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

Tribute contract implementation #27

Merged
merged 6 commits into from
May 7, 2024
Merged

Tribute contract implementation #27

merged 6 commits into from
May 7, 2024

Conversation

dusan-maksimovic
Copy link
Contributor

Closes #7

The three main messages are kept pretty much the same way they were, except for the part that they don't consider only the winner proposal, but the top N proposals. Round ID has been removed from AddTribute message, since it is only allowed to add tributes for the ongoing round. The code that calculates the amount of tribute that goes to each voter is adjusted to calculate percentage correctly.

contracts/tribute/src/state.rs Show resolved Hide resolved
contracts/tribute/src/state.rs Show resolved Hide resolved
contracts/tribute/src/testing.rs Show resolved Hide resolved
contracts/tribute/src/contract.rs Show resolved Hide resolved
contracts/tribute/src/contract.rs Show resolved Hide resolved
contracts/tribute/src/contract.rs Outdated Show resolved Hide resolved
@p-offtermatt
Copy link
Member

Just out of an abundance of caution, we should make sure that if a proposal receives no support at all, we allow refunding its tribute.

@dusan-maksimovic
Copy link
Contributor Author

dusan-maksimovic commented May 7, 2024

Just out of an abundance of caution, we should make sure that if a proposal receives no support at all, we allow refunding its tribute.

We are good here with our current implementation, since the TopNProposals query uses PROPS_BY_SCORE to fetch the proposals, and if nobody voted for proposal it won't even be in this map, since it is only inserted during vote() message execution. So, this means that get_top_n_proposal() will return None if someone tries to refund the tribute for the proposal with 0 votes.

Copy link
Member

@p-offtermatt p-offtermatt left a comment

Choose a reason for hiding this comment

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

Nice, thanks! LGTM

@dusan-maksimovic dusan-maksimovic merged commit 728fa80 into main May 7, 2024
3 checks passed
@dusan-maksimovic dusan-maksimovic deleted the tribute-contract branch May 7, 2024 11:12
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.

Update and test the tribute contract
2 participants