2 stable releases

2.3.0 Oct 18, 2023
2.2.0 Jul 9, 2023
2.1.5 Jul 6, 2023
2.1.0 Jul 3, 2023

#8 in #staked

Download history 9/week @ 2024-02-19 13/week @ 2024-02-26 22/week @ 2024-03-11 1/week @ 2024-03-18 79/week @ 2024-04-01

102 downloads per month
Used in 3 crates (2 directly)

BSD-3-Clause

220KB
5K SLoC

CW20 Staked Balance Voting

dao-voting-cw20-staked on crates.io docs.rs

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

This contract implements the interface needed to be a DAO DAO voting module. It 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 cw20-stake.

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

~9.5MB
~207K SLoC