DA0-DA0 / dao-contracts

CosmWasm smart contracts for Interchain DAOs.
https://docs.daodao.zone
BSD 3-Clause "New" or "Revised" License
202 stars 132 forks source link

Proposal Incentives & Voting Incentives #797

Open ismellike opened 5 months ago

ismellike commented 5 months ago

Proposal Incentives Contract (dao-proposal-incentives):

A new contract has been added to implement incentives for making successful proposals in a DAO. This contract allows DAO's to offer rewards for successful proposals, which can be configured as native or CW20 tokens. The rewards are determined based on the configuration at the proposal's start time.

A new query has been added to the proposal modules for GenericProposalInfo, which we can call from a received hook to get a proposal's proposer and start_time.

A new query has been added to the DAO core for ProposalModule, which we can call from the incentives contract to check authorization of the sender as a proposal module of the DAO.

Voting Incentives Contract (dao-voting-incentives):

The voting incentives contract is adapted from the proposal incentives contract.

When a vote hook is received, its proposal is queried to make sure the proposal occurred after the contract was instantiated (config.start_height). If the user has already voted, then we ignore the vote. Otherwise, we increment config.total_vote_count and the user's votes. From this, we can determine how much a user will be awarded after the voting incentives' expiration. If no users have voted during the voting incentives' period, then the funds will be sent to the contract's owner on expiration.

Anyone can call the expire function to set the amount available for distribution. Users can then call ExecuteMsg::Claim{} to receive their rewards.

JakeHartnell commented 4 months ago

@ismellike, the proposal incentives contract looks great!