Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Coinbase staking_reward tx type #7619

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

coinyon
Copy link
Contributor

@coinyon coinyon commented Mar 16, 2024

When digging into coinbase API responses, I found that rotki ignored the staking_reward tx type. This PR adds support in the same way as inflation_reward and interest.

As a related note, I don't know why all three (interest, inflation_reward and staking_reward) are reported with Event Subtype NONE where they could be reported as REWARD. If you want me to change this as well with this PR, let me know.

Checklist

  • The PR modified the frontend, and updated the user guide to reflect the changes.

Copy link

codecov bot commented Mar 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.43%. Comparing base (a774835) to head (305fc5b).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7619      +/-   ##
===========================================
- Coverage    80.04%   71.43%   -8.61%     
===========================================
  Files         1103     1103              
  Lines       106532   106532              
  Branches     13449    13449              
===========================================
- Hits         85270    76101    -9169     
- Misses       19120    28593    +9473     
+ Partials      2142     1838     -304     
Flag Coverage Δ
backend 63.33% <ø> (-17.66%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@LefterisJP LefterisJP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment about the change.

For the subtype, would need to check.

I think the interest/inflation_reward/staking_rewards can be like this.

But if you see the place you edited has another elif which is afaics (but I am not sure since I don't use coinbase and did not write the code) concerns internal movements/receivals. So that part should stay as is.

@@ -538,7 +538,7 @@ def _query_single_account_transactions(
elif tx_type in ('buy', 'sell'):
self._process_normal_trade(event=transaction, trades=trades)
elif (
tx_type in ('interest', 'inflation_reward') or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this exists as a transaction type then it's a good addition.

Can you also edit the test at test_coinbase_query_income_loss_expense and add a mock event with this type and test it in the test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants