#dao #voting #balance #module #staked #threshold #cw20

cw20-staked-balance-voting

DAO DAO v1 voting module for staked cw20 balances

1 unstable release

0.1.0 Jul 3, 2023

#12 in #staked

Download history 193/week @ 2023-12-13 35/week @ 2023-12-20 35/week @ 2023-12-27 125/week @ 2024-01-03 11/week @ 2024-01-10 1/week @ 2024-01-17 8/week @ 2024-01-24 85/week @ 2024-01-31 74/week @ 2024-02-07 17/week @ 2024-02-14 24/week @ 2024-02-21 28/week @ 2024-02-28 19/week @ 2024-03-06 40/week @ 2024-03-13 175/week @ 2024-03-20 69/week @ 2024-03-27

309 downloads per month
Used in 2 crates

Apache-2.0

140KB
3.5K SLoC

CW20 Staked Balance Voting

A voting power module which determines voting power based on the staked token balance of specific addresses at given heights.

Also features the functionality to set an active threshold, this threshold allows DAOs to be marked as inactive if it is not met. This threshold can either be an absolute count of tokens staked or a percentage of the token's total supply.

Endpoints

Execute

UpdateActiveThreshold - Allows the user to update the active threshold.

Query

TokenContract - Provided via the token_query macro, simply returns the underlying CW20 token's address.

StakingContract - Returns the underlying staking contract used to derive voting power at a given height. Should point to an instance of stake-cw20.

VotingPowerAtHeight - Given an address and an optional height, return the voting power that address has at that height. If no height is given it defaults to the current block height. In this case it is the address' staked balance at that height.

TotalPowerAtHeight - Given an optional height, determine the total voting power available. If no height is given it defaults to the current block height. In this case it is the total staked balance at that height.

Info - Uses the CW2 spec to return the contracts info.

Dao - Returns the DAO that this voting module belongs to.

IsActive - Returns true or false depending on if this DAO is active and can make proposals. Uses the active threshold described above to determine this.

ActiveThreshold - Returns the details for the current active threshold in place, if any.

Dependencies

~4–5.5MB
~125K SLoC