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

Voter delegation #34

Merged
merged 8 commits into from
Jul 27, 2023
Merged

Voter delegation #34

merged 8 commits into from
Jul 27, 2023

Conversation

EdNoepel
Copy link
Contributor

@EdNoepel EdNoepel commented Jul 24, 2023

Index AJNA token contract for tracking voting delegation. Update voting power when each distribution period starts. Fold Voter entity into Account. Other misc improvements.

Has not been well-tested due to lack of tooling.

@@ -254,6 +249,15 @@ export function handleDistributionPeriodStarted(
distributionPeriod.startBlock = distributionStarted.startBlock
distributionPeriod.endBlock = distributionStarted.endBlock

// loop through DistributionPeriodVotes for the current period and update voting power
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can actually just remove this code block entirely - at the time of a distribution periods start there won't be any DistributionPeriodVote to loop through as they can't be created until after

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal was to capture voting power after the snapshot period, before anyone actually votes. What's the best way to accomplish this?

Copy link
Contributor

@MikeHathaway MikeHathaway Jul 24, 2023

Choose a reason for hiding this comment

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

I think we would need to loop through all accounts, create a new loadOrCreateDistributionPeriodVote entity for that distribution period of the account. Then, call the contract for each account and then call just getScreeningStageVotePower.

We could just loop through accounts that had delegated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, there is no way to query the store for all entities of a specific type. Should we get the list of votes from the previous distribution period (if it exists), and create new DistributionPeriodVotes for each of those entities when the new distribution period starts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah that sounds good to me. I can do that as part of my PR if you'd like to just get this merged

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy for you to do that in your branch. I will await your PR before merging this one.

Copy link
Contributor

@MikeHathaway MikeHathaway left a comment

Choose a reason for hiding this comment

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

LGTM - one comment about potentially removing an additional code block

* update FundingVote entity

* fix todo

* update FundingVote entity

* fix todo

* expand vote unit testing

* fix fundingVote flow

* fix votingPowerUsed calculation

* cleanups

* expand test assertions

* wip distributionPeriod start screening power tracking

* expand fundedSlate entity

* add funds available to DistributionPeriod; improve treasury tracking

* remove screeningStageVotingPower; rename fundingStage votingPower attributes

* delete unused file

* use wmul for fundsAvailable

* fix FundedSlate bugs

---------

Co-authored-by: Mike <mikehathaway@makerdao.com>
@MikeHathaway MikeHathaway merged commit 27918da into develop Jul 27, 2023
1 check passed
@MikeHathaway MikeHathaway deleted the voter-delegation branch July 27, 2023 18:19
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.

2 participants