Skip to content

Commit

Permalink
support instantiate2 in ModuleInstantiateInfo and various contract in…
Browse files Browse the repository at this point in the history
…stantiations
  • Loading branch information
NoahSaso committed Feb 26, 2025
1 parent a26eadf commit cdc8a91
Show file tree
Hide file tree
Showing 75 changed files with 981 additions and 299 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ jobs:
docker-images: true
swap-storage: true

- name: Install latest stable toolchain
- name: Install nightly-2024-01-08 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: nightly-2024-01-08
target: wasm32-unknown-unknown
override: true

- name: Run tests
uses: actions-rs/cargo@v1
with:
toolchain: stable
toolchain: nightly-2024-01-08
command: all-test
args: --locked
env:
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Compile WASM contract
uses: actions-rs/cargo@v1
with:
toolchain: stable
toolchain: nightly-2024-01-08
command: wasm
args: --locked
env:
Expand All @@ -56,25 +56,25 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
- name: Install nightly-2024-01-08 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: nightly-2024-01-08
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
toolchain: stable
toolchain: nightly-2024-01-08
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
toolchain: stable
toolchain: nightly-2024-01-08
command: clippy
args: --all-targets -- -D warnings

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
docker-images: true
swap-storage: true

- name: Install latest nightly toolchain
- name: Install nightly-2024-01-08 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-02-02
toolchain: nightly-2024-01-08
target: wasm32-unknown-unknown
override: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_tube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
docker-images: true
swap-storage: true

- name: Install latest nightly toolchain
- name: Install nightly-2024-01-08 toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ ci/configs/cosm-orc/local.yaml
contracts/**/Cargo.lock
packages/**/Cargo.lock
debug/**/Cargo.lock
ci/**/Cargo.lock
ci/**/Cargo.lock
.aider*
2 changes: 1 addition & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ cosm-orc = { version = "4.0" }
cosm-tome = "0.2"
cosmos-sdk-proto = "0.19"
cosmwasm-schema = { version = "1.5.4" }
cosmwasm-std = { version = "1.5.4", features = ["ibc3", "cosmwasm_1_1"] }
cosmwasm-std = { version = "1.5.4", features = ["ibc3", "cosmwasm_1_2"] }
cw-controllers = "1.1"
cw-multi-test = { version = "0.20.1", features = ["cosmwasm_1_1"] }
cw-multi-test = { version = "0.20.1", features = ["cosmwasm_1_2"] }
cw-storage-plus = { version = "1.1" }
cw-utils = "1.0"
cw2 = "1.1"
Expand Down
11 changes: 8 additions & 3 deletions ci/bootstrap-env/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fn main() -> Result<()> {
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")?,
salt: None,
label: "DAO DAO Gov token".to_string(),
name: "DAO".to_string(),
symbol: "DAO".to_string(),
Expand All @@ -69,14 +70,16 @@ fn main() -> Result<()> {
}],
marketing: None,
staking_code_id: orc.contract_map.code_id("cw20_stake")?,
staking_salt: None,
unstaking_duration: Some(cw_utils::Duration::Time(1209600)),
initial_dao_balance: None,
},
active_threshold: None,
})?,
funds: vec![],
funds: None,
admin: Some(Admin::CoreModule {}),
label: "DAO DAO Voting Module".to_string(),
salt: None,
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: orc.contract_map.code_id("dao_proposal_single")?,
Expand Down Expand Up @@ -109,17 +112,19 @@ fn main() -> Result<()> {
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
funds: None,
label: "DAO DAO Pre-Propose Module".to_string(),
salt: None,
},
},
close_proposal_on_execution_failure: false,
veto: None,
delegation_module: None,
})?,
admin: Some(Admin::CoreModule {}),
funds: vec![],
funds: None,
label: "DAO DAO Proposal Module".to_string(),
salt: None,
}],
initial_items: None,
initial_actions: None,
Expand Down
11 changes: 8 additions & 3 deletions ci/integration-tests/src/helpers/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub fn create_dao(
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")?,
salt: None,
label: "DAO DAO Gov token".to_string(),
name: "DAO".to_string(),
symbol: "DAO".to_string(),
Expand All @@ -52,14 +53,16 @@ pub fn create_dao(
}],
marketing: None,
staking_code_id: chain.orc.contract_map.code_id("cw20_stake")?,
staking_salt: None,
unstaking_duration: Some(Duration::Time(1209600)),
initial_dao_balance: None,
},
active_threshold: None,
})?,
admin: Some(Admin::CoreModule {}),
label: "DAO DAO Voting Module".to_string(),
funds: vec![],
funds: None,
salt: None,
},
proposal_modules_instantiate_info: vec![ModuleInstantiateInfo {
code_id: chain.orc.contract_map.code_id("dao_proposal_single")?,
Expand Down Expand Up @@ -93,16 +96,18 @@ pub fn create_dao(
})
.unwrap(),
admin: Some(Admin::CoreModule {}),
funds: vec![],
funds: None,
label: "DAO DAO Pre-Propose Module".to_string(),
salt: None,
},
},
veto: None,
delegation_module: None,
})?,
admin: Some(Admin::CoreModule {}),
funds: vec![],
funds: None,
label: "DAO DAO Proposal Module".to_string(),
salt: None,
}],
initial_items: None,
initial_actions: None,
Expand Down
2 changes: 1 addition & 1 deletion ci/integration-tests/src/tests/cw_vesting_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use test_context::test_context;

use crate::helpers::chain::Chain;

const CONTRACT_NAME: &str = "cw_vesting";
const CONTRACT_NAME: &str = "cw_vesting-staking";

async fn balance<C: CosmosClient>(addr: &str, client: &CosmTome<C>) -> u128 {
client
Expand Down
51 changes: 45 additions & 6 deletions contracts/dao-dao-core/schema/dao-dao-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@
"type": "object",
"required": [
"code_id",
"funds",
"label",
"msg"
],
Expand All @@ -645,7 +644,10 @@
},
"funds": {
"description": "Funds to be sent to the instantiated contract.",
"type": "array",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Coin"
}
Expand All @@ -661,6 +663,17 @@
"$ref": "#/definitions/Binary"
}
]
},
"salt": {
"description": "Salt to use with instantiate2, if defined. Otherwise uses normal instantiate.",
"anyOf": [
{
"$ref": "#/definitions/Binary"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
Expand Down Expand Up @@ -2040,7 +2053,6 @@
"type": "object",
"required": [
"code_id",
"funds",
"label",
"msg"
],
Expand All @@ -2064,7 +2076,10 @@
},
"funds": {
"description": "Funds to be sent to the instantiated contract.",
"type": "array",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Coin"
}
Expand All @@ -2080,6 +2095,17 @@
"$ref": "#/definitions/Binary"
}
]
},
"salt": {
"description": "Salt to use with instantiate2, if defined. Otherwise uses normal instantiate.",
"anyOf": [
{
"$ref": "#/definitions/Binary"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
Expand Down Expand Up @@ -3083,7 +3109,6 @@
"type": "object",
"required": [
"code_id",
"funds",
"label",
"msg"
],
Expand All @@ -3107,7 +3132,10 @@
},
"funds": {
"description": "Funds to be sent to the instantiated contract.",
"type": "array",
"type": [
"array",
"null"
],
"items": {
"$ref": "#/definitions/Coin"
}
Expand All @@ -3123,6 +3151,17 @@
"$ref": "#/definitions/Binary"
}
]
},
"salt": {
"description": "Salt to use with instantiate2, if defined. Otherwise uses normal instantiate.",
"anyOf": [
{
"$ref": "#/definitions/Binary"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
Expand Down
3 changes: 2 additions & 1 deletion contracts/dao-dao-core/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,8 @@ pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> Result<Response, Con
msg: to_json_binary(&migrate_params.params).unwrap(),
admin: Some(Admin::CoreModule {}),
label: "migrator".to_string(),
funds: vec![],
funds: None,
salt: None,
}],
to_disable: vec![],
})
Expand Down
Loading

0 comments on commit cdc8a91

Please sign in to comment.