-
Notifications
You must be signed in to change notification settings - Fork 32
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 governance amount and delegate ID to VeSugar #32
Conversation
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.
Looks good, but not sure if we're doing the most efficient call to get the delegate_id
.
Let's double check 🙏
contracts/VeSugar.vy
Outdated
governance_amount: uint256 = self.gov.getVotes(_id, timepoint - 1) | ||
|
||
checkpoint_length: uint48 = self.ve.numCheckpoints(_id) | ||
delegate_id: uint256 = self.ve.checkpoints(_id, checkpoint_length - 1).delegatee |
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.
@ethzoomer shouldn't we be using the self.ve.delegates(_id)
?
@airtoonricardo If you don't mind pls double check this to confirm if it's the proper delegate implementation for what we discussed earlier |
My apologies, I thought the intended use case would be to have the whole checkpoint's information in order to be able to display delegated balances and other information. Since we are only fetching who the veNFT is delegating to, we should use the |
contracts/VeSugar.vy
Outdated
@@ -146,6 +155,11 @@ def _byId(_id: uint256) -> VeNFT: | |||
amount, expires_at, perma = self.ve.locked(_id) | |||
last_voted: uint256 = 0 | |||
|
|||
timepoint: uint256 = convert(self.gov.clock(), uint256) | |||
governance_amount: uint256 = self.gov.getVotes(_id, timepoint - 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.
Was taking a closer look at this, do we actually need to call clock()
, a simple block.timestamp
should be enough, no?
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.
Yes ty. Adding
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.
Lets go!
No description provided.