-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
Add Decoder for The Graph staking #6712
Add Decoder for The Graph staking #6712
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #6712 +/- ##
===========================================
- Coverage 78.69% 78.69% -0.01%
===========================================
Files 1147 1149 +2
Lines 100321 100410 +89
Branches 11714 11723 +9
===========================================
+ Hits 78951 79013 +62
- Misses 19497 19511 +14
- Partials 1873 1886 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some smaller comments
|
||
# also account for the GRT burnt due to delegation tax | ||
tokens_burnt = initial_amount_norm - stake_amount_norm | ||
if tokens_burnt > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this always be true? Or just going for some kidn of future proof thing where maybe the protocol removes the fee?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should always be true, yes, so it's just a sanity-check to not send a negative amount into a new EvmEvent
instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the PR has 7 commits already. It should only have 1. Or 2. One for implementation and 1 for tests. As linked before in contribution guide we keep commits doing one thing and if multiple commits are for same reason combine them.
3a5b592
to
fd2972e
Compare
fd2972e
to
61099ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Looks good to me, will merge.
Do the small nitpicks in the next PR and keep them in mind. Also you would need to add a changelog in the next PR.
delegator = hex_or_bytes_to_address(context.tx_log.topics[2]) | ||
if delegator is None or self.base.is_tracked(delegator) is False: | ||
return DEFAULT_DECODING_OUTPUT | ||
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use newline after if. Helps readability
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) | |
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) |
delegator = hex_or_bytes_to_address(context.tx_log.topics[2]) | ||
if delegator is None or self.base.is_tracked(delegator) is False: | ||
return DEFAULT_DECODING_OUTPUT | ||
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use newline after if. Helps readability
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) | |
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) | |
delegator = hex_or_bytes_to_address(context.tx_log.topics[2]) | ||
if delegator is None or self.base.is_tracked(delegator) is False: | ||
return DEFAULT_DECODING_OUTPUT | ||
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use newline after if. Helps readability
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) | |
indexer = hex_or_bytes_to_address(context.tx_log.topics[1]) | |
'Withdraw 1003.70342593701668535 GRT' | ||
' from indexer 0x6125eA331851367716beE301ECDe7F38A7E429e7' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a nitpick and can't enforce from linter but I have notices when you split a sentence string across multiple lines you end the line without a space and start the new with a space. Can you try to be doing the opposite? It's how we do it in the rest of the code.
Really minor nitpick to keep in mind. Here and in all other places you do it.
'Withdraw 1003.70342593701668535 GRT' | |
' from indexer 0x6125eA331851367716beE301ECDe7F38A7E429e7' | |
'Withdraw 1003.70342593701668535 GRT ' | |
'from indexer 0x6125eA331851367716beE301ECDe7F38A7E429e7' |
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2023 rotki Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
rotki/test-caching/tree/issue_2044_the_graph_staking was successfully merged |
Related to #2044
For Delegator staking the typical scenario is:
delegate()
(emitsStakeDelegated
event)undelegate()
(emitsStakeDelegatedLocked
event)withdrawDelegated()
(emitsStakeDelegatedWithdrawn
event)