Skip to content

Commit

Permalink
add info query to pre-propose-base
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Jul 19, 2024
1 parent ebc7914 commit 6a97155
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,20 @@
},
"additionalProperties": false
},
{
"description": "Returns contract version info.",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Gets the module's configuration.",
"type": "object",
Expand Down Expand Up @@ -2613,6 +2627,40 @@
}
}
},
"info": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InfoResponse",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"$ref": "#/definitions/ContractVersion"
}
},
"additionalProperties": false,
"definitions": {
"ContractVersion": {
"type": "object",
"required": [
"contract",
"version"
],
"properties": {
"contract": {
"description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing",
"type": "string"
},
"version": {
"description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)",
"type": "string"
}
},
"additionalProperties": false
}
}
},
"proposal_module": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Addr",
Expand Down
16 changes: 16 additions & 0 deletions contracts/pre-propose/dao-pre-propose-approval-single/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use cw_multi_test::{App, BankSudo, Contract, ContractWrapper, Executor};
use cw_utils::Duration;
use dao_interface::state::ProposalModule;
use dao_interface::state::{Admin, ModuleInstantiateInfo};
use dao_interface::proposal::InfoResponse;
use dao_pre_propose_base::{error::PreProposeError, msg::DepositInfoResponse, state::Config};
use dao_proposal_single::query::ProposalResponse;
use dao_testing::helpers::instantiate_with_cw4_groups_governance;
Expand Down Expand Up @@ -179,6 +180,15 @@ fn setup_default_test(
get_proposal_module(app, pre_propose.clone())
);
assert_eq!(core_addr, get_dao(app, pre_propose.clone()));
assert_eq!(
InfoResponse {
info: ContractVersion {
contract: "crates.io:dao-pre-propose-approval-single".to_string(),
version: env!("CARGO_PKG_VERSION").to_string()
}
},
get_info(app, pre_propose.clone())
);

DefaultTestSetup {
core_addr,
Expand Down Expand Up @@ -297,6 +307,12 @@ fn get_dao(app: &App, module: Addr) -> Addr {
.unwrap()
}

fn get_info(app: &App, module: Addr) -> InfoResponse {
app.wrap()
.query_wasm_smart(module, &QueryMsg::Info {})
.unwrap()
}

fn get_proposal_module(app: &App, module: Addr) -> Addr {
app.wrap()
.query_wasm_smart(module, &QueryMsg::ProposalModule {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,20 @@
},
"additionalProperties": false
},
{
"description": "Returns contract version info.",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Gets the module's configuration.",
"type": "object",
Expand Down Expand Up @@ -1227,6 +1241,40 @@
}
}
},
"info": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InfoResponse",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"$ref": "#/definitions/ContractVersion"
}
},
"additionalProperties": false,
"definitions": {
"ContractVersion": {
"type": "object",
"required": [
"contract",
"version"
],
"properties": {
"contract": {
"description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing",
"type": "string"
},
"version": {
"description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)",
"type": "string"
}
},
"additionalProperties": false
}
}
},
"proposal_module": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Addr",
Expand Down
16 changes: 16 additions & 0 deletions contracts/pre-propose/dao-pre-propose-approver/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use cw2::ContractVersion;
use cw20::Cw20Coin;
use cw_denom::UncheckedDenom;
use cw_multi_test::{App, BankSudo, Contract, ContractWrapper, Executor};
use dao_interface::proposal::InfoResponse;
use dao_voting::pre_propose::{PreProposeSubmissionPolicy, PreProposeSubmissionPolicyError};
use dps::query::{ProposalListResponse, ProposalResponse};

Expand Down Expand Up @@ -300,6 +301,15 @@ fn setup_default_test(
approver_core_addr,
get_dao(app, pre_propose_approver.clone())
);
assert_eq!(
InfoResponse {
info: ContractVersion {
contract: "crates.io:dao-pre-propose-approver".to_string(),
version: env!("CARGO_PKG_VERSION").to_string()
}
},
get_info(app, pre_propose_approver.clone())
);

DefaultTestSetup {
core_addr,
Expand Down Expand Up @@ -418,6 +428,12 @@ fn get_dao(app: &App, module: Addr) -> Addr {
.unwrap()
}

fn get_info(app: &App, module: Addr) -> InfoResponse {
app.wrap()
.query_wasm_smart(module, &QueryMsg::Info {})
.unwrap()
}

fn get_proposal_module(app: &App, module: Addr) -> Addr {
app.wrap()
.query_wasm_smart(module, &QueryMsg::ProposalModule {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,20 @@
},
"additionalProperties": false
},
{
"description": "Returns contract version info.",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Gets the module's configuration.",
"type": "object",
Expand Down Expand Up @@ -2298,6 +2312,40 @@
}
}
},
"info": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InfoResponse",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"$ref": "#/definitions/ContractVersion"
}
},
"additionalProperties": false,
"definitions": {
"ContractVersion": {
"type": "object",
"required": [
"contract",
"version"
],
"properties": {
"contract": {
"description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing",
"type": "string"
},
"version": {
"description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)",
"type": "string"
}
},
"additionalProperties": false
}
}
},
"proposal_module": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Addr",
Expand Down
16 changes: 16 additions & 0 deletions contracts/pre-propose/dao-pre-propose-multiple/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use cw_multi_test::{App, BankSudo, Contract, ContractWrapper, Executor};
use cw_utils::Duration;
use dao_interface::state::ProposalModule;
use dao_interface::state::{Admin, ModuleInstantiateInfo};
use dao_interface::proposal::InfoResponse;
use dao_pre_propose_base::{error::PreProposeError, msg::DepositInfoResponse, state::Config};
use dao_proposal_multiple as cpm;
use dao_testing::helpers::instantiate_with_cw4_groups_governance;
Expand Down Expand Up @@ -178,6 +179,15 @@ fn setup_default_test(
get_proposal_module(app, pre_propose.clone())
);
assert_eq!(core_addr, get_dao(app, pre_propose.clone()));
assert_eq!(
InfoResponse {
info: ContractVersion {
contract: "crates.io:dao-pre-propose-multiple".to_string(),
version: env!("CARGO_PKG_VERSION").to_string()
}
},
get_info(app, pre_propose.clone())
);

DefaultTestSetup {
core_addr,
Expand Down Expand Up @@ -350,6 +360,12 @@ fn get_dao(app: &App, module: Addr) -> Addr {
.unwrap()
}

fn get_info(app: &App, module: Addr) -> InfoResponse {
app.wrap()
.query_wasm_smart(module, &QueryMsg::Info {})
.unwrap()
}

fn get_proposal_module(app: &App, module: Addr) -> Addr {
app.wrap()
.query_wasm_smart(module, &QueryMsg::ProposalModule {})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,20 @@
},
"additionalProperties": false
},
{
"description": "Returns contract version info.",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"description": "Gets the module's configuration.",
"type": "object",
Expand Down Expand Up @@ -2272,6 +2286,40 @@
}
}
},
"info": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InfoResponse",
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"$ref": "#/definitions/ContractVersion"
}
},
"additionalProperties": false,
"definitions": {
"ContractVersion": {
"type": "object",
"required": [
"contract",
"version"
],
"properties": {
"contract": {
"description": "contract is the crate name of the implementing contract, eg. `crate:cw20-base` we will use other prefixes for other languages, and their standard global namespacing",
"type": "string"
},
"version": {
"description": "version is any string that this implementation knows. It may be simple counter \"1\", \"2\". or semantic version on release tags \"v0.7.0\", or some custom feature flag list. the only code that needs to understand the version parsing is code that knows how to migrate from the given contract (and is tied to it's implementation somehow)",
"type": "string"
}
},
"additionalProperties": false
}
}
},
"proposal_module": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Addr",
Expand Down
16 changes: 16 additions & 0 deletions contracts/pre-propose/dao-pre-propose-single/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use cw_multi_test::{App, BankSudo, Contract, ContractWrapper, Executor};
use cw_utils::Duration;
use dao_interface::state::ProposalModule;
use dao_interface::state::{Admin, ModuleInstantiateInfo};
use dao_interface::proposal::InfoResponse;
use dao_pre_propose_base::{error::PreProposeError, msg::DepositInfoResponse, state::Config};
use dao_proposal_single as dps;
use dao_testing::helpers::instantiate_with_cw4_groups_governance;
Expand Down Expand Up @@ -176,6 +177,15 @@ fn setup_default_test(
get_proposal_module(app, pre_propose.clone())
);
assert_eq!(core_addr, get_dao(app, pre_propose.clone()));
assert_eq!(
InfoResponse {
info: ContractVersion {
contract: "crates.io:dao-pre-propose-single".to_string(),
version: env!("CARGO_PKG_VERSION").to_string()
}
},
get_info(app, pre_propose.clone())
);

DefaultTestSetup {
core_addr,
Expand Down Expand Up @@ -325,6 +335,12 @@ fn get_dao(app: &App, module: Addr) -> Addr {
.unwrap()
}

fn get_info(app: &App, module: Addr) -> InfoResponse {
app.wrap()
.query_wasm_smart(module, &QueryMsg::Info {})
.unwrap()
}

fn query_hooks(app: &App, module: Addr) -> cw_hooks::HooksResponse {
app.wrap()
.query_wasm_smart(module, &QueryMsg::ProposalSubmittedHooks {})
Expand Down
Loading

0 comments on commit 6a97155

Please sign in to comment.