forked from DA0-DA0/dao-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
92 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
# dao-voting-incentives | ||
This contract enables DAOs to offer incentives for voting on DAO proposals. By rewarding active voters, DAOs can encourage greater community involvement and decision-making. | ||
|
||
[![dao-voting-incentives on crates.io](https://img.shields.io/crates/v/dao-voting-incentives.svg?logo=rust)](https://crates.io/crates/dao-voting-incentives) | ||
[![docs.rs](https://img.shields.io/docsrs/dao-voting-incentives?logo=docsdotrs)](https://docs.rs/dao-voting-incentives/latest/cw_admin_factory/) | ||
## Instantiate | ||
|
||
Allows for DAOs to offer incentives for voting on DAO proposals. | ||
To instantiate the contract, provide the following parameters: | ||
|
||
When creating this contract, the DAO specifies an `epoch_duration` and an amount to pay out per epoch. Then, the DAO needs to add this contract as a `VoteHook` to the `dao-voting-single` or `dao-voting-multiple` proposal module. When DAO members vote, this contract keeps track of the proposals and who voted. | ||
- `owner`: The DAO sending this contract voting hooks. | ||
- `denom`: The denomination of the tokens to distribute as rewards. | ||
- `expiration`: The expiration of the voting incentives period, defining how long the incentives are active. | ||
|
||
At the end of the epoch, rewards are payable as follows: | ||
## Configuration | ||
|
||
`` | ||
rewards = (user vote count / prop count) / total_vote_count * voting incentives | ||
`` | ||
- This contract should be added as a `VoteHook` to either the `dao-proposal-single` or `dao-proposal-multiple` proposal modules. | ||
- The DAO must be set as the `owner` of this contract to manage incentives and ownership. | ||
|
||
If no proposals happen during an epoch, no rewards are paid out. | ||
If no votes are cast during the voting incentives period, then the contract's funds are sent to the `owner` on expiration. | ||
|
||
## TODO | ||
- [ ] Unit and Integration tests with a full DAO | ||
- [ ] Make sure it works with multiple proposal modules (i.e. multiple choice and single choice) | ||
- [ ] Make sure claiming rewards is gas effecient even if many epochs have passed. | ||
- [ ] Support Cw20. | ||
- [ ] Use `cw-ownable` to configure a contract owner who can update the voting incentives config. | ||
- [ ] Add more info to the readme and delete this TODO section. | ||
Rewards for a user are determined as such: `reward(user) = votes(user) * contract's balance / total votes` | ||
|
||
## Execute | ||
|
||
- **VoteHook(VoteHookMsg)**: Triggered when a new vote is cast. This is used to track voting activity and allocate rewards accordingly. | ||
- **Claim {}**: Allows voters to claim their rewards after expiration. | ||
- **Expire {}**: Expires the voting incentives period, allowing voters to claim rewards. | ||
- **UpdateOwnership(cw_ownable::Action)**: Updates the ownership of the contract. This can be used to transfer ownership or perform other ownership-related actions. | ||
- **Receive(Cw20ReceiveMsg)**: Handles the receipt of CW20 tokens. This is necessary for managing CW20-based incentives. | ||
|
||
## Query | ||
|
||
- **Config {}**: Returns the configuration of the voting incentives. | ||
- **Rewards { address: String }**: Queries the claimable rewards for a specific address. | ||
- **ExpectedRewards { address: String }**: Estimates the expected rewards for a specific address, based on current votes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters