Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal Incentives & Voting Incentives #797

Open
wants to merge 49 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fb60e86
Smart contract skeleton for voting incentives
JakeHartnell Jan 9, 2024
16bfaee
More comments
JakeHartnell Jan 23, 2024
bd79371
dao-proposal-incentives initial commit
JakeHartnell Jan 24, 2024
97e2472
Add more design notes and TODOs
JakeHartnell Jan 24, 2024
c1ef0bf
Proposal incentives fixups and notes
JakeHartnell Jan 25, 2024
a7bb852
Voting incentives checks and notes
JakeHartnell Jan 25, 2024
21c488b
More notes
JakeHartnell Jan 25, 2024
b7b01cb
Proposal Incentives
ismellike Jan 31, 2024
834e16e
Fix clippy errors
ismellike Jan 31, 2024
34c7474
More clippy
ismellike Jan 31, 2024
41b15fe
Schema + clippy fix
ismellike Feb 1, 2024
ed344a4
Progress on voting incentives
ismellike Feb 7, 2024
f0c494b
Handle revoting and update readme's
ismellike Feb 7, 2024
1c3d428
Update README.md
ismellike Feb 7, 2024
86c85f5
Work on voting tests
ismellike Feb 8, 2024
01eedd6
Fix for simultaneous hook error handling
ismellike Feb 9, 2024
e4477df
Wrap up tests for voting incentives
ismellike Feb 10, 2024
30bfeab
Combine rewards queries
ismellike Feb 13, 2024
2816beb
Add is_claimable flag to reward response
ismellike Feb 14, 2024
a86f0dc
Merge branch 'development' into gov-incentives
ismellike May 7, 2024
a76127f
Schemas and clippy fixes
ismellike May 8, 2024
064f353
Update contracts/external/dao-proposal-incentives/Cargo.toml
ismellike Jun 13, 2024
8849221
Smart contract skeleton for voting incentives
JakeHartnell Jan 9, 2024
55b9665
More comments
JakeHartnell Jan 23, 2024
aa3dd76
dao-proposal-incentives initial commit
JakeHartnell Jan 24, 2024
e219dea
Add more design notes and TODOs
JakeHartnell Jan 24, 2024
76f5ca1
Proposal incentives fixups and notes
JakeHartnell Jan 25, 2024
40dd5fe
Voting incentives checks and notes
JakeHartnell Jan 25, 2024
632bfe4
More notes
JakeHartnell Jan 25, 2024
d2c39be
Proposal Incentives
ismellike Jan 31, 2024
dbab201
Fix clippy errors
ismellike Jan 31, 2024
3597697
More clippy
ismellike Jan 31, 2024
012f8c3
Schema + clippy fix
ismellike Feb 1, 2024
2bf1ec1
Progress on voting incentives
ismellike Feb 7, 2024
5c9383f
Handle revoting and update readme's
ismellike Feb 7, 2024
22a13d1
Update README.md
ismellike Feb 7, 2024
65fa0de
Work on voting tests
ismellike Feb 8, 2024
9419658
Fix for simultaneous hook error handling
ismellike Feb 9, 2024
6961ce6
Wrap up tests for voting incentives
ismellike Feb 10, 2024
809ba2c
Combine rewards queries
ismellike Feb 13, 2024
1d5bd35
Add is_claimable flag to reward response
ismellike Feb 14, 2024
21eb271
Schemas and clippy fixes
ismellike May 8, 2024
4a9a9e1
Update contracts/external/dao-proposal-incentives/Cargo.toml
ismellike Jun 13, 2024
778a361
Improve proposal & voting incentives readme's + add not audited warnings
ismellike Aug 16, 2024
2fb9ec5
Merge branch 'gov-incentives' of https://github.com/ismellike/dao-con…
ismellike Aug 16, 2024
7cce5b3
gen schema
ismellike Aug 16, 2024
754442d
Disable doctests on gov-incentives
ismellike Aug 16, 2024
ffe92b1
Bump integration_tests to nightly toolchain
ismellike Aug 16, 2024
c3b6321
Free up space for test_tube.yml
ismellike Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
444 changes: 241 additions & 203 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ dao-pre-propose-multiple = { path = "./contracts/pre-propose/dao-pre-propose-mul
dao-pre-propose-single = { path = "./contracts/pre-propose/dao-pre-propose-single", version = "2.4.0" }
dao-proposal-condorcet = { path = "./contracts/proposal/dao-proposal-condorcet", version = "2.4.0" }
dao-proposal-hook-counter = { path = "./contracts/test/dao-proposal-hook-counter", version = "2.4.0" }
dao-proposal-incentives = { path = "./contracts/external/dao-proposal-incentives", version = "2.4.0" }
dao-proposal-multiple = { path = "./contracts/proposal/dao-proposal-multiple", version = "2.4.0" }
dao-proposal-single = { path = "./contracts/proposal/dao-proposal-single", version = "2.4.0" }
dao-proposal-sudo = { path = "./contracts/test/dao-proposal-sudo", version = "2.4.0" }
Expand Down
8 changes: 8 additions & 0 deletions contracts/dao-dao-core/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
QueryMsg::ProposalModules { start_after, limit } => {
query_proposal_modules(deps, start_after, limit)
}
QueryMsg::ProposalModule { address } => query_proposal_module(deps, address),
QueryMsg::ProposalModuleCount {} => query_proposal_module_count(deps),
QueryMsg::TotalPowerAtHeight { height } => query_total_power_at_height(deps, height),
QueryMsg::VotingModule {} => query_voting_module(deps),
Expand All @@ -577,6 +578,13 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
}
}

pub fn query_proposal_module(deps: Deps, address: String) -> StdResult<Binary> {
let address = deps.api.addr_validate(&address)?;
let proposal_module = &PROPOSAL_MODULES.load(deps.storage, address)?;

to_json_binary(&proposal_module)
}

pub fn query_admin(deps: Deps) -> StdResult<Binary> {
let admin = ADMIN.load(deps.storage)?;
to_json_binary(&admin)
Expand Down
4 changes: 4 additions & 0 deletions contracts/external/dao-proposal-incentives/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
40 changes: 40 additions & 0 deletions contracts/external/dao-proposal-incentives/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[package]
name ="dao-proposal-incentives"
authors = ["Jake Hartnell <[email protected]>", "ismellike"]
description = "A contract that implements incentives for voting in a DAO."
ismellike marked this conversation as resolved.
Show resolved Hide resolved
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = { workspace = true }

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[dependencies]
cosmwasm-std = { workspace = true }
cosmwasm-schema = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
dao-hooks = { workspace = true }
dao-interface = { workspace = true }
dao-voting = { workspace = true }
thiserror = { workspace = true }
cw-utils = { workspace = true }
cw-denom = { workspace = true }
cw-ownable = { workspace = true }
cw20 = { workspace = true }

[dev-dependencies]
cosmwasm-schema = { workspace = true }
cw-multi-test = { workspace = true }
dao-dao-core = { workspace = true, features = ["library"] }
cw20-base = { workspace = true, features = ["library"] }
dao-testing = { workspace = true }
dao-proposal-single = { workspace = true, features = ["library"] }
cw-hooks = { workspace = true }
10 changes: 10 additions & 0 deletions contracts/external/dao-proposal-incentives/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# dao-proposal-incentives

[![dao-proposal-incentives on crates.io](https://img.shields.io/crates/v/dao-proposal-incentives.svg?logo=rust)](https://crates.io/crates/dao-proposal-incentives)
[![docs.rs](https://img.shields.io/docsrs/dao-proposal-incentives?logo=docsdotrs)](https://docs.rs/dao-proposal-incentives/latest/cw_admin_factory/)

Allows for DAOs to offer incentives for making successful proposals.

To setup this contract, the DAO needs to add this contract as a `ProposalHook` to the `dao-voting-single` or `dao-voting-multiple` proposal module, and the DAO must be the `owner` of this contract. When someone successfully passes a proposal the specified rewards are automatically paid out.

The incentives can be configured as native or cw20 tokens, and the award is determined by the configuration at the passed proposal's `start_time`.
11 changes: 11 additions & 0 deletions contracts/external/dao-proposal-incentives/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use cosmwasm_schema::write_api;
use dao_proposal_incentives::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
query: QueryMsg,
execute: ExecuteMsg,
migrate: MigrateMsg,
}
}
Loading
Loading