diff --git a/packages/voting-contract/src/ballots.rs b/packages/voting-contract/src/ballots.rs index 02d4f088..34b68dfd 100644 --- a/packages/voting-contract/src/ballots.rs +++ b/packages/voting-contract/src/ballots.rs @@ -18,6 +18,7 @@ pub struct Ballot { } pub struct BallotIndexes<'a> { + // This PrimaryKey allows quering over all proposal ids for given voter address pub voter: MultiIndex<'a, Addr, Ballot, (u64, Addr)>, } diff --git a/packages/voting-contract/src/lib.rs b/packages/voting-contract/src/lib.rs index 335788e1..49db075e 100644 --- a/packages/voting-contract/src/lib.rs +++ b/packages/voting-contract/src/lib.rs @@ -1,4 +1,4 @@ -pub mod ballots; +mod ballots; mod error; pub mod msg; #[cfg(test)] @@ -377,6 +377,7 @@ pub fn list_votes_by_voter( limit: usize, ) -> StdResult { let voter_addr = deps.api.addr_validate(&voter)?; + // PrimaryKey of that IndexMap is (proposal_id, voter_address) -> (u64, Addr) let start = start_after.map(|m| Bound::exclusive((m, voter_addr.clone()))); let votes: StdResult> = ballots()