From 8c41d2a46ecbc2d0aca4b097e4cc9556c9f2fe2b Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 12 Aug 2024 16:53:24 +0200 Subject: [PATCH 1/3] Add cosmwasm_2_2 to reflect contract --- contracts/reflect/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/reflect/Cargo.toml b/contracts/reflect/Cargo.toml index b31a20b1d5..055502444a 100644 --- a/contracts/reflect/Cargo.toml +++ b/contracts/reflect/Cargo.toml @@ -31,7 +31,7 @@ cranelift = ["cosmwasm-vm/cranelift"] [dependencies] cosmwasm-schema = { path = "../../packages/schema" } -cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["std", "staking", "stargate", "cosmwasm_2_0"] } +cosmwasm-std = { path = "../../packages/std", default-features = false, features = ["std", "staking", "stargate", "cosmwasm_2_2"] } schemars = "0.8.12" serde = { version = "1.0.103", default-features = false, features = ["derive"] } thiserror = "1.0.26" From 9bc9a0e56a7002fd1fed35b52a6c9b63c8804389 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 12 Aug 2024 17:04:18 +0200 Subject: [PATCH 2/3] Fix CI --- .circleci/config.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 492598273f..cdbddef9b5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -579,10 +579,8 @@ jobs: - restore_cache: keys: - cargocache-v2-contract_crypto_verify-rust:1.74-{{ checksum "Cargo.lock" }} - # TODO: Enable this once 2.1 has been released to crates.io - check_contract: min_version: "2.1" - skip_cosmwasm_check: true - save_cache: paths: - /usr/local/cargo/registry @@ -665,10 +663,8 @@ jobs: - restore_cache: keys: - cargocache-v2-contract_ibc_callbacks-rust:1.74-{{ checksum "Cargo.lock" }} - # TODO: Enable this once 2.1 has been released to crates.io - check_contract: min_version: "2.1" - skip_cosmwasm_check: true - save_cache: paths: - /usr/local/cargo/registry @@ -695,9 +691,9 @@ jobs: - restore_cache: keys: - cargocache-v2-contract_ibc_reflect-rust:1.74-{{ checksum "Cargo.lock" }} - # TODO: Enable this once 2.1 has been released to crates.io + # TODO: enable again once 2.2 is released - check_contract: - min_version: "2.1" + min_version: "2.2" skip_cosmwasm_check: true - save_cache: paths: @@ -809,8 +805,10 @@ jobs: - restore_cache: keys: - cargocache-v2-contract_reflect-rust:1.74-{{ checksum "Cargo.lock" }} + # TODO: enable again once 2.2 is released - check_contract: - min_version: "2.0" + min_version: "2.2" + skip_cosmwasm_check: true - save_cache: paths: - /usr/local/cargo/registry From 9731358be3f410adc36e223fb61a204e9ab05110 Mon Sep 17 00:00:00 2001 From: Christoph Otter Date: Mon, 12 Aug 2024 17:13:48 +0200 Subject: [PATCH 3/3] Update reflect schema --- contracts/reflect/schema/raw/execute.json | 167 ++++++++++++++++++ contracts/reflect/schema/raw/query.json | 28 ++++ contracts/reflect/schema/reflect.json | 195 ++++++++++++++++++++++ 3 files changed, 390 insertions(+) diff --git a/contracts/reflect/schema/raw/execute.json b/contracts/reflect/schema/raw/execute.json index 947eb3997c..56e0f3fe26 100644 --- a/contracts/reflect/schema/raw/execute.json +++ b/contracts/reflect/schema/raw/execute.json @@ -476,6 +476,47 @@ } ] }, + "IbcAcknowledgement": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + }, + "IbcFee": { + "type": "object", + "required": [ + "ack_fee", + "receive_fee", + "timeout_fee" + ], + "properties": { + "ack_fee": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "receive_fee": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "timeout_fee": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + }, + "additionalProperties": false + }, "IbcMsg": { "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", "oneOf": [ @@ -567,6 +608,45 @@ }, "additionalProperties": false }, + { + "description": "Acknowledges a packet that this contract received over IBC. This allows acknowledging a packet that was not acknowledged yet in the `ibc_packet_receive` call.", + "type": "object", + "required": [ + "write_acknowledgement" + ], + "properties": { + "write_acknowledgement": { + "type": "object", + "required": [ + "ack", + "channel_id", + "packet_sequence" + ], + "properties": { + "ack": { + "description": "The acknowledgement to send back", + "allOf": [ + { + "$ref": "#/definitions/IbcAcknowledgement" + } + ] + }, + "channel_id": { + "description": "Existing channel where the packet was received", + "type": "string" + }, + "packet_sequence": { + "description": "Sequence number of the packet that was received", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", "type": "object", @@ -588,6 +668,93 @@ } }, "additionalProperties": false + }, + { + "description": "Incentivizes the next IBC packet sent after this message with a fee. Note that this does not necessarily have to be a packet sent by this contract. The fees are taken from the contract's balance immediately and locked until the packet is handled.\n\n# Example\n\nMost commonly, you will attach this message to a response right before sending a packet using [`IbcMsg::SendPacket`] or [`IbcMsg::Transfer`].\n\n```rust # use cosmwasm_std::{IbcMsg, IbcEndpoint, IbcFee, IbcTimeout, Coin, coins, CosmosMsg, Response, Timestamp};\n\nlet incentivize = IbcMsg::PayPacketFee { port_id: \"transfer\".to_string(), channel_id: \"source-channel\".to_string(), fee: IbcFee { receive_fee: coins(100, \"token\"), ack_fee: coins(201, \"token\"), timeout_fee: coins(200, \"token\"), }, relayers: vec![], }; let transfer = IbcMsg::Transfer { channel_id: \"source-channel\".to_string(), to_address: \"receiver\".to_string(), amount: Coin::new(100u32, \"token\"), timeout: IbcTimeout::with_timestamp(Timestamp::from_nanos(0)), memo: None, };\n\n# #[cfg(feature = \"stargate\")] let _: Response = Response::new() .add_message(CosmosMsg::Ibc(incentivize)) .add_message(CosmosMsg::Ibc(transfer)); ```", + "type": "object", + "required": [ + "pay_packet_fee" + ], + "properties": { + "pay_packet_fee": { + "type": "object", + "required": [ + "channel_id", + "fee", + "port_id", + "relayers" + ], + "properties": { + "channel_id": { + "description": "The channel id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "fee": { + "$ref": "#/definitions/IbcFee" + }, + "port_id": { + "description": "The port id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "relayers": { + "description": "Allowlist of relayer addresses that can receive the fee. An empty list means that any relayer can receive the fee.\n\nThis is currently not implemented and *must* be empty.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Incentivizes the existing IBC packet with the given port, channel and sequence with a fee. Note that this does not necessarily have to be a packet sent by this contract. The fees are taken from the contract's balance immediately and locked until the packet is handled. They are added to the existing fees on the packet.", + "type": "object", + "required": [ + "pay_packet_fee_async" + ], + "properties": { + "pay_packet_fee_async": { + "type": "object", + "required": [ + "channel_id", + "fee", + "port_id", + "relayers", + "sequence" + ], + "properties": { + "channel_id": { + "description": "The channel id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "fee": { + "$ref": "#/definitions/IbcFee" + }, + "port_id": { + "description": "The port id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "relayers": { + "description": "Allowlist of relayer addresses that can receive the fee. An empty list means that any relayer can receive the fee.\n\nThis is currently not implemented and *must* be empty.", + "type": "array", + "items": { + "type": "string" + } + }, + "sequence": { + "description": "The sequence number of the packet that should be incentivized.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } ] }, diff --git a/contracts/reflect/schema/raw/query.json b/contracts/reflect/schema/raw/query.json index 10a4b0841d..1663f569e7 100644 --- a/contracts/reflect/schema/raw/query.json +++ b/contracts/reflect/schema/raw/query.json @@ -422,6 +422,34 @@ } }, "additionalProperties": false + }, + { + "description": "Queries whether the given channel supports IBC fees. If port_id is omitted, it will default to the contract's own channel. (To save a PortId{} call)\n\nReturns a `FeeEnabledChannelResponse`.", + "type": "object", + "required": [ + "fee_enabled_channel" + ], + "properties": { + "fee_enabled_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "port_id": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } ] }, diff --git a/contracts/reflect/schema/reflect.json b/contracts/reflect/schema/reflect.json index 61fc2dd641..340c1f609c 100644 --- a/contracts/reflect/schema/reflect.json +++ b/contracts/reflect/schema/reflect.json @@ -486,6 +486,47 @@ } ] }, + "IbcAcknowledgement": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + }, + "IbcFee": { + "type": "object", + "required": [ + "ack_fee", + "receive_fee", + "timeout_fee" + ], + "properties": { + "ack_fee": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "receive_fee": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "timeout_fee": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + } + }, + "additionalProperties": false + }, "IbcMsg": { "description": "These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts (contracts that directly speak the IBC protocol via 6 entry points)", "oneOf": [ @@ -577,6 +618,45 @@ }, "additionalProperties": false }, + { + "description": "Acknowledges a packet that this contract received over IBC. This allows acknowledging a packet that was not acknowledged yet in the `ibc_packet_receive` call.", + "type": "object", + "required": [ + "write_acknowledgement" + ], + "properties": { + "write_acknowledgement": { + "type": "object", + "required": [ + "ack", + "channel_id", + "packet_sequence" + ], + "properties": { + "ack": { + "description": "The acknowledgement to send back", + "allOf": [ + { + "$ref": "#/definitions/IbcAcknowledgement" + } + ] + }, + "channel_id": { + "description": "Existing channel where the packet was received", + "type": "string" + }, + "packet_sequence": { + "description": "Sequence number of the packet that was received", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, { "description": "This will close an existing channel that is owned by this contract. Port is auto-assigned to the contract's IBC port", "type": "object", @@ -598,6 +678,93 @@ } }, "additionalProperties": false + }, + { + "description": "Incentivizes the next IBC packet sent after this message with a fee. Note that this does not necessarily have to be a packet sent by this contract. The fees are taken from the contract's balance immediately and locked until the packet is handled.\n\n# Example\n\nMost commonly, you will attach this message to a response right before sending a packet using [`IbcMsg::SendPacket`] or [`IbcMsg::Transfer`].\n\n```rust # use cosmwasm_std::{IbcMsg, IbcEndpoint, IbcFee, IbcTimeout, Coin, coins, CosmosMsg, Response, Timestamp};\n\nlet incentivize = IbcMsg::PayPacketFee { port_id: \"transfer\".to_string(), channel_id: \"source-channel\".to_string(), fee: IbcFee { receive_fee: coins(100, \"token\"), ack_fee: coins(201, \"token\"), timeout_fee: coins(200, \"token\"), }, relayers: vec![], }; let transfer = IbcMsg::Transfer { channel_id: \"source-channel\".to_string(), to_address: \"receiver\".to_string(), amount: Coin::new(100u32, \"token\"), timeout: IbcTimeout::with_timestamp(Timestamp::from_nanos(0)), memo: None, };\n\n# #[cfg(feature = \"stargate\")] let _: Response = Response::new() .add_message(CosmosMsg::Ibc(incentivize)) .add_message(CosmosMsg::Ibc(transfer)); ```", + "type": "object", + "required": [ + "pay_packet_fee" + ], + "properties": { + "pay_packet_fee": { + "type": "object", + "required": [ + "channel_id", + "fee", + "port_id", + "relayers" + ], + "properties": { + "channel_id": { + "description": "The channel id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "fee": { + "$ref": "#/definitions/IbcFee" + }, + "port_id": { + "description": "The port id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "relayers": { + "description": "Allowlist of relayer addresses that can receive the fee. An empty list means that any relayer can receive the fee.\n\nThis is currently not implemented and *must* be empty.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Incentivizes the existing IBC packet with the given port, channel and sequence with a fee. Note that this does not necessarily have to be a packet sent by this contract. The fees are taken from the contract's balance immediately and locked until the packet is handled. They are added to the existing fees on the packet.", + "type": "object", + "required": [ + "pay_packet_fee_async" + ], + "properties": { + "pay_packet_fee_async": { + "type": "object", + "required": [ + "channel_id", + "fee", + "port_id", + "relayers", + "sequence" + ], + "properties": { + "channel_id": { + "description": "The channel id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "fee": { + "$ref": "#/definitions/IbcFee" + }, + "port_id": { + "description": "The port id on the chain where the packet is sent from (this chain).", + "type": "string" + }, + "relayers": { + "description": "Allowlist of relayer addresses that can receive the fee. An empty list means that any relayer can receive the fee.\n\nThis is currently not implemented and *must* be empty.", + "type": "array", + "items": { + "type": "string" + } + }, + "sequence": { + "description": "The sequence number of the packet that should be incentivized.", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } ] }, @@ -1515,6 +1682,34 @@ } }, "additionalProperties": false + }, + { + "description": "Queries whether the given channel supports IBC fees. If port_id is omitted, it will default to the contract's own channel. (To save a PortId{} call)\n\nReturns a `FeeEnabledChannelResponse`.", + "type": "object", + "required": [ + "fee_enabled_channel" + ], + "properties": { + "fee_enabled_channel": { + "type": "object", + "required": [ + "channel_id" + ], + "properties": { + "channel_id": { + "type": "string" + }, + "port_id": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false } ] },