From 339529f59018bf9e92b0a35470e26260541b56a6 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Mon, 21 Aug 2023 05:45:25 -0700 Subject: [PATCH 1/5] modify chainlink contracts --- contracts/access-controller/Cargo.toml | 3 +- .../access-controller/examples/schema.rs | 11 +- .../schema/access-controller.json | 137 ++ .../{execute_msg.json => raw/execute.json} | 0 .../instantiate.json} | 0 .../schema/{query_msg.json => raw/query.json} | 22 +- .../schema/raw/response_to_has_access.json | 5 + .../schema/raw/response_to_owner.json | 6 + contracts/access-controller/src/contract.rs | 2 +- contracts/access-controller/src/msg.rs | 10 +- .../deviation-flagging-validator/Cargo.toml | 3 +- .../examples/schema.rs | 34 +- .../main/deviation-flagging-validator.json | 241 ++++ .../schema/{ => other}/state.json | 0 .../{execute_msg.json => raw/execute.json} | 0 .../instantiate.json} | 0 .../schema/{query_msg.json => raw/query.json} | 28 +- .../raw/response_to_flagging_threshold.json | 15 + .../schema/raw/response_to_is_valid.json | 5 + .../schema/raw/response_to_owner.json | 6 + .../src/contract.rs | 4 +- .../deviation-flagging-validator/src/msg.rs | 16 +- contracts/flags/Cargo.toml | 2 +- contracts/flags/examples/schema.rs | 11 +- contracts/flags/schema/flags.json | 245 ++++ .../{execute_msg.json => raw/execute.json} | 0 .../instantiate.json} | 0 .../schema/{query_msg.json => raw/query.json} | 41 +- .../flags/schema/raw/response_to_flag.json | 5 + .../flags/schema/raw/response_to_flags.json | 8 + .../flags/schema/raw/response_to_owner.json | 6 + ...response_to_raising_access_controller.json | 6 + contracts/flags/src/contract.rs | 4 +- contracts/flags/src/msg.rs | 24 +- contracts/ocr2/Cargo.toml | 2 +- contracts/ocr2/examples/schema.rs | 52 +- contracts/ocr2/schema/main/ocr2.json | 1220 +++++++++++++++++ .../ocr2/schema/{ => other}/billing.json | 0 contracts/ocr2/schema/{ => other}/config.json | 0 .../latest_config_details_response.json | 0 .../latest_transmission_details_response.json | 0 .../link_available_for_payment_response.json | 0 .../ocr2/schema/{ => other}/proposal.json | 0 .../ocr2/schema/{ => other}/transmitter.json | 0 .../{ => other}/transmitters_response.json | 0 .../ocr2/schema/{ => other}/validator.json | 0 contracts/ocr2/schema/query_msg.json | 113 -- .../{execute_msg.json => raw/execute.json} | 0 .../instantiate.json} | 0 contracts/ocr2/schema/raw/query.json | 262 ++++ .../ocr2/schema/raw/response_to_billing.json | 61 + ...response_to_billing_access_controller.json | 6 + .../ocr2/schema/raw/response_to_decimals.json | 7 + .../schema/raw/response_to_description.json | 5 + .../response_to_latest_config_details.json | 32 + ...nse_to_latest_config_digest_and_epoch.json | 30 + .../raw/response_to_latest_round_data.json | 31 + ...sponse_to_latest_transmission_details.json | 42 + ...esponse_to_link_available_for_payment.json | 13 + .../schema/raw/response_to_link_token.json | 6 + .../response_to_oracle_observation_count.json | 7 + .../schema/raw/response_to_owed_payment.json | 6 + .../ocr2/schema/raw/response_to_owner.json | 6 + .../ocr2/schema/raw/response_to_proposal.json | 63 + ...sponse_to_requester_access_controller.json | 6 + .../schema/raw/response_to_round_data.json | 31 + .../schema/raw/response_to_transmitters.json | 22 + .../ocr2/schema/raw/response_to_version.json | 5 + contracts/ocr2/src/contract.rs | 28 +- contracts/ocr2/src/msg.rs | 58 +- contracts/proxy-ocr2/Cargo.toml | 2 +- contracts/proxy-ocr2/examples/schema.rs | 11 +- contracts/proxy-ocr2/schema/proxy-ocr2.json | 449 ++++++ contracts/proxy-ocr2/schema/query_msg.json | 86 -- .../{execute_msg.json => raw/execute.json} | 0 .../instantiate.json} | 0 contracts/proxy-ocr2/schema/raw/query.json | 180 +++ .../schema/raw/response_to_aggregator.json | 6 + .../schema/raw/response_to_decimals.json | 7 + .../schema/raw/response_to_description.json | 5 + .../raw/response_to_latest_round_data.json | 31 + .../schema/raw/response_to_owner.json | 6 + .../raw/response_to_phase_aggregators.json | 6 + .../schema/raw/response_to_phase_id.json | 7 + .../raw/response_to_proposed_aggregator.json | 6 + ...esponse_to_proposed_latest_round_data.json | 31 + .../raw/response_to_proposed_round_data.json | 31 + .../schema/raw/response_to_round_data.json | 31 + .../schema/raw/response_to_version.json | 5 + contracts/proxy-ocr2/src/lib.rs | 74 +- 90 files changed, 3627 insertions(+), 361 deletions(-) create mode 100644 contracts/access-controller/schema/access-controller.json rename contracts/access-controller/schema/{execute_msg.json => raw/execute.json} (100%) rename contracts/access-controller/schema/{instantiate_msg.json => raw/instantiate.json} (100%) rename contracts/access-controller/schema/{query_msg.json => raw/query.json} (64%) create mode 100644 contracts/access-controller/schema/raw/response_to_has_access.json create mode 100644 contracts/access-controller/schema/raw/response_to_owner.json create mode 100644 contracts/deviation-flagging-validator/schema/main/deviation-flagging-validator.json rename contracts/deviation-flagging-validator/schema/{ => other}/state.json (100%) rename contracts/deviation-flagging-validator/schema/{execute_msg.json => raw/execute.json} (100%) rename contracts/deviation-flagging-validator/schema/{instantiate_msg.json => raw/instantiate.json} (100%) rename contracts/deviation-flagging-validator/schema/{query_msg.json => raw/query.json} (71%) create mode 100644 contracts/deviation-flagging-validator/schema/raw/response_to_flagging_threshold.json create mode 100644 contracts/deviation-flagging-validator/schema/raw/response_to_is_valid.json create mode 100644 contracts/deviation-flagging-validator/schema/raw/response_to_owner.json create mode 100644 contracts/flags/schema/flags.json rename contracts/flags/schema/{execute_msg.json => raw/execute.json} (100%) rename contracts/flags/schema/{instantiate_msg.json => raw/instantiate.json} (100%) rename contracts/flags/schema/{query_msg.json => raw/query.json} (64%) create mode 100644 contracts/flags/schema/raw/response_to_flag.json create mode 100644 contracts/flags/schema/raw/response_to_flags.json create mode 100644 contracts/flags/schema/raw/response_to_owner.json create mode 100644 contracts/flags/schema/raw/response_to_raising_access_controller.json create mode 100644 contracts/ocr2/schema/main/ocr2.json rename contracts/ocr2/schema/{ => other}/billing.json (100%) rename contracts/ocr2/schema/{ => other}/config.json (100%) rename contracts/ocr2/schema/{ => other}/latest_config_details_response.json (100%) rename contracts/ocr2/schema/{ => other}/latest_transmission_details_response.json (100%) rename contracts/ocr2/schema/{ => other}/link_available_for_payment_response.json (100%) rename contracts/ocr2/schema/{ => other}/proposal.json (100%) rename contracts/ocr2/schema/{ => other}/transmitter.json (100%) rename contracts/ocr2/schema/{ => other}/transmitters_response.json (100%) rename contracts/ocr2/schema/{ => other}/validator.json (100%) delete mode 100644 contracts/ocr2/schema/query_msg.json rename contracts/ocr2/schema/{execute_msg.json => raw/execute.json} (100%) rename contracts/ocr2/schema/{instantiate_msg.json => raw/instantiate.json} (100%) create mode 100644 contracts/ocr2/schema/raw/query.json create mode 100644 contracts/ocr2/schema/raw/response_to_billing.json create mode 100644 contracts/ocr2/schema/raw/response_to_billing_access_controller.json create mode 100644 contracts/ocr2/schema/raw/response_to_decimals.json create mode 100644 contracts/ocr2/schema/raw/response_to_description.json create mode 100644 contracts/ocr2/schema/raw/response_to_latest_config_details.json create mode 100644 contracts/ocr2/schema/raw/response_to_latest_config_digest_and_epoch.json create mode 100644 contracts/ocr2/schema/raw/response_to_latest_round_data.json create mode 100644 contracts/ocr2/schema/raw/response_to_latest_transmission_details.json create mode 100644 contracts/ocr2/schema/raw/response_to_link_available_for_payment.json create mode 100644 contracts/ocr2/schema/raw/response_to_link_token.json create mode 100644 contracts/ocr2/schema/raw/response_to_oracle_observation_count.json create mode 100644 contracts/ocr2/schema/raw/response_to_owed_payment.json create mode 100644 contracts/ocr2/schema/raw/response_to_owner.json create mode 100644 contracts/ocr2/schema/raw/response_to_proposal.json create mode 100644 contracts/ocr2/schema/raw/response_to_requester_access_controller.json create mode 100644 contracts/ocr2/schema/raw/response_to_round_data.json create mode 100644 contracts/ocr2/schema/raw/response_to_transmitters.json create mode 100644 contracts/ocr2/schema/raw/response_to_version.json create mode 100644 contracts/proxy-ocr2/schema/proxy-ocr2.json delete mode 100644 contracts/proxy-ocr2/schema/query_msg.json rename contracts/proxy-ocr2/schema/{execute_msg.json => raw/execute.json} (100%) rename contracts/proxy-ocr2/schema/{instantiate_msg.json => raw/instantiate.json} (100%) create mode 100644 contracts/proxy-ocr2/schema/raw/query.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_aggregator.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_decimals.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_description.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_latest_round_data.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_owner.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_phase_aggregators.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_phase_id.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_proposed_aggregator.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_proposed_latest_round_data.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_proposed_round_data.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_round_data.json create mode 100644 contracts/proxy-ocr2/schema/raw/response_to_version.json diff --git a/contracts/access-controller/Cargo.toml b/contracts/access-controller/Cargo.toml index 8daf6240b..92b9b86b1 100644 --- a/contracts/access-controller/Cargo.toml +++ b/contracts/access-controller/Cargo.toml @@ -22,6 +22,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] +cosmwasm-schema = { version = "1.1.5" } cosmwasm-std = { version = "1.1.5" } cosmwasm-storage = { version = "1.1.5" } cw-storage-plus = "0.16.0" @@ -32,4 +33,4 @@ thiserror = { version = "1.0.26" } owned = { version = "1.0", path = "../../crates/owned" } [dev-dependencies] -cosmwasm-schema = { version = "1.1.5" } + diff --git a/contracts/access-controller/examples/schema.rs b/contracts/access-controller/examples/schema.rs index a6a54225f..c81e60e5a 100644 --- a/contracts/access-controller/examples/schema.rs +++ b/contracts/access-controller/examples/schema.rs @@ -1,7 +1,7 @@ use std::env::current_dir; use std::fs::create_dir_all; -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; +use cosmwasm_schema::write_api; use access_controller::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; @@ -9,9 +9,10 @@ fn main() { let mut out_dir = current_dir().unwrap(); out_dir.push("schema"); create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); + write_api! { + instantiate: InstantiateMsg, + execute: ExecuteMsg, + query: QueryMsg, + } } diff --git a/contracts/access-controller/schema/access-controller.json b/contracts/access-controller/schema/access-controller.json new file mode 100644 index 000000000..e8d8f9b95 --- /dev/null +++ b/contracts/access-controller/schema/access-controller.json @@ -0,0 +1,137 @@ +{ + "contract_name": "access-controller", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object" + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "string", + "enum": [ + "accept_ownership" + ] + }, + { + "type": "object", + "required": [ + "add_access" + ], + "properties": { + "add_access": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "remove_access" + ], + "properties": { + "remove_access": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transfer_ownership" + ], + "properties": { + "transfer_ownership": { + "type": "object", + "required": [ + "to" + ], + "properties": { + "to": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "has_access" + ], + "properties": { + "has_access": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "has_access": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Boolean", + "type": "boolean" + }, + "owner": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + } + } +} diff --git a/contracts/access-controller/schema/execute_msg.json b/contracts/access-controller/schema/raw/execute.json similarity index 100% rename from contracts/access-controller/schema/execute_msg.json rename to contracts/access-controller/schema/raw/execute.json diff --git a/contracts/access-controller/schema/instantiate_msg.json b/contracts/access-controller/schema/raw/instantiate.json similarity index 100% rename from contracts/access-controller/schema/instantiate_msg.json rename to contracts/access-controller/schema/raw/instantiate.json diff --git a/contracts/access-controller/schema/query_msg.json b/contracts/access-controller/schema/raw/query.json similarity index 64% rename from contracts/access-controller/schema/query_msg.json rename to contracts/access-controller/schema/raw/query.json index 396837324..e8c6aef81 100644 --- a/contracts/access-controller/schema/query_msg.json +++ b/contracts/access-controller/schema/raw/query.json @@ -2,12 +2,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "QueryMsg", "oneOf": [ - { - "type": "string", - "enum": [ - "owner" - ] - }, { "type": "object", "required": [ @@ -23,7 +17,21 @@ "address": { "type": "string" } - } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "object", + "additionalProperties": false } }, "additionalProperties": false diff --git a/contracts/access-controller/schema/raw/response_to_has_access.json b/contracts/access-controller/schema/raw/response_to_has_access.json new file mode 100644 index 000000000..a7fe2bfe9 --- /dev/null +++ b/contracts/access-controller/schema/raw/response_to_has_access.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Boolean", + "type": "boolean" +} diff --git a/contracts/access-controller/schema/raw/response_to_owner.json b/contracts/access-controller/schema/raw/response_to_owner.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/access-controller/schema/raw/response_to_owner.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/access-controller/src/contract.rs b/contracts/access-controller/src/contract.rs index bef4412d1..12b55917a 100644 --- a/contracts/access-controller/src/contract.rs +++ b/contracts/access-controller/src/contract.rs @@ -48,7 +48,7 @@ pub fn execute( pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg { QueryMsg::HasAccess { address } => to_binary(&query_has_access(deps, address)?), - QueryMsg::Owner => Ok(to_binary(&OWNER.query_owner(deps)?)?), + QueryMsg::Owner {} => Ok(to_binary(&OWNER.query_owner(deps)?)?), } } diff --git a/contracts/access-controller/src/msg.rs b/contracts/access-controller/src/msg.rs index b20633d7b..4b47eff58 100644 --- a/contracts/access-controller/src/msg.rs +++ b/contracts/access-controller/src/msg.rs @@ -1,3 +1,5 @@ +use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_std::Addr; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -14,9 +16,11 @@ pub enum ExecuteMsg { AcceptOwnership, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[derive(QueryResponses, Eq)] pub enum QueryMsg { + #[returns(bool)] HasAccess { address: String }, - Owner, + #[returns(Addr)] + Owner {}, } diff --git a/contracts/deviation-flagging-validator/Cargo.toml b/contracts/deviation-flagging-validator/Cargo.toml index 6cfd9a050..dac5f1f29 100644 --- a/contracts/deviation-flagging-validator/Cargo.toml +++ b/contracts/deviation-flagging-validator/Cargo.toml @@ -24,7 +24,8 @@ thiserror = { version = "1.0.24" } cw-storage-plus = "0.16.0" owned = { path = "../../crates/owned" } flags = { path = "../flags", default-features = false, features = ["library"] } +cosmwasm-schema = { version = "1.1.5" } [dev-dependencies] -cosmwasm-schema = { version = "1.1.5" } + diff --git a/contracts/deviation-flagging-validator/examples/schema.rs b/contracts/deviation-flagging-validator/examples/schema.rs index 04cf114c7..f7968d663 100644 --- a/contracts/deviation-flagging-validator/examples/schema.rs +++ b/contracts/deviation-flagging-validator/examples/schema.rs @@ -1,19 +1,39 @@ use std::env::current_dir; -use std::fs::create_dir_all; +use std::fs::{create_dir_all, remove_dir_all, rename}; -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; +use cosmwasm_schema::{export_schema, remove_schemas, schema_for, write_api}; use deviation_flagging_validator::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; use deviation_flagging_validator::state::State; fn main() { + // clean directory let mut out_dir = current_dir().unwrap(); out_dir.push("schema"); + remove_dir_all(&out_dir).unwrap(); create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); - export_schema(&schema_for!(State), &out_dir); + write_api! { + instantiate: InstantiateMsg, + execute: ExecuteMsg, + query: QueryMsg, + } + + // put main schema under main folder for codegen.js (else it will error) + let mut main_dir = out_dir.clone(); + main_dir.push("main"); + create_dir_all(&main_dir).unwrap(); + + let mut main_file = out_dir.clone(); + main_file.push("deviation-flagging-validator.json"); + + let mut new_location = main_dir.clone(); + new_location.push("deviation-flagging-validator.json"); + rename(&main_file, &new_location).unwrap(); + + // put other hand-exported schemas in seperate folder + let mut other_dir = out_dir.clone(); + other_dir.push("other"); + create_dir_all(&other_dir).unwrap(); + export_schema(&schema_for!(State), &other_dir); } diff --git a/contracts/deviation-flagging-validator/schema/main/deviation-flagging-validator.json b/contracts/deviation-flagging-validator/schema/main/deviation-flagging-validator.json new file mode 100644 index 000000000..041198a67 --- /dev/null +++ b/contracts/deviation-flagging-validator/schema/main/deviation-flagging-validator.json @@ -0,0 +1,241 @@ +{ + "contract_name": "deviation-flagging-validator", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "flagging_threshold", + "flags" + ], + "properties": { + "flagging_threshold": { + "description": "The threshold that will trigger a flag to be raised Setting the value of 100,000 is equivalent to tolerating a 100% change compared to the previous price", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "flags": { + "description": "The address of the flags contract", + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Initiate contract ownership transfer to another address. Can be used only by owner", + "type": "object", + "required": [ + "transfer_ownership" + ], + "properties": { + "transfer_ownership": { + "type": "object", + "required": [ + "to" + ], + "properties": { + "to": { + "description": "Address to transfer ownership to", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Finish contract ownership transfer. Can be used only by pending owner", + "type": "string", + "enum": [ + "accept_ownership" + ] + }, + { + "description": "Updates the flagging threshold Can be used only by owner", + "type": "object", + "required": [ + "set_flagging_threshold" + ], + "properties": { + "set_flagging_threshold": { + "type": "object", + "required": [ + "threshold" + ], + "properties": { + "threshold": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Updates the flagging contract address for raising flags Can be used only by owner", + "type": "object", + "required": [ + "set_flags_address" + ], + "properties": { + "set_flags_address": { + "type": "object", + "required": [ + "flags" + ], + "properties": { + "flags": { + "$ref": "#/definitions/Addr" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Checks whether the parameters count as valid by comparing the difference change to the flagging threshold", + "type": "object", + "required": [ + "validate" + ], + "properties": { + "validate": { + "type": "object", + "required": [ + "answer", + "previous_answer", + "previous_round_id", + "round_id" + ], + "properties": { + "answer": { + "description": "Current answer which is compared for a ration of change to make sure it has not exceeded the flagging threshold", + "type": "string" + }, + "previous_answer": { + "description": "Previous answer, used as the median of difference with the current answer to determine if the deviation threshold has been exceeded", + "type": "string" + }, + "previous_round_id": { + "description": "ID of the previous round", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "description": "ID of the current round", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "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" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "description": "Check whether the parameters count is valid by comparing the difference change to the flagging threshold Res", + "type": "object", + "required": [ + "is_valid" + ], + "properties": { + "is_valid": { + "type": "object", + "required": [ + "answer", + "previous_answer" + ], + "properties": { + "answer": { + "description": "Current answer which is compared for a ration of change to make sure it has not exceeded the flagging threshold", + "type": "string" + }, + "previous_answer": { + "description": "Previous answer, used as the median of difference with the current answer to determine if the deviation threshold has been exceeded", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Query the flagging threshold Response: [`FlaggingThresholdResponse`]", + "type": "object", + "required": [ + "flagging_threshold" + ], + "properties": { + "flagging_threshold": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "description": "Returns contract owner's address Response [`Addr`]", + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "flagging_threshold": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FlaggingThresholdResponse", + "type": "object", + "required": [ + "threshold" + ], + "properties": { + "threshold": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "is_valid": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Boolean", + "type": "boolean" + }, + "owner": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + } + } +} diff --git a/contracts/deviation-flagging-validator/schema/state.json b/contracts/deviation-flagging-validator/schema/other/state.json similarity index 100% rename from contracts/deviation-flagging-validator/schema/state.json rename to contracts/deviation-flagging-validator/schema/other/state.json diff --git a/contracts/deviation-flagging-validator/schema/execute_msg.json b/contracts/deviation-flagging-validator/schema/raw/execute.json similarity index 100% rename from contracts/deviation-flagging-validator/schema/execute_msg.json rename to contracts/deviation-flagging-validator/schema/raw/execute.json diff --git a/contracts/deviation-flagging-validator/schema/instantiate_msg.json b/contracts/deviation-flagging-validator/schema/raw/instantiate.json similarity index 100% rename from contracts/deviation-flagging-validator/schema/instantiate_msg.json rename to contracts/deviation-flagging-validator/schema/raw/instantiate.json diff --git a/contracts/deviation-flagging-validator/schema/query_msg.json b/contracts/deviation-flagging-validator/schema/raw/query.json similarity index 71% rename from contracts/deviation-flagging-validator/schema/query_msg.json rename to contracts/deviation-flagging-validator/schema/raw/query.json index f4f5e3afa..030c024f4 100644 --- a/contracts/deviation-flagging-validator/schema/query_msg.json +++ b/contracts/deviation-flagging-validator/schema/raw/query.json @@ -3,7 +3,7 @@ "title": "QueryMsg", "oneOf": [ { - "description": "Check whether the parameters count is valid by comparing the difference change to the flagging threshold Response: [`bool`]", + "description": "Check whether the parameters count is valid by comparing the difference change to the flagging threshold Res", "type": "object", "required": [ "is_valid" @@ -30,18 +30,30 @@ "additionalProperties": false }, { - "description": "Query the flagging threshold Response: [`u32`]", - "type": "string", - "enum": [ + "description": "Query the flagging threshold Response: [`FlaggingThresholdResponse`]", + "type": "object", + "required": [ "flagging_threshold" - ] + ], + "properties": { + "flagging_threshold": { + "type": "object" + } + }, + "additionalProperties": false }, { "description": "Returns contract owner's address Response [`Addr`]", - "type": "string", - "enum": [ + "type": "object", + "required": [ "owner" - ] + ], + "properties": { + "owner": { + "type": "object" + } + }, + "additionalProperties": false } ] } diff --git a/contracts/deviation-flagging-validator/schema/raw/response_to_flagging_threshold.json b/contracts/deviation-flagging-validator/schema/raw/response_to_flagging_threshold.json new file mode 100644 index 000000000..a60b83564 --- /dev/null +++ b/contracts/deviation-flagging-validator/schema/raw/response_to_flagging_threshold.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "FlaggingThresholdResponse", + "type": "object", + "required": [ + "threshold" + ], + "properties": { + "threshold": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/deviation-flagging-validator/schema/raw/response_to_is_valid.json b/contracts/deviation-flagging-validator/schema/raw/response_to_is_valid.json new file mode 100644 index 000000000..a7fe2bfe9 --- /dev/null +++ b/contracts/deviation-flagging-validator/schema/raw/response_to_is_valid.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Boolean", + "type": "boolean" +} diff --git a/contracts/deviation-flagging-validator/schema/raw/response_to_owner.json b/contracts/deviation-flagging-validator/schema/raw/response_to_owner.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/deviation-flagging-validator/schema/raw/response_to_owner.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/deviation-flagging-validator/src/contract.rs b/contracts/deviation-flagging-validator/src/contract.rs index 31e88a268..26fce6002 100644 --- a/contracts/deviation-flagging-validator/src/contract.rs +++ b/contracts/deviation-flagging-validator/src/contract.rs @@ -85,8 +85,8 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { let flagging_threshold = CONFIG.load(deps.storage)?.flagging_threshold; to_binary(&is_valid(flagging_threshold, previous_answer, answer)?) } - QueryMsg::FlaggingThreshold => to_binary(&query_flagging_threshold(deps)?), - QueryMsg::Owner => Ok(to_binary(&OWNER.query_owner(deps)?)?), + QueryMsg::FlaggingThreshold {} => to_binary(&query_flagging_threshold(deps)?), + QueryMsg::Owner {} => Ok(to_binary(&OWNER.query_owner(deps)?)?), } } diff --git a/contracts/deviation-flagging-validator/src/msg.rs b/contracts/deviation-flagging-validator/src/msg.rs index b79eaa6fc..f7f92ba8b 100644 --- a/contracts/deviation-flagging-validator/src/msg.rs +++ b/contracts/deviation-flagging-validator/src/msg.rs @@ -1,3 +1,4 @@ +use cosmwasm_schema::QueryResponses; use cosmwasm_std::Addr; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -24,6 +25,7 @@ pub mod bignum { } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct InstantiateMsg { /// The address of the flags contract pub flags: String, @@ -70,12 +72,13 @@ pub enum ExecuteMsg { }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)] #[serde(rename_all = "snake_case")] pub enum QueryMsg { /// Check whether the parameters count is valid by comparing the difference /// change to the flagging threshold - /// Response: [`bool`] + /// Res + #[returns(bool)] IsValid { /// Previous answer, used as the median of difference with the current /// answer to determine if the deviation threshold has been exceeded @@ -89,14 +92,17 @@ pub enum QueryMsg { answer: i128, }, /// Query the flagging threshold - /// Response: [`u32`] - FlaggingThreshold, + /// Response: [`FlaggingThresholdResponse`] + #[returns(FlaggingThresholdResponse)] + FlaggingThreshold {}, /// Returns contract owner's address /// Response [`Addr`] - Owner, + #[returns(Addr)] + Owner {}, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct FlaggingThresholdResponse { pub threshold: u32, } diff --git a/contracts/flags/Cargo.toml b/contracts/flags/Cargo.toml index db723ff67..d5be2841a 100644 --- a/contracts/flags/Cargo.toml +++ b/contracts/flags/Cargo.toml @@ -24,7 +24,7 @@ serde = { version = "1.0.103", default-features = false, features = ["derive"] } thiserror = { version = "1.0.24" } owned = { version = "1.0", path = "../../crates/owned", default-features = false } access-controller = { version = "1.0", path = "../access-controller", default-features = false, features = ["library"] } +cosmwasm-schema = { version = "1.1.5" } [dev-dependencies] -cosmwasm-schema = { version = "1.1.5" } cw-multi-test = "0.16.0" diff --git a/contracts/flags/examples/schema.rs b/contracts/flags/examples/schema.rs index 2891bfa88..7dd2edd17 100644 --- a/contracts/flags/examples/schema.rs +++ b/contracts/flags/examples/schema.rs @@ -1,7 +1,7 @@ use std::env::current_dir; use std::fs::create_dir_all; -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; +use cosmwasm_schema::write_api; use flags::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; @@ -9,9 +9,10 @@ fn main() { let mut out_dir = current_dir().unwrap(); out_dir.push("schema"); create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); + write_api! { + instantiate: InstantiateMsg, + execute: ExecuteMsg, + query: QueryMsg, + } } diff --git a/contracts/flags/schema/flags.json b/contracts/flags/schema/flags.json new file mode 100644 index 000000000..a8130b56c --- /dev/null +++ b/contracts/flags/schema/flags.json @@ -0,0 +1,245 @@ +{ + "contract_name": "flags", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "lowering_access_controller", + "raising_access_controller" + ], + "properties": { + "lowering_access_controller": { + "type": "string" + }, + "raising_access_controller": { + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Initiate contract ownership transfer to another address. Can be used only by owner", + "type": "object", + "required": [ + "transfer_ownership" + ], + "properties": { + "transfer_ownership": { + "type": "object", + "required": [ + "to" + ], + "properties": { + "to": { + "description": "Address to transfer ownership to", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Finish contract ownership transfer. Can be used only by pending owner", + "type": "string", + "enum": [ + "accept_ownership" + ] + }, + { + "type": "object", + "required": [ + "raise_flag" + ], + "properties": { + "raise_flag": { + "type": "object", + "required": [ + "subject" + ], + "properties": { + "subject": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "raise_flags" + ], + "properties": { + "raise_flags": { + "type": "object", + "required": [ + "subjects" + ], + "properties": { + "subjects": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "lower_flags" + ], + "properties": { + "lower_flags": { + "type": "object", + "required": [ + "subjects" + ], + "properties": { + "subjects": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_raising_access_controller" + ], + "properties": { + "set_raising_access_controller": { + "type": "object", + "required": [ + "rac_address" + ], + "properties": { + "rac_address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "Owner" + ], + "properties": { + "Owner": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "Flag" + ], + "properties": { + "Flag": { + "type": "object", + "required": [ + "subject" + ], + "properties": { + "subject": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "Flags" + ], + "properties": { + "Flags": { + "type": "object", + "required": [ + "subjects" + ], + "properties": { + "subjects": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "RaisingAccessController" + ], + "properties": { + "RaisingAccessController": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "flag": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Boolean", + "type": "boolean" + }, + "flags": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_Boolean", + "type": "array", + "items": { + "type": "boolean" + } + }, + "owner": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "raising_access_controller": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + } + } +} diff --git a/contracts/flags/schema/execute_msg.json b/contracts/flags/schema/raw/execute.json similarity index 100% rename from contracts/flags/schema/execute_msg.json rename to contracts/flags/schema/raw/execute.json diff --git a/contracts/flags/schema/instantiate_msg.json b/contracts/flags/schema/raw/instantiate.json similarity index 100% rename from contracts/flags/schema/instantiate_msg.json rename to contracts/flags/schema/raw/instantiate.json diff --git a/contracts/flags/schema/query_msg.json b/contracts/flags/schema/raw/query.json similarity index 64% rename from contracts/flags/schema/query_msg.json rename to contracts/flags/schema/raw/query.json index 356ab8468..b25bb2442 100644 --- a/contracts/flags/schema/query_msg.json +++ b/contracts/flags/schema/raw/query.json @@ -3,25 +3,24 @@ "title": "QueryMsg", "oneOf": [ { - "type": "string", - "enum": [ - "raising_access_controller" - ] - }, - { - "description": "Returns contract owner's address Response [`Addr`]", - "type": "string", - "enum": [ - "owner" - ] + "type": "object", + "required": [ + "Owner" + ], + "properties": { + "Owner": { + "type": "object" + } + }, + "additionalProperties": false }, { "type": "object", "required": [ - "flag" + "Flag" ], "properties": { - "flag": { + "Flag": { "type": "object", "required": [ "subject" @@ -38,10 +37,10 @@ { "type": "object", "required": [ - "flags" + "Flags" ], "properties": { - "flags": { + "Flags": { "type": "object", "required": [ "subjects" @@ -57,6 +56,18 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "RaisingAccessController" + ], + "properties": { + "RaisingAccessController": { + "type": "object" + } + }, + "additionalProperties": false } ] } diff --git a/contracts/flags/schema/raw/response_to_flag.json b/contracts/flags/schema/raw/response_to_flag.json new file mode 100644 index 000000000..a7fe2bfe9 --- /dev/null +++ b/contracts/flags/schema/raw/response_to_flag.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Boolean", + "type": "boolean" +} diff --git a/contracts/flags/schema/raw/response_to_flags.json b/contracts/flags/schema/raw/response_to_flags.json new file mode 100644 index 000000000..469bb153f --- /dev/null +++ b/contracts/flags/schema/raw/response_to_flags.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_Boolean", + "type": "array", + "items": { + "type": "boolean" + } +} diff --git a/contracts/flags/schema/raw/response_to_owner.json b/contracts/flags/schema/raw/response_to_owner.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/flags/schema/raw/response_to_owner.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/flags/schema/raw/response_to_raising_access_controller.json b/contracts/flags/schema/raw/response_to_raising_access_controller.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/flags/schema/raw/response_to_raising_access_controller.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/flags/src/contract.rs b/contracts/flags/src/contract.rs index 2384a1d4b..58e82f336 100644 --- a/contracts/flags/src/contract.rs +++ b/contracts/flags/src/contract.rs @@ -68,10 +68,10 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result Ok(to_binary(&query_flag(deps, subject)?)?), QueryMsg::Flags { subjects } => Ok(to_binary(&query_flags(deps, subjects)?)?), - QueryMsg::RaisingAccessController => { + QueryMsg::RaisingAccessController {} => { Ok(to_binary(&query_raising_access_controller(deps)?)?) } - QueryMsg::Owner => Ok(to_binary(&OWNER.query_owner(deps)?)?), + QueryMsg::Owner {} => Ok(to_binary(&OWNER.query_owner(deps)?)?), } } diff --git a/contracts/flags/src/msg.rs b/contracts/flags/src/msg.rs index 1c0f18276..48ac14b79 100644 --- a/contracts/flags/src/msg.rs +++ b/contracts/flags/src/msg.rs @@ -1,7 +1,10 @@ +use cosmwasm_schema::QueryResponses; +use cosmwasm_std::Addr; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct InstantiateMsg { pub raising_access_controller: String, pub lowering_access_controller: String, @@ -32,17 +35,14 @@ pub enum ExecuteMsg { }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)] pub enum QueryMsg { - /// Returns contract owner's address - /// Response [`Addr`] - Owner, - Flag { - subject: String, - }, - Flags { - subjects: Vec, - }, - RaisingAccessController, + #[returns(Addr)] + Owner {}, + #[returns(bool)] + Flag { subject: String }, + #[returns(Vec)] + Flags { subjects: Vec }, + #[returns(Addr)] + RaisingAccessController {}, } diff --git a/contracts/ocr2/Cargo.toml b/contracts/ocr2/Cargo.toml index fcec32101..eabc2a1d4 100644 --- a/contracts/ocr2/Cargo.toml +++ b/contracts/ocr2/Cargo.toml @@ -35,9 +35,9 @@ hex = "0.4.3" access-controller = { version = "1.0", path = "../access-controller", default-features = false, features = ["library"] } deviation-flagging-validator = { version = "1.0", path = "../deviation-flagging-validator", default-features = false, features = ["library"] } owned = { version = "1.0", path = "../../crates/owned" } +cosmwasm-schema = { version = "1.1.5" } [dev-dependencies] -cosmwasm-schema = { version = "1.1.5" } ed25519-zebra = "3.0.0" rand = "0.8" cw-multi-test = "0.16.0" diff --git a/contracts/ocr2/examples/schema.rs b/contracts/ocr2/examples/schema.rs index 41e2592d2..34170cc3e 100644 --- a/contracts/ocr2/examples/schema.rs +++ b/contracts/ocr2/examples/schema.rs @@ -1,7 +1,7 @@ use std::env::current_dir; -use std::fs::create_dir_all; +use std::fs::{create_dir_all, remove_dir_all, rename}; -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; +use cosmwasm_schema::{export_schema, remove_schemas, schema_for, write_api}; use ocr2::msg::{ ExecuteMsg, InstantiateMsg, LatestConfigDetailsResponse, LatestTransmissionDetailsResponse, @@ -10,21 +10,41 @@ use ocr2::msg::{ use ocr2::state::{Billing, Config, Proposal, Transmitter, Validator}; fn main() { + // clean directory let mut out_dir = current_dir().unwrap(); out_dir.push("schema"); + remove_dir_all(&out_dir).unwrap(); create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); - export_schema(&schema_for!(Config), &out_dir); - export_schema(&schema_for!(Proposal), &out_dir); - export_schema(&schema_for!(Billing), &out_dir); - export_schema(&schema_for!(Validator), &out_dir); - export_schema(&schema_for!(Transmitter), &out_dir); - export_schema(&schema_for!(LatestConfigDetailsResponse), &out_dir); - export_schema(&schema_for!(TransmittersResponse), &out_dir); - export_schema(&schema_for!(LatestTransmissionDetailsResponse), &out_dir); - export_schema(&schema_for!(LinkAvailableForPaymentResponse), &out_dir); + + write_api! { + instantiate: InstantiateMsg, + execute: ExecuteMsg, + query: QueryMsg, + } + + // put main schema under main folder for codegen.js (else it will error) + let mut main_dir = out_dir.clone(); + main_dir.push("main"); + create_dir_all(&main_dir).unwrap(); + + let mut main_file = out_dir.clone(); + main_file.push("ocr2.json"); + + let mut new_location = main_dir.clone(); + new_location.push("ocr2.json"); + rename(&main_file, &new_location).unwrap(); + + // put other hand-exported schemas in seperate folder + let mut other_dir = out_dir.clone(); + other_dir.push("other"); + create_dir_all(&other_dir).unwrap(); + export_schema(&schema_for!(Config), &other_dir); + export_schema(&schema_for!(Proposal), &other_dir); + export_schema(&schema_for!(Billing), &other_dir); + export_schema(&schema_for!(Validator), &other_dir); + export_schema(&schema_for!(Transmitter), &other_dir); + export_schema(&schema_for!(LatestConfigDetailsResponse), &other_dir); + export_schema(&schema_for!(TransmittersResponse), &other_dir); + export_schema(&schema_for!(LatestTransmissionDetailsResponse), &other_dir); + export_schema(&schema_for!(LinkAvailableForPaymentResponse), &other_dir); } diff --git a/contracts/ocr2/schema/main/ocr2.json b/contracts/ocr2/schema/main/ocr2.json new file mode 100644 index 000000000..bc20067ee --- /dev/null +++ b/contracts/ocr2/schema/main/ocr2.json @@ -0,0 +1,1220 @@ +{ + "contract_name": "ocr2", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "billing_access_controller", + "decimals", + "description", + "link_token", + "max_answer", + "min_answer", + "requester_access_controller" + ], + "properties": { + "billing_access_controller": { + "description": "Billing access controller address", + "type": "string" + }, + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "description": { + "type": "string" + }, + "link_token": { + "description": "LINK token contract address", + "type": "string" + }, + "max_answer": { + "type": "string" + }, + "min_answer": { + "type": "string" + }, + "requester_access_controller": { + "description": "RequestNewRound access controller address", + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "string", + "enum": [ + "begin_proposal", + "accept_ownership", + "request_new_round" + ] + }, + { + "type": "object", + "required": [ + "clear_proposal" + ], + "properties": { + "clear_proposal": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/definitions/Uint128" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "finalize_proposal" + ], + "properties": { + "finalize_proposal": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/definitions/Uint128" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "accept_proposal" + ], + "properties": { + "accept_proposal": { + "type": "object", + "required": [ + "digest", + "id" + ], + "properties": { + "digest": { + "$ref": "#/definitions/Binary" + }, + "id": { + "$ref": "#/definitions/Uint128" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "propose_config" + ], + "properties": { + "propose_config": { + "type": "object", + "required": [ + "f", + "id", + "onchain_config", + "payees", + "signers", + "transmitters" + ], + "properties": { + "f": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "id": { + "$ref": "#/definitions/Uint128" + }, + "onchain_config": { + "$ref": "#/definitions/Binary" + }, + "payees": { + "type": "array", + "items": { + "type": "string" + } + }, + "signers": { + "type": "array", + "items": { + "$ref": "#/definitions/Binary" + } + }, + "transmitters": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "propose_offchain_config" + ], + "properties": { + "propose_offchain_config": { + "type": "object", + "required": [ + "id", + "offchain_config", + "offchain_config_version" + ], + "properties": { + "id": { + "$ref": "#/definitions/Uint128" + }, + "offchain_config": { + "$ref": "#/definitions/Binary" + }, + "offchain_config_version": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transfer_ownership" + ], + "properties": { + "transfer_ownership": { + "type": "object", + "required": [ + "to" + ], + "properties": { + "to": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transmit" + ], + "properties": { + "transmit": { + "type": "object", + "required": [ + "report", + "report_context", + "signatures" + ], + "properties": { + "report": { + "$ref": "#/definitions/Binary" + }, + "report_context": { + "$ref": "#/definitions/Binary" + }, + "signatures": { + "type": "array", + "items": { + "$ref": "#/definitions/Binary" + } + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_billing" + ], + "properties": { + "set_billing": { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "$ref": "#/definitions/Billing" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_validator_config" + ], + "properties": { + "set_validator_config": { + "type": "object", + "properties": { + "config": { + "anyOf": [ + { + "$ref": "#/definitions/Validator" + }, + { + "type": "null" + } + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_billing_access_controller" + ], + "properties": { + "set_billing_access_controller": { + "type": "object", + "required": [ + "access_controller" + ], + "properties": { + "access_controller": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_requester_access_controller" + ], + "properties": { + "set_requester_access_controller": { + "type": "object", + "required": [ + "access_controller" + ], + "properties": { + "access_controller": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_payment" + ], + "properties": { + "withdraw_payment": { + "type": "object", + "required": [ + "transmitter" + ], + "properties": { + "transmitter": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw_funds" + ], + "properties": { + "withdraw_funds": { + "type": "object", + "required": [ + "amount", + "recipient" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "recipient": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_link_token" + ], + "properties": { + "set_link_token": { + "type": "object", + "required": [ + "link_token", + "recipient" + ], + "properties": { + "link_token": { + "type": "string" + }, + "recipient": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Handler for LINK token Receive message", + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transfer_payeeship" + ], + "properties": { + "transfer_payeeship": { + "type": "object", + "required": [ + "proposed", + "transmitter" + ], + "properties": { + "proposed": { + "type": "string" + }, + "transmitter": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "accept_payeeship" + ], + "properties": { + "accept_payeeship": { + "type": "object", + "required": [ + "transmitter" + ], + "properties": { + "transmitter": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "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" + }, + "Billing": { + "type": "object", + "required": [ + "observation_payment_gjuels", + "recommended_gas_price_micro", + "transmission_payment_gjuels" + ], + "properties": { + "gas_adjustment": { + "description": "In percent", + "type": [ + "integer", + "null" + ], + "format": "uint8", + "minimum": 0.0 + }, + "gas_base": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "gas_per_signature": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "observation_payment_gjuels": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "recommended_gas_price_micro": { + "description": "Should match . For example if reports contain juels_per_atom, then recommended_gas_price is in uATOM.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "transmission_payment_gjuels": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "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" + }, + "Cw20ReceiveMsg": { + "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", + "type": "object", + "required": [ + "amount", + "msg", + "sender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + }, + "Validator": { + "type": "object", + "required": [ + "address", + "gas_limit" + ], + "properties": { + "address": { + "$ref": "#/definitions/Addr" + }, + "gas_limit": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "latest_config_details" + ], + "properties": { + "latest_config_details": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transmitters" + ], + "properties": { + "transmitters": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_transmission_details" + ], + "properties": { + "latest_transmission_details": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_config_digest_and_epoch" + ], + "properties": { + "latest_config_digest_and_epoch": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "description" + ], + "properties": { + "description": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decimals" + ], + "properties": { + "decimals": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "round_data" + ], + "properties": { + "round_data": { + "type": "object", + "required": [ + "round_id" + ], + "properties": { + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_round_data" + ], + "properties": { + "latest_round_data": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "link_token" + ], + "properties": { + "link_token": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "billing" + ], + "properties": { + "billing": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "billing_access_controller" + ], + "properties": { + "billing_access_controller": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "requester_access_controller" + ], + "properties": { + "requester_access_controller": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owed_payment" + ], + "properties": { + "owed_payment": { + "type": "object", + "required": [ + "transmitter" + ], + "properties": { + "transmitter": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "link_available_for_payment" + ], + "properties": { + "link_available_for_payment": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "oracle_observation_count" + ], + "properties": { + "oracle_observation_count": { + "type": "object", + "required": [ + "transmitter" + ], + "properties": { + "transmitter": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposal" + ], + "properties": { + "proposal": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/definitions/Uint128" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "object" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "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" + } + } + }, + "migrate": null, + "sudo": null, + "responses": { + "billing": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Billing", + "type": "object", + "required": [ + "observation_payment_gjuels", + "recommended_gas_price_micro", + "transmission_payment_gjuels" + ], + "properties": { + "gas_adjustment": { + "description": "In percent", + "type": [ + "integer", + "null" + ], + "format": "uint8", + "minimum": 0.0 + }, + "gas_base": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "gas_per_signature": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "observation_payment_gjuels": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "recommended_gas_price_micro": { + "description": "Should match . For example if reports contain juels_per_atom, then recommended_gas_price is in uATOM.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "transmission_payment_gjuels": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } + }, + "billing_access_controller": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "decimals": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint8", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "description": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" + }, + "latest_config_details": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LatestConfigDetailsResponse", + "type": "object", + "required": [ + "block_number", + "config_count", + "config_digest" + ], + "properties": { + "block_number": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "config_count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "config_digest": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + } + } + }, + "latest_config_digest_and_epoch": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LatestConfigDigestAndEpochResponse", + "type": "object", + "required": [ + "config_digest", + "epoch", + "scan_logs" + ], + "properties": { + "config_digest": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + }, + "epoch": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "scan_logs": { + "type": "boolean" + } + } + }, + "latest_round_data": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "latest_transmission_details": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LatestTransmissionDetailsResponse", + "type": "object", + "required": [ + "epoch", + "latest_answer", + "latest_config_digest", + "latest_timestamp", + "round" + ], + "properties": { + "epoch": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "latest_answer": { + "type": "string" + }, + "latest_config_digest": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + }, + "latest_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + }, + "link_available_for_payment": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LinkAvailableForPaymentResponse", + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "string" + } + } + }, + "link_token": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "oracle_observation_count": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "owed_payment": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "owner": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "proposal": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Proposal", + "type": "object", + "required": [ + "f", + "finalized", + "offchain_config", + "offchain_config_version", + "oracles", + "owner" + ], + "properties": { + "f": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "finalized": { + "type": "boolean" + }, + "offchain_config": { + "$ref": "#/definitions/Binary" + }, + "offchain_config_version": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "oracles": { + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Binary" + }, + { + "$ref": "#/definitions/Addr" + }, + { + "$ref": "#/definitions/Addr" + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "owner": { + "$ref": "#/definitions/Addr" + } + }, + "definitions": { + "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" + }, + "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" + } + } + }, + "requester_access_controller": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "round_data": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "transmitters": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TransmittersResponse", + "type": "object", + "required": [ + "addresses" + ], + "properties": { + "addresses": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + } + }, + "definitions": { + "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" + } + } + }, + "version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" + } + } +} diff --git a/contracts/ocr2/schema/billing.json b/contracts/ocr2/schema/other/billing.json similarity index 100% rename from contracts/ocr2/schema/billing.json rename to contracts/ocr2/schema/other/billing.json diff --git a/contracts/ocr2/schema/config.json b/contracts/ocr2/schema/other/config.json similarity index 100% rename from contracts/ocr2/schema/config.json rename to contracts/ocr2/schema/other/config.json diff --git a/contracts/ocr2/schema/latest_config_details_response.json b/contracts/ocr2/schema/other/latest_config_details_response.json similarity index 100% rename from contracts/ocr2/schema/latest_config_details_response.json rename to contracts/ocr2/schema/other/latest_config_details_response.json diff --git a/contracts/ocr2/schema/latest_transmission_details_response.json b/contracts/ocr2/schema/other/latest_transmission_details_response.json similarity index 100% rename from contracts/ocr2/schema/latest_transmission_details_response.json rename to contracts/ocr2/schema/other/latest_transmission_details_response.json diff --git a/contracts/ocr2/schema/link_available_for_payment_response.json b/contracts/ocr2/schema/other/link_available_for_payment_response.json similarity index 100% rename from contracts/ocr2/schema/link_available_for_payment_response.json rename to contracts/ocr2/schema/other/link_available_for_payment_response.json diff --git a/contracts/ocr2/schema/proposal.json b/contracts/ocr2/schema/other/proposal.json similarity index 100% rename from contracts/ocr2/schema/proposal.json rename to contracts/ocr2/schema/other/proposal.json diff --git a/contracts/ocr2/schema/transmitter.json b/contracts/ocr2/schema/other/transmitter.json similarity index 100% rename from contracts/ocr2/schema/transmitter.json rename to contracts/ocr2/schema/other/transmitter.json diff --git a/contracts/ocr2/schema/transmitters_response.json b/contracts/ocr2/schema/other/transmitters_response.json similarity index 100% rename from contracts/ocr2/schema/transmitters_response.json rename to contracts/ocr2/schema/other/transmitters_response.json diff --git a/contracts/ocr2/schema/validator.json b/contracts/ocr2/schema/other/validator.json similarity index 100% rename from contracts/ocr2/schema/validator.json rename to contracts/ocr2/schema/other/validator.json diff --git a/contracts/ocr2/schema/query_msg.json b/contracts/ocr2/schema/query_msg.json deleted file mode 100644 index 472f44e0a..000000000 --- a/contracts/ocr2/schema/query_msg.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "oneOf": [ - { - "type": "string", - "enum": [ - "latest_config_details", - "transmitters", - "latest_transmission_details", - "latest_config_digest_and_epoch", - "description", - "decimals", - "latest_round_data", - "link_token", - "billing", - "billing_access_controller", - "requester_access_controller", - "link_available_for_payment", - "version", - "owner" - ] - }, - { - "type": "object", - "required": [ - "round_data" - ], - "properties": { - "round_data": { - "type": "object", - "required": [ - "round_id" - ], - "properties": { - "round_id": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "owed_payment" - ], - "properties": { - "owed_payment": { - "type": "object", - "required": [ - "transmitter" - ], - "properties": { - "transmitter": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "oracle_observation_count" - ], - "properties": { - "oracle_observation_count": { - "type": "object", - "required": [ - "transmitter" - ], - "properties": { - "transmitter": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "proposal" - ], - "properties": { - "proposal": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "$ref": "#/definitions/Uint128" - } - } - } - }, - "additionalProperties": false - } - ], - "definitions": { - "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" - } - } -} diff --git a/contracts/ocr2/schema/execute_msg.json b/contracts/ocr2/schema/raw/execute.json similarity index 100% rename from contracts/ocr2/schema/execute_msg.json rename to contracts/ocr2/schema/raw/execute.json diff --git a/contracts/ocr2/schema/instantiate_msg.json b/contracts/ocr2/schema/raw/instantiate.json similarity index 100% rename from contracts/ocr2/schema/instantiate_msg.json rename to contracts/ocr2/schema/raw/instantiate.json diff --git a/contracts/ocr2/schema/raw/query.json b/contracts/ocr2/schema/raw/query.json new file mode 100644 index 000000000..29b57ed35 --- /dev/null +++ b/contracts/ocr2/schema/raw/query.json @@ -0,0 +1,262 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "latest_config_details" + ], + "properties": { + "latest_config_details": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "transmitters" + ], + "properties": { + "transmitters": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_transmission_details" + ], + "properties": { + "latest_transmission_details": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_config_digest_and_epoch" + ], + "properties": { + "latest_config_digest_and_epoch": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "description" + ], + "properties": { + "description": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "decimals" + ], + "properties": { + "decimals": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "round_data" + ], + "properties": { + "round_data": { + "type": "object", + "required": [ + "round_id" + ], + "properties": { + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_round_data" + ], + "properties": { + "latest_round_data": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "link_token" + ], + "properties": { + "link_token": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "billing" + ], + "properties": { + "billing": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "billing_access_controller" + ], + "properties": { + "billing_access_controller": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "requester_access_controller" + ], + "properties": { + "requester_access_controller": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owed_payment" + ], + "properties": { + "owed_payment": { + "type": "object", + "required": [ + "transmitter" + ], + "properties": { + "transmitter": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "link_available_for_payment" + ], + "properties": { + "link_available_for_payment": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "oracle_observation_count" + ], + "properties": { + "oracle_observation_count": { + "type": "object", + "required": [ + "transmitter" + ], + "properties": { + "transmitter": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposal" + ], + "properties": { + "proposal": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/definitions/Uint128" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "object" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "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" + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_billing.json b/contracts/ocr2/schema/raw/response_to_billing.json new file mode 100644 index 000000000..323a995c7 --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_billing.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Billing", + "type": "object", + "required": [ + "observation_payment_gjuels", + "recommended_gas_price_micro", + "transmission_payment_gjuels" + ], + "properties": { + "gas_adjustment": { + "description": "In percent", + "type": [ + "integer", + "null" + ], + "format": "uint8", + "minimum": 0.0 + }, + "gas_base": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "gas_per_signature": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "observation_payment_gjuels": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "recommended_gas_price_micro": { + "description": "Should match . For example if reports contain juels_per_atom, then recommended_gas_price is in uATOM.", + "allOf": [ + { + "$ref": "#/definitions/Decimal" + } + ] + }, + "transmission_payment_gjuels": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_billing_access_controller.json b/contracts/ocr2/schema/raw/response_to_billing_access_controller.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_billing_access_controller.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/ocr2/schema/raw/response_to_decimals.json b/contracts/ocr2/schema/raw/response_to_decimals.json new file mode 100644 index 000000000..b0d6c9bd2 --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_decimals.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint8", + "type": "integer", + "format": "uint8", + "minimum": 0.0 +} diff --git a/contracts/ocr2/schema/raw/response_to_description.json b/contracts/ocr2/schema/raw/response_to_description.json new file mode 100644 index 000000000..f689acebf --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_description.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" +} diff --git a/contracts/ocr2/schema/raw/response_to_latest_config_details.json b/contracts/ocr2/schema/raw/response_to_latest_config_details.json new file mode 100644 index 000000000..751630fcc --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_latest_config_details.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LatestConfigDetailsResponse", + "type": "object", + "required": [ + "block_number", + "config_count", + "config_digest" + ], + "properties": { + "block_number": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "config_count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "config_digest": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_latest_config_digest_and_epoch.json b/contracts/ocr2/schema/raw/response_to_latest_config_digest_and_epoch.json new file mode 100644 index 000000000..d15ed046d --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_latest_config_digest_and_epoch.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LatestConfigDigestAndEpochResponse", + "type": "object", + "required": [ + "config_digest", + "epoch", + "scan_logs" + ], + "properties": { + "config_digest": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + }, + "epoch": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "scan_logs": { + "type": "boolean" + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_latest_round_data.json b/contracts/ocr2/schema/raw/response_to_latest_round_data.json new file mode 100644 index 000000000..553c1420a --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_latest_round_data.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_latest_transmission_details.json b/contracts/ocr2/schema/raw/response_to_latest_transmission_details.json new file mode 100644 index 000000000..4ff083895 --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_latest_transmission_details.json @@ -0,0 +1,42 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LatestTransmissionDetailsResponse", + "type": "object", + "required": [ + "epoch", + "latest_answer", + "latest_config_digest", + "latest_timestamp", + "round" + ], + "properties": { + "epoch": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "latest_answer": { + "type": "string" + }, + "latest_config_digest": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "maxItems": 32, + "minItems": 32 + }, + "latest_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_link_available_for_payment.json b/contracts/ocr2/schema/raw/response_to_link_available_for_payment.json new file mode 100644 index 000000000..7c13147b7 --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_link_available_for_payment.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LinkAvailableForPaymentResponse", + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "string" + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_link_token.json b/contracts/ocr2/schema/raw/response_to_link_token.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_link_token.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/ocr2/schema/raw/response_to_oracle_observation_count.json b/contracts/ocr2/schema/raw/response_to_oracle_observation_count.json new file mode 100644 index 000000000..de85c3e56 --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_oracle_observation_count.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint32", + "type": "integer", + "format": "uint32", + "minimum": 0.0 +} diff --git a/contracts/ocr2/schema/raw/response_to_owed_payment.json b/contracts/ocr2/schema/raw/response_to_owed_payment.json new file mode 100644 index 000000000..25b73e8f2 --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_owed_payment.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/ocr2/schema/raw/response_to_owner.json b/contracts/ocr2/schema/raw/response_to_owner.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_owner.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/ocr2/schema/raw/response_to_proposal.json b/contracts/ocr2/schema/raw/response_to_proposal.json new file mode 100644 index 000000000..63c649f28 --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_proposal.json @@ -0,0 +1,63 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Proposal", + "type": "object", + "required": [ + "f", + "finalized", + "offchain_config", + "offchain_config_version", + "oracles", + "owner" + ], + "properties": { + "f": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "finalized": { + "type": "boolean" + }, + "offchain_config": { + "$ref": "#/definitions/Binary" + }, + "offchain_config_version": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "oracles": { + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/Binary" + }, + { + "$ref": "#/definitions/Addr" + }, + { + "$ref": "#/definitions/Addr" + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "owner": { + "$ref": "#/definitions/Addr" + } + }, + "definitions": { + "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" + }, + "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/contracts/ocr2/schema/raw/response_to_requester_access_controller.json b/contracts/ocr2/schema/raw/response_to_requester_access_controller.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_requester_access_controller.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/ocr2/schema/raw/response_to_round_data.json b/contracts/ocr2/schema/raw/response_to_round_data.json new file mode 100644 index 000000000..553c1420a --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_round_data.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_transmitters.json b/contracts/ocr2/schema/raw/response_to_transmitters.json new file mode 100644 index 000000000..740435f1d --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_transmitters.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TransmittersResponse", + "type": "object", + "required": [ + "addresses" + ], + "properties": { + "addresses": { + "type": "array", + "items": { + "$ref": "#/definitions/Addr" + } + } + }, + "definitions": { + "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" + } + } +} diff --git a/contracts/ocr2/schema/raw/response_to_version.json b/contracts/ocr2/schema/raw/response_to_version.json new file mode 100644 index 000000000..f689acebf --- /dev/null +++ b/contracts/ocr2/schema/raw/response_to_version.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" +} diff --git a/contracts/ocr2/src/contract.rs b/contracts/ocr2/src/contract.rs index dbda2cc65..8a4541796 100644 --- a/contracts/ocr2/src/contract.rs +++ b/contracts/ocr2/src/contract.rs @@ -206,32 +206,32 @@ pub fn execute( #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { match msg { - QueryMsg::LatestConfigDetails => to_binary(&query_latest_config_details(deps)?), - QueryMsg::Transmitters => to_binary(&query_transmitters(deps)?), - QueryMsg::LatestConfigDigestAndEpoch => { + QueryMsg::LatestConfigDetails {} => to_binary(&query_latest_config_details(deps)?), + QueryMsg::Transmitters {} => to_binary(&query_transmitters(deps)?), + QueryMsg::LatestConfigDigestAndEpoch {} => { to_binary(&query_latest_config_digest_and_epoch(deps)?) } - QueryMsg::LatestTransmissionDetails => to_binary(&query_latest_transmission_details(deps)?), + QueryMsg::LatestTransmissionDetails {} => to_binary(&query_latest_transmission_details(deps)?), // v3 - QueryMsg::Description => to_binary(&query_description(deps)?), - QueryMsg::Decimals => to_binary(&query_decimals(deps)?), + QueryMsg::Description {} => to_binary(&query_description(deps)?), + QueryMsg::Decimals {} => to_binary(&query_decimals(deps)?), QueryMsg::RoundData { round_id } => to_binary(&query_round_data(deps, round_id)?), - QueryMsg::LatestRoundData => to_binary(&query_latest_round_data(deps)?), + QueryMsg::LatestRoundData {} => to_binary(&query_latest_round_data(deps)?), - QueryMsg::LinkToken => to_binary(&query_link_token(deps)?), - QueryMsg::Billing => to_binary(&query_billing(deps)?), - QueryMsg::BillingAccessController => to_binary(&query_billing_access_controller(deps)?), - QueryMsg::RequesterAccessController => to_binary(&query_requester_access_controller(deps)?), + QueryMsg::LinkToken {} => to_binary(&query_link_token(deps)?), + QueryMsg::Billing {} => to_binary(&query_billing(deps)?), + QueryMsg::BillingAccessController {} => to_binary(&query_billing_access_controller(deps)?), + QueryMsg::RequesterAccessController {} => to_binary(&query_requester_access_controller(deps)?), QueryMsg::OwedPayment { transmitter } => to_binary(&query_owed_payment(deps, transmitter)?), - QueryMsg::LinkAvailableForPayment => { + QueryMsg::LinkAvailableForPayment {} => { to_binary(&query_link_available_for_payment(deps, env)?) } QueryMsg::OracleObservationCount { transmitter } => { to_binary(&query_oracle_observation_count(deps, transmitter)?) } QueryMsg::Proposal { id } => to_binary(&query_proposal(deps, id)?), - QueryMsg::Version => Ok(to_binary(CONTRACT_VERSION)?), - QueryMsg::Owner => Ok(to_binary(&OWNER.query_owner(deps)?)?), + QueryMsg::Version {} => Ok(to_binary(CONTRACT_VERSION)?), + QueryMsg::Owner {} => Ok(to_binary(&OWNER.query_owner(deps)?)?), } } diff --git a/contracts/ocr2/src/msg.rs b/contracts/ocr2/src/msg.rs index 8cf64f1d7..8e017fdf9 100644 --- a/contracts/ocr2/src/msg.rs +++ b/contracts/ocr2/src/msg.rs @@ -1,4 +1,5 @@ -use crate::state::{bignum, Billing, ProposalId, Validator}; +use crate::state::{bignum, Billing, Proposal, ProposalId, Round, Validator}; +use cosmwasm_schema::QueryResponses; use cosmwasm_std::{Addr, Binary, Uint128}; use cw20::Cw20ReceiveMsg; use schemars::JsonSchema; @@ -108,33 +109,50 @@ pub enum ExecuteMsg { }, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)] #[serde(rename_all = "snake_case")] pub enum QueryMsg { // BASE: - LatestConfigDetails, - Transmitters, - LatestTransmissionDetails, - LatestConfigDigestAndEpoch, - - Description, - Decimals, + #[returns(LatestConfigDetailsResponse)] + LatestConfigDetails {}, + #[returns(TransmittersResponse)] + Transmitters {}, + #[returns(LatestTransmissionDetailsResponse)] + LatestTransmissionDetails {}, + #[returns(LatestConfigDigestAndEpochResponse)] + LatestConfigDigestAndEpoch {}, + #[returns(String)] + Description {}, + #[returns(u8)] + Decimals {}, + #[returns(Round)] RoundData { round_id: u32 }, - LatestRoundData, - - LinkToken, - Billing, - BillingAccessController, - RequesterAccessController, + #[returns(Round)] + LatestRoundData {}, + #[returns(Addr)] + LinkToken {}, + #[returns(Billing)] + Billing {}, + #[returns(Addr)] + BillingAccessController {}, + #[returns(Addr)] + RequesterAccessController {}, + #[returns(Uint128)] OwedPayment { transmitter: String }, - LinkAvailableForPayment, + #[returns(LinkAvailableForPaymentResponse)] + LinkAvailableForPayment {}, + #[returns(u32)] OracleObservationCount { transmitter: String }, + #[returns(Proposal)] Proposal { id: ProposalId }, - Version, - Owner, + #[returns(str)] + Version {}, + #[returns(Addr)] + Owner {}, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct LatestConfigDetailsResponse { pub config_count: u32, pub block_number: u64, @@ -142,11 +160,13 @@ pub struct LatestConfigDetailsResponse { } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct TransmittersResponse { pub addresses: Vec, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct LatestTransmissionDetailsResponse { pub latest_config_digest: [u8; 32], pub epoch: u32, @@ -158,6 +178,7 @@ pub struct LatestTransmissionDetailsResponse { } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct LatestConfigDigestAndEpochResponse { pub scan_logs: bool, pub config_digest: [u8; 32], @@ -165,6 +186,7 @@ pub struct LatestConfigDigestAndEpochResponse { } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] pub struct LinkAvailableForPaymentResponse { #[serde(with = "bignum")] #[schemars(with = "String")] diff --git a/contracts/proxy-ocr2/Cargo.toml b/contracts/proxy-ocr2/Cargo.toml index 7a0b60986..04bdc1f44 100644 --- a/contracts/proxy-ocr2/Cargo.toml +++ b/contracts/proxy-ocr2/Cargo.toml @@ -15,6 +15,7 @@ library = [] [dependencies] ocr2 = { path = "../ocr2", default-features = false, features = ["library"] } owned = { version = "1.0", path = "../../crates/owned" } +cosmwasm-schema = { version = "1.1.5" } cosmwasm-std = { version = "1.1.5" } cosmwasm-storage = { version = "1.1.5" } cw-storage-plus = "0.16.0" @@ -25,6 +26,5 @@ schemars = "0.8.3" serde = { version = "1.0.127", default-features = false, features = ["derive"] } [dev-dependencies] -cosmwasm-schema = { version = "1.1.5" } cw-multi-test = "0.16.0" cw-storage-plus = "0.16.0" diff --git a/contracts/proxy-ocr2/examples/schema.rs b/contracts/proxy-ocr2/examples/schema.rs index baf50e461..789d58cd0 100644 --- a/contracts/proxy-ocr2/examples/schema.rs +++ b/contracts/proxy-ocr2/examples/schema.rs @@ -1,7 +1,7 @@ use std::env::current_dir; use std::fs::create_dir_all; -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; +use cosmwasm_schema::write_api; use proxy_ocr2::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; @@ -9,9 +9,10 @@ fn main() { let mut out_dir = current_dir().unwrap(); out_dir.push("schema"); create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(InstantiateMsg), &out_dir); - export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema(&schema_for!(QueryMsg), &out_dir); + write_api! { + instantiate: InstantiateMsg, + execute: ExecuteMsg, + query: QueryMsg, + } } diff --git a/contracts/proxy-ocr2/schema/proxy-ocr2.json b/contracts/proxy-ocr2/schema/proxy-ocr2.json new file mode 100644 index 000000000..8c264603d --- /dev/null +++ b/contracts/proxy-ocr2/schema/proxy-ocr2.json @@ -0,0 +1,449 @@ +{ + "contract_name": "proxy-ocr2", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "contract_address" + ], + "properties": { + "contract_address": { + "type": "string" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "propose_contract" + ], + "properties": { + "propose_contract": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "confirm_contract" + ], + "properties": { + "confirm_contract": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Initiate contract ownership transfer to another address. Can be used only by owner", + "type": "object", + "required": [ + "transfer_ownership" + ], + "properties": { + "transfer_ownership": { + "type": "object", + "required": [ + "to" + ], + "properties": { + "to": { + "description": "Address to transfer ownership to", + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Finish contract ownership transfer. Can be used only by pending owner", + "type": "string", + "enum": [ + "accept_ownership" + ] + } + ] + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "decimals" + ], + "properties": { + "decimals": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "description" + ], + "properties": { + "description": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "round_data" + ], + "properties": { + "round_data": { + "type": "object", + "required": [ + "round_id" + ], + "properties": { + "round_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_round_data" + ], + "properties": { + "latest_round_data": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposed_round_data" + ], + "properties": { + "proposed_round_data": { + "type": "object", + "required": [ + "round_id" + ], + "properties": { + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposed_latest_round_data" + ], + "properties": { + "proposed_latest_round_data": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "aggregator" + ], + "properties": { + "aggregator": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "phase_id" + ], + "properties": { + "phase_id": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "phase_aggregators" + ], + "properties": { + "phase_aggregators": { + "type": "object", + "required": [ + "phase_id" + ], + "properties": { + "phase_id": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposed_aggregator" + ], + "properties": { + "proposed_aggregator": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "aggregator": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "decimals": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint8", + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "description": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" + }, + "latest_round_data": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "owner": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "phase_aggregators": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "phase_id": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint16", + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "proposed_aggregator": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "proposed_latest_round_data": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "proposed_round_data": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "round_data": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "version": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" + } + } +} diff --git a/contracts/proxy-ocr2/schema/query_msg.json b/contracts/proxy-ocr2/schema/query_msg.json deleted file mode 100644 index 59bcf42e3..000000000 --- a/contracts/proxy-ocr2/schema/query_msg.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryMsg", - "oneOf": [ - { - "type": "string", - "enum": [ - "decimals", - "version", - "description", - "latest_round_data", - "proposed_latest_round_data", - "aggregator", - "phase_id", - "proposed_aggregator", - "owner" - ] - }, - { - "type": "object", - "required": [ - "round_data" - ], - "properties": { - "round_data": { - "type": "object", - "required": [ - "round_id" - ], - "properties": { - "round_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "proposed_round_data" - ], - "properties": { - "proposed_round_data": { - "type": "object", - "required": [ - "round_id" - ], - "properties": { - "round_id": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "phase_aggregators" - ], - "properties": { - "phase_aggregators": { - "type": "object", - "required": [ - "phase_id" - ], - "properties": { - "phase_id": { - "type": "integer", - "format": "uint16", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false - } - ] -} diff --git a/contracts/proxy-ocr2/schema/execute_msg.json b/contracts/proxy-ocr2/schema/raw/execute.json similarity index 100% rename from contracts/proxy-ocr2/schema/execute_msg.json rename to contracts/proxy-ocr2/schema/raw/execute.json diff --git a/contracts/proxy-ocr2/schema/instantiate_msg.json b/contracts/proxy-ocr2/schema/raw/instantiate.json similarity index 100% rename from contracts/proxy-ocr2/schema/instantiate_msg.json rename to contracts/proxy-ocr2/schema/raw/instantiate.json diff --git a/contracts/proxy-ocr2/schema/raw/query.json b/contracts/proxy-ocr2/schema/raw/query.json new file mode 100644 index 000000000..ca75ad64f --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/query.json @@ -0,0 +1,180 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "decimals" + ], + "properties": { + "decimals": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "version" + ], + "properties": { + "version": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "description" + ], + "properties": { + "description": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "round_data" + ], + "properties": { + "round_data": { + "type": "object", + "required": [ + "round_id" + ], + "properties": { + "round_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "latest_round_data" + ], + "properties": { + "latest_round_data": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposed_round_data" + ], + "properties": { + "proposed_round_data": { + "type": "object", + "required": [ + "round_id" + ], + "properties": { + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposed_latest_round_data" + ], + "properties": { + "proposed_latest_round_data": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "aggregator" + ], + "properties": { + "aggregator": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "phase_id" + ], + "properties": { + "phase_id": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "phase_aggregators" + ], + "properties": { + "phase_aggregators": { + "type": "object", + "required": [ + "phase_id" + ], + "properties": { + "phase_id": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposed_aggregator" + ], + "properties": { + "proposed_aggregator": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "owner": { + "type": "object" + } + }, + "additionalProperties": false + } + ] +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_aggregator.json b/contracts/proxy-ocr2/schema/raw/response_to_aggregator.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_aggregator.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_decimals.json b/contracts/proxy-ocr2/schema/raw/response_to_decimals.json new file mode 100644 index 000000000..b0d6c9bd2 --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_decimals.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint8", + "type": "integer", + "format": "uint8", + "minimum": 0.0 +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_description.json b/contracts/proxy-ocr2/schema/raw/response_to_description.json new file mode 100644 index 000000000..f689acebf --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_description.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_latest_round_data.json b/contracts/proxy-ocr2/schema/raw/response_to_latest_round_data.json new file mode 100644 index 000000000..553c1420a --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_latest_round_data.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_owner.json b/contracts/proxy-ocr2/schema/raw/response_to_owner.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_owner.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_phase_aggregators.json b/contracts/proxy-ocr2/schema/raw/response_to_phase_aggregators.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_phase_aggregators.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_phase_id.json b/contracts/proxy-ocr2/schema/raw/response_to_phase_id.json new file mode 100644 index 000000000..05fca26ae --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_phase_id.json @@ -0,0 +1,7 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "uint16", + "type": "integer", + "format": "uint16", + "minimum": 0.0 +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_proposed_aggregator.json b/contracts/proxy-ocr2/schema/raw/response_to_proposed_aggregator.json new file mode 100644 index 000000000..4c7f1934d --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_proposed_aggregator.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_proposed_latest_round_data.json b/contracts/proxy-ocr2/schema/raw/response_to_proposed_latest_round_data.json new file mode 100644 index 000000000..553c1420a --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_proposed_latest_round_data.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_proposed_round_data.json b/contracts/proxy-ocr2/schema/raw/response_to_proposed_round_data.json new file mode 100644 index 000000000..553c1420a --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_proposed_round_data.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_round_data.json b/contracts/proxy-ocr2/schema/raw/response_to_round_data.json new file mode 100644 index 000000000..553c1420a --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_round_data.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Round", + "type": "object", + "required": [ + "answer", + "observations_timestamp", + "round_id", + "transmission_timestamp" + ], + "properties": { + "answer": { + "type": "string" + }, + "observations_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "round_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "transmission_timestamp": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/contracts/proxy-ocr2/schema/raw/response_to_version.json b/contracts/proxy-ocr2/schema/raw/response_to_version.json new file mode 100644 index 000000000..f689acebf --- /dev/null +++ b/contracts/proxy-ocr2/schema/raw/response_to_version.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "String", + "type": "string" +} diff --git a/contracts/proxy-ocr2/src/lib.rs b/contracts/proxy-ocr2/src/lib.rs index 928d21414..10d84781c 100644 --- a/contracts/proxy-ocr2/src/lib.rs +++ b/contracts/proxy-ocr2/src/lib.rs @@ -1,17 +1,17 @@ mod integration_tests; +use cosmwasm_schema::QueryResponses; use cosmwasm_std::{ entry_point, to_binary, Addr, Deps, DepsMut, Empty, Env, Event, MessageInfo, QueryResponse, Response, StdError, }; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; use cw_storage_plus::{Item, Map}; use thiserror::Error; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - use owned::Auth; #[derive(Error, Debug)] @@ -61,6 +61,7 @@ pub mod msg { use super::*; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] + #[serde(rename_all = "snake_case")] pub struct InstantiateMsg { pub contract_address: String, } @@ -84,24 +85,33 @@ pub mod msg { AcceptOwnership, } - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] + #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)] #[serde(rename_all = "snake_case")] pub enum QueryMsg { - Decimals, - Version, - Description, - + #[returns(u8)] + Decimals {}, + #[returns(str)] + Version {}, + #[returns(str)] + Description {}, + #[returns(ocr2::state::Round)] RoundData { round_id: u64 }, - LatestRoundData, + #[returns(ocr2::state::Round)] + LatestRoundData {}, + #[returns(ocr2::state::Round)] ProposedRoundData { round_id: u32 }, - ProposedLatestRoundData, - - Aggregator, - PhaseId, + #[returns(ocr2::state::Round)] + ProposedLatestRoundData {}, + #[returns(Addr)] + Aggregator {}, + #[returns(u16)] + PhaseId {}, + #[returns(Addr)] PhaseAggregators { phase_id: u16 }, - ProposedAggregator, - - Owner, + #[returns(Addr)] + ProposedAggregator {}, + #[returns(Addr)] + Owner {}, } } @@ -198,25 +208,25 @@ pub fn execute( #[entry_point] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { match msg { - QueryMsg::Decimals => { + QueryMsg::Decimals {} => { let contract_address = CURRENT_PHASE.load(deps.storage)?.contract_address; let decimals: u8 = deps .querier - .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::Decimals)?; + .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::Decimals {})?; Ok(to_binary(&decimals)?) } - QueryMsg::Version => { + QueryMsg::Version {} => { let contract_address = CURRENT_PHASE.load(deps.storage)?.contract_address; let version: String = deps .querier - .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::Version)?; + .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::Version {})?; Ok(to_binary(&version)?) } - QueryMsg::Description => { + QueryMsg::Description {} => { let contract_address = CURRENT_PHASE.load(deps.storage)?.contract_address; let description: String = deps .querier - .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::Description)?; + .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::Description {})?; Ok(to_binary(&description)?) } QueryMsg::RoundData { round_id } => { @@ -229,11 +239,11 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { + QueryMsg::LatestRoundData {} => { let phase = CURRENT_PHASE.load(deps.storage)?; let round: ocr2::state::Round = deps.querier.query_wasm_smart( phase.contract_address, - &ocr2::msg::QueryMsg::LatestRoundData, + &ocr2::msg::QueryMsg::LatestRoundData {}, )?; Ok(to_binary(&with_phase_id(round, phase.id))?) } @@ -245,30 +255,30 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { + QueryMsg::ProposedLatestRoundData {} => { let contract_address = PROPOSED_CONTRACT.load(deps.storage)?; let round: ocr2::state::Round = deps .querier - .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::LatestRoundData)?; + .query_wasm_smart(contract_address, &ocr2::msg::QueryMsg::LatestRoundData {})?; Ok(to_binary(&round)?) } - QueryMsg::Aggregator => { - let contract_address = CURRENT_PHASE.load(deps.storage)?.contract_address; + QueryMsg::Aggregator {} => { + let contract_address: Addr = CURRENT_PHASE.load(deps.storage)?.contract_address; Ok(to_binary(&contract_address)?) } - QueryMsg::PhaseId => { - let phase_id = CURRENT_PHASE.load(deps.storage)?.id; + QueryMsg::PhaseId {} => { + let phase_id: u16 = CURRENT_PHASE.load(deps.storage)?.id; Ok(to_binary(&phase_id)?) } QueryMsg::PhaseAggregators { phase_id } => { let contract_address = PHASES.load(deps.storage, phase_id)?; Ok(to_binary(&contract_address)?) } - QueryMsg::ProposedAggregator => { + QueryMsg::ProposedAggregator {} => { let contract_address = PROPOSED_CONTRACT.load(deps.storage)?; Ok(to_binary(&contract_address)?) } - QueryMsg::Owner => Ok(to_binary(&OWNER.query_owner(deps)?)?), + QueryMsg::Owner {} => Ok(to_binary(&OWNER.query_owner(deps)?)?), } } From 9d68cd9820d81580274e5f14dd42c7ad94fc6662 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Mon, 21 Aug 2023 06:05:15 -0700 Subject: [PATCH 2/5] add the cw-plus schema changes --- .gitignore | 2 +- .../contracts/cw20_base/schema/cw20-base.json | 1375 +++++++ .../{ => raw}/all_accounts_response.json | 0 .../{ => raw}/all_allowances_response.json | 0 .../schema/{ => raw}/allowance_response.json | 0 .../schema/{ => raw}/balance_response.json | 0 .../execute.json} | 0 .../instantiate.json} | 0 .../schema/{query_msg.json => raw/query.json} | 0 .../schema/{ => raw}/token_info_response.json | 0 .../schema/cw3-flex-multisig.json | 3435 +++++++++++++++++ .../{execute_msg.json => raw/execute.json} | 0 .../instantiate.json} | 0 .../schema/{query_msg.json => raw/query.json} | 0 .../contracts/cw4_group/schema/cw4-group.json | 395 ++ .../schema/{ => raw}/admin_response.json | 0 .../{execute_msg.json => raw/execute.json} | 0 .../instantiate.json} | 0 .../{ => raw}/member_list_response.json | 0 .../schema/{ => raw}/member_response.json | 0 .../schema/{query_msg.json => raw/query.json} | 0 .../{ => raw}/total_weight_response.json | 0 .../gauntlet-cosmos-cw-plus/package.json | 2 +- 23 files changed, 5207 insertions(+), 2 deletions(-) create mode 100644 packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/cw20-base.json rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{ => raw}/all_accounts_response.json (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{ => raw}/all_allowances_response.json (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{ => raw}/allowance_response.json (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{ => raw}/balance_response.json (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{cw20_execute_msg.json => raw/execute.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{instantiate_msg.json => raw/instantiate.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{query_msg.json => raw/query.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/{ => raw}/token_info_response.json (100%) create mode 100644 packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/cw3-flex-multisig.json rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/{execute_msg.json => raw/execute.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/{instantiate_msg.json => raw/instantiate.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/{query_msg.json => raw/query.json} (100%) create mode 100644 packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/cw4-group.json rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/{ => raw}/admin_response.json (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/{execute_msg.json => raw/execute.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/{instantiate_msg.json => raw/instantiate.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/{ => raw}/member_list_response.json (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/{ => raw}/member_response.json (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/{query_msg.json => raw/query.json} (100%) rename packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/{ => raw}/total_weight_response.json (100%) diff --git a/.gitignore b/.gitignore index 99730203c..097294d40 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,6 @@ integration-tests/logs integration-tests/smoke/logs integration-tests/soak/logs tmp-manifest-* -artifacts +/artifacts .local-mock-server diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/cw20-base.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/cw20-base.json new file mode 100644 index 000000000..2cd3061ea --- /dev/null +++ b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/cw20-base.json @@ -0,0 +1,1375 @@ +{ + "contract_name": "cw20-base", + "contract_version": "0.16.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "decimals", + "initial_balances", + "name", + "symbol" + ], + "properties": { + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "initial_balances": { + "type": "array", + "items": { + "$ref": "#/definitions/Cw20Coin" + } + }, + "marketing": { + "anyOf": [ + { + "$ref": "#/definitions/InstantiateMarketingInfo" + }, + { + "type": "null" + } + ] + }, + "mint": { + "anyOf": [ + { + "$ref": "#/definitions/MinterResponse" + }, + { + "type": "null" + } + ] + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + }, + "additionalProperties": false, + "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", + "type": "string" + }, + "Cw20Coin": { + "type": "object", + "required": [ + "address", + "amount" + ], + "properties": { + "address": { + "type": "string" + }, + "amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + }, + "EmbeddedLogo": { + "description": "This is used to store the logo on the blockchain in an accepted format. Enforce maximum size of 5KB on all variants.", + "oneOf": [ + { + "description": "Store the Logo as an SVG file. The content must conform to the spec at https://en.wikipedia.org/wiki/Scalable_Vector_Graphics (The contract should do some light-weight sanity-check validation)", + "type": "object", + "required": [ + "svg" + ], + "properties": { + "svg": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + }, + { + "description": "Store the Logo as a PNG file. This will likely only support up to 64x64 or so within the 5KB limit.", + "type": "object", + "required": [ + "png" + ], + "properties": { + "png": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + } + ] + }, + "InstantiateMarketingInfo": { + "type": "object", + "properties": { + "description": { + "type": [ + "string", + "null" + ] + }, + "logo": { + "anyOf": [ + { + "$ref": "#/definitions/Logo" + }, + { + "type": "null" + } + ] + }, + "marketing": { + "type": [ + "string", + "null" + ] + }, + "project": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "Logo": { + "description": "This is used for uploading logo data, or setting it in InstantiateData", + "oneOf": [ + { + "description": "A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL.", + "type": "object", + "required": [ + "url" + ], + "properties": { + "url": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "description": "Logo content stored on the blockchain. Enforce maximum size of 5KB on all variants", + "type": "object", + "required": [ + "embedded" + ], + "properties": { + "embedded": { + "$ref": "#/definitions/EmbeddedLogo" + } + }, + "additionalProperties": false + } + ] + }, + "MinterResponse": { + "type": "object", + "required": [ + "minter" + ], + "properties": { + "cap": { + "description": "cap is a hard cap on total supply that can be achieved by minting. Note that this refers to total_supply. If None, there is unlimited cap.", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "minter": { + "type": "string" + } + }, + "additionalProperties": false + }, + "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" + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Transfer is a base message to move tokens to another account without triggering actions", + "type": "object", + "required": [ + "transfer" + ], + "properties": { + "transfer": { + "type": "object", + "required": [ + "amount", + "recipient" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "recipient": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Burn is a base message to destroy tokens forever", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Send is a base message to transfer tokens to a contract and trigger an action on the receiving contract.", + "type": "object", + "required": [ + "send" + ], + "properties": { + "send": { + "type": "object", + "required": [ + "amount", + "contract", + "msg" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "contract": { + "type": "string" + }, + "msg": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"approval\" extension. Allows spender to access an additional amount tokens from the owner's (env.sender) account. If expires is Some(), overwrites current allowance expiration with this one.", + "type": "object", + "required": [ + "increase_allowance" + ], + "properties": { + "increase_allowance": { + "type": "object", + "required": [ + "amount", + "spender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "expires": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "spender": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"approval\" extension. Lowers the spender's access of tokens from the owner's (env.sender) account by amount. If expires is Some(), overwrites current allowance expiration with this one.", + "type": "object", + "required": [ + "decrease_allowance" + ], + "properties": { + "decrease_allowance": { + "type": "object", + "required": [ + "amount", + "spender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "expires": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "spender": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"approval\" extension. Transfers amount tokens from owner -> recipient if `env.sender` has sufficient pre-approval.", + "type": "object", + "required": [ + "transfer_from" + ], + "properties": { + "transfer_from": { + "type": "object", + "required": [ + "amount", + "owner", + "recipient" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "owner": { + "type": "string" + }, + "recipient": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"approval\" extension. Sends amount tokens from owner -> contract if `env.sender` has sufficient pre-approval.", + "type": "object", + "required": [ + "send_from" + ], + "properties": { + "send_from": { + "type": "object", + "required": [ + "amount", + "contract", + "msg", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "contract": { + "type": "string" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"approval\" extension. Destroys tokens forever", + "type": "object", + "required": [ + "burn_from" + ], + "properties": { + "burn_from": { + "type": "object", + "required": [ + "amount", + "owner" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with the \"mintable\" extension. If authorized, creates amount new tokens and adds to the recipient balance.", + "type": "object", + "required": [ + "mint" + ], + "properties": { + "mint": { + "type": "object", + "required": [ + "amount", + "recipient" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "recipient": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with the \"mintable\" extension. The current minter may set a new minter. Setting the minter to None will remove the token's minter forever.", + "type": "object", + "required": [ + "update_minter" + ], + "properties": { + "update_minter": { + "type": "object", + "properties": { + "new_minter": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with the \"marketing\" extension. If authorized, updates marketing metadata. Setting None/null for any of these will leave it unchanged. Setting Some(\"\") will clear this field on the contract storage", + "type": "object", + "required": [ + "update_marketing" + ], + "properties": { + "update_marketing": { + "type": "object", + "properties": { + "description": { + "description": "A longer description of the token and it's utility. Designed for tooltips or such", + "type": [ + "string", + "null" + ] + }, + "marketing": { + "description": "The address (if any) who can update this data structure", + "type": [ + "string", + "null" + ] + }, + "project": { + "description": "A URL pointing to the project behind this token.", + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "If set as the \"marketing\" role on the contract, upload a new URL, SVG, or PNG for the token", + "type": "object", + "required": [ + "upload_logo" + ], + "properties": { + "upload_logo": { + "$ref": "#/definitions/Logo" + } + }, + "additionalProperties": false + } + ], + "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", + "type": "string" + }, + "EmbeddedLogo": { + "description": "This is used to store the logo on the blockchain in an accepted format. Enforce maximum size of 5KB on all variants.", + "oneOf": [ + { + "description": "Store the Logo as an SVG file. The content must conform to the spec at https://en.wikipedia.org/wiki/Scalable_Vector_Graphics (The contract should do some light-weight sanity-check validation)", + "type": "object", + "required": [ + "svg" + ], + "properties": { + "svg": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + }, + { + "description": "Store the Logo as a PNG file. This will likely only support up to 64x64 or so within the 5KB limit.", + "type": "object", + "required": [ + "png" + ], + "properties": { + "png": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + } + ] + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Logo": { + "description": "This is used for uploading logo data, or setting it in InstantiateData", + "oneOf": [ + { + "description": "A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL.", + "type": "object", + "required": [ + "url" + ], + "properties": { + "url": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "description": "Logo content stored on the blockchain. Enforce maximum size of 5KB on all variants", + "type": "object", + "required": [ + "embedded" + ], + "properties": { + "embedded": { + "$ref": "#/definitions/EmbeddedLogo" + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "description": "Returns the current balance of the given address, 0 if unset.", + "type": "object", + "required": [ + "balance" + ], + "properties": { + "balance": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns metadata on the contract - name, decimals, supply, etc.", + "type": "object", + "required": [ + "token_info" + ], + "properties": { + "token_info": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"mintable\" extension. Returns who can mint and the hard cap on maximum tokens after minting.", + "type": "object", + "required": [ + "minter" + ], + "properties": { + "minter": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"allowance\" extension. Returns how much spender can use from owner account, 0 if unset.", + "type": "object", + "required": [ + "allowance" + ], + "properties": { + "allowance": { + "type": "object", + "required": [ + "owner", + "spender" + ], + "properties": { + "owner": { + "type": "string" + }, + "spender": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"enumerable\" extension (and \"allowances\") Returns all allowances this owner has approved. Supports pagination.", + "type": "object", + "required": [ + "all_allowances" + ], + "properties": { + "all_allowances": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"enumerable\" extension (and \"allowances\") Returns all allowances this spender has been granted. Supports pagination.", + "type": "object", + "required": [ + "all_spender_allowances" + ], + "properties": { + "all_spender_allowances": { + "type": "object", + "required": [ + "spender" + ], + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "spender": { + "type": "string" + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"enumerable\" extension Returns all accounts that have balances. Supports pagination.", + "type": "object", + "required": [ + "all_accounts" + ], + "properties": { + "all_accounts": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"marketing\" extension Returns more metadata on the contract to display in the client: - description, logo, project url, etc.", + "type": "object", + "required": [ + "marketing_info" + ], + "properties": { + "marketing_info": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Only with \"marketing\" extension Downloads the embedded logo data (if stored on chain). Errors if no logo data is stored for this contract.", + "type": "object", + "required": [ + "download_logo" + ], + "properties": { + "download_logo": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "all_accounts": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllAccountsResponse", + "type": "object", + "required": [ + "accounts" + ], + "properties": { + "accounts": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "all_allowances": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllAllowancesResponse", + "type": "object", + "required": [ + "allowances" + ], + "properties": { + "allowances": { + "type": "array", + "items": { + "$ref": "#/definitions/AllowanceInfo" + } + } + }, + "definitions": { + "AllowanceInfo": { + "type": "object", + "required": [ + "allowance", + "expires", + "spender" + ], + "properties": { + "allowance": { + "$ref": "#/definitions/Uint128" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "spender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } + }, + "all_spender_allowances": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllSpenderAllowancesResponse", + "type": "object", + "required": [ + "allowances" + ], + "properties": { + "allowances": { + "type": "array", + "items": { + "$ref": "#/definitions/SpenderAllowanceInfo" + } + } + }, + "definitions": { + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "SpenderAllowanceInfo": { + "type": "object", + "required": [ + "allowance", + "expires", + "owner" + ], + "properties": { + "allowance": { + "$ref": "#/definitions/Uint128" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "owner": { + "type": "string" + } + }, + "additionalProperties": false + }, + "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" + } + } + }, + "allowance": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllowanceResponse", + "type": "object", + "required": [ + "allowance", + "expires" + ], + "properties": { + "allowance": { + "$ref": "#/definitions/Uint128" + }, + "expires": { + "$ref": "#/definitions/Expiration" + } + }, + "definitions": { + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } + }, + "balance": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "BalanceResponse", + "type": "object", + "required": [ + "balance" + ], + "properties": { + "balance": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false, + "definitions": { + "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" + } + } + }, + "download_logo": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DownloadLogoResponse", + "description": "When we download an embedded logo, we get this response type. We expect a SPA to be able to accept this info and display it.", + "type": "object", + "required": [ + "data", + "mime_type" + ], + "properties": { + "data": { + "$ref": "#/definitions/Binary" + }, + "mime_type": { + "type": "string" + } + }, + "additionalProperties": false, + "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", + "type": "string" + } + } + }, + "marketing_info": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MarketingInfoResponse", + "type": "object", + "properties": { + "description": { + "description": "A longer description of the token and it's utility. Designed for tooltips or such", + "type": [ + "string", + "null" + ] + }, + "logo": { + "description": "A link to the logo, or a comment there is an on-chain logo stored", + "anyOf": [ + { + "$ref": "#/definitions/LogoInfo" + }, + { + "type": "null" + } + ] + }, + "marketing": { + "description": "The address (if any) who can update this data structure", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + }, + "project": { + "description": "A URL pointing to the project behind this token.", + "type": [ + "string", + "null" + ] + } + }, + "definitions": { + "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" + }, + "LogoInfo": { + "description": "This is used to display logo info, provide a link or inform there is one that can be downloaded from the blockchain itself", + "oneOf": [ + { + "type": "string", + "enum": [ + "embedded" + ] + }, + { + "description": "A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL.", + "type": "object", + "required": [ + "url" + ], + "properties": { + "url": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + } + }, + "minter": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MinterResponse", + "type": "object", + "required": [ + "minter" + ], + "properties": { + "cap": { + "description": "cap is a hard cap on total supply that can be achieved by minting. Note that this refers to total_supply. If None, there is unlimited cap.", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "minter": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "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" + } + } + }, + "token_info": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TokenInfoResponse", + "type": "object", + "required": [ + "decimals", + "name", + "symbol", + "total_supply" + ], + "properties": { + "decimals": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + }, + "total_supply": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false, + "definitions": { + "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" + } + } + } + } +} diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/all_accounts_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/all_accounts_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/all_accounts_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/all_accounts_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/all_allowances_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/all_allowances_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/all_allowances_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/all_allowances_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/allowance_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/allowance_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/allowance_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/allowance_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/balance_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/balance_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/balance_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/balance_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/cw20_execute_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/execute.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/cw20_execute_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/execute.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/instantiate_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/instantiate.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/instantiate_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/instantiate.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/query_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/query.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/query_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/query.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/token_info_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/token_info_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/token_info_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw20_base/schema/raw/token_info_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/cw3-flex-multisig.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/cw3-flex-multisig.json new file mode 100644 index 000000000..822b085a5 --- /dev/null +++ b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/cw3-flex-multisig.json @@ -0,0 +1,3435 @@ +{ + "contract_name": "cw3-flex-multisig", + "contract_version": "0.16.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "group_addr", + "max_voting_period", + "threshold" + ], + "properties": { + "executor": { + "anyOf": [ + { + "$ref": "#/definitions/Executor" + }, + { + "type": "null" + } + ] + }, + "group_addr": { + "type": "string" + }, + "max_voting_period": { + "$ref": "#/definitions/Duration" + }, + "threshold": { + "$ref": "#/definitions/Threshold" + } + }, + "additionalProperties": false, + "definitions": { + "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" + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "Duration": { + "description": "Duration is a delta of time. You can add it to a BlockInfo or Expiration to move that further in the future. Note that an height-based Duration and a time-based Expiration cannot be combined", + "oneOf": [ + { + "type": "object", + "required": [ + "height" + ], + "properties": { + "height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "Time in seconds", + "type": "object", + "required": [ + "time" + ], + "properties": { + "time": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + ] + }, + "Executor": { + "description": "Defines who is able to execute proposals once passed", + "oneOf": [ + { + "type": "string", + "enum": [ + "member" + ] + }, + { + "description": "Only the given address", + "type": "object", + "required": [ + "only" + ], + "properties": { + "only": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + ] + }, + "Threshold": { + "description": "This defines the different ways tallies can happen.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation). See also `ThresholdResponse` in the cw3 spec.", + "oneOf": [ + { + "description": "Declares that a fixed weight of Yes votes is needed to pass. See `ThresholdResponse.AbsoluteCount` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes in order for a proposal to pass. See `ThresholdResponse.AbsolutePercentage` in the cw3 spec for details.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. See `ThresholdResponse.ThresholdQuorum` in the cw3 spec for details.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "propose" + ], + "properties": { + "propose": { + "type": "object", + "required": [ + "description", + "msgs", + "title" + ], + "properties": { + "description": { + "type": "string" + }, + "latest": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "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/Vote" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "execute" + ], + "properties": { + "execute": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "close" + ], + "properties": { + "close": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Handles update hook messages from the group contract", + "type": "object", + "required": [ + "member_changed_hook" + ], + "properties": { + "member_changed_hook": { + "$ref": "#/definitions/MemberChangedHookMsg" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "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", + "type": "string" + }, + "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 + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + } + ] + }, + "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" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "MemberChangedHookMsg": { + "description": "MemberChangedHookMsg should be de/serialized under `MemberChangedHook()` variant in a ExecuteMsg. This contains a list of all diffs on the given transaction.", + "type": "object", + "required": [ + "diffs" + ], + "properties": { + "diffs": { + "type": "array", + "items": { + "$ref": "#/definitions/MemberDiff" + } + } + }, + "additionalProperties": false + }, + "MemberDiff": { + "description": "MemberDiff shows the old and new states for a given cw4 member They cannot both be None. old = None, new = Some -> Insert old = Some, new = Some -> Update old = Some, new = None -> Delete", + "type": "object", + "required": [ + "key" + ], + "properties": { + "key": { + "type": "string" + }, + "new": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + }, + "old": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "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 + } + ] + }, + "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" + }, + "Vote": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "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 + } + ] + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "threshold" + ], + "properties": { + "threshold": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "proposal" + ], + "properties": { + "proposal": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_proposals" + ], + "properties": { + "list_proposals": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "reverse_proposals" + ], + "properties": { + "reverse_proposals": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_before": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "vote" + ], + "properties": { + "vote": { + "type": "object", + "required": [ + "proposal_id", + "voter" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "voter": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_votes" + ], + "properties": { + "list_votes": { + "type": "object", + "required": [ + "proposal_id" + ], + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "voter" + ], + "properties": { + "voter": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_voters" + ], + "properties": { + "list_voters": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "list_proposals": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalListResponse_for_Empty", + "type": "object", + "required": [ + "proposals" + ], + "properties": { + "proposals": { + "type": "array", + "items": { + "$ref": "#/definitions/ProposalResponse_for_Empty" + } + } + }, + "additionalProperties": false, + "definitions": { + "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", + "type": "string" + }, + "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 + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "ProposalResponse_for_Empty": { + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "status", + "threshold", + "title" + ], + "properties": { + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + }, + "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": { + "type": "string", + "enum": [ + "pending", + "open", + "rejected", + "passed", + "executed" + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + }, + "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 + } + ] + } + } + }, + "list_voters": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoterListResponse", + "type": "object", + "required": [ + "voters" + ], + "properties": { + "voters": { + "type": "array", + "items": { + "$ref": "#/definitions/VoterDetail" + } + } + }, + "additionalProperties": false, + "definitions": { + "VoterDetail": { + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "list_votes": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoteListResponse", + "type": "object", + "required": [ + "votes" + ], + "properties": { + "votes": { + "type": "array", + "items": { + "$ref": "#/definitions/VoteInfo" + } + } + }, + "additionalProperties": false, + "definitions": { + "Vote": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "veto" + ] + }, + "VoteInfo": { + "description": "Returns the vote (opinion as well as weight counted) as well as the address of the voter who submitted it", + "type": "object", + "required": [ + "proposal_id", + "vote", + "voter", + "weight" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + }, + "voter": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "proposal": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalResponse_for_Empty", + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "status", + "threshold", + "title" + ], + "properties": { + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false, + "definitions": { + "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", + "type": "string" + }, + "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 + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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": { + "type": "string", + "enum": [ + "pending", + "open", + "rejected", + "passed", + "executed" + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + }, + "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 + } + ] + } + } + }, + "reverse_proposals": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ProposalListResponse_for_Empty", + "type": "object", + "required": [ + "proposals" + ], + "properties": { + "proposals": { + "type": "array", + "items": { + "$ref": "#/definitions/ProposalResponse_for_Empty" + } + } + }, + "additionalProperties": false, + "definitions": { + "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", + "type": "string" + }, + "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 + }, + { + "type": "object", + "required": [ + "wasm" + ], + "properties": { + "wasm": { + "$ref": "#/definitions/WasmMsg" + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "ProposalResponse_for_Empty": { + "description": "Note, if you are storing custom messages in the proposal, the querier needs to know what possible custom message types those are in order to parse the response", + "type": "object", + "required": [ + "description", + "expires", + "id", + "msgs", + "status", + "threshold", + "title" + ], + "properties": { + "description": { + "type": "string" + }, + "expires": { + "$ref": "#/definitions/Expiration" + }, + "id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "msgs": { + "type": "array", + "items": { + "$ref": "#/definitions/CosmosMsg_for_Empty" + } + }, + "status": { + "$ref": "#/definitions/Status" + }, + "threshold": { + "description": "This is the threshold that is applied to this proposal. Both the rules of the voting contract, as well as the total_weight of the voting group may have changed since this time. That means that the generic `Threshold{}` query does not provide valid information for existing proposals.", + "allOf": [ + { + "$ref": "#/definitions/ThresholdResponse" + } + ] + }, + "title": { + "type": "string" + } + }, + "additionalProperties": false + }, + "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": { + "type": "string", + "enum": [ + "pending", + "open", + "rejected", + "passed", + "executed" + ] + }, + "ThresholdResponse": { + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + }, + "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 + } + ] + } + } + }, + "threshold": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ThresholdResponse", + "description": "This defines the different ways tallies can happen. Every contract should support a subset of these, ideally all.\n\nThe total_weight used for calculating success as well as the weights of each individual voter used in tallying should be snapshotted at the beginning of the block at which the proposal starts (this is likely the responsibility of a correct cw4 implementation).", + "oneOf": [ + { + "description": "Declares that a fixed weight of yes votes is needed to pass. It does not matter how many no votes are cast, or how many do not vote, as long as `weight` yes votes are cast.\n\nThis is the simplest format and usually suitable for small multisigs of trusted parties, like 3 of 5. (weight: 3, total_weight: 5)\n\nA proposal of this type can pass early as soon as the needed weight of yes votes has been cast.", + "type": "object", + "required": [ + "absolute_count" + ], + "properties": { + "absolute_count": { + "type": "object", + "required": [ + "total_weight", + "weight" + ], + "properties": { + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Declares a percentage of the total weight that must cast Yes votes, in order for a proposal to pass. The passing weight is computed over the total weight minus the weight of the abstained votes.\n\nThis is useful for similar circumstances as `AbsoluteCount`, where we have a relatively small set of voters, and participation is required. It is understood that if the voting set (group) changes between different proposals that refer to the same group, each proposal will work with a different set of voter weights (the ones snapshotted at proposal creation), and the passing weight for each proposal will be computed based on the absolute percentage, times the total weights of the members at the time of each proposal creation.\n\nExample: we set `percentage` to 51%. Proposal 1 starts when there is a `total_weight` of 5. This will require 3 weight of Yes votes in order to pass. Later, the Proposal 2 starts but the `total_weight` of the group has increased to 9. That proposal will then automatically require 5 Yes of 9 to pass, rather than 3 yes of 9 as would be the case with `AbsoluteCount`.", + "type": "object", + "required": [ + "absolute_percentage" + ], + "properties": { + "absolute_percentage": { + "type": "object", + "required": [ + "percentage", + "total_weight" + ], + "properties": { + "percentage": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "In addition to a `threshold`, declares a `quorum` of the total votes that must participate in the election in order for the vote to be considered at all. Within the votes that were cast, it requires `threshold` votes in favor. That is calculated by ignoring the Abstain votes (they count towards `quorum`, but do not influence `threshold`). That is, we calculate `Yes / (Yes + No + Veto)` and compare it with `threshold` to consider if the proposal was passed.\n\nIt is rather difficult for a proposal of this type to pass early. That can only happen if the required quorum has been already met, and there are already enough Yes votes for the proposal to pass.\n\n30% Yes votes, 10% No votes, and 20% Abstain would pass early if quorum <= 60% (who has cast votes) and if the threshold is <= 37.5% (the remaining 40% voting no => 30% yes + 50% no). Once the voting period has passed with no additional votes, that same proposal would be considered successful if quorum <= 60% and threshold <= 75% (percent in favor if we ignore abstain votes).\n\nThis type is more common in general elections, where participation is often expected to be low, and `AbsolutePercentage` would either be too high to pass anything, or allow low percentages to pass, independently of if there was high participation in the election or not.", + "type": "object", + "required": [ + "threshold_quorum" + ], + "properties": { + "threshold_quorum": { + "type": "object", + "required": [ + "quorum", + "threshold", + "total_weight" + ], + "properties": { + "quorum": { + "$ref": "#/definitions/Decimal" + }, + "threshold": { + "$ref": "#/definitions/Decimal" + }, + "total_weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } + }, + "vote": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoteResponse", + "type": "object", + "properties": { + "vote": { + "anyOf": [ + { + "$ref": "#/definitions/VoteInfo" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "Vote": { + "type": "string", + "enum": [ + "yes", + "no", + "abstain", + "veto" + ] + }, + "VoteInfo": { + "description": "Returns the vote (opinion as well as weight counted) as well as the address of the voter who submitted it", + "type": "object", + "required": [ + "proposal_id", + "vote", + "voter", + "weight" + ], + "properties": { + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "vote": { + "$ref": "#/definitions/Vote" + }, + "voter": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "voter": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "VoterResponse", + "type": "object", + "properties": { + "weight": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/execute_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/raw/execute.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/execute_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/raw/execute.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/instantiate_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/raw/instantiate.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/instantiate_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/raw/instantiate.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/query_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/raw/query.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/query_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw3_flex_multisig/schema/raw/query.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/cw4-group.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/cw4-group.json new file mode 100644 index 000000000..3895d9a71 --- /dev/null +++ b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/cw4-group.json @@ -0,0 +1,395 @@ +{ + "contract_name": "cw4-group", + "contract_version": "0.16.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "members" + ], + "properties": { + "admin": { + "description": "The admin is the only account that can update the group state. Omit it to make the group immutable.", + "type": [ + "string", + "null" + ] + }, + "members": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + } + }, + "additionalProperties": false, + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "description": "Change the admin", + "type": "object", + "required": [ + "update_admin" + ], + "properties": { + "update_admin": { + "type": "object", + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "apply a diff to the existing members. remove is applied after add, so if an address is in both, it is removed", + "type": "object", + "required": [ + "update_members" + ], + "properties": { + "update_members": { + "type": "object", + "required": [ + "add", + "remove" + ], + "properties": { + "add": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + }, + "remove": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Add a new hook to be informed of all membership changes. Must be called by Admin", + "type": "object", + "required": [ + "add_hook" + ], + "properties": { + "add_hook": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Remove a hook. Must be called by Admin", + "type": "object", + "required": [ + "remove_hook" + ], + "properties": { + "remove_hook": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "admin" + ], + "properties": { + "admin": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "total_weight" + ], + "properties": { + "total_weight": { + "type": "object", + "properties": { + "at_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "list_members" + ], + "properties": { + "list_members": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "member" + ], + "properties": { + "member": { + "type": "object", + "required": [ + "addr" + ], + "properties": { + "addr": { + "type": "string" + }, + "at_height": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Shows all registered hooks.", + "type": "object", + "required": [ + "hooks" + ], + "properties": { + "hooks": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "migrate": null, + "sudo": null, + "responses": { + "admin": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AdminResponse", + "description": "Returned from Admin.query_admin()", + "type": "object", + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + }, + "hooks": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HooksResponse", + "type": "object", + "required": [ + "hooks" + ], + "properties": { + "hooks": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "list_members": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MemberListResponse", + "type": "object", + "required": [ + "members" + ], + "properties": { + "members": { + "type": "array", + "items": { + "$ref": "#/definitions/Member" + } + } + }, + "additionalProperties": false, + "definitions": { + "Member": { + "description": "A group member has a weight associated with them. This may all be equal, or may have meaning in the app that makes use of the group (eg. voting power)", + "type": "object", + "required": [ + "addr", + "weight" + ], + "properties": { + "addr": { + "type": "string" + }, + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } + }, + "member": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MemberResponse", + "type": "object", + "properties": { + "weight": { + "type": [ + "integer", + "null" + ], + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + "total_weight": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TotalWeightResponse", + "type": "object", + "required": [ + "weight" + ], + "properties": { + "weight": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + } +} diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/admin_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/admin_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/admin_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/admin_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/execute_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/execute.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/execute_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/execute.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/instantiate_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/instantiate.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/instantiate_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/instantiate.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/member_list_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/member_list_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/member_list_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/member_list_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/member_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/member_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/member_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/member_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/query_msg.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/query.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/query_msg.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/query.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/total_weight_response.json b/packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/total_weight_response.json similarity index 100% rename from packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/total_weight_response.json rename to packages-ts/gauntlet-cosmos-cw-plus/artifacts/contracts/cw4_group/schema/raw/total_weight_response.json diff --git a/packages-ts/gauntlet-cosmos-cw-plus/package.json b/packages-ts/gauntlet-cosmos-cw-plus/package.json index 3c5de3c57..d901928d4 100644 --- a/packages-ts/gauntlet-cosmos-cw-plus/package.json +++ b/packages-ts/gauntlet-cosmos-cw-plus/package.json @@ -21,7 +21,7 @@ "preinstall": "node ../../scripts/require-yarn.js", "gauntlet": "ts-node ./src/index.ts", "lint": "tsc", - "test": "SKIP_PROMPTS=true jest --runInBand", + "test": "SKIP_PROMPTS=true jest -runInBand --config ../../jest.config.js --selectProjects gauntlet-cosmos-cw-plus --passWithNoTests", "test:coverage": "yarn test --collectCoverage", "test:ci": "yarn test --ci", "lint:format": "yarn prettier --check ./src", From f75d8ec7717767af84d8dea4e8ca68ed4fb0b285 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Mon, 21 Aug 2023 06:23:12 -0700 Subject: [PATCH 3/5] cargo fmt --- contracts/ocr2/src/contract.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contracts/ocr2/src/contract.rs b/contracts/ocr2/src/contract.rs index 8a4541796..11cc2a618 100644 --- a/contracts/ocr2/src/contract.rs +++ b/contracts/ocr2/src/contract.rs @@ -211,7 +211,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::LatestConfigDigestAndEpoch {} => { to_binary(&query_latest_config_digest_and_epoch(deps)?) } - QueryMsg::LatestTransmissionDetails {} => to_binary(&query_latest_transmission_details(deps)?), + QueryMsg::LatestTransmissionDetails {} => { + to_binary(&query_latest_transmission_details(deps)?) + } // v3 QueryMsg::Description {} => to_binary(&query_description(deps)?), QueryMsg::Decimals {} => to_binary(&query_decimals(deps)?), @@ -221,7 +223,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { QueryMsg::LinkToken {} => to_binary(&query_link_token(deps)?), QueryMsg::Billing {} => to_binary(&query_billing(deps)?), QueryMsg::BillingAccessController {} => to_binary(&query_billing_access_controller(deps)?), - QueryMsg::RequesterAccessController {} => to_binary(&query_requester_access_controller(deps)?), + QueryMsg::RequesterAccessController {} => { + to_binary(&query_requester_access_controller(deps)?) + } QueryMsg::OwedPayment { transmitter } => to_binary(&query_owed_payment(deps, transmitter)?), QueryMsg::LinkAvailableForPayment {} => { to_binary(&query_link_available_for_payment(deps, env)?) From 4613e512461112fbb136cf4cd5579f51f305b7eb Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Mon, 21 Aug 2023 06:45:49 -0700 Subject: [PATCH 4/5] change msg type --- .../schema/access-controller.json | 6 ++-- .../access-controller/schema/raw/query.json | 6 ++-- contracts/access-controller/src/msg.rs | 6 ++-- contracts/ocr2/src/integration_tests.rs | 34 +++++++++--------- contracts/proxy-ocr2/src/integration_tests.rs | 36 +++++++++---------- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/contracts/access-controller/schema/access-controller.json b/contracts/access-controller/schema/access-controller.json index e8d8f9b95..bb9c45824 100644 --- a/contracts/access-controller/schema/access-controller.json +++ b/contracts/access-controller/schema/access-controller.json @@ -98,8 +98,7 @@ "address": { "type": "string" } - }, - "additionalProperties": false + } } }, "additionalProperties": false @@ -111,8 +110,7 @@ ], "properties": { "owner": { - "type": "object", - "additionalProperties": false + "type": "object" } }, "additionalProperties": false diff --git a/contracts/access-controller/schema/raw/query.json b/contracts/access-controller/schema/raw/query.json index e8c6aef81..b0cf422ed 100644 --- a/contracts/access-controller/schema/raw/query.json +++ b/contracts/access-controller/schema/raw/query.json @@ -17,8 +17,7 @@ "address": { "type": "string" } - }, - "additionalProperties": false + } } }, "additionalProperties": false @@ -30,8 +29,7 @@ ], "properties": { "owner": { - "type": "object", - "additionalProperties": false + "type": "object" } }, "additionalProperties": false diff --git a/contracts/access-controller/src/msg.rs b/contracts/access-controller/src/msg.rs index 4b47eff58..9635a093f 100644 --- a/contracts/access-controller/src/msg.rs +++ b/contracts/access-controller/src/msg.rs @@ -1,4 +1,4 @@ -use cosmwasm_schema::{cw_serde, QueryResponses}; +use cosmwasm_schema::QueryResponses; use cosmwasm_std::Addr; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -16,8 +16,8 @@ pub enum ExecuteMsg { AcceptOwnership, } -#[cw_serde] -#[derive(QueryResponses, Eq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)] +#[serde(rename_all = "snake_case")] pub enum QueryMsg { #[returns(bool)] HasAccess { address: String }, diff --git a/contracts/ocr2/src/integration_tests.rs b/contracts/ocr2/src/integration_tests.rs index 6b423155d..b0cabeb80 100644 --- a/contracts/ocr2/src/integration_tests.rs +++ b/contracts/ocr2/src/integration_tests.rs @@ -427,7 +427,7 @@ fn transmit_happy_path() { let config: LatestConfigDetailsResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestConfigDetails) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestConfigDetails {}) .unwrap(); assert_eq!(config.config_count, 1); @@ -437,14 +437,14 @@ fn transmit_happy_path() { let description: String = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Description) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Description {}) .unwrap(); assert_eq!(description, "ETH/USD"); let decimals: u8 = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Decimals) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Decimals {}) .unwrap(); assert_eq!(decimals, 18); @@ -465,7 +465,7 @@ fn transmit_happy_path() { let data: Round = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestRoundData) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestRoundData {}) .unwrap(); assert_eq!(data.observations_timestamp, 1633364819); assert_eq!(data.transmission_timestamp, 1571797419); @@ -474,7 +474,7 @@ fn transmit_happy_path() { let response: LatestTransmissionDetailsResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestTransmissionDetails) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestTransmissionDetails {}) .unwrap(); assert_eq!(response.round, 1); assert_eq!(response.latest_timestamp, data.transmission_timestamp); @@ -506,7 +506,7 @@ fn transmit_happy_path() { let available: LinkAvailableForPaymentResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment {}) .unwrap(); assert_eq!( @@ -557,7 +557,7 @@ fn transmit_happy_path() { let available: LinkAvailableForPaymentResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment {}) .unwrap(); assert_eq!( @@ -693,7 +693,7 @@ fn transmit_happy_path() { let available: LinkAvailableForPaymentResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment {}) .unwrap(); assert_eq!( @@ -739,7 +739,7 @@ fn set_link_token() { let config: LatestConfigDetailsResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestConfigDetails) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestConfigDetails {}) .unwrap(); assert_eq!(config.config_count, 1); @@ -749,14 +749,14 @@ fn set_link_token() { let description: String = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Description) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Description {}) .unwrap(); assert_eq!(description, "ETH/USD"); let decimals: u8 = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Decimals) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::Decimals {}) .unwrap(); assert_eq!(decimals, 18); @@ -768,7 +768,7 @@ fn set_link_token() { let data: Round = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestRoundData) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestRoundData {}) .unwrap(); assert_eq!(data.observations_timestamp, 1633364819); assert_eq!(data.transmission_timestamp, 1571797419); @@ -777,7 +777,7 @@ fn set_link_token() { let response: LatestTransmissionDetailsResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestTransmissionDetails) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestTransmissionDetails {}) .unwrap(); assert_eq!(response.round, 1); assert_eq!(response.latest_timestamp, data.transmission_timestamp); @@ -889,7 +889,7 @@ fn set_link_token() { let token_addr: Addr = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkToken) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkToken {}) .unwrap(); assert_eq!(token_addr, new_link_token); } @@ -918,7 +918,7 @@ fn revert_payouts_correctly() { let available: LinkAvailableForPaymentResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment {}) .unwrap(); let msg = ExecuteMsg::WithdrawFunds { recipient: env.owner.to_string(), @@ -930,7 +930,7 @@ fn revert_payouts_correctly() { let available: LinkAvailableForPaymentResponse = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LinkAvailableForPayment {}) .unwrap(); assert_eq!(0, available.amount); @@ -1137,7 +1137,7 @@ fn transmit_failing_validation() { let round: Round = env .router .wrap() - .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestRoundData) + .query_wasm_smart(&env.ocr2_addr, &QueryMsg::LatestRoundData {}) .unwrap(); assert_eq!(round.round_id, 2); assert_eq!(round.answer, 1000); diff --git a/contracts/proxy-ocr2/src/integration_tests.rs b/contracts/proxy-ocr2/src/integration_tests.rs index bbc513f71..92193ad98 100644 --- a/contracts/proxy-ocr2/src/integration_tests.rs +++ b/contracts/proxy-ocr2/src/integration_tests.rs @@ -73,14 +73,14 @@ mod mock { let round = ROUNDS.load(deps.storage, round_id)?; to_binary(&round) } - QueryMsg::LatestRoundData => { + QueryMsg::LatestRoundData {} => { let latest_round = LATEST_ROUND.load(deps.storage)?; let round = ROUNDS.load(deps.storage, latest_round)?; to_binary(&round) } - QueryMsg::Decimals => to_binary(&DECIMALS), - QueryMsg::Version => to_binary(&VERSION), - QueryMsg::Description => to_binary(&NAME.to_string()), + QueryMsg::Decimals {} => to_binary(&DECIMALS), + QueryMsg::Version {} => to_binary(&VERSION), + QueryMsg::Description {} => to_binary(&NAME.to_string()), _ => unimplemented!(), } } @@ -180,7 +180,7 @@ fn it_works() { let latest_round: Round = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::LatestRoundData) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::LatestRoundData {}) .unwrap(); assert_eq!(parse_round_id(latest_round.round_id), (1, 2)); @@ -189,7 +189,7 @@ fn it_works() { let decimal: u8 = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::Decimals) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::Decimals {}) .unwrap(); assert_eq!(decimal, mock::DECIMALS); @@ -197,7 +197,7 @@ fn it_works() { let version: String = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::Version) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::Version {}) .unwrap(); assert_eq!(version, mock::VERSION.to_string()); @@ -205,7 +205,7 @@ fn it_works() { let desc: String = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::Description) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::Description {}) .unwrap(); assert_eq!(desc, mock::NAME.to_string()); @@ -270,7 +270,7 @@ fn it_works() { let latest_round: Round = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::LatestRoundData) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::LatestRoundData {}) .unwrap(); assert_eq!(parse_round_id(latest_round.round_id), (1, 2)); @@ -278,7 +278,7 @@ fn it_works() { let proposed_latest_round: Round = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::ProposedLatestRoundData) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::ProposedLatestRoundData {}) .unwrap(); assert_eq!(proposed_latest_round.round_id, 3); @@ -300,7 +300,7 @@ fn it_works() { let old_aggregator: String = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::Aggregator) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::Aggregator {}) .unwrap(); assert_eq!(env.ocr2_addr.to_string(), old_aggregator); @@ -308,7 +308,7 @@ fn it_works() { let proposed_aggregator: String = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::ProposedAggregator) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::ProposedAggregator {}) .unwrap(); assert_eq!(ocr2_addr2.to_string(), proposed_aggregator); @@ -316,7 +316,7 @@ fn it_works() { let old_phase: u16 = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::PhaseId) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::PhaseId {}) .unwrap(); // confirm aggregator swap @@ -335,7 +335,7 @@ fn it_works() { let new_aggregator: String = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::Aggregator) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::Aggregator {}) .unwrap(); assert_ne!(old_aggregator, new_aggregator); assert_eq!(ocr2_addr2.to_string(), new_aggregator); @@ -345,7 +345,7 @@ fn it_works() { let new_phase: u16 = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::PhaseId) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::PhaseId {}) .unwrap(); assert_ne!(old_phase, new_phase); let old_phase_agg: String = env @@ -374,7 +374,7 @@ fn it_works() { let latest_round: Round = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::LatestRoundData) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::LatestRoundData {}) .unwrap(); assert_eq!(parse_round_id(latest_round.round_id), (2, 3)); @@ -396,7 +396,7 @@ fn it_works() { let old_owner: String = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::Owner) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::Owner {}) .unwrap(); let owner2 = Addr::unchecked("new_owner"); // cannot transfer if not owner @@ -458,7 +458,7 @@ fn it_works() { let new_owner: String = env .router .wrap() - .query_wasm_smart(&env.proxy_addr, &QueryMsg::Owner) + .query_wasm_smart(&env.proxy_addr, &QueryMsg::Owner {}) .unwrap(); assert_ne!(old_owner, new_owner); assert_eq!(owner2.to_string(), new_owner); From f1ff6782c60844a17ce5e27ba4024479db48cdb4 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Mon, 21 Aug 2023 06:53:52 -0700 Subject: [PATCH 5/5] fix types --- examples/hello-world/src/contract.rs | 4 ++-- examples/hello-world/src/integration_tests.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/hello-world/src/contract.rs b/examples/hello-world/src/contract.rs index 1b367d59c..5de19c7ba 100644 --- a/examples/hello-world/src/contract.rs +++ b/examples/hello-world/src/contract.rs @@ -54,7 +54,7 @@ pub fn instantiate( let decimals = deps .querier - .query_wasm_smart(&feed, &ChainlinkQueryMsg::Decimals)?; + .query_wasm_smart(&feed, &ChainlinkQueryMsg::Decimals {})?; CONFIG.save(deps.storage, &Config { feed, decimals })?; @@ -87,7 +87,7 @@ fn execute_run(deps: DepsMut, _env: Env, _info: MessageInfo) -> Result StdResult { match msg { - ChainlinkQueryMsg::Decimals => to_binary(&DECIMALS), - ChainlinkQueryMsg::LatestRoundData => to_binary(&ROUND), + ChainlinkQueryMsg::Decimals {} => to_binary(&DECIMALS), + ChainlinkQueryMsg::LatestRoundData {} => to_binary(&ROUND), _ => unimplemented!(), } }