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

Merged
merged 2 commits into from
Jul 6, 2024

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 53.74%. Comparing base (86d0589) to head (56065fc).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7619      +/-   ##
===========================================
+ Coverage    53.72%   53.74%   +0.02%     
===========================================
  Files         1706     1706              
  Lines       168410   168498      +88     
  Branches     13901    13914      +13     
===========================================
+ Hits         90478    90564      +86     
- Misses       75512    75517       +5     
+ Partials      2420     2417       -3     
Flag Coverage Δ
backend 80.88% <ø> (+0.02%) ⬆️

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. This is how I get the data from the API, unfortunately without any notes

@coinyon
Copy link
Contributor Author

coinyon commented Jul 6, 2024

@LefterisJP The test failures seem unrelated

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.

LGTM

@LefterisJP LefterisJP merged commit 622e5b2 into rotki:develop Jul 6, 2024
14 checks passed
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