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

Cwd proposal delegate #562

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6d8035d
init cwd-proposal-delegate
baoskee Nov 22, 2022
5a7afcf
Msg + Error + State design
baoskee Nov 22, 2022
3ccfe6d
Skeleton code setup
baoskee Nov 22, 2022
c0383c2
execute and state redesign for security
baoskee Nov 23, 2022
afab973
execute_delegate and execute_remove_delegation
baoskee Nov 23, 2022
9642d52
execute_execute body
baoskee Nov 23, 2022
d54df15
Reply implementation for submessage
baoskee Nov 23, 2022
0a995fc
Query functions
baoskee Nov 23, 2022
1fd25d2
Added smart contract risks section
baoskee Nov 23, 2022
a474388
Update contracts/proposal/cwd-proposal-delegate/Cargo.toml
baoskee Dec 27, 2022
4d679b0
Update contracts/proposal/cwd-proposal-delegate/Cargo.toml
baoskee Dec 27, 2022
b8c9830
Merge https://github.com/DA0-DA0/dao-contracts into cwd-proposal-dele…
baoskee Dec 27, 2022
a103eee
new cargo.toml
baoskee Dec 27, 2022
cf21c54
Removed exposure of delegation count
baoskee Dec 27, 2022
683ccd8
merged
baoskee Dec 27, 2022
2a3ea2a
test shell
baoskee Dec 27, 2022
f433008
Added testing strategy
baoskee Dec 27, 2022
d44ffb7
test unauthorized delegation
baoskee Dec 27, 2022
d3513e9
execute_authorization tests
baoskee Dec 27, 2022
b003b9a
Expiration test
baoskee Dec 27, 2022
07f2358
Revocable policy and delegation not found error path
baoskee Dec 27, 2022
b0e54d0
First try at testing submessage
baoskee Dec 28, 2022
5c1bc28
Added pagination query for delegations
baoskee Dec 28, 2022
c635cca
Reply hook testing
baoskee Dec 28, 2022
b8e34e3
refactor to policy_module_irrevocable
baoskee Dec 28, 2022
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
Prev Previous commit
Next Next commit
Added pagination query for delegations
baoskee committed Dec 28, 2022
commit 5c1bc28c68a1a6244b5086824c121b06bb1dc7ad
40 changes: 40 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contracts/proposal/cwd-proposal-delegate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ dao-pre-propose-base = { workspace = true }
dao-interface = { workspace = true }
dao-voting = { workspace = true }
cw-hooks = { workspace = true }
cw-paginate = { workspace = true }
dao-proposal-hooks = { workspace = true }
dao-vote-hooks = { workspace = true }
dao-pre-propose-multiple = { workspace = true }
11 changes: 11 additions & 0 deletions contracts/proposal/cwd-proposal-delegate/src/contract.rs
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ use cosmwasm_std::{
to_binary, Binary, BlockInfo, Deps, DepsMut, Empty, Env, MessageInfo, OverflowError, Reply,
Response, StdError, StdResult, Storage, SubMsg, WasmMsg,
};
use cw_paginate::paginate_map_values;
use cw_utils::Expiration;
// use cw2::set_contract_version;

@@ -105,6 +106,16 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
QueryMsg::Delegation { delegation_id } => {
Ok(to_binary(&query_delegation(deps, delegation_id)?)?)
}
QueryMsg::Delegations { start_after, limit } => {
let delegations = paginate_map_values(
deps,
&DELEGATIONS,
start_after,
limit,
cosmwasm_std::Order::Ascending,
)?;
Ok(to_binary(&delegations)?)
}
}
}

7 changes: 6 additions & 1 deletion contracts/proposal/cwd-proposal-delegate/src/msg.rs
Original file line number Diff line number Diff line change
@@ -29,8 +29,13 @@ pub enum ExecuteMsg {
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(DelegationResponse)]
#[returns(Delegation)]
Delegation { delegation_id: u64 },
#[returns(Vec<Delegation>)]
Delegations {
start_after: Option<u64>,
limit: Option<u32>,
},
}

pub type DelegationResponse = Delegation;