-
Notifications
You must be signed in to change notification settings - Fork 11
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
tg3: Common voting interfaces for tgrade #93
Conversation
b26657d
to
841e3ac
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.
I think it is good. Surprised I didn't seem more changes.
Left a few comments for cleanup, but nothing blocking
@@ -2,7 +2,7 @@ use schemars::JsonSchema; | |||
use serde::{Deserialize, Serialize}; | |||
|
|||
use cosmwasm_std::Coin; | |||
use cw3::Vote; | |||
use tg3::Vote; |
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.
Something seems odd to me here.
If these have different field names, I would expect some diff in this repo when I construct Vote to use points
not weight
.
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.
Most of things happens in voting contracts package. In contracts they are just passed around. Thanks to good code abstraction.
|
||
Ok(VoterResponse { weight }) | ||
Ok(VoterResponse { points }) |
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.
Or is this only used in voting-contract and these two updates (here and below) are the only place weight was exposed?
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.
Yup.
addr: member.addr, | ||
weight: member.points, | ||
}) | ||
.map(|Member { addr, points }| VoterDetail { addr, points }) |
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.
nice restructuring
packages/tg3/README.md
Outdated
|
||
`Vote{proposal_id, vote}` - Given a proposal_id, you can | ||
vote yes, no, abstain or veto. Each signed may have a | ||
different "weight" in the voting and they apply their |
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.
-> points
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.
Ehh, grepped for READMEs and still miss it :/
packages/tg3/README.md
Outdated
Information on who can vote is contract dependent. But | ||
we will work on a common API to display some of this. | ||
|
||
`Voter { address }` - returns voting power (weight) of this address, if any |
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.
points
packages/tg3/src/query.rs
Outdated
/// This defines the different ways tallies can happen. | ||
/// Every contract should support a subset of these, ideally all. | ||
/// | ||
/// The total_weight used for calculating success as well as the weights of each |
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.
points
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.
I guess I grepped docs and comments for this before moving tg3.
packages/tg3/src/query.rs
Outdated
pub votes: Vec<VoteInfo>, | ||
} | ||
|
||
/// Returns the vote (opinion as well as weight counted) as well as |
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.
points (and other usage this file)
packages/tg3/src/query.rs
Outdated
/// correct cw4 implementation). | ||
#[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum ThresholdResponse { |
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.
Is this object never constructed in the code?
I cannot find anything making "total_points" that would be needed to construct this
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.
I am surprised - I knew it is in ProposalResponse which is returned by voting-contract, but it turns out, that... ProposalResponse is redefined in voting-contract! Without this one. Just will remove along with the whole ProposalResponse.
Closes #85