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

Add governance amount and delegate ID to VeSugar #32

Merged
merged 4 commits into from
Oct 31, 2023
Merged

Add governance amount and delegate ID to VeSugar #32

merged 4 commits into from
Oct 31, 2023

Conversation

ethzoomer
Copy link
Contributor

No description provided.

@ethzoomer ethzoomer requested a review from stas October 26, 2023 23:36
Copy link
Collaborator

@stas stas left a 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 🙏

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
Copy link
Collaborator

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) ?

@ethzoomer
Copy link
Contributor Author

@airtoonricardo If you don't mind pls double check this to confirm if it's the proper delegate implementation for what we discussed earlier

@airtoonricardo
Copy link

@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 self.ve.delegates(_id) instead, as Stas has mentioned.

@ethzoomer ethzoomer requested a review from stas October 27, 2023 17:02
@@ -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)
Copy link
Collaborator

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes ty. Adding

@ethzoomer ethzoomer requested a review from stas October 28, 2023 13:38
@stas stas changed the title SOL-246: add governance amount and delegate ID to veNFT on VeSugar Add governance amount and delegate ID to VeSugar Oct 28, 2023
Copy link
Collaborator

@stas stas left a comment

Choose a reason for hiding this comment

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

Lets go!

@ethzoomer ethzoomer merged commit 46467b9 into v2 Oct 31, 2023
0 of 2 checks passed
@stas stas deleted the SOL-246 branch January 16, 2024 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants