From f46152ac42d8967dc7674b802c31996b07a9742b Mon Sep 17 00:00:00 2001 From: Nino Lipartiia Date: Thu, 22 Dec 2022 16:10:00 +0200 Subject: [PATCH 1/5] new rule: CheckPassedProposals --- contracts/cw-croncat/src/balancer.rs | 9 ++-- contracts/cw-croncat/src/helpers.rs | 6 +-- contracts/cw-croncat/src/owner.rs | 12 +++--- contracts/cw-rules/src/contract.rs | 42 ++++++++++++++++++- contracts/cw-rules/src/types.rs | 16 ++++++- packages/cw-croncat-core/schema/croncat.json | 23 ++++++++++ .../cw-croncat-core/schema/execute_msg.json | 23 ++++++++++ .../schema/get_agent_tasks_response.json | 23 ++++++++++ .../schema/get_state_response.json | 23 ++++++++++ .../schema/get_task_response.json | 23 ++++++++++ .../schema/get_tasks_by_owner_response.json | 23 ++++++++++ .../schema/get_tasks_response.json | 23 ++++++++++ .../get_tasks_with_queries_response.json | 23 ++++++++++ .../cw-croncat-core/schema/query_msg.json | 23 ++++++++++ .../cw-rules-core/schema/croncat_query.json | 23 ++++++++++ .../cw-rules-core/schema/query_construct.json | 23 ++++++++++ packages/cw-rules-core/schema/query_msg.json | 35 ++++++++++++++++ packages/cw-rules-core/src/msg.rs | 5 ++- packages/cw-rules-core/src/types.rs | 6 +++ 19 files changed, 365 insertions(+), 19 deletions(-) diff --git a/contracts/cw-croncat/src/balancer.rs b/contracts/cw-croncat/src/balancer.rs index 87644e4d..970dcf39 100644 --- a/contracts/cw-croncat/src/balancer.rs +++ b/contracts/cw-croncat/src/balancer.rs @@ -44,9 +44,6 @@ pub struct RoundRobinBalancer { } impl RoundRobinBalancer { - pub fn default() -> RoundRobinBalancer { - RoundRobinBalancer::new(BalancerMode::ActivationOrder) - } pub fn new(mode: BalancerMode) -> RoundRobinBalancer { RoundRobinBalancer { mode } } @@ -292,3 +289,9 @@ impl<'a> Balancer<'a> for RoundRobinBalancer { Ok(()) } } + +impl Default for RoundRobinBalancer { + fn default() -> RoundRobinBalancer { + RoundRobinBalancer::new(BalancerMode::ActivationOrder) + } +} diff --git a/contracts/cw-croncat/src/helpers.rs b/contracts/cw-croncat/src/helpers.rs index 1e6d91df..16eaabe2 100644 --- a/contracts/cw-croncat/src/helpers.rs +++ b/contracts/cw-croncat/src/helpers.rs @@ -177,11 +177,7 @@ impl<'a> CwCroncat<'a> { // It's possible there are more "covered tasks" than total tasks, // so use saturating subtraction to hit zero and not go below let total_tasks_needing_agents = total_tasks.saturating_sub(num_tasks_covered); - let remainder = if total_tasks_needing_agents % max_tasks == 0 { - 0 - } else { - 1 - }; + let remainder = u64::from(total_tasks_needing_agents % max_tasks != 0); total_tasks_needing_agents / max_tasks + remainder } else { 0 diff --git a/contracts/cw-croncat/src/owner.rs b/contracts/cw-croncat/src/owner.rs index fef6ff55..f1951e18 100644 --- a/contracts/cw-croncat/src/owner.rs +++ b/contracts/cw-croncat/src/owner.rs @@ -204,7 +204,7 @@ impl<'a> CwCroncat<'a> { // Querier guarantees to returns up-to-date data, including funds sent in this handle message // https://github.com/CosmWasm/wasmd/blob/master/x/wasm/internal/keeper/keeper.go#L185-L192 - let state_balances = deps.querier.query_all_balances(&env.contract.address)?; + let state_balances = deps.querier.query_all_balances(env.contract.address)?; let mut has_fund_err = false; let messages: Result, ContractError> = balances @@ -303,7 +303,7 @@ impl<'a> CwCroncat<'a> { .time_slots .range(deps.storage, None, None, Order::Ascending) .skip(from_index_unwrap as usize) - .take(limit_unwrap as usize) + .take(limit_unwrap) .map(|res| { let res = res.unwrap(); SlotResponse { @@ -317,7 +317,7 @@ impl<'a> CwCroncat<'a> { .block_slots .range(deps.storage, None, None, Order::Ascending) .skip(from_index_unwrap as usize) - .take(limit_unwrap as usize) + .take(limit_unwrap) .map(|res| { let res = res.unwrap(); SlotResponse { @@ -331,7 +331,7 @@ impl<'a> CwCroncat<'a> { .balances .range(deps.storage, None, None, Order::Ascending) .skip(from_index_unwrap as usize) - .take(limit_unwrap as usize) + .take(limit_unwrap) .map(|res| { let res = res.unwrap(); BalancesResponse { @@ -350,7 +350,7 @@ impl<'a> CwCroncat<'a> { .time_map_queries .range(deps.storage, None, None, Order::Ascending) .skip(from_index_unwrap as usize) - .take(limit_unwrap as usize) + .take(limit_unwrap) .map(|res| { let res = res.unwrap(); SlotWithQueriesResponse { @@ -364,7 +364,7 @@ impl<'a> CwCroncat<'a> { .block_map_queries .range(deps.storage, None, None, Order::Ascending) .skip(from_index_unwrap as usize) - .take(limit_unwrap as usize) + .take(limit_unwrap) .map(|res| { let res = res.unwrap(); SlotWithQueriesResponse { diff --git a/contracts/cw-rules/src/contract.rs b/contracts/cw-rules/src/contract.rs index 19dcc84d..fb7fb215 100644 --- a/contracts/cw-rules/src/contract.rs +++ b/contracts/cw-rules/src/contract.rs @@ -1,5 +1,7 @@ use cw_rules_core::msg::{QueryConstruct, QueryConstructResponse}; -use cw_rules_core::types::{CheckOwnerOfNft, CheckProposalStatus, CroncatQuery, HasBalanceGte}; +use cw_rules_core::types::{ + CheckOwnerOfNft, CheckPassedProposals, CheckProposalStatus, CroncatQuery, HasBalanceGte, +}; // use schemars::JsonSchema; // use serde::{Deserialize, Serialize}; @@ -21,7 +23,7 @@ use cw_rules_core::msg::{ExecuteMsg, InstantiateMsg, QueryMsg, QueryResponse}; //use cosmwasm_std::from_binary; //use crate::msg::QueryMultiResponse; -use crate::types::dao::{ProposalResponse, QueryDao, Status}; +use crate::types::dao::{ProposalListResponse, ProposalResponse, QueryDao, Status}; use generic_query::GenericQuery; // version info for migration info @@ -87,6 +89,9 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { proposal_id, status, )?), + QueryMsg::CheckPassedProposals(CheckPassedProposals { dao_address }) => { + to_binary(&query_dao_proposals(deps, dao_address)?) + } QueryMsg::GenericQuery(query) => to_binary(&generic_query(deps, query)?), QueryMsg::SmartQuery(query) => to_binary(&smart_query(deps, query)?), QueryMsg::QueryConstruct(QueryConstruct { queries }) => { @@ -203,6 +208,36 @@ fn query_dao_proposal_status( }) } +// Check for passed proposals +// Return the first passed proposal +fn query_dao_proposals(deps: Deps, dao_address: String) -> StdResult { + let dao_addr = deps.api.addr_validate(&dao_address)?; + // Query the amount of proposals + let proposal_count = deps + .querier + .query_wasm_smart(dao_addr.clone(), &QueryDao::ProposalCount {})?; + let res: ProposalListResponse = deps.querier.query_wasm_smart( + dao_addr, + &QueryDao::ListProposals { + start_after: None, + limit: Some(proposal_count), + }, + )?; + + for proposal_response in &res.proposals { + if proposal_response.proposal.status == Status::Passed { + return Ok(QueryResponse { + result: true, + data: to_binary(&proposal_response.id)?, + }); + } + } + Ok(QueryResponse { + result: false, + data: to_binary(&res.proposals)?, + }) +} + // // // GOAL: // // // Parse a generic query response, and inject input for the next query // // fn query_chain(deps: Deps, env: Env) -> StdResult { @@ -256,6 +291,9 @@ fn query_construct(deps: Deps, queries: Vec) -> StdResult query_dao_proposal_status(deps, dao_address, proposal_id, status), + CroncatQuery::CheckPassedProposals(CheckPassedProposals { dao_address }) => { + query_dao_proposals(deps, dao_address) + } CroncatQuery::GenericQuery(query) => generic_query(deps, query), CroncatQuery::SmartQuery(query) => smart_query(deps, query), }?; diff --git a/contracts/cw-rules/src/types.rs b/contracts/cw-rules/src/types.rs index c14b0430..583104ed 100644 --- a/contracts/cw-rules/src/types.rs +++ b/contracts/cw-rules/src/types.rs @@ -10,7 +10,14 @@ pub mod dao { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub enum QueryDao { - Proposal { proposal_id: u64 }, + Proposal { + proposal_id: u64, + }, + ListProposals { + start_after: Option, + limit: Option, + }, + ProposalCount {}, } #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] @@ -19,7 +26,12 @@ pub mod dao { pub id: u64, pub proposal: AnyChoiceProposal, } - // + + #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] + pub struct ProposalListResponse { + pub proposals: Vec, + } + #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] pub struct AnyChoiceProposal { pub status: Status, diff --git a/packages/cw-croncat-core/schema/croncat.json b/packages/cw-croncat-core/schema/croncat.json index 94a331c6..be29fddd 100644 --- a/packages/cw-croncat-core/schema/croncat.json +++ b/packages/cw-croncat-core/schema/croncat.json @@ -506,6 +506,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -717,6 +728,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/execute_msg.json b/packages/cw-croncat-core/schema/execute_msg.json index 4f5d11f4..1876b92a 100644 --- a/packages/cw-croncat-core/schema/execute_msg.json +++ b/packages/cw-croncat-core/schema/execute_msg.json @@ -575,6 +575,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -786,6 +797,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/get_agent_tasks_response.json b/packages/cw-croncat-core/schema/get_agent_tasks_response.json index 3bf92210..4b6624e6 100644 --- a/packages/cw-croncat-core/schema/get_agent_tasks_response.json +++ b/packages/cw-croncat-core/schema/get_agent_tasks_response.json @@ -219,6 +219,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -430,6 +441,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/get_state_response.json b/packages/cw-croncat-core/schema/get_state_response.json index f72806ec..c6ca6cbc 100644 --- a/packages/cw-croncat-core/schema/get_state_response.json +++ b/packages/cw-croncat-core/schema/get_state_response.json @@ -377,6 +377,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -588,6 +599,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/get_task_response.json b/packages/cw-croncat-core/schema/get_task_response.json index 8e8d0293..7735e1e0 100644 --- a/packages/cw-croncat-core/schema/get_task_response.json +++ b/packages/cw-croncat-core/schema/get_task_response.json @@ -219,6 +219,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -430,6 +441,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/get_tasks_by_owner_response.json b/packages/cw-croncat-core/schema/get_tasks_by_owner_response.json index 8ed0a1b4..8ae8ed9c 100644 --- a/packages/cw-croncat-core/schema/get_tasks_by_owner_response.json +++ b/packages/cw-croncat-core/schema/get_tasks_by_owner_response.json @@ -215,6 +215,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -426,6 +437,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/get_tasks_response.json b/packages/cw-croncat-core/schema/get_tasks_response.json index 4edac6ab..9914fb29 100644 --- a/packages/cw-croncat-core/schema/get_tasks_response.json +++ b/packages/cw-croncat-core/schema/get_tasks_response.json @@ -215,6 +215,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -426,6 +437,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/get_tasks_with_queries_response.json b/packages/cw-croncat-core/schema/get_tasks_with_queries_response.json index fb43ddde..2b321cac 100644 --- a/packages/cw-croncat-core/schema/get_tasks_with_queries_response.json +++ b/packages/cw-croncat-core/schema/get_tasks_with_queries_response.json @@ -133,6 +133,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -231,6 +242,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-croncat-core/schema/query_msg.json b/packages/cw-croncat-core/schema/query_msg.json index 269736a3..6c545a9f 100644 --- a/packages/cw-croncat-core/schema/query_msg.json +++ b/packages/cw-croncat-core/schema/query_msg.json @@ -462,6 +462,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -673,6 +684,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-rules-core/schema/croncat_query.json b/packages/cw-rules-core/schema/croncat_query.json index f17d959f..e34513a5 100644 --- a/packages/cw-rules-core/schema/croncat_query.json +++ b/packages/cw-rules-core/schema/croncat_query.json @@ -62,6 +62,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -143,6 +155,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ diff --git a/packages/cw-rules-core/schema/query_construct.json b/packages/cw-rules-core/schema/query_construct.json index 231f5895..48485b41 100644 --- a/packages/cw-rules-core/schema/query_construct.json +++ b/packages/cw-rules-core/schema/query_construct.json @@ -69,6 +69,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -167,6 +178,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-rules-core/schema/query_msg.json b/packages/cw-rules-core/schema/query_msg.json index b198f5be..27afc641 100644 --- a/packages/cw-rules-core/schema/query_msg.json +++ b/packages/cw-rules-core/schema/query_msg.json @@ -86,6 +86,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ @@ -179,6 +191,17 @@ } } }, + "CheckPassedProposals": { + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } + }, "CheckProposalStatus": { "type": "object", "required": [ @@ -277,6 +300,18 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "check_passed_proposals" + ], + "properties": { + "check_passed_proposals": { + "$ref": "#/definitions/CheckPassedProposals" + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/packages/cw-rules-core/src/msg.rs b/packages/cw-rules-core/src/msg.rs index c8b026aa..de802dcf 100644 --- a/packages/cw-rules-core/src/msg.rs +++ b/packages/cw-rules-core/src/msg.rs @@ -1,4 +1,6 @@ -use crate::types::{CheckOwnerOfNft, CheckProposalStatus, CroncatQuery, HasBalanceGte}; +use crate::types::{ + CheckOwnerOfNft, CheckPassedProposals, CheckProposalStatus, CroncatQuery, HasBalanceGte, +}; use generic_query::GenericQuery; //use cw_croncat_core::types::Rule; //use cosmwasm_std::Coin; @@ -30,6 +32,7 @@ pub enum QueryMsg { HasBalanceGte(HasBalanceGte), CheckOwnerOfNft(CheckOwnerOfNft), CheckProposalStatus(CheckProposalStatus), + CheckPassedProposals(CheckPassedProposals), GenericQuery(GenericQuery), // Full evaluations QueryConstruct(QueryConstruct), diff --git a/packages/cw-rules-core/src/types.rs b/packages/cw-rules-core/src/types.rs index 75afeda0..36a0e6b5 100644 --- a/packages/cw-rules-core/src/types.rs +++ b/packages/cw-rules-core/src/types.rs @@ -32,6 +32,7 @@ pub enum CroncatQuery { HasBalanceGte(HasBalanceGte), CheckOwnerOfNft(CheckOwnerOfNft), CheckProposalStatus(CheckProposalStatus), + CheckPassedProposals(CheckPassedProposals), GenericQuery(GenericQuery), SmartQuery(SmartQueryHead), } @@ -55,3 +56,8 @@ pub struct CheckProposalStatus { pub proposal_id: u64, pub status: Status, } + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +pub struct CheckPassedProposals { + pub dao_address: String, +} From acbcf41f558b7cb9db6a4a402872a958891a9d2b Mon Sep 17 00:00:00 2001 From: Nino Lipartiia Date: Thu, 22 Dec 2022 16:15:36 +0200 Subject: [PATCH 2/5] Script for the task that executes passed proposals --- .../create-auto-execute-dao-task.sh | 79 +++++++++++++++++++ scripts/uni-testnet/proxy-call-with-query.sh | 28 +++++++ 2 files changed, 107 insertions(+) create mode 100644 scripts/uni-testnet/create-auto-execute-dao-task.sh create mode 100644 scripts/uni-testnet/proxy-call-with-query.sh diff --git a/scripts/uni-testnet/create-auto-execute-dao-task.sh b/scripts/uni-testnet/create-auto-execute-dao-task.sh new file mode 100644 index 00000000..f0d4b5bc --- /dev/null +++ b/scripts/uni-testnet/create-auto-execute-dao-task.sh @@ -0,0 +1,79 @@ +set -e + +SH_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" +SH_DIR="$(cd -P "$(dirname "${SH_PATH}")";pwd)" +. $SH_DIR/base/init-vars.sh + +if [ -z "$1" ]; then + echo "Must provide contract address" + exit 1 +elif [ -z "$2" ]; then + echo "Must provide user address" + exit 1 +elif [ -z "$3" ]; then + echo "Must provide rules address" + exit 1 +elif [ -z "$4" ]; then + echo "Must provide dao address" + exit 1 +elif [ -z "$5" ]; then + echo "Must provide agent address" + exit 1 +fi + +CONTRACT="$1" +USER="$2" +RULES="$3" +DAO="$4" +AGENT="$5" + +EXECUTE_MSG='{"execute":{"proposal_id":""}}' +ENCODED_EXECUTE_MSG=$(printf $EXECUTE_MSG | base64) + +DAODAO='{ + "create_task": { + "task": { + "interval": "Immediate", + "cw20_coins": [], + "stop_on_fail": false, + "actions": [ + { + "msg": { + "wasm": { + "execute": { + "contract_addr": "'$DAO'", + "msg": "'$ENCODED_EXECUTE_MSG'", + "funds": [] + } + } + }, + "gas_limit": 300000 + } + ], + "queries": [ + { + "check_passed_proposals": { + "dao_address": "'$DAO'" + } + } + ], + "transforms": [ + { + "action_idx": 0, + "query_idx": 0, + "action_path": [ + { + "key": "execute" + }, + { + "key": "proposal_id" + } + ], + "query_response_path": [] + } + ] + } + } +}' + +junod tx wasm execute $CONTRACT "$DAODAO" --amount 1000000ujunox --from "$USER" $TXFLAG -y diff --git a/scripts/uni-testnet/proxy-call-with-query.sh b/scripts/uni-testnet/proxy-call-with-query.sh new file mode 100644 index 00000000..022a75fc --- /dev/null +++ b/scripts/uni-testnet/proxy-call-with-query.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +SH_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")" +SH_DIR="$(cd -P "$(dirname "${SH_PATH}")";pwd)" +. $SH_DIR/base/init-vars.sh + +if [ -z "$1" ] +then + echo "Must provide contract address" + exit 1 +elif [ -z "$2" ] +then + echo "Must provide address of the agent" + exit 1 +elif [ -z "$3" ] +then + echo "Must provide the task hash" + exit 1 +else + CONTRACT="$1" + AGENT="$2" + HASH="$3" +fi + + +PROXY_CALL='{"proxy_call":{"task_hash": "'$HASH'"}}' +junod tx wasm execute $CONTRACT "$PROXY_CALL" --from $AGENT $TXFLAG -y From 9f2d7eeb1f57a47868a18fe6040f5de1976efdcd Mon Sep 17 00:00:00 2001 From: Nino Lipartiia Date: Thu, 22 Dec 2022 18:54:08 +0200 Subject: [PATCH 3/5] Tests for CheckPassedProposals --- contracts/cw-rules/src/tests/daodao.rs | 385 +++++++++++++++++- .../cw-croncat-core/CwCroncatCore.client.ts | 2 +- .../cw-croncat-core/CwCroncatCore.types.ts | 6 + .../cw-rules-core/CwRulesCore.client.ts | 19 +- .../cw-rules-core/CwRulesCore.types.ts | 8 + 5 files changed, 417 insertions(+), 3 deletions(-) diff --git a/contracts/cw-rules/src/tests/daodao.rs b/contracts/cw-rules/src/tests/daodao.rs index 89b261fa..f7bb78e1 100644 --- a/contracts/cw-rules/src/tests/daodao.rs +++ b/contracts/cw-rules/src/tests/daodao.rs @@ -1,7 +1,7 @@ use cosmwasm_std::{to_binary, Addr, Binary, Uint128}; use cw20::Cw20Coin; use cw_multi_test::{next_block, App, Executor}; -use cw_rules_core::types::{CheckProposalStatus, Status}; +use cw_rules_core::types::{CheckPassedProposals, CheckProposalStatus, Status}; use cwd_core::state::ProposalModule; use cwd_proposal_multiple::proposal::MultipleChoiceProposal; use cwd_proposal_single::proposal::SingleChoiceProposal; @@ -665,3 +665,386 @@ fn test_dao_multiple_proposal_ready() { } ); } + +#[test] +fn test_single_check_passed_proposals() { + let mut app = App::default(); + let code_id = app.store_code(cw_rules_contract()); + + let instantiate = InstantiateMsg {}; + let contract_addr = app + .instantiate_contract( + code_id, + Addr::unchecked(CREATOR_ADDR), + &instantiate, + &[], + "cw-rules", + None, + ) + .unwrap(); + + let proposal_module_code_id = app.store_code(single_proposal_contract()); + let threshold = Threshold::AbsolutePercentage { + percentage: PercentageThreshold::Majority {}, + }; + let max_voting_period = cw_utils::Duration::Height(6); + let instantiate_govmod = cwd_proposal_single::msg::InstantiateMsg { + threshold, + max_voting_period, + min_voting_period: None, + only_members_execute: false, + allow_revoting: false, + close_proposal_on_execution_failure: true, + pre_propose_info: cwd_voting::pre_propose::PreProposeInfo::AnyoneMayPropose {}, + }; + let governance_addr = instantiate_with_staking_active_threshold( + &mut app, + proposal_module_code_id, + to_binary(&instantiate_govmod).unwrap(), + None, + None, + ); + let governance_modules: Vec = app + .wrap() + .query_wasm_smart( + governance_addr, + &cwd_core::msg::QueryMsg::ProposalModules { + start_after: None, + limit: None, + }, + ) + .unwrap(); + + assert_eq!(governance_modules.len(), 1); + let govmod_single = governance_modules.into_iter().next().unwrap().address; + + let govmod_config: cwd_proposal_single::state::Config = app + .wrap() + .query_wasm_smart( + govmod_single.clone(), + &cwd_proposal_single::msg::QueryMsg::Config {}, + ) + .unwrap(); + let dao = govmod_config.dao; + let voting_module: Addr = app + .wrap() + .query_wasm_smart(dao, &cwd_core::msg::QueryMsg::VotingModule {}) + .unwrap(); + let staking_contract: Addr = app + .wrap() + .query_wasm_smart( + voting_module.clone(), + &cwd_voting_cw20_staked::msg::QueryMsg::StakingContract {}, + ) + .unwrap(); + let token_contract: Addr = app + .wrap() + .query_wasm_smart( + voting_module, + &cwd_interface::voting::Query::TokenContract {}, + ) + .unwrap(); + + // Stake some tokens so we can propose + let msg = cw20::Cw20ExecuteMsg::Send { + contract: staking_contract.to_string(), + amount: Uint128::new(2000), + msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + }; + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + token_contract.clone(), + &msg, + &[], + ) + .unwrap(); + app.update_block(next_block); + + // Create 100 new proposals + for num in 1..101 { + let mut title = "Cron".to_string(); + title.push(num.into()); + let mut description = "Cat".to_string(); + description.push(num.into()); + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + govmod_single.clone(), + &cwd_proposal_single::msg::ExecuteMsg::Propose { + title, + description, + msgs: vec![], + proposer: None, + }, + &[], + ) + .unwrap(); + } + + // Neither proposal has passed + let res: QueryResponse = app + .wrap() + .query_wasm_smart( + contract_addr.clone(), + &QueryMsg::CheckPassedProposals(CheckPassedProposals { + dao_address: govmod_single.to_string(), + }), + ) + .unwrap(); + assert!(!res.result); + + // Approve even proposals + for num in 1..51 { + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + govmod_single.clone(), + &cwd_proposal_single::msg::ExecuteMsg::Vote { + proposal_id: 2 * num as u64, + vote: Vote::Yes, + }, + &[], + ) + .unwrap(); + } + + // Query passed proposals and execute them + for num in 1..51 { + let index: u64 = 2 * num; + + // Check that CheckPassedProposals returns index as the number of the first passed proposal + let res: QueryResponse = app + .wrap() + .query_wasm_smart( + contract_addr.clone(), + &QueryMsg::CheckPassedProposals(CheckPassedProposals { + dao_address: govmod_single.to_string(), + }), + ) + .unwrap(); + assert_eq!( + res, + QueryResponse { + result: true, + data: to_binary(&index).unwrap() + } + ); + + // Execute the proposal + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + govmod_single.clone(), + &cwd_proposal_single::msg::ExecuteMsg::Execute { proposal_id: index }, + &[], + ) + .unwrap(); + } + + // All passed proposals are executed + // There shouldn't be any passed proposals + let res: QueryResponse = app + .wrap() + .query_wasm_smart( + contract_addr.clone(), + &QueryMsg::CheckPassedProposals(CheckPassedProposals { + dao_address: govmod_single.to_string(), + }), + ) + .unwrap(); + assert!(!res.result,); +} + +#[test] +fn test_multiple_check_passed_proposals() { + let mut app = App::default(); + let code_id = app.store_code(cw_rules_contract()); + let instantiate = InstantiateMsg {}; + let contract_addr = app + .instantiate_contract( + code_id, + Addr::unchecked(CREATOR_ADDR), + &instantiate, + &[], + "cw-rules", + None, + ) + .unwrap(); + + let proposal_module_code_id = app.store_code(multiple_proposal_contract()); + let voting_strategy = VotingStrategy::SingleChoice { + quorum: PercentageThreshold::Majority {}, + }; + let max_voting_period = cw_utils::Duration::Height(6); + let instantiate_govmod = cwd_proposal_multiple::msg::InstantiateMsg { + voting_strategy, + max_voting_period, + min_voting_period: None, + only_members_execute: false, + allow_revoting: false, + close_proposal_on_execution_failure: true, + pre_propose_info: cwd_voting::pre_propose::PreProposeInfo::AnyoneMayPropose {}, + }; + let governance_addr = instantiate_with_staking_active_threshold( + &mut app, + proposal_module_code_id, + to_binary(&instantiate_govmod).unwrap(), + None, + None, + ); + let governance_modules: Vec = app + .wrap() + .query_wasm_smart( + governance_addr, + &cwd_core::msg::QueryMsg::ProposalModules { + start_after: None, + limit: None, + }, + ) + .unwrap(); + + assert_eq!(governance_modules.len(), 1); + let govmod_single = governance_modules.into_iter().next().unwrap().address; + + let govmod_config: cwd_proposal_multiple::state::Config = app + .wrap() + .query_wasm_smart( + govmod_single.clone(), + &cwd_proposal_multiple::msg::QueryMsg::Config {}, + ) + .unwrap(); + let dao = govmod_config.dao; + let voting_module: Addr = app + .wrap() + .query_wasm_smart(dao, &cwd_core::msg::QueryMsg::VotingModule {}) + .unwrap(); + let staking_contract: Addr = app + .wrap() + .query_wasm_smart( + voting_module.clone(), + &cwd_voting_cw20_staked::msg::QueryMsg::StakingContract {}, + ) + .unwrap(); + let token_contract: Addr = app + .wrap() + .query_wasm_smart( + voting_module, + &cwd_interface::voting::Query::TokenContract {}, + ) + .unwrap(); + + // Stake some tokens so we can propose + let msg = cw20::Cw20ExecuteMsg::Send { + contract: staking_contract.to_string(), + amount: Uint128::new(2000), + msg: to_binary(&cw20_stake::msg::ReceiveMsg::Stake {}).unwrap(), + }; + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + token_contract.clone(), + &msg, + &[], + ) + .unwrap(); + app.update_block(next_block); + + // Create 100 new proposals + for num in 1..101 { + let mut title = "Cron".to_string(); + title.push(num.into()); + let mut description = "Cat".to_string(); + description.push(num.into()); + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + govmod_single.clone(), + &cwd_proposal_multiple::msg::ExecuteMsg::Propose { + title, + description, + choices: MultipleChoiceOptions { + options: vec![ + MultipleChoiceOption { + description: "a".to_string(), + msgs: None, + }, + MultipleChoiceOption { + description: "b".to_string(), + msgs: None, + }, + ], + }, + proposer: None, + }, + &[], + ) + .unwrap(); + } + + // Neither proposal has passed + let res: QueryResponse = app + .wrap() + .query_wasm_smart( + contract_addr.clone(), + &QueryMsg::CheckPassedProposals(CheckPassedProposals { + dao_address: govmod_single.to_string(), + }), + ) + .unwrap(); + assert!(!res.result,); + + // Vote on even proposals + for num in 1..51 { + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + govmod_single.clone(), + &cwd_proposal_multiple::msg::ExecuteMsg::Vote { + proposal_id: 2 * num as u64, + vote: MultipleChoiceVote { option_id: 0 }, + }, + &[], + ) + .unwrap(); + } + + // Query passed proposals and execute them + for num in 1..51 { + let index: u64 = 2 * num; + + // Check that CheckPassedProposals returns index as the number of the first passed proposal + let res: QueryResponse = app + .wrap() + .query_wasm_smart( + contract_addr.clone(), + &QueryMsg::CheckPassedProposals(CheckPassedProposals { + dao_address: govmod_single.to_string(), + }), + ) + .unwrap(); + + // Execute the proposal + assert_eq!( + res, + QueryResponse { + result: true, + data: to_binary(&index).unwrap() + } + ); + + app.execute_contract( + Addr::unchecked(CREATOR_ADDR), + govmod_single.clone(), + &cwd_proposal_multiple::msg::ExecuteMsg::Execute { proposal_id: index }, + &[], + ) + .unwrap(); + } + + // All passed proposals are executed + // There shouldn't be any passed proposals + let res: QueryResponse = app + .wrap() + .query_wasm_smart( + contract_addr.clone(), + &QueryMsg::CheckPassedProposals(CheckPassedProposals { + dao_address: govmod_single.to_string(), + }), + ) + .unwrap(); + assert!(!res.result,); +} diff --git a/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts b/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts index befe9a5f..b2fddd13 100644 --- a/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts +++ b/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts @@ -6,7 +6,7 @@ import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { StdFee } from "@cosmjs/amino"; -import { Addr, Uint128, Timestamp, Uint64, SlotType, AgentStatus, CosmosMsgForEmpty, BankMsg, StakingMsg, DistributionMsg, Binary, IbcMsg, WasmMsg, GovMsg, VoteOption, Boundary, Interval, CroncatQuery, Balance, NativeBalance, Status, ValueOrdering, ValueIndex, PathToValue, SmartQueries, Croncat, Agent, GenericBalance, Cw20CoinVerified, Coin, GetBalancesResponse, GetConfigResponse, GasFraction, GetAgentIdsResponse, AgentResponse, AgentTaskResponse, GetSlotHashesResponse, GetSlotIdsResponse, TaskResponse, ActionForEmpty, Empty, IbcTimeout, IbcTimeoutBlock, HasBalanceGte, CheckOwnerOfNft, CheckProposalStatus, GenericQuery, SmartQueryHead, SmartQuery, GetWalletBalancesResponse, Task, BoundaryValidated, Transform, TaskRequest, Cw20Coin, ExecuteMsg, Cw20ReceiveMsg, GetAgentResponse, GetAgentTasksResponse, RoundRobinBalancerModeResponse, GetStateResponse, BalancesResponse, SlotResponse, SlotWithQueriesResponse, TaskWithQueriesResponse, GetTaskHashResponse, GetTaskResponse, GetTasksByOwnerResponse, GetTasksResponse, GetTasksWithQueriesResponse, InstantiateMsg, QueryMsg, ValidateIntervalResponse } from "./CwCroncatCore.types"; +import { Addr, Uint128, Timestamp, Uint64, SlotType, AgentStatus, CosmosMsgForEmpty, BankMsg, StakingMsg, DistributionMsg, Binary, IbcMsg, WasmMsg, GovMsg, VoteOption, Boundary, Interval, CroncatQuery, Balance, NativeBalance, Status, ValueOrdering, ValueIndex, PathToValue, SmartQueries, Croncat, Agent, GenericBalance, Cw20CoinVerified, Coin, GetBalancesResponse, GetConfigResponse, GasFraction, GetAgentIdsResponse, AgentResponse, AgentTaskResponse, GetSlotHashesResponse, GetSlotIdsResponse, TaskResponse, ActionForEmpty, Empty, IbcTimeout, IbcTimeoutBlock, HasBalanceGte, CheckOwnerOfNft, CheckProposalStatus, CheckPassedProposals, GenericQuery, SmartQueryHead, SmartQuery, GetWalletBalancesResponse, Task, BoundaryValidated, Transform, TaskRequest, Cw20Coin, ExecuteMsg, Cw20ReceiveMsg, GetAgentResponse, GetAgentTasksResponse, RoundRobinBalancerModeResponse, GetStateResponse, BalancesResponse, SlotResponse, SlotWithQueriesResponse, TaskWithQueriesResponse, GetTaskHashResponse, GetTaskResponse, GetTasksByOwnerResponse, GetTasksResponse, GetTasksWithQueriesResponse, InstantiateMsg, QueryMsg, ValidateIntervalResponse } from "./CwCroncatCore.types"; export interface CwCroncatCoreReadOnlyInterface { contractAddress: string; getConfig: () => Promise; diff --git a/typescript/contracts/cw-croncat-core/CwCroncatCore.types.ts b/typescript/contracts/cw-croncat-core/CwCroncatCore.types.ts index 8785d9c1..a62c34cd 100644 --- a/typescript/contracts/cw-croncat-core/CwCroncatCore.types.ts +++ b/typescript/contracts/cw-croncat-core/CwCroncatCore.types.ts @@ -169,6 +169,8 @@ export type CroncatQuery = { check_owner_of_nft: CheckOwnerOfNft; } | { check_proposal_status: CheckProposalStatus; +} | { + check_passed_proposals: CheckPassedProposals; } | { generic_query: GenericQuery; } | { @@ -347,6 +349,10 @@ export interface CheckProposalStatus { status: Status; [k: string]: unknown; } +export interface CheckPassedProposals { + dao_address: string; + [k: string]: unknown; +} export interface GenericQuery { contract_addr: string; msg: Binary; diff --git a/typescript/contracts/cw-rules-core/CwRulesCore.client.ts b/typescript/contracts/cw-rules-core/CwRulesCore.client.ts index 1f05237e..60598969 100644 --- a/typescript/contracts/cw-rules-core/CwRulesCore.client.ts +++ b/typescript/contracts/cw-rules-core/CwRulesCore.client.ts @@ -6,7 +6,7 @@ import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { StdFee } from "@cosmjs/amino"; -import { Binary, CheckOwnerOfNftResponse, CheckOwnerOfNft, CheckProposalStatusResponse, Status, CheckProposalStatus, CroncatQuery, Balance, Uint128, NativeBalance, Addr, ValueOrdering, ValueIndex, PathToValue, SmartQueries, HasBalanceGte, Coin, Cw20CoinVerified, GenericQuery, SmartQueryHead, SmartQuery, ExecuteMsg, GenericQueryResponse, GetBalanceResponse, GetCw20BalanceResponse, HasBalanceGteResponse, InstantiateMsg, QueryConstructResponse, QueryConstruct, QueryMsg, QueryMultiResponse, RuleResponse, SmartQueryResponse } from "./CwRulesCore.types"; +import { Binary, CheckOwnerOfNftResponse, CheckOwnerOfNft, CheckProposalStatusResponse, Status, CheckProposalStatus, CroncatQuery, Balance, Uint128, NativeBalance, Addr, ValueOrdering, ValueIndex, PathToValue, SmartQueries, HasBalanceGte, Coin, Cw20CoinVerified, CheckPassedProposals, GenericQuery, SmartQueryHead, SmartQuery, ExecuteMsg, GenericQueryResponse, GetBalanceResponse, GetCw20BalanceResponse, HasBalanceGteResponse, InstantiateMsg, QueryConstructResponse, QueryConstruct, QueryMsg, QueryMultiResponse, RuleResponse, SmartQueryResponse } from "./CwRulesCore.types"; export interface CwRulesCoreReadOnlyInterface { contractAddress: string; getBalance: ({ @@ -48,6 +48,11 @@ export interface CwRulesCoreReadOnlyInterface { proposalId: number; status: Status; }) => Promise; + checkPassedProposals: ({ + daoAddress + }: { + daoAddress: string; + }) => Promise; genericQuery: ({ contractAddr, msg, @@ -94,6 +99,7 @@ export class CwRulesCoreQueryClient implements CwRulesCoreReadOnlyInterface { this.hasBalanceGte = this.hasBalanceGte.bind(this); this.checkOwnerOfNft = this.checkOwnerOfNft.bind(this); this.checkProposalStatus = this.checkProposalStatus.bind(this); + this.checkPassedProposals = this.checkPassedProposals.bind(this); this.genericQuery = this.genericQuery.bind(this); this.queryConstruct = this.queryConstruct.bind(this); this.smartQuery = this.smartQuery.bind(this); @@ -175,6 +181,17 @@ export class CwRulesCoreQueryClient implements CwRulesCoreReadOnlyInterface { } }); }; + checkPassedProposals = async ({ + daoAddress + }: { + daoAddress: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + check_passed_proposals: { + dao_address: daoAddress + } + }); + }; genericQuery = async ({ contractAddr, msg, diff --git a/typescript/contracts/cw-rules-core/CwRulesCore.types.ts b/typescript/contracts/cw-rules-core/CwRulesCore.types.ts index 0a517add..7f0b1c48 100644 --- a/typescript/contracts/cw-rules-core/CwRulesCore.types.ts +++ b/typescript/contracts/cw-rules-core/CwRulesCore.types.ts @@ -40,6 +40,8 @@ export type CroncatQuery = { check_owner_of_nft: CheckOwnerOfNft; } | { check_proposal_status: CheckProposalStatus; +} | { + check_passed_proposals: CheckPassedProposals; } | { generic_query: GenericQuery; } | { @@ -76,6 +78,10 @@ export interface Cw20CoinVerified { amount: Uint128; [k: string]: unknown; } +export interface CheckPassedProposals { + dao_address: string; + [k: string]: unknown; +} export interface GenericQuery { contract_addr: string; msg: Binary; @@ -155,6 +161,8 @@ export type QueryMsg = { check_owner_of_nft: CheckOwnerOfNft; } | { check_proposal_status: CheckProposalStatus; +} | { + check_passed_proposals: CheckPassedProposals; } | { generic_query: GenericQuery; } | { From b0d6025b7cb348a70500725d951cf7772de3a07d Mon Sep 17 00:00:00 2001 From: Nino Lipartiia Date: Thu, 22 Dec 2022 19:02:02 +0200 Subject: [PATCH 4/5] clippy --- contracts/cw-rules/src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/cw-rules/src/types.rs b/contracts/cw-rules/src/types.rs index 583104ed..f16a7e17 100644 --- a/contracts/cw-rules/src/types.rs +++ b/contracts/cw-rules/src/types.rs @@ -27,7 +27,7 @@ pub mod dao { pub proposal: AnyChoiceProposal, } - #[derive(Serialize, Deserialize, Clone, PartialEq, JsonSchema, Debug)] + #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] pub struct ProposalListResponse { pub proposals: Vec, } From 9b20813c7c729c066b5cc41ff8fc438aaba27bab Mon Sep 17 00:00:00 2001 From: Nino Lipartiia Date: Thu, 22 Dec 2022 20:25:44 +0200 Subject: [PATCH 5/5] schemas and types --- checksum | 4 +- .../schema/get_state_response.json | 1772 ----------------- .../cw-rules-core/examples/rules_schema.rs | 10 +- .../schema/check_passed_proposals.json | 13 + .../check_passed_proposals_response.json | 23 + typescript/build/codegen.js | 13 +- .../cw-rules-core/CwRulesCore.client.js | 8 + .../cw-croncat-core/CwCroncatCore.client.ts | 6 +- .../cw-rules-core/CwRulesCore.client.ts | 2 +- .../cw-rules-core/CwRulesCore.types.ts | 13 +- 10 files changed, 67 insertions(+), 1797 deletions(-) delete mode 100644 packages/cw-croncat-core/schema/get_state_response.json create mode 100644 packages/cw-rules-core/schema/check_passed_proposals.json create mode 100644 packages/cw-rules-core/schema/check_passed_proposals_response.json diff --git a/checksum b/checksum index 2ec67374..2ef21e65 100644 --- a/checksum +++ b/checksum @@ -1,2 +1,2 @@ -fc76a0e370c9e947d6e33d018585137d566f32d1a1fb06b1b49e695e5984a57e cw_croncat.wasm -348ce203ce7a18c2e28f001139c1f7a215f7a569c735825dc819dc79692aaffb cw_rules.wasm +2d2b8d5bb188d7a29b24a00c5fcb87c1e2e4f7c53c0f4bf176e2dc2024bd2cc6 cw_croncat.wasm +307b8919d8fcae59dd7336319c6220fe5c477488b59bf043158fba67a292234d cw_rules.wasm diff --git a/packages/cw-croncat-core/schema/get_state_response.json b/packages/cw-croncat-core/schema/get_state_response.json deleted file mode 100644 index c6ca6cbc..00000000 --- a/packages/cw-croncat-core/schema/get_state_response.json +++ /dev/null @@ -1,1772 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "GetStateResponse", - "type": "object", - "required": [ - "agent_active_queue", - "agent_pending_queue", - "agents", - "balancer_mode", - "balances", - "block_slots", - "block_slots_queries", - "config", - "reply_index", - "task_total", - "tasks", - "tasks_with_queries", - "tasks_with_queries_total", - "time_slots", - "time_slots_queries" - ], - "properties": { - "agent_active_queue": { - "type": "array", - "items": { - "$ref": "#/definitions/Addr" - } - }, - "agent_nomination_begin_time": { - "anyOf": [ - { - "$ref": "#/definitions/Timestamp" - }, - { - "type": "null" - } - ] - }, - "agent_pending_queue": { - "type": "array", - "items": { - "$ref": "#/definitions/Addr" - } - }, - "agents": { - "type": "array", - "items": { - "$ref": "#/definitions/AgentResponse" - } - }, - "balancer_mode": { - "$ref": "#/definitions/RoundRobinBalancerModeResponse" - }, - "balances": { - "type": "array", - "items": { - "$ref": "#/definitions/BalancesResponse" - } - }, - "block_slots": { - "type": "array", - "items": { - "$ref": "#/definitions/SlotResponse" - } - }, - "block_slots_queries": { - "type": "array", - "items": { - "$ref": "#/definitions/SlotWithQueriesResponse" - } - }, - "config": { - "$ref": "#/definitions/GetConfigResponse" - }, - "reply_index": { - "$ref": "#/definitions/Uint64" - }, - "task_total": { - "$ref": "#/definitions/Uint64" - }, - "tasks": { - "type": "array", - "items": { - "$ref": "#/definitions/TaskResponse" - } - }, - "tasks_with_queries": { - "type": "array", - "items": { - "$ref": "#/definitions/TaskWithQueriesResponse" - } - }, - "tasks_with_queries_total": { - "$ref": "#/definitions/Uint64" - }, - "time_slots": { - "type": "array", - "items": { - "$ref": "#/definitions/SlotResponse" - } - }, - "time_slots_queries": { - "type": "array", - "items": { - "$ref": "#/definitions/SlotWithQueriesResponse" - } - } - }, - "definitions": { - "Action_for_Empty": { - "type": "object", - "required": [ - "msg" - ], - "properties": { - "gas_limit": { - "description": "The gas needed to safely process the execute msg", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "msg": { - "description": "Supported CosmosMsgs only!", - "allOf": [ - { - "$ref": "#/definitions/CosmosMsg_for_Empty" - } - ] - } - } - }, - "Addr": { - "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", - "type": "string" - }, - "AgentResponse": { - "type": "object", - "required": [ - "balance", - "last_executed_slot", - "payable_account_id", - "register_start", - "status", - "total_tasks_executed" - ], - "properties": { - "balance": { - "$ref": "#/definitions/GenericBalance" - }, - "last_executed_slot": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "payable_account_id": { - "$ref": "#/definitions/Addr" - }, - "register_start": { - "$ref": "#/definitions/Timestamp" - }, - "status": { - "$ref": "#/definitions/AgentStatus" - }, - "total_tasks_executed": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - }, - "AgentStatus": { - "type": "string", - "enum": [ - "Active", - "Pending", - "Nominated" - ] - }, - "Balance": { - "oneOf": [ - { - "type": "object", - "required": [ - "native" - ], - "properties": { - "native": { - "$ref": "#/definitions/NativeBalance" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "cw20" - ], - "properties": { - "cw20": { - "$ref": "#/definitions/Cw20CoinVerified" - } - }, - "additionalProperties": false - } - ] - }, - "BalancesResponse": { - "type": "object", - "required": [ - "address", - "balances" - ], - "properties": { - "address": { - "$ref": "#/definitions/Addr" - }, - "balances": { - "type": "array", - "items": { - "$ref": "#/definitions/Cw20CoinVerified" - } - } - } - }, - "BankMsg": { - "description": "The message types of the bank module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto", - "oneOf": [ - { - "description": "Sends native tokens from the contract to the given address.\n\nThis is translated to a [MsgSend](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/bank/v1beta1/tx.proto#L19-L28). `from_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "send" - ], - "properties": { - "send": { - "type": "object", - "required": [ - "amount", - "to_address" - ], - "properties": { - "amount": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "to_address": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This will burn the given coins from the contract's account. There is no Cosmos SDK message that performs this, but it can be done by calling the bank keeper. Important if a contract controls significant token supply that must be retired.", - "type": "object", - "required": [ - "burn" - ], - "properties": { - "burn": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - } - } - } - }, - "additionalProperties": false - } - ] - }, - "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", - "type": "string" - }, - "Boundary": { - "oneOf": [ - { - "type": "object", - "required": [ - "Height" - ], - "properties": { - "Height": { - "type": "object", - "properties": { - "end": { - "anyOf": [ - { - "$ref": "#/definitions/Uint64" - }, - { - "type": "null" - } - ] - }, - "start": { - "anyOf": [ - { - "$ref": "#/definitions/Uint64" - }, - { - "type": "null" - } - ] - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "Time" - ], - "properties": { - "Time": { - "type": "object", - "properties": { - "end": { - "anyOf": [ - { - "$ref": "#/definitions/Timestamp" - }, - { - "type": "null" - } - ] - }, - "start": { - "anyOf": [ - { - "$ref": "#/definitions/Timestamp" - }, - { - "type": "null" - } - ] - } - } - } - }, - "additionalProperties": false - } - ] - }, - "CheckOwnerOfNft": { - "type": "object", - "required": [ - "address", - "nft_address", - "token_id" - ], - "properties": { - "address": { - "type": "string" - }, - "nft_address": { - "type": "string" - }, - "token_id": { - "type": "string" - } - } - }, - "CheckPassedProposals": { - "type": "object", - "required": [ - "dao_address" - ], - "properties": { - "dao_address": { - "type": "string" - } - } - }, - "CheckProposalStatus": { - "type": "object", - "required": [ - "dao_address", - "proposal_id", - "status" - ], - "properties": { - "dao_address": { - "type": "string" - }, - "proposal_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "status": { - "$ref": "#/definitions/Status" - } - } - }, - "Coin": { - "type": "object", - "required": [ - "amount", - "denom" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - } - } - }, - "CosmosMsg_for_Empty": { - "oneOf": [ - { - "type": "object", - "required": [ - "bank" - ], - "properties": { - "bank": { - "$ref": "#/definitions/BankMsg" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "custom" - ], - "properties": { - "custom": { - "$ref": "#/definitions/Empty" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "staking" - ], - "properties": { - "staking": { - "$ref": "#/definitions/StakingMsg" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "distribution" - ], - "properties": { - "distribution": { - "$ref": "#/definitions/DistributionMsg" - } - }, - "additionalProperties": false - }, - { - "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", - "type": "object", - "required": [ - "stargate" - ], - "properties": { - "stargate": { - "type": "object", - "required": [ - "type_url", - "value" - ], - "properties": { - "type_url": { - "type": "string" - }, - "value": { - "$ref": "#/definitions/Binary" - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "ibc" - ], - "properties": { - "ibc": { - "$ref": "#/definitions/IbcMsg" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "wasm" - ], - "properties": { - "wasm": { - "$ref": "#/definitions/WasmMsg" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "gov" - ], - "properties": { - "gov": { - "$ref": "#/definitions/GovMsg" - } - }, - "additionalProperties": false - } - ] - }, - "CroncatQuery": { - "oneOf": [ - { - "type": "object", - "required": [ - "query" - ], - "properties": { - "query": { - "type": "object", - "required": [ - "contract_addr", - "msg" - ], - "properties": { - "contract_addr": { - "type": "string" - }, - "msg": { - "$ref": "#/definitions/Binary" - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "has_balance_gte" - ], - "properties": { - "has_balance_gte": { - "$ref": "#/definitions/HasBalanceGte" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "check_owner_of_nft" - ], - "properties": { - "check_owner_of_nft": { - "$ref": "#/definitions/CheckOwnerOfNft" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "check_proposal_status" - ], - "properties": { - "check_proposal_status": { - "$ref": "#/definitions/CheckProposalStatus" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "check_passed_proposals" - ], - "properties": { - "check_passed_proposals": { - "$ref": "#/definitions/CheckPassedProposals" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "generic_query" - ], - "properties": { - "generic_query": { - "$ref": "#/definitions/GenericQuery" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "smart_query" - ], - "properties": { - "smart_query": { - "$ref": "#/definitions/SmartQueryHead" - } - }, - "additionalProperties": false - } - ] - }, - "Cw20CoinVerified": { - "type": "object", - "required": [ - "address", - "amount" - ], - "properties": { - "address": { - "$ref": "#/definitions/Addr" - }, - "amount": { - "$ref": "#/definitions/Uint128" - } - } - }, - "DistributionMsg": { - "description": "The message types of the distribution module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto", - "oneOf": [ - { - "description": "This is translated to a [MsgSetWithdrawAddress](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L29-L37). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "set_withdraw_address" - ], - "properties": { - "set_withdraw_address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "description": "The `withdraw_address`", - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This is translated to a [[MsgWithdrawDelegatorReward](https://github.com/cosmos/cosmos-sdk/blob/v0.42.4/proto/cosmos/distribution/v1beta1/tx.proto#L42-L50). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "withdraw_delegator_reward" - ], - "properties": { - "withdraw_delegator_reward": { - "type": "object", - "required": [ - "validator" - ], - "properties": { - "validator": { - "description": "The `validator_address`", - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] - }, - "Empty": { - "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", - "type": "object" - }, - "GasFraction": { - "type": "object", - "required": [ - "denominator", - "numerator" - ], - "properties": { - "denominator": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "numerator": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - }, - "GenericBalance": { - "type": "object", - "required": [ - "cw20", - "native" - ], - "properties": { - "cw20": { - "type": "array", - "items": { - "$ref": "#/definitions/Cw20CoinVerified" - } - }, - "native": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - } - } - }, - "GenericQuery": { - "type": "object", - "required": [ - "contract_addr", - "msg", - "ordering", - "path_to_value", - "value" - ], - "properties": { - "contract_addr": { - "type": "string" - }, - "msg": { - "$ref": "#/definitions/Binary" - }, - "ordering": { - "$ref": "#/definitions/ValueOrdering" - }, - "path_to_value": { - "$ref": "#/definitions/PathToValue" - }, - "value": { - "$ref": "#/definitions/Binary" - } - } - }, - "GetConfigResponse": { - "type": "object", - "required": [ - "agent_active_indices", - "agent_fee", - "agent_nomination_duration", - "agents_eject_threshold", - "available_balance", - "cw20_whitelist", - "cw_rules_addr", - "gas_action_fee", - "gas_base_fee", - "gas_fraction", - "limit", - "min_tasks_per_agent", - "native_denom", - "owner_id", - "paused", - "proxy_callback_gas", - "slot_granularity_time", - "staked_balance" - ], - "properties": { - "agent_active_indices": { - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/SlotType" - }, - { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - }, - { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - ], - "maxItems": 3, - "minItems": 3 - } - }, - "agent_fee": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "agent_nomination_duration": { - "type": "integer", - "format": "uint16", - "minimum": 0.0 - }, - "agents_eject_threshold": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "available_balance": { - "$ref": "#/definitions/GenericBalance" - }, - "cw20_whitelist": { - "type": "array", - "items": { - "$ref": "#/definitions/Addr" - } - }, - "cw_rules_addr": { - "$ref": "#/definitions/Addr" - }, - "gas_action_fee": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "gas_base_fee": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "gas_fraction": { - "$ref": "#/definitions/GasFraction" - }, - "limit": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "min_tasks_per_agent": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "native_denom": { - "type": "string" - }, - "owner_id": { - "$ref": "#/definitions/Addr" - }, - "paused": { - "type": "boolean" - }, - "proxy_callback_gas": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - }, - "slot_granularity_time": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "staked_balance": { - "$ref": "#/definitions/GenericBalance" - } - } - }, - "GovMsg": { - "oneOf": [ - { - "description": "This maps directly to [MsgVote](https://github.com/cosmos/cosmos-sdk/blob/v0.42.5/proto/cosmos/gov/v1beta1/tx.proto#L46-L56) in the Cosmos SDK with voter set to the contract address.", - "type": "object", - "required": [ - "vote" - ], - "properties": { - "vote": { - "type": "object", - "required": [ - "proposal_id", - "vote" - ], - "properties": { - "proposal_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "vote": { - "$ref": "#/definitions/VoteOption" - } - } - } - }, - "additionalProperties": false - } - ] - }, - "HasBalanceGte": { - "type": "object", - "required": [ - "address", - "required_balance" - ], - "properties": { - "address": { - "type": "string" - }, - "required_balance": { - "$ref": "#/definitions/Balance" - } - } - }, - "IbcMsg": { - "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", - "oneOf": [ - { - "description": "Sends bank tokens owned by the contract to the given address on another chain. The channel must already be established between the ibctransfer module on this chain and a matching module on the remote chain. We cannot select the port_id, this is whatever the local chain has bound the ibctransfer module to.", - "type": "object", - "required": [ - "transfer" - ], - "properties": { - "transfer": { - "type": "object", - "required": [ - "amount", - "channel_id", - "timeout", - "to_address" - ], - "properties": { - "amount": { - "description": "packet data only supports one coin https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/applications/transfer/v1/transfer.proto#L11-L20", - "allOf": [ - { - "$ref": "#/definitions/Coin" - } - ] - }, - "channel_id": { - "description": "exisiting channel to send the tokens over", - "type": "string" - }, - "timeout": { - "description": "when packet times out, measured on remote chain", - "allOf": [ - { - "$ref": "#/definitions/IbcTimeout" - } - ] - }, - "to_address": { - "description": "address on the remote chain to receive these tokens", - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "Sends an IBC packet with given data over the existing channel. Data should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.", - "type": "object", - "required": [ - "send_packet" - ], - "properties": { - "send_packet": { - "type": "object", - "required": [ - "channel_id", - "data", - "timeout" - ], - "properties": { - "channel_id": { - "type": "string" - }, - "data": { - "$ref": "#/definitions/Binary" - }, - "timeout": { - "description": "when packet times out, measured on remote chain", - "allOf": [ - { - "$ref": "#/definitions/IbcTimeout" - } - ] - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", - "type": "object", - "required": [ - "close_channel" - ], - "properties": { - "close_channel": { - "type": "object", - "required": [ - "channel_id" - ], - "properties": { - "channel_id": { - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] - }, - "IbcTimeout": { - "description": "In IBC each package must set at least one type of timeout: the timestamp or the block height. Using this rather complex enum instead of two timeout fields we ensure that at least one timeout is set.", - "type": "object", - "properties": { - "block": { - "anyOf": [ - { - "$ref": "#/definitions/IbcTimeoutBlock" - }, - { - "type": "null" - } - ] - }, - "timestamp": { - "anyOf": [ - { - "$ref": "#/definitions/Timestamp" - }, - { - "type": "null" - } - ] - } - } - }, - "IbcTimeoutBlock": { - "description": "IBCTimeoutHeight Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients. Ordering is (revision_number, timeout_height)", - "type": "object", - "required": [ - "height", - "revision" - ], - "properties": { - "height": { - "description": "block height after which the packet times out. the height within the given revision", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "revision": { - "description": "the version that the client is currently on (eg. after reseting the chain this could increment 1 as height drops to 0)", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - }, - "Interval": { - "description": "Defines the spacing of execution NOTES: - Block Height Based: Once, Immediate, Block - Timestamp Based: Cron - No Epoch support directly, advised to use block heights instead", - "oneOf": [ - { - "description": "For when this is a non-recurring future scheduled TXN", - "type": "string", - "enum": [ - "Once" - ] - }, - { - "description": "The ugly batch schedule type, in case you need to exceed single TXN gas limits, within fewest block(s)", - "type": "string", - "enum": [ - "Immediate" - ] - }, - { - "description": "Allows timing based on block intervals rather than timestamps", - "type": "object", - "required": [ - "Block" - ], - "properties": { - "Block": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - }, - { - "description": "Crontab Spec String", - "type": "object", - "required": [ - "Cron" - ], - "properties": { - "Cron": { - "type": "string" - } - }, - "additionalProperties": false - } - ] - }, - "NativeBalance": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "PathToValue": { - "type": "array", - "items": { - "$ref": "#/definitions/ValueIndex" - } - }, - "RoundRobinBalancerModeResponse": { - "type": "string", - "enum": [ - "ActivationOrder", - "Equalizer" - ] - }, - "SlotResponse": { - "type": "object", - "required": [ - "slot", - "tasks" - ], - "properties": { - "slot": { - "$ref": "#/definitions/Uint64" - }, - "tasks": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8", - "minimum": 0.0 - } - } - } - } - }, - "SlotType": { - "type": "string", - "enum": [ - "Block", - "Cron" - ] - }, - "SlotWithQueriesResponse": { - "type": "object", - "required": [ - "slot", - "task_hash" - ], - "properties": { - "slot": { - "$ref": "#/definitions/Uint64" - }, - "task_hash": { - "type": "array", - "items": { - "type": "integer", - "format": "uint8", - "minimum": 0.0 - } - } - } - }, - "SmartQueries": { - "type": "array", - "items": { - "$ref": "#/definitions/SmartQuery" - } - }, - "SmartQuery": { - "type": "object", - "required": [ - "contract_addr", - "msg", - "path_to_msg_value", - "path_to_query_value" - ], - "properties": { - "contract_addr": { - "type": "string" - }, - "msg": { - "$ref": "#/definitions/Binary" - }, - "path_to_msg_value": { - "description": "Replace value inside this query", - "allOf": [ - { - "$ref": "#/definitions/PathToValue" - } - ] - }, - "path_to_query_value": { - "description": "Value passed to the next iteration", - "allOf": [ - { - "$ref": "#/definitions/PathToValue" - } - ] - } - } - }, - "SmartQueryHead": { - "type": "object", - "required": [ - "contract_addr", - "msg", - "ordering", - "path_to_query_value", - "queries", - "value" - ], - "properties": { - "contract_addr": { - "type": "string" - }, - "msg": { - "description": "First query without placeholder!", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "ordering": { - "$ref": "#/definitions/ValueOrdering" - }, - "path_to_query_value": { - "description": "Value from this message", - "allOf": [ - { - "$ref": "#/definitions/PathToValue" - } - ] - }, - "queries": { - "$ref": "#/definitions/SmartQueries" - }, - "value": { - "$ref": "#/definitions/Binary" - } - } - }, - "StakingMsg": { - "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", - "oneOf": [ - { - "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "delegate" - ], - "properties": { - "delegate": { - "type": "object", - "required": [ - "amount", - "validator" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Coin" - }, - "validator": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "undelegate" - ], - "properties": { - "undelegate": { - "type": "object", - "required": [ - "amount", - "validator" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Coin" - }, - "validator": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "redelegate" - ], - "properties": { - "redelegate": { - "type": "object", - "required": [ - "amount", - "dst_validator", - "src_validator" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Coin" - }, - "dst_validator": { - "type": "string" - }, - "src_validator": { - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] - }, - "Status": { - "oneOf": [ - { - "type": "string", - "enum": [ - "execution_failed" - ] - }, - { - "description": "The proposal is open for voting.", - "type": "string", - "enum": [ - "open" - ] - }, - { - "description": "The proposal has been rejected.", - "type": "string", - "enum": [ - "rejected" - ] - }, - { - "description": "The proposal has been passed but has not been executed.", - "type": "string", - "enum": [ - "passed" - ] - }, - { - "description": "The proposal has been passed and executed.", - "type": "string", - "enum": [ - "executed" - ] - }, - { - "description": "The proposal has failed or expired and has been closed. A proposal deposit refund has been issued if applicable.", - "type": "string", - "enum": [ - "closed" - ] - } - ] - }, - "TaskResponse": { - "type": "object", - "required": [ - "actions", - "amount_for_one_task_cw20", - "amount_for_one_task_native", - "interval", - "owner_id", - "stop_on_fail", - "task_hash", - "total_cw20_deposit", - "total_deposit" - ], - "properties": { - "actions": { - "type": "array", - "items": { - "$ref": "#/definitions/Action_for_Empty" - } - }, - "amount_for_one_task_cw20": { - "type": "array", - "items": { - "$ref": "#/definitions/Cw20CoinVerified" - } - }, - "amount_for_one_task_native": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "boundary": { - "anyOf": [ - { - "$ref": "#/definitions/Boundary" - }, - { - "type": "null" - } - ] - }, - "interval": { - "$ref": "#/definitions/Interval" - }, - "owner_id": { - "$ref": "#/definitions/Addr" - }, - "queries": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/CroncatQuery" - } - }, - "stop_on_fail": { - "type": "boolean" - }, - "task_hash": { - "type": "string" - }, - "total_cw20_deposit": { - "type": "array", - "items": { - "$ref": "#/definitions/Cw20CoinVerified" - } - }, - "total_deposit": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - } - } - }, - "TaskWithQueriesResponse": { - "type": "object", - "required": [ - "interval", - "task_hash" - ], - "properties": { - "boundary": { - "anyOf": [ - { - "$ref": "#/definitions/Boundary" - }, - { - "type": "null" - } - ] - }, - "interval": { - "$ref": "#/definitions/Interval" - }, - "queries": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/CroncatQuery" - } - }, - "task_hash": { - "type": "string" - } - } - }, - "Timestamp": { - "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", - "allOf": [ - { - "$ref": "#/definitions/Uint64" - } - ] - }, - "Uint128": { - "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", - "type": "string" - }, - "Uint64": { - "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", - "type": "string" - }, - "ValueIndex": { - "oneOf": [ - { - "type": "object", - "required": [ - "key" - ], - "properties": { - "key": { - "type": "string" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "index" - ], - "properties": { - "index": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - ] - }, - "ValueOrdering": { - "type": "string", - "enum": [ - "unit_above", - "unit_above_equal", - "unit_below", - "unit_below_equal", - "equal", - "not_equal" - ] - }, - "VoteOption": { - "type": "string", - "enum": [ - "yes", - "no", - "abstain", - "no_with_veto" - ] - }, - "WasmMsg": { - "description": "The message types of the wasm module.\n\nSee https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto", - "oneOf": [ - { - "description": "Dispatches a call to another contract at a known address (with known ABI).\n\nThis is translated to a [MsgExecuteContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L68-L78). `sender` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "execute" - ], - "properties": { - "execute": { - "type": "object", - "required": [ - "contract_addr", - "funds", - "msg" - ], - "properties": { - "contract_addr": { - "type": "string" - }, - "funds": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "msg": { - "description": "msg is the json-encoded ExecuteMsg struct (as raw Binary)", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - } - } - } - }, - "additionalProperties": false - }, - { - "description": "Instantiates a new contracts from previously uploaded Wasm code.\n\nThis is translated to a [MsgInstantiateContract](https://github.com/CosmWasm/wasmd/blob/v0.16.0-alpha1/x/wasm/internal/types/tx.proto#L47-L61). `sender` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "instantiate" - ], - "properties": { - "instantiate": { - "type": "object", - "required": [ - "code_id", - "funds", - "label", - "msg" - ], - "properties": { - "admin": { - "type": [ - "string", - "null" - ] - }, - "code_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "funds": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "label": { - "description": "A human-readbale label for the contract", - "type": "string" - }, - "msg": { - "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - } - } - } - }, - "additionalProperties": false - }, - { - "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "migrate" - ], - "properties": { - "migrate": { - "type": "object", - "required": [ - "contract_addr", - "msg", - "new_code_id" - ], - "properties": { - "contract_addr": { - "type": "string" - }, - "msg": { - "description": "msg is the json-encoded MigrateMsg struct that will be passed to the new code", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "new_code_id": { - "description": "the code_id of the new logic to place in the given contract", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false - }, - { - "description": "Sets a new admin (for migrate) on the given contract. Fails if this contract is not currently admin of the target contract.", - "type": "object", - "required": [ - "update_admin" - ], - "properties": { - "update_admin": { - "type": "object", - "required": [ - "admin", - "contract_addr" - ], - "properties": { - "admin": { - "type": "string" - }, - "contract_addr": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "Clears the admin on the given contract, so no more migration possible. Fails if this contract is not currently admin of the target contract.", - "type": "object", - "required": [ - "clear_admin" - ], - "properties": { - "clear_admin": { - "type": "object", - "required": [ - "contract_addr" - ], - "properties": { - "contract_addr": { - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] - } - } -} diff --git a/packages/cw-rules-core/examples/rules_schema.rs b/packages/cw-rules-core/examples/rules_schema.rs index 65fcba7e..a948dc91 100644 --- a/packages/cw-rules-core/examples/rules_schema.rs +++ b/packages/cw-rules-core/examples/rules_schema.rs @@ -6,7 +6,9 @@ use cw_rules_core::{ msg::{ ExecuteMsg, InstantiateMsg, QueryConstruct, QueryMsg, QueryMultiResponse, QueryResponse, }, - types::{CheckOwnerOfNft, CheckProposalStatus, CroncatQuery, HasBalanceGte}, + types::{ + CheckOwnerOfNft, CheckPassedProposals, CheckProposalStatus, CroncatQuery, HasBalanceGte, + }, }; fn main() { @@ -26,6 +28,7 @@ fn main() { export_schema(&schema_for!(HasBalanceGte), &out_dir); export_schema(&schema_for!(CheckOwnerOfNft), &out_dir); export_schema(&schema_for!(CheckProposalStatus), &out_dir); + export_schema(&schema_for!(CheckPassedProposals), &out_dir); export_schema_with_title(&schema_for!(QueryResponse), &out_dir, "RuleResponse"); export_schema_with_title( @@ -55,6 +58,11 @@ fn main() { &out_dir, "CheckProposalStatusResponse", ); + export_schema_with_title( + &schema_for!(QueryResponse), + &out_dir, + "CheckPassedProposalsResponse", + ); export_schema_with_title( &schema_for!(QueryResponse), &out_dir, diff --git a/packages/cw-rules-core/schema/check_passed_proposals.json b/packages/cw-rules-core/schema/check_passed_proposals.json new file mode 100644 index 00000000..388ce2d2 --- /dev/null +++ b/packages/cw-rules-core/schema/check_passed_proposals.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CheckPassedProposals", + "type": "object", + "required": [ + "dao_address" + ], + "properties": { + "dao_address": { + "type": "string" + } + } +} diff --git a/packages/cw-rules-core/schema/check_passed_proposals_response.json b/packages/cw-rules-core/schema/check_passed_proposals_response.json new file mode 100644 index 00000000..3a4edb68 --- /dev/null +++ b/packages/cw-rules-core/schema/check_passed_proposals_response.json @@ -0,0 +1,23 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CheckPassedProposalsResponse", + "type": "object", + "required": [ + "data", + "result" + ], + "properties": { + "data": { + "$ref": "#/definitions/Binary" + }, + "result": { + "type": "boolean" + } + }, + "definitions": { + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + } + } +} diff --git a/typescript/build/codegen.js b/typescript/build/codegen.js index 783655d9..2e8fbe3c 100644 --- a/typescript/build/codegen.js +++ b/typescript/build/codegen.js @@ -31,18 +31,6 @@ const DEFAULT_CONFIG = { outputName: OutputType.contracts, outputDir: CONTRACTS_OUTPUT_DIR, }, - { - name: OutputType.contracts, - paths: [`../contracts/${OutputType.croncat}`], - outputName: OutputType.contracts, - outputDir: CONTRACTS_OUTPUT_DIR, - }, - { - name: OutputType.contracts, - paths: [`../contracts/${OutputType.rules}`], - outputName: OutputType.contracts, - outputDir: CONTRACTS_OUTPUT_DIR, - }, { name: OutputType.packages, paths: [`../${OutputType.packages}`], @@ -109,6 +97,7 @@ function main() { const { name, paths, outputName, outputDir } = root; for (const path of paths) { const schemaDirectories = yield getSchemaDirectories(path); + console.log(schemaDirectories); for (const [directory, contractName] of schemaDirectories) { compilationSpecs.push({ contractName: contractName, diff --git a/typescript/build/contracts/cw-rules-core/CwRulesCore.client.js b/typescript/build/contracts/cw-rules-core/CwRulesCore.client.js index e82a0128..cd7b4ac0 100644 --- a/typescript/build/contracts/cw-rules-core/CwRulesCore.client.js +++ b/typescript/build/contracts/cw-rules-core/CwRulesCore.client.js @@ -59,6 +59,13 @@ class CwRulesCoreQueryClient { } }); }); + this.checkPassedProposals = ({ daoAddress }) => __awaiter(this, void 0, void 0, function* () { + return this.client.queryContractSmart(this.contractAddress, { + check_passed_proposals: { + dao_address: daoAddress + } + }); + }); this.genericQuery = ({ contractAddr, msg, ordering, pathToValue, value }) => __awaiter(this, void 0, void 0, function* () { return this.client.queryContractSmart(this.contractAddress, { generic_query: { @@ -96,6 +103,7 @@ class CwRulesCoreQueryClient { this.hasBalanceGte = this.hasBalanceGte.bind(this); this.checkOwnerOfNft = this.checkOwnerOfNft.bind(this); this.checkProposalStatus = this.checkProposalStatus.bind(this); + this.checkPassedProposals = this.checkPassedProposals.bind(this); this.genericQuery = this.genericQuery.bind(this); this.queryConstruct = this.queryConstruct.bind(this); this.smartQuery = this.smartQuery.bind(this); diff --git a/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts b/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts index 2956f60d..c0b4af52 100644 --- a/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts +++ b/typescript/contracts/cw-croncat-core/CwCroncatCore.client.ts @@ -6,11 +6,7 @@ import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { StdFee } from "@cosmjs/amino"; -<<<<<<< HEAD -import { Addr, Uint128, Timestamp, Uint64, SlotType, AgentStatus, CosmosMsgForEmpty, BankMsg, StakingMsg, DistributionMsg, Binary, IbcMsg, WasmMsg, GovMsg, VoteOption, Boundary, Interval, CroncatQuery, Balance, NativeBalance, Status, ValueOrdering, ValueIndex, PathToValue, SmartQueries, Croncat, Agent, GenericBalance, Cw20CoinVerified, Coin, GetBalancesResponse, GetConfigResponse, GasFraction, GetAgentIdsResponse, AgentResponse, AgentTaskResponse, GetSlotHashesResponse, GetSlotIdsResponse, TaskResponse, ActionForEmpty, Empty, IbcTimeout, IbcTimeoutBlock, HasBalanceGte, CheckOwnerOfNft, CheckProposalStatus, CheckPassedProposals, GenericQuery, SmartQueryHead, SmartQuery, GetWalletBalancesResponse, Task, BoundaryValidated, Transform, TaskRequest, Cw20Coin, ExecuteMsg, Cw20ReceiveMsg, GetAgentResponse, GetAgentTasksResponse, RoundRobinBalancerModeResponse, GetStateResponse, BalancesResponse, SlotResponse, SlotWithQueriesResponse, TaskWithQueriesResponse, GetTaskHashResponse, GetTaskResponse, GetTasksByOwnerResponse, GetTasksResponse, GetTasksWithQueriesResponse, InstantiateMsg, QueryMsg, ValidateIntervalResponse } from "./CwCroncatCore.types"; -======= -import { Addr, Uint128, Timestamp, Uint64, SlotType, AgentStatus, CosmosMsgForEmpty, BankMsg, StakingMsg, DistributionMsg, Binary, IbcMsg, WasmMsg, GovMsg, VoteOption, Boundary, Interval, CroncatQuery, Balance, NativeBalance, Status, ValueOrdering, ValueIndex, PathToValue, SmartQueries, Croncat, Agent, GenericBalance, Cw20CoinVerified, Coin, GetBalancesResponse, GetConfigResponse, GasPrice, GetAgentIdsResponse, AgentResponse, AgentTaskResponse, GetSlotHashesResponse, GetSlotIdsResponse, TaskResponse, ActionForEmpty, Empty, IbcTimeout, IbcTimeoutBlock, HasBalanceGte, CheckOwnerOfNft, CheckProposalStatus, GenericQuery, SmartQueryHead, SmartQuery, GetWalletBalancesResponse, Task, BoundaryValidated, Transform, TaskRequest, Cw20Coin, ExecuteMsg, Cw20ReceiveMsg, GetAgentResponse, GetAgentTasksResponse, GetTaskHashResponse, GetTaskResponse, GetTasksByOwnerResponse, GetTasksResponse, GetTasksWithQueriesResponse, TaskWithQueriesResponse, InstantiateMsg, QueryMsg, ValidateIntervalResponse } from "./CwCroncatCore.types"; ->>>>>>> main +import { Addr, Uint128, Timestamp, Uint64, SlotType, AgentStatus, CosmosMsgForEmpty, BankMsg, StakingMsg, DistributionMsg, Binary, IbcMsg, WasmMsg, GovMsg, VoteOption, Boundary, Interval, CroncatQuery, Balance, NativeBalance, Status, ValueOrdering, ValueIndex, PathToValue, SmartQueries, Croncat, Agent, GenericBalance, Cw20CoinVerified, Coin, GetBalancesResponse, GetConfigResponse, GasPrice, GetAgentIdsResponse, AgentResponse, AgentTaskResponse, GetSlotHashesResponse, GetSlotIdsResponse, TaskResponse, ActionForEmpty, Empty, IbcTimeout, IbcTimeoutBlock, HasBalanceGte, CheckOwnerOfNft, CheckProposalStatus, CheckPassedProposals, GenericQuery, SmartQueryHead, SmartQuery, GetWalletBalancesResponse, Task, BoundaryValidated, Transform, TaskRequest, Cw20Coin, ExecuteMsg, Cw20ReceiveMsg, GetAgentResponse, GetAgentTasksResponse, GetTaskHashResponse, GetTaskResponse, GetTasksByOwnerResponse, GetTasksResponse, GetTasksWithQueriesResponse, TaskWithQueriesResponse, InstantiateMsg, QueryMsg, ValidateIntervalResponse } from "./CwCroncatCore.types"; export interface CwCroncatCoreReadOnlyInterface { contractAddress: string; getConfig: () => Promise; diff --git a/typescript/contracts/cw-rules-core/CwRulesCore.client.ts b/typescript/contracts/cw-rules-core/CwRulesCore.client.ts index 60598969..ffffc0bd 100644 --- a/typescript/contracts/cw-rules-core/CwRulesCore.client.ts +++ b/typescript/contracts/cw-rules-core/CwRulesCore.client.ts @@ -6,7 +6,7 @@ import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { StdFee } from "@cosmjs/amino"; -import { Binary, CheckOwnerOfNftResponse, CheckOwnerOfNft, CheckProposalStatusResponse, Status, CheckProposalStatus, CroncatQuery, Balance, Uint128, NativeBalance, Addr, ValueOrdering, ValueIndex, PathToValue, SmartQueries, HasBalanceGte, Coin, Cw20CoinVerified, CheckPassedProposals, GenericQuery, SmartQueryHead, SmartQuery, ExecuteMsg, GenericQueryResponse, GetBalanceResponse, GetCw20BalanceResponse, HasBalanceGteResponse, InstantiateMsg, QueryConstructResponse, QueryConstruct, QueryMsg, QueryMultiResponse, RuleResponse, SmartQueryResponse } from "./CwRulesCore.types"; +import { Binary, CheckOwnerOfNftResponse, CheckOwnerOfNft, CheckPassedProposalsResponse, CheckPassedProposals, CheckProposalStatusResponse, Status, CheckProposalStatus, CroncatQuery, Balance, Uint128, NativeBalance, Addr, ValueOrdering, ValueIndex, PathToValue, SmartQueries, HasBalanceGte, Coin, Cw20CoinVerified, GenericQuery, SmartQueryHead, SmartQuery, ExecuteMsg, GenericQueryResponse, GetBalanceResponse, GetCw20BalanceResponse, HasBalanceGteResponse, InstantiateMsg, QueryConstructResponse, QueryConstruct, QueryMsg, QueryMultiResponse, RuleResponse, SmartQueryResponse } from "./CwRulesCore.types"; export interface CwRulesCoreReadOnlyInterface { contractAddress: string; getBalance: ({ diff --git a/typescript/contracts/cw-rules-core/CwRulesCore.types.ts b/typescript/contracts/cw-rules-core/CwRulesCore.types.ts index 7f0b1c48..03b05442 100644 --- a/typescript/contracts/cw-rules-core/CwRulesCore.types.ts +++ b/typescript/contracts/cw-rules-core/CwRulesCore.types.ts @@ -16,6 +16,15 @@ export interface CheckOwnerOfNft { token_id: string; [k: string]: unknown; } +export interface CheckPassedProposalsResponse { + data: Binary; + result: boolean; + [k: string]: unknown; +} +export interface CheckPassedProposals { + dao_address: string; + [k: string]: unknown; +} export interface CheckProposalStatusResponse { data: Binary; result: boolean; @@ -78,10 +87,6 @@ export interface Cw20CoinVerified { amount: Uint128; [k: string]: unknown; } -export interface CheckPassedProposals { - dao_address: string; - [k: string]: unknown; -} export interface GenericQuery { contract_addr: string; msg: Binary;