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

cw20 hooks and DAO transfer rules #806

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
65 changes: 56 additions & 9 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ prost-types = { version = "0.12.3", default-features = false }
quote = "1.0"
rand = "0.8"
schemars = "0.8"
semver = "1.0"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde-cw-value = "0.7"
serde_json = "1.0"
Expand Down Expand Up @@ -90,6 +91,7 @@ cw-tokenfactory-issuer = { path = "./contracts/external/cw-tokenfactory-issuer",
cw-tokenfactory-types = { path = "./packages/cw-tokenfactory-types", version = "2.4.2", default-features = false }
cw-vesting = { path = "./contracts/external/cw-vesting", version = "2.4.2" }
cw-wormhole = { path = "./packages/cw-wormhole", version = "2.4.2" }
cw20-hooks = { path = "./contracts/external/cw20-hooks", version = "2.4.2" }
cw20-stake = { path = "./contracts/staking/cw20-stake", version = "2.4.2" }
cw721-controllers = { path = "./packages/cw721-controllers", version = "2.4.2" }
cw721-roles = { path = "./contracts/external/cw721-roles", version = "2.4.2" }
Expand Down
4 changes: 2 additions & 2 deletions ci/bootstrap-env/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn main() -> Result<()> {
code_id: orc.contract_map.code_id("dao_voting_cw20_staked")?,
msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg {
token_info: dao_voting_cw20_staked::msg::TokenInfo::New {
code_id: orc.contract_map.code_id("cw20_base")?,
code_id: orc.contract_map.code_id("cw20_hooks")?,
label: "DAO DAO Gov token".to_string(),
name: "DAO".to_string(),
symbol: "DAO".to_string(),
Expand Down Expand Up @@ -147,7 +147,7 @@ fn main() -> Result<()> {

println!(
"NEXT_PUBLIC_CW20_CODE_ID={}",
orc.contract_map.code_id("cw20_base")?
orc.contract_map.code_id("cw20_hooks")?
);
println!(
"NEXT_PUBLIC_CW4GROUP_CODE_ID={}",
Expand Down
2 changes: 1 addition & 1 deletion ci/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = { workspace = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
cosm-orc = { workspace = true }
cw20 = { workspace = true }
cw20-base = { workspace = true }
cw20-hooks = { workspace = true }
cw721-base = { workspace = true }
cw721-roles = { workspace = true }
cw721 = { workspace = true }
Expand Down
14 changes: 7 additions & 7 deletions ci/integration-tests/src/helpers/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn create_dao(
code_id: chain.orc.contract_map.code_id("dao_voting_cw20_staked")?,
msg: to_json_binary(&dao_voting_cw20_staked::msg::InstantiateMsg {
token_info: dao_voting_cw20_staked::msg::TokenInfo::New {
code_id: chain.orc.contract_map.code_id("cw20_base")?,
code_id: chain.orc.contract_map.code_id("cw20_hooks")?,
label: "DAO DAO Gov token".to_string(),
name: "DAO".to_string(),
symbol: "DAO".to_string(),
Expand Down Expand Up @@ -106,7 +106,7 @@ pub fn create_dao(
.orc
.instantiate("dao_dao_core", op_name, &msg, key, None, vec![])?;

// add proposal, pre-propose, voting, cw20_stake, and cw20_base
// add proposal, pre-propose, voting, cw20_stake, and cw20_hooks
// contracts to the orc contract map.

let state: DumpStateResponse = chain
Expand Down Expand Up @@ -160,7 +160,7 @@ pub fn create_dao(
.contract_map
.add_address("cw20_stake", cw20_stake)
.unwrap();
let cw20_base: String = chain
let cw20_hooks: String = chain
.orc
.query(
"dao_voting_cw20_staked",
Expand All @@ -172,7 +172,7 @@ pub fn create_dao(
chain
.orc
.contract_map
.add_address("cw20_base", cw20_base)
.add_address("cw20_hooks", cw20_hooks)
.unwrap();

Ok(DaoState {
Expand All @@ -185,7 +185,7 @@ pub fn stake_tokens(chain: &mut Chain, how_many: u128, key: &SigningKey) {
chain
.orc
.execute(
"cw20_base",
"cw20_hooks",
"send_and_stake_cw20",
&cw20::Cw20ExecuteMsg::Send {
contract: chain.orc.contract_map.address("cw20_stake").unwrap(),
Expand Down Expand Up @@ -221,8 +221,8 @@ pub fn create_proposal(
chain
.orc
.execute(
"cw20_base",
"cw20_base_increase_allowance",
"cw20_hooks",
"cw20_hooks_increase_allowance",
&cw20::Cw20ExecuteMsg::IncreaseAllowance {
spender: chain
.orc
Expand Down
6 changes: 3 additions & 3 deletions ci/integration-tests/src/tests/cw20_stake_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ fn execute_stake_tokens(chain: &mut Chain) {
chain
.orc
.contract_map
.add_address("cw20_base", config.token_address.as_str())
.add_address("cw20_hooks", config.token_address.as_str())
.unwrap();
chain
.orc
.execute(
"cw20_base",
"cw20_hooks",
"exc_stake_stake_tokens",
&cw20_base::msg::ExecuteMsg::Send {
&cw20_hooks::msg::ExecuteMsg::Send {
contract: staking_addr,
amount: Uint128::new(100),
msg: to_json_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(),
Expand Down
3 changes: 2 additions & 1 deletion contracts/dao-dao-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ cw-core-v1 = { workspace = true, features = ["library"] }

[dev-dependencies]
cw-multi-test = { workspace = true, features = ["stargate"] }
cw20-base = { workspace = true }
cw20-hooks = { workspace = true }
cw721-base = { workspace = true }
dao-proposal-sudo = { workspace = true }
dao-voting-cw20-balance = { workspace = true }
dao-testing = { workspace = true }
Loading
Loading