From 25cdda4017271ff97fee481a91e67ac731b65858 Mon Sep 17 00:00:00 2001 From: Sergey Ratiashvili Date: Fri, 22 Dec 2023 13:27:02 +0100 Subject: [PATCH] feat: interceptor > puppeteer --- Cargo.lock | 12 +-- Cargo.toml | 8 +- Makefile | 8 ++ .../.cargo/config | 2 - .../interchain-interceptor-authz/README.md | 1 - .../interchain-interceptor/.cargo/config | 2 - contracts/interchain-interceptor/README.md | 1 - contracts/puppeteer-authz/.cargo/config | 2 + .../Cargo.toml | 4 +- contracts/puppeteer-authz/README.md | 1 + .../src/bin/lido-puppeteer-authz-schema.rs} | 2 +- .../src/contract.rs | 88 +++++++-------- .../src/lib.rs | 0 .../src/msg.rs | 2 +- .../src/state.rs | 2 +- contracts/puppeteer/.cargo/config | 2 + .../Cargo.toml | 38 +++---- contracts/puppeteer/README.md | 1 + .../src/bin/lido-puppeteer-schema.rs} | 2 +- .../src/contract.rs | 102 +++++++++--------- .../src/lib.rs | 0 .../src/msg.rs | 2 +- .../src/proto.rs | 0 .../src/proto/COSMOS_SDK_COMMIT | 0 .../src/proto/cosmos.base.query.v1beta1.rs | 0 .../src/proto/cosmos.base.v1beta1.rs | 0 .../src/proto/cosmos.distribution.v1beta1.rs | 0 .../cosmos.distribution.v1beta1.tonic.rs | 0 .../src/proto/cosmos_proto.rs | 0 .../liquidstaking.distribution.v1beta1.rs | 0 ...iquidstaking.distribution.v1beta1.tonic.rs | 0 .../proto/liquidstaking.staking.v1beta1.rs | 0 .../liquidstaking.staking.v1beta1.tonic.rs | 0 .../src/state.rs | 2 +- contracts/stargate-poc/Cargo.toml | 2 +- integration_tests/package.json | 4 +- .../src/generated/contractLib/index.ts | 8 +- ...erchainInterceptor.ts => lidoPuppeteer.ts} | 2 +- ...erceptorAuthz.ts => lidoPuppeteerAuthz.ts} | 2 +- ...-authz.test.ts => puppeteer-authz.test.ts} | 56 +++++----- ...{interceptor.test.ts => puppeteer.test.ts} | 18 ++-- packages/base/Cargo.toml | 2 +- .../interchain-interceptor-base/README.md | 1 - .../Cargo.toml | 2 +- packages/puppeteer-base/README.md | 1 + .../src/error.rs | 0 .../src/execute.rs | 4 +- .../src/lib.rs | 0 .../src/msg.rs | 0 .../src/query.rs | 4 +- .../src/reply.rs | 4 +- .../src/state.rs | 6 +- .../src/sudo.rs | 4 +- 53 files changed, 202 insertions(+), 202 deletions(-) delete mode 100644 contracts/interchain-interceptor-authz/.cargo/config delete mode 100644 contracts/interchain-interceptor-authz/README.md delete mode 100644 contracts/interchain-interceptor/.cargo/config delete mode 100644 contracts/interchain-interceptor/README.md create mode 100644 contracts/puppeteer-authz/.cargo/config rename contracts/{interchain-interceptor-authz => puppeteer-authz}/Cargo.toml (93%) create mode 100644 contracts/puppeteer-authz/README.md rename contracts/{interchain-interceptor/src/bin/lido-interchain-interceptor-schema.rs => puppeteer-authz/src/bin/lido-puppeteer-authz-schema.rs} (88%) rename contracts/{interchain-interceptor-authz => puppeteer-authz}/src/contract.rs (83%) rename contracts/{interchain-interceptor-authz => puppeteer-authz}/src/lib.rs (100%) rename contracts/{interchain-interceptor-authz => puppeteer-authz}/src/msg.rs (96%) rename contracts/{interchain-interceptor-authz => puppeteer-authz}/src/state.rs (95%) create mode 100644 contracts/puppeteer/.cargo/config rename contracts/{interchain-interceptor => puppeteer}/Cargo.toml (53%) create mode 100644 contracts/puppeteer/README.md rename contracts/{interchain-interceptor-authz/src/bin/lido-interchain-interceptor-authz-schema.rs => puppeteer/src/bin/lido-puppeteer-schema.rs} (86%) rename contracts/{interchain-interceptor => puppeteer}/src/contract.rs (84%) rename contracts/{interchain-interceptor => puppeteer}/src/lib.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/msg.rs (97%) rename contracts/{interchain-interceptor => puppeteer}/src/proto.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/COSMOS_SDK_COMMIT (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/cosmos.base.query.v1beta1.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/cosmos.base.v1beta1.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/cosmos.distribution.v1beta1.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/cosmos.distribution.v1beta1.tonic.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/cosmos_proto.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/liquidstaking.distribution.v1beta1.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/liquidstaking.distribution.v1beta1.tonic.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/liquidstaking.staking.v1beta1.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/proto/liquidstaking.staking.v1beta1.tonic.rs (100%) rename contracts/{interchain-interceptor => puppeteer}/src/state.rs (95%) rename integration_tests/src/generated/contractLib/{lidoInterchainInterceptor.ts => lidoPuppeteer.ts} (99%) rename integration_tests/src/generated/contractLib/{lidoInterchainInterceptorAuthz.ts => lidoPuppeteerAuthz.ts} (99%) rename integration_tests/src/testcases/{interceptor-authz.test.ts => puppeteer-authz.test.ts} (93%) rename integration_tests/src/testcases/{interceptor.test.ts => puppeteer.test.ts} (96%) delete mode 100644 packages/interchain-interceptor-base/README.md rename packages/{interchain-interceptor-base => puppeteer-base}/Cargo.toml (97%) create mode 100644 packages/puppeteer-base/README.md rename packages/{interchain-interceptor-base => puppeteer-base}/src/error.rs (100%) rename packages/{interchain-interceptor-base => puppeteer-base}/src/execute.rs (96%) rename packages/{interchain-interceptor-base => puppeteer-base}/src/lib.rs (100%) rename packages/{interchain-interceptor-base => puppeteer-base}/src/msg.rs (100%) rename packages/{interchain-interceptor-base => puppeteer-base}/src/query.rs (94%) rename packages/{interchain-interceptor-base => puppeteer-base}/src/reply.rs (93%) rename packages/{interchain-interceptor-base => puppeteer-base}/src/state.rs (93%) rename packages/{interchain-interceptor-base => puppeteer-base}/src/sudo.rs (97%) diff --git a/Cargo.lock b/Cargo.lock index c156eed8..36e3b583 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -693,7 +693,7 @@ dependencies = [ ] [[package]] -name = "lido-interchain-interceptor" +name = "lido-puppeteer" version = "1.0.0" dependencies = [ "base64", @@ -705,7 +705,7 @@ dependencies = [ "cw-storage-plus", "cw2", "cw20", - "lido-interchain-interceptor-base", + "lido-puppeteer-base", "neutron-sdk", "prost", "prost-types", @@ -717,7 +717,7 @@ dependencies = [ ] [[package]] -name = "lido-interchain-interceptor-authz" +name = "lido-puppeteer-authz" version = "1.0.0" dependencies = [ "base64", @@ -729,7 +729,7 @@ dependencies = [ "cw-storage-plus", "cw2", "cw20", - "lido-interchain-interceptor-base", + "lido-puppeteer-base", "neutron-sdk", "prost", "prost-types", @@ -741,7 +741,7 @@ dependencies = [ ] [[package]] -name = "lido-interchain-interceptor-base" +name = "lido-puppeteer-base" version = "1.0.0" dependencies = [ "base64", @@ -790,7 +790,7 @@ dependencies = [ "cw-storage-plus", "cw2", "cw20", - "lido-interchain-interceptor-base", + "lido-puppeteer-base", "neutron-sdk", "prost", "prost-types", diff --git a/Cargo.toml b/Cargo.toml index 8d8a1c1c..54f42d1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,14 +4,14 @@ members = [ "contracts/stargate-poc", "contracts/distribution", "contracts/factory", - "contracts/interchain-interceptor", - "contracts/interchain-interceptor-authz", + "contracts/puppeteer", + "contracts/puppeteer-authz", "contracts/validators-stats", "contracts/token", "contracts/validators-set", "contracts/strategy", "contracts/core", - "packages/interchain-interceptor-base", + "packages/puppeteer-base", "packages/base", ] @@ -43,7 +43,7 @@ serde-json-wasm = { version = "1.0.0" } sha2 = { version = "0.10.8" } bech32 = { version = "0.9.1" } -lido-interchain-interceptor-base = { path = "./packages/interchain-interceptor-base", default-features = false } +lido-puppeteer-base = { path = "./packages/puppeteer-base", default-features = false } lido-staking-base = { path = "./packages/base", default-features = false } thiserror = "1.0.50" diff --git a/Makefile b/Makefile index 79ef51f1..b62645a8 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,14 @@ compile: --platform linux/amd64 \ cosmwasm/workspace-optimizer:0.15.0 +compile_arm64: + @docker run --rm -v "$(CURDIR)":/code \ + --mount type=volume,source="$(notdir $(CURDIR))_cache",target=/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + --platform linux/arm64 \ + cosmwasm/workspace-optimizer-arm64:0.15.0 + @cd artifacts && for file in *-aarch64.wasm; do cp -f "$$file" "$${file%-aarch64.wasm}.wasm"; done + check_contracts: @cargo install cosmwasm-check @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron,cosmwasm_1_1,cosmwasm_1_2 artifacts/*.wasm diff --git a/contracts/interchain-interceptor-authz/.cargo/config b/contracts/interchain-interceptor-authz/.cargo/config deleted file mode 100644 index a15ba6c7..00000000 --- a/contracts/interchain-interceptor-authz/.cargo/config +++ /dev/null @@ -1,2 +0,0 @@ -[alias] -schema = "run --bin lido-interchain-interceptor-authz-schema" diff --git a/contracts/interchain-interceptor-authz/README.md b/contracts/interchain-interceptor-authz/README.md deleted file mode 100644 index 911446c5..00000000 --- a/contracts/interchain-interceptor-authz/README.md +++ /dev/null @@ -1 +0,0 @@ -# LIDO Interchain interceptor with Authz support \ No newline at end of file diff --git a/contracts/interchain-interceptor/.cargo/config b/contracts/interchain-interceptor/.cargo/config deleted file mode 100644 index 2f687060..00000000 --- a/contracts/interchain-interceptor/.cargo/config +++ /dev/null @@ -1,2 +0,0 @@ -[alias] -schema = "run --bin lido-interchain-interceptor-schema" diff --git a/contracts/interchain-interceptor/README.md b/contracts/interchain-interceptor/README.md deleted file mode 100644 index 4ac41e2e..00000000 --- a/contracts/interchain-interceptor/README.md +++ /dev/null @@ -1 +0,0 @@ -# LIDO Interchain interceptor \ No newline at end of file diff --git a/contracts/puppeteer-authz/.cargo/config b/contracts/puppeteer-authz/.cargo/config new file mode 100644 index 00000000..7a2f4192 --- /dev/null +++ b/contracts/puppeteer-authz/.cargo/config @@ -0,0 +1,2 @@ +[alias] +schema = "run --bin lido-puppeteer-authz-schema" diff --git a/contracts/interchain-interceptor-authz/Cargo.toml b/contracts/puppeteer-authz/Cargo.toml similarity index 93% rename from contracts/interchain-interceptor-authz/Cargo.toml rename to contracts/puppeteer-authz/Cargo.toml index 210b6c04..d0253094 100644 --- a/contracts/interchain-interceptor-authz/Cargo.toml +++ b/contracts/puppeteer-authz/Cargo.toml @@ -5,7 +5,7 @@ authors = [ ] description = "Contract to facilitate base interchain features with authz module usage" edition = "2021" -name = "lido-interchain-interceptor-authz" +name = "lido-puppeteer-authz" version = "1.0.0" exclude = [ @@ -43,7 +43,7 @@ schemars = { workspace = true } serde = { workspace = true } serde-json-wasm = { workspace = true } -lido-interchain-interceptor-base = { workspace = true } +lido-puppeteer-base = { workspace = true } [dev-dependencies] cosmwasm-storage = { version = "1.0" } diff --git a/contracts/puppeteer-authz/README.md b/contracts/puppeteer-authz/README.md new file mode 100644 index 00000000..da3f2341 --- /dev/null +++ b/contracts/puppeteer-authz/README.md @@ -0,0 +1 @@ +# LIDO Interchain puppeteer with Authz support \ No newline at end of file diff --git a/contracts/interchain-interceptor/src/bin/lido-interchain-interceptor-schema.rs b/contracts/puppeteer-authz/src/bin/lido-puppeteer-authz-schema.rs similarity index 88% rename from contracts/interchain-interceptor/src/bin/lido-interchain-interceptor-schema.rs rename to contracts/puppeteer-authz/src/bin/lido-puppeteer-authz-schema.rs index b9158641..acbb7a2f 100644 --- a/contracts/interchain-interceptor/src/bin/lido-interchain-interceptor-schema.rs +++ b/contracts/puppeteer-authz/src/bin/lido-puppeteer-authz-schema.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::write_api; -use lido_interchain_interceptor::{ +use lido_puppeteer_authz::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, state::QueryMsg, }; diff --git a/contracts/interchain-interceptor-authz/src/contract.rs b/contracts/puppeteer-authz/src/contract.rs similarity index 83% rename from contracts/interchain-interceptor-authz/src/contract.rs rename to contracts/puppeteer-authz/src/contract.rs index de6231dd..0b1c5329 100644 --- a/contracts/interchain-interceptor-authz/src/contract.rs +++ b/contracts/puppeteer-authz/src/contract.rs @@ -19,10 +19,10 @@ use neutron_sdk::{ NeutronError, NeutronResult, }; -use lido_interchain_interceptor_base::{ +use lido_puppeteer_base::{ error::ContractResult, msg::{QueryMsg, SudoPayload}, - state::{InterchainIntercaptorBase, State, ICA_ID, SUDO_PAYLOAD_REPLY_ID}, + state::{PuppeteerBase, State, ICA_ID, SUDO_PAYLOAD_REPLY_ID}, }; use prost::Message; use prost_types::Any; @@ -32,7 +32,7 @@ use crate::{ state::Config, }; -pub type InterchainInterceptor<'a> = InterchainIntercaptorBase<'a, Config, Transaction>; +pub type Puppeteer<'a> = PuppeteerBase<'a, Config, Transaction>; const CONTRACT_NAME: &str = concat!("crates.io:lido-neutron-contracts__", env!("CARGO_PKG_NAME")); const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -58,12 +58,12 @@ pub fn instantiate( proxy_address: msg.proxy_address, }; - InterchainInterceptor::default().instantiate(deps, config) + Puppeteer::default().instantiate(deps, config) } #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { - InterchainInterceptor::default().query(deps, env, msg) + Puppeteer::default().query(deps, env, msg) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -73,7 +73,7 @@ pub fn execute( info: MessageInfo, msg: ExecuteMsg, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); + let puppeteer_base = Puppeteer::default(); match msg { ExecuteMsg::Delegate { @@ -106,7 +106,7 @@ pub fn execute( ExecuteMsg::RegisterDelegatorDelegationsQuery { validators } => { register_delegations_query(deps, validators) } - _ => interceptor_base.execute(deps, env, msg.to_base_enum()), + _ => puppeteer_base.execute(deps, env, msg.to_base_enum()), } } @@ -114,8 +114,8 @@ fn register_delegations_query( deps: DepsMut, validators: Vec, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config = interceptor_base.config.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config = puppeteer_base.config.load(deps.storage)?; let msg = new_register_delegator_delegations_query_msg( config.connection_id, @@ -134,9 +134,9 @@ fn execute_delegate( amount: Uint128, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let grantee = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") })?; @@ -186,9 +186,9 @@ fn execute_undelegate( amount: Uint128, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let grantee = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -240,9 +240,9 @@ fn execute_redelegate( amount: Uint128, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let grantee = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -294,9 +294,9 @@ fn execute_withdraw_reward( validator: String, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let grantee = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -342,8 +342,8 @@ fn compose_submsg( sudo_payload: Transaction, timeout: Option, ) -> NeutronResult> { - let interceptor_base = InterchainInterceptor::default(); - let ibc_fee: IbcFee = interceptor_base.ibc_fee.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let ibc_fee: IbcFee = puppeteer_base.ibc_fee.load(deps.storage)?; let connection_id = config.connection_id; let mut buf = Vec::new(); buf.reserve(in_msg.encoded_len()); @@ -385,8 +385,8 @@ fn msg_with_sudo_callback>, T>( msg: C, payload: SudoPayload, ) -> StdResult> { - let interceptor_base = InterchainInterceptor::default(); - interceptor_base + let puppeteer_base = Puppeteer::default(); + puppeteer_base .reply_id_storage .save(deps.storage, &to_json_vec(&payload)?)?; @@ -395,7 +395,7 @@ fn msg_with_sudo_callback>, T>( #[entry_point] pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> NeutronResult { - let interceptor_base = InterchainInterceptor::default(); + let puppeteer_base = Puppeteer::default(); deps.api.debug(&format!( "WASMDEBUG: sudo call: {:?} block: {:?}", @@ -407,16 +407,16 @@ pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> NeutronResul query_id, height, data, - } => interceptor_base.sudo_tx_query_result(deps, env, query_id, height, data), + } => puppeteer_base.sudo_tx_query_result(deps, env, query_id, height, data), SudoMsg::KVQueryResult { query_id } => { - interceptor_base.sudo_kv_query_result(deps, env, query_id) + puppeteer_base.sudo_kv_query_result(deps, env, query_id) } SudoMsg::OpenAck { port_id, channel_id, counterparty_channel_id, counterparty_version, - } => interceptor_base.sudo_open_ack( + } => puppeteer_base.sudo_open_ack( deps, env, port_id, @@ -434,7 +434,7 @@ fn sudo_response( request: RequestPacket, data: Binary, ) -> NeutronResult { - let interceptor_base = InterchainInterceptor::default(); + let puppeteer_base = Puppeteer::default(); let seq_id = request .sequence @@ -443,7 +443,7 @@ fn sudo_response( .source_channel .ok_or_else(|| StdError::generic_err("channel_id not found"))?; - let payload = interceptor_base + let payload = puppeteer_base .sudo_payload .load(deps.storage, (channel_id.clone(), seq_id))?; @@ -470,10 +470,10 @@ fn sudo_response( } => { deps.api .debug("WASMDEBUG: sudo_response: MsgDelegateResponse"); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; txs.extend(vec![tx]); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id, seq_id)); } @@ -486,10 +486,10 @@ fn sudo_response( deps.api .debug("WASMDEBUG: sudo_response: MsgUndelegateResponse"); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; txs.extend(vec![tx]); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id, seq_id)); } @@ -503,10 +503,10 @@ fn sudo_response( deps.api .debug("WASMDEBUG: sudo_response: MsgBeginRedelegateResponse"); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; txs.extend(vec![tx]); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id, seq_id)); } @@ -517,10 +517,10 @@ fn sudo_response( deps.api .debug("WASMDEBUG: sudo_response: MsgWithdrawDelegatorReward"); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; txs.extend(vec![tx]); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id, seq_id)); } @@ -535,7 +535,7 @@ fn sudo_response( #[entry_point] pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> StdResult { - InterchainInterceptor::default().reply(deps, env, msg) + Puppeteer::default().reply(deps, env, msg) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/interchain-interceptor-authz/src/lib.rs b/contracts/puppeteer-authz/src/lib.rs similarity index 100% rename from contracts/interchain-interceptor-authz/src/lib.rs rename to contracts/puppeteer-authz/src/lib.rs diff --git a/contracts/interchain-interceptor-authz/src/msg.rs b/contracts/puppeteer-authz/src/msg.rs similarity index 96% rename from contracts/interchain-interceptor-authz/src/msg.rs rename to contracts/puppeteer-authz/src/msg.rs index 15d5b2fc..e5bcefd9 100644 --- a/contracts/interchain-interceptor-authz/src/msg.rs +++ b/contracts/puppeteer-authz/src/msg.rs @@ -1,7 +1,7 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::{Addr, Uint128}; -use lido_interchain_interceptor_base::msg::ExecuteMsg as BaseExecuteMsg; +use lido_puppeteer_base::msg::ExecuteMsg as BaseExecuteMsg; #[cw_serde] pub struct InstantiateMsg { diff --git a/contracts/interchain-interceptor-authz/src/state.rs b/contracts/puppeteer-authz/src/state.rs similarity index 95% rename from contracts/interchain-interceptor-authz/src/state.rs rename to contracts/puppeteer-authz/src/state.rs index 35ffe02e..967ccaac 100644 --- a/contracts/interchain-interceptor-authz/src/state.rs +++ b/contracts/puppeteer-authz/src/state.rs @@ -1,7 +1,7 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::Addr; -use lido_interchain_interceptor_base::{ +use lido_puppeteer_base::{ msg::DelegationsResponse, state::{BaseConfig, State, Transfer}, }; diff --git a/contracts/puppeteer/.cargo/config b/contracts/puppeteer/.cargo/config new file mode 100644 index 00000000..0a7b3d9b --- /dev/null +++ b/contracts/puppeteer/.cargo/config @@ -0,0 +1,2 @@ +[alias] +schema = "run --bin lido-puppeteer-schema" diff --git a/contracts/interchain-interceptor/Cargo.toml b/contracts/puppeteer/Cargo.toml similarity index 53% rename from contracts/interchain-interceptor/Cargo.toml rename to contracts/puppeteer/Cargo.toml index 08ef4a4e..8c8d9475 100644 --- a/contracts/interchain-interceptor/Cargo.toml +++ b/contracts/puppeteer/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Sergey Ratiashvili "] description = "Contract to facilitate base interchain features" edition = "2021" -name = "lido-interchain-interceptor" +name = "lido-puppeteer" version = "1.0.0" exclude = [ @@ -23,24 +23,24 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -base64 = { workspace = true } -cosmos-sdk-proto = { workspace = true } -neutron-sdk = { workspace = true } -prost = { workspace = true } -prost-types = { workspace = true } -protobuf = { workspace = true } -tendermint-proto = { workspace = true } - -cosmwasm-schema = { workspace = true } -cosmwasm-std = { workspace = true } -cw-storage-plus = { workspace = true } -cw2 = { workspace = true } -cw20 = { workspace = true } -schemars = { workspace = true } -serde = { workspace = true } -serde-json-wasm = { workspace = true } - -lido-interchain-interceptor-base = { workspace = true } +base64 = { workspace = true } +cosmos-sdk-proto = { workspace = true } +neutron-sdk = { workspace = true } +prost = { workspace = true } +prost-types = { workspace = true } +protobuf = { workspace = true } +tendermint-proto = { workspace = true } + +cosmwasm-schema = { workspace = true } +cosmwasm-std = { workspace = true } +cw-storage-plus = { workspace = true } +cw2 = { workspace = true } +cw20 = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true } +serde-json-wasm = { workspace = true } + +lido-puppeteer-base = { workspace = true } [dev-dependencies] cosmwasm-storage = { version = "1.0" } diff --git a/contracts/puppeteer/README.md b/contracts/puppeteer/README.md new file mode 100644 index 00000000..3a4ef463 --- /dev/null +++ b/contracts/puppeteer/README.md @@ -0,0 +1 @@ +# LIDO Interchain puppeteer \ No newline at end of file diff --git a/contracts/interchain-interceptor-authz/src/bin/lido-interchain-interceptor-authz-schema.rs b/contracts/puppeteer/src/bin/lido-puppeteer-schema.rs similarity index 86% rename from contracts/interchain-interceptor-authz/src/bin/lido-interchain-interceptor-authz-schema.rs rename to contracts/puppeteer/src/bin/lido-puppeteer-schema.rs index 0fed1086..61f7a70b 100644 --- a/contracts/interchain-interceptor-authz/src/bin/lido-interchain-interceptor-authz-schema.rs +++ b/contracts/puppeteer/src/bin/lido-puppeteer-schema.rs @@ -1,6 +1,6 @@ use cosmwasm_schema::write_api; -use lido_interchain_interceptor_authz::{ +use lido_puppeteer::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, state::QueryMsg, }; diff --git a/contracts/interchain-interceptor/src/contract.rs b/contracts/puppeteer/src/contract.rs similarity index 84% rename from contracts/interchain-interceptor/src/contract.rs rename to contracts/puppeteer/src/contract.rs index 30792eef..6f17f4cc 100644 --- a/contracts/interchain-interceptor/src/contract.rs +++ b/contracts/puppeteer/src/contract.rs @@ -20,10 +20,10 @@ use neutron_sdk::{ NeutronError, NeutronResult, }; -use lido_interchain_interceptor_base::{ +use lido_puppeteer_base::{ error::ContractResult, msg::{QueryMsg, SudoPayload}, - state::{InterchainIntercaptorBase, State, ICA_ID, SUDO_PAYLOAD_REPLY_ID}, + state::{PuppeteerBase, State, ICA_ID, SUDO_PAYLOAD_REPLY_ID}, }; use prost::Message; @@ -37,7 +37,7 @@ use crate::{ state::Config, }; -pub type InterchainInterceptor<'a> = InterchainIntercaptorBase<'a, Config, Transaction>; +pub type Puppeteer<'a> = PuppeteerBase<'a, Config, Transaction>; const CONTRACT_NAME: &str = concat!("crates.io:lido-neutron-contracts__", env!("CARGO_PKG_NAME")); const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -62,12 +62,12 @@ pub fn instantiate( owner, }; - InterchainInterceptor::default().instantiate(deps, config) + Puppeteer::default().instantiate(deps, config) } #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { - InterchainInterceptor::default().query(deps, env, msg) + Puppeteer::default().query(deps, env, msg) } #[cfg_attr(not(feature = "library"), entry_point)] @@ -77,7 +77,7 @@ pub fn execute( info: MessageInfo, msg: ExecuteMsg, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); + let puppeteer_base = Puppeteer::default(); match msg { ExecuteMsg::Delegate { @@ -118,7 +118,7 @@ pub fn execute( ExecuteMsg::RegisterDelegatorDelegationsQuery { validators } => { register_delegations_query(deps, validators) } - _ => interceptor_base.execute(deps, env, msg.to_base_enum()), + _ => puppeteer_base.execute(deps, env, msg.to_base_enum()), } } @@ -126,9 +126,9 @@ fn register_delegations_query( deps: DepsMut, validators: Vec, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let delegator = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -150,9 +150,9 @@ fn execute_delegate( amount: Uint128, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let delegator = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") })?; @@ -191,9 +191,9 @@ fn execute_undelegate( amount: Uint128, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let delegator = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -235,9 +235,9 @@ fn execute_redelegate( amount: Uint128, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let delegator = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -279,9 +279,9 @@ fn execute_tokenize_share( amount: Uint128, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let delegator = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -323,9 +323,9 @@ fn execute_redeem_share( denom: String, timeout: Option, ) -> ContractResult> { - let interceptor_base = InterchainInterceptor::default(); - let config: Config = interceptor_base.config.load(deps.storage)?; - let state: State = interceptor_base.state.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let config: Config = puppeteer_base.config.load(deps.storage)?; + let state: State = puppeteer_base.state.load(deps.storage)?; let delegator = state.ica.ok_or_else(|| { StdError::generic_err("Interchain account is not registered. Please register it first") @@ -365,8 +365,8 @@ fn compose_submsg( sudo_payload: Transaction, timeout: Option, ) -> NeutronResult> { - let interceptor_base = InterchainInterceptor::default(); - let ibc_fee: IbcFee = interceptor_base.ibc_fee.load(deps.storage)?; + let puppeteer_base = Puppeteer::default(); + let ibc_fee: IbcFee = puppeteer_base.ibc_fee.load(deps.storage)?; let connection_id = config.connection_id; let mut buf = Vec::new(); buf.reserve(in_msg.encoded_len()); @@ -408,8 +408,8 @@ fn msg_with_sudo_callback>, T>( msg: C, payload: SudoPayload, ) -> StdResult> { - let interceptor_base = InterchainInterceptor::default(); - interceptor_base + let puppeteer_base = Puppeteer::default(); + puppeteer_base .reply_id_storage .save(deps.storage, &to_json_vec(&payload)?)?; @@ -418,7 +418,7 @@ fn msg_with_sudo_callback>, T>( #[entry_point] pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> NeutronResult { - let interceptor_base = InterchainInterceptor::default(); + let puppeteer_base = Puppeteer::default(); deps.api.debug(&format!( "WASMDEBUG: sudo call: {:?} block: {:?}", @@ -430,16 +430,16 @@ pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> NeutronResul query_id, height, data, - } => interceptor_base.sudo_tx_query_result(deps, env, query_id, height, data), + } => puppeteer_base.sudo_tx_query_result(deps, env, query_id, height, data), SudoMsg::KVQueryResult { query_id } => { - interceptor_base.sudo_kv_query_result(deps, env, query_id) + puppeteer_base.sudo_kv_query_result(deps, env, query_id) } SudoMsg::OpenAck { port_id, channel_id, counterparty_channel_id, counterparty_version, - } => interceptor_base.sudo_open_ack( + } => puppeteer_base.sudo_open_ack( deps, env, port_id, @@ -457,7 +457,7 @@ fn sudo_response( request: RequestPacket, data: Binary, ) -> NeutronResult { - let interceptor_base = InterchainInterceptor::default(); + let puppeteer_base = Puppeteer::default(); let seq_id = request .sequence @@ -466,7 +466,7 @@ fn sudo_response( .source_channel .ok_or_else(|| StdError::generic_err("channel_id not found"))?; - let payload = interceptor_base + let payload = puppeteer_base .sudo_payload .load(deps.storage, (channel_id.clone(), seq_id))?; deps.api @@ -488,10 +488,10 @@ fn sudo_response( deps.api.debug(&format!( "WASMDEBUG: sudo_response: MsgDelegateResponse: {out:?}" )); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; txs.extend(payload.info.clone()); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id.clone(), seq_id)); } @@ -502,10 +502,10 @@ fn sudo_response( deps.api.debug(&format!( "WASMDEBUG: sudo_response: MsgUndelegateResponse: {out:?}" )); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; txs.extend(payload.info.clone()); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id.clone(), seq_id)); } @@ -517,7 +517,7 @@ fn sudo_response( "WASMDEBUG: sudo_response: MsgTokenizeSharesResponse: {out:?}" )); let denom = out.amount.map(|coin| coin.denom).unwrap_or_default(); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; let info = match payload.info.clone() { Some(info) => match info { Transaction::TokenizeShare { @@ -536,8 +536,8 @@ fn sudo_response( None => None, }; txs.extend(info); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id.clone(), seq_id)); } @@ -548,10 +548,10 @@ fn sudo_response( deps.api.debug(&format!( "WASMDEBUG: sudo_response: MsgBeginRedelegateResponse: {out:?}" )); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; txs.extend(payload.info.clone()); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id.clone(), seq_id)); } @@ -563,7 +563,7 @@ fn sudo_response( "WASMDEBUG: sudo_response: MsgRedeemTokensForSharesResponse: {out:?}" )); let denom = out.amount.map(|coin| coin.denom).unwrap_or_default(); - let mut txs = interceptor_base.transactions.load(deps.storage)?; + let mut txs = puppeteer_base.transactions.load(deps.storage)?; let info: Option = match payload.info.clone() { Some(info) => match info { Transaction::TokenizeShare { @@ -582,8 +582,8 @@ fn sudo_response( None => None, }; txs.extend(info); - interceptor_base.transactions.save(deps.storage, &txs)?; - interceptor_base + puppeteer_base.transactions.save(deps.storage, &txs)?; + puppeteer_base .sudo_payload .remove(deps.storage, (channel_id.clone(), seq_id)); } @@ -600,7 +600,7 @@ fn sudo_response( #[entry_point] pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> StdResult { - InterchainInterceptor::default().reply(deps, env, msg) + Puppeteer::default().reply(deps, env, msg) } #[cfg_attr(not(feature = "library"), entry_point)] diff --git a/contracts/interchain-interceptor/src/lib.rs b/contracts/puppeteer/src/lib.rs similarity index 100% rename from contracts/interchain-interceptor/src/lib.rs rename to contracts/puppeteer/src/lib.rs diff --git a/contracts/interchain-interceptor/src/msg.rs b/contracts/puppeteer/src/msg.rs similarity index 97% rename from contracts/interchain-interceptor/src/msg.rs rename to contracts/puppeteer/src/msg.rs index 6e9f6603..2da1869d 100644 --- a/contracts/interchain-interceptor/src/msg.rs +++ b/contracts/puppeteer/src/msg.rs @@ -1,7 +1,7 @@ use cosmwasm_schema::cw_serde; use cosmwasm_std::Uint128; -use lido_interchain_interceptor_base::msg::ExecuteMsg as BaseExecuteMsg; +use lido_puppeteer_base::msg::ExecuteMsg as BaseExecuteMsg; #[cw_serde] pub struct InstantiateMsg { diff --git a/contracts/interchain-interceptor/src/proto.rs b/contracts/puppeteer/src/proto.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto.rs rename to contracts/puppeteer/src/proto.rs diff --git a/contracts/interchain-interceptor/src/proto/COSMOS_SDK_COMMIT b/contracts/puppeteer/src/proto/COSMOS_SDK_COMMIT similarity index 100% rename from contracts/interchain-interceptor/src/proto/COSMOS_SDK_COMMIT rename to contracts/puppeteer/src/proto/COSMOS_SDK_COMMIT diff --git a/contracts/interchain-interceptor/src/proto/cosmos.base.query.v1beta1.rs b/contracts/puppeteer/src/proto/cosmos.base.query.v1beta1.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/cosmos.base.query.v1beta1.rs rename to contracts/puppeteer/src/proto/cosmos.base.query.v1beta1.rs diff --git a/contracts/interchain-interceptor/src/proto/cosmos.base.v1beta1.rs b/contracts/puppeteer/src/proto/cosmos.base.v1beta1.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/cosmos.base.v1beta1.rs rename to contracts/puppeteer/src/proto/cosmos.base.v1beta1.rs diff --git a/contracts/interchain-interceptor/src/proto/cosmos.distribution.v1beta1.rs b/contracts/puppeteer/src/proto/cosmos.distribution.v1beta1.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/cosmos.distribution.v1beta1.rs rename to contracts/puppeteer/src/proto/cosmos.distribution.v1beta1.rs diff --git a/contracts/interchain-interceptor/src/proto/cosmos.distribution.v1beta1.tonic.rs b/contracts/puppeteer/src/proto/cosmos.distribution.v1beta1.tonic.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/cosmos.distribution.v1beta1.tonic.rs rename to contracts/puppeteer/src/proto/cosmos.distribution.v1beta1.tonic.rs diff --git a/contracts/interchain-interceptor/src/proto/cosmos_proto.rs b/contracts/puppeteer/src/proto/cosmos_proto.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/cosmos_proto.rs rename to contracts/puppeteer/src/proto/cosmos_proto.rs diff --git a/contracts/interchain-interceptor/src/proto/liquidstaking.distribution.v1beta1.rs b/contracts/puppeteer/src/proto/liquidstaking.distribution.v1beta1.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/liquidstaking.distribution.v1beta1.rs rename to contracts/puppeteer/src/proto/liquidstaking.distribution.v1beta1.rs diff --git a/contracts/interchain-interceptor/src/proto/liquidstaking.distribution.v1beta1.tonic.rs b/contracts/puppeteer/src/proto/liquidstaking.distribution.v1beta1.tonic.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/liquidstaking.distribution.v1beta1.tonic.rs rename to contracts/puppeteer/src/proto/liquidstaking.distribution.v1beta1.tonic.rs diff --git a/contracts/interchain-interceptor/src/proto/liquidstaking.staking.v1beta1.rs b/contracts/puppeteer/src/proto/liquidstaking.staking.v1beta1.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/liquidstaking.staking.v1beta1.rs rename to contracts/puppeteer/src/proto/liquidstaking.staking.v1beta1.rs diff --git a/contracts/interchain-interceptor/src/proto/liquidstaking.staking.v1beta1.tonic.rs b/contracts/puppeteer/src/proto/liquidstaking.staking.v1beta1.tonic.rs similarity index 100% rename from contracts/interchain-interceptor/src/proto/liquidstaking.staking.v1beta1.tonic.rs rename to contracts/puppeteer/src/proto/liquidstaking.staking.v1beta1.tonic.rs diff --git a/contracts/interchain-interceptor/src/state.rs b/contracts/puppeteer/src/state.rs similarity index 95% rename from contracts/interchain-interceptor/src/state.rs rename to contracts/puppeteer/src/state.rs index 546f9425..2f91240c 100644 --- a/contracts/interchain-interceptor/src/state.rs +++ b/contracts/puppeteer/src/state.rs @@ -1,7 +1,7 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::Addr; -use lido_interchain_interceptor_base::{ +use lido_puppeteer_base::{ msg::DelegationsResponse, state::{BaseConfig, State, Transfer}, }; diff --git a/contracts/stargate-poc/Cargo.toml b/contracts/stargate-poc/Cargo.toml index b7780238..dc493993 100644 --- a/contracts/stargate-poc/Cargo.toml +++ b/contracts/stargate-poc/Cargo.toml @@ -39,7 +39,7 @@ schemars = { workspace = true } serde = { workspace = true } serde-json-wasm = { workspace = true } -lido-interchain-interceptor-base = { path = "../../packages/interchain-interceptor-base", default-features = false } +lido-puppeteer-base = { workspace = true } [dev-dependencies] cosmwasm-storage = { workspace = true } diff --git a/integration_tests/package.json b/integration_tests/package.json index 4c4ede52..3b191b69 100644 --- a/integration_tests/package.json +++ b/integration_tests/package.json @@ -7,8 +7,8 @@ "test": "vitest --run", "test:poc-stargate": "vitest --run poc-stargate --bail 1", "test:core": "vitest --run core --bail 1", - "test:interceptor": "vitest --run interceptor.test --bail 1", - "test:interceptor-authz": "vitest --run interceptor-authz.test --bail 1", + "test:puppeteer": "vitest --run puppeteer.test --bail 1", + "test:puppeteer-authz": "vitest --run puppeteer-authz.test --bail 1", "test:validators-stats": "vitest --run validators-stats.test --bail 1", "test:validator-set": "vitest --run validator-set.test --bail 1", "watch": "vitest", diff --git a/integration_tests/src/generated/contractLib/index.ts b/integration_tests/src/generated/contractLib/index.ts index 2e9dd14d..b5a308a2 100644 --- a/integration_tests/src/generated/contractLib/index.ts +++ b/integration_tests/src/generated/contractLib/index.ts @@ -7,11 +7,11 @@ export const LidoDistribution = _1; import * as _2 from './lidoFactory'; export const LidoFactory = _2; -import * as _3 from './lidoInterchainInterceptorAuthz'; -export const LidoInterchainInterceptorAuthz = _3; +import * as _3 from './lidoPuppeteerAuthz'; +export const LidoPuppeteerAuthz = _3; -import * as _4 from './lidoInterchainInterceptor'; -export const LidoInterchainInterceptor = _4; +import * as _4 from './lidoPuppeteer'; +export const LidoPuppeteer = _4; import * as _5 from './lidoStargatePoc'; export const LidoStargatePoc = _5; diff --git a/integration_tests/src/generated/contractLib/lidoInterchainInterceptor.ts b/integration_tests/src/generated/contractLib/lidoPuppeteer.ts similarity index 99% rename from integration_tests/src/generated/contractLib/lidoInterchainInterceptor.ts rename to integration_tests/src/generated/contractLib/lidoPuppeteer.ts index 78f4b583..20a602a8 100644 --- a/integration_tests/src/generated/contractLib/lidoInterchainInterceptor.ts +++ b/integration_tests/src/generated/contractLib/lidoPuppeteer.ts @@ -83,7 +83,7 @@ export type ArrayOfTransaction = Transaction[]; export type IcaState = "none" | "in_progress" | "registered"; export type ArrayOfTransfer = Transfer[]; -export interface LidoInterchainInterceptorSchema { +export interface LidoPuppeteerSchema { responses: Config | DelegationsResponse | ArrayOfTransaction | State | ArrayOfTransfer; execute: | RegisterDelegatorDelegationsQueryArgs diff --git a/integration_tests/src/generated/contractLib/lidoInterchainInterceptorAuthz.ts b/integration_tests/src/generated/contractLib/lidoPuppeteerAuthz.ts similarity index 99% rename from integration_tests/src/generated/contractLib/lidoInterchainInterceptorAuthz.ts rename to integration_tests/src/generated/contractLib/lidoPuppeteerAuthz.ts index f6f491c0..2ad0a668 100644 --- a/integration_tests/src/generated/contractLib/lidoInterchainInterceptorAuthz.ts +++ b/integration_tests/src/generated/contractLib/lidoPuppeteerAuthz.ts @@ -79,7 +79,7 @@ export type ArrayOfTransaction = Transaction[]; export type IcaState = "none" | "in_progress" | "registered"; export type ArrayOfTransfer = Transfer[]; -export interface LidoInterchainInterceptorAuthzSchema { +export interface LidoPuppeteerAuthzSchema { responses: Config | DelegationsResponse | ArrayOfTransaction | State | ArrayOfTransfer; execute: | RegisterDelegatorDelegationsQueryArgs diff --git a/integration_tests/src/testcases/interceptor-authz.test.ts b/integration_tests/src/testcases/puppeteer-authz.test.ts similarity index 93% rename from integration_tests/src/testcases/interceptor-authz.test.ts rename to integration_tests/src/testcases/puppeteer-authz.test.ts index 9c3bffa9..53237d0a 100644 --- a/integration_tests/src/testcases/interceptor-authz.test.ts +++ b/integration_tests/src/testcases/puppeteer-authz.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, beforeAll, afterAll } from 'vitest'; -import { LidoInterchainInterceptorAuthz } from '../generated/contractLib'; +import { LidoPuppeteerAuthz } from '../generated/contractLib'; import { QueryClient, StakingExtension, @@ -21,20 +21,20 @@ import { DelegationsResponse, Transaction, Transfer, -} from '../generated/contractLib/lidoInterchainInterceptorAuthz'; +} from '../generated/contractLib/lidoPuppeteerAuthz'; import { grantAuthzPermission } from '../helpers/utils'; import { AuthzExtension } from '@cosmjs/stargate/build/modules/authz/queries'; -const InterceptorClass = LidoInterchainInterceptorAuthz.Client; +const PuppeteerClass = LidoPuppeteerAuthz.Client; -describe('Interchain interceptor with AuthZ support', () => { +describe('Interchain puppeteer with AuthZ support', () => { const context: { park?: Cosmopark; contractAddress?: string; wallet?: DirectSecp256k1HdWallet; gaiaWallet?: DirectSecp256k1HdWallet; - contractClient?: InstanceType; + contractClient?: InstanceType; account?: AccountData; gaiaAccount?: AccountData; icaAddress?: string; @@ -48,11 +48,7 @@ describe('Interchain interceptor with AuthZ support', () => { } = {}; beforeAll(async () => { - context.park = await setupPark( - 'interceptorauthz', - ['neutron', 'gaia'], - true, - ); + context.park = await setupPark('puppeteerauthz', ['neutron', 'gaia'], true); context.wallet = await DirectSecp256k1HdWallet.fromMnemonic( context.park.config.wallets.demowallet1.mnemonic, { @@ -108,34 +104,30 @@ describe('Interchain interceptor with AuthZ support', () => { const res = await client.upload( account.address, fs.readFileSync( - join( - __dirname, - '../../../artifacts/lido_interchain_interceptor_authz.wasm', - ), + join(__dirname, '../../../artifacts/lido_puppeteer_authz.wasm'), ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); - const instantiateRes = - await LidoInterchainInterceptorAuthz.Client.instantiate( - client, - account.address, - res.codeId, - { - connection_id: 'connection-0', - port_id: 'transfer', - update_period: 10, - remote_denom: 'stake', - owner: account.address, - proxy_address: gaiaAccount.address, - }, - 'label', - [], - 'auto', - ); + const instantiateRes = await LidoPuppeteerAuthz.Client.instantiate( + client, + account.address, + res.codeId, + { + connection_id: 'connection-0', + port_id: 'transfer', + update_period: 10, + remote_denom: 'stake', + owner: account.address, + proxy_address: gaiaAccount.address, + }, + 'label', + [], + 'auto', + ); expect(instantiateRes.contractAddress).toHaveLength(66); context.contractAddress = instantiateRes.contractAddress; - context.contractClient = new LidoInterchainInterceptorAuthz.Client( + context.contractClient = new LidoPuppeteerAuthz.Client( client, context.contractAddress, ); diff --git a/integration_tests/src/testcases/interceptor.test.ts b/integration_tests/src/testcases/puppeteer.test.ts similarity index 96% rename from integration_tests/src/testcases/interceptor.test.ts rename to integration_tests/src/testcases/puppeteer.test.ts index 271ccc8c..6c0dc7a4 100644 --- a/integration_tests/src/testcases/interceptor.test.ts +++ b/integration_tests/src/testcases/puppeteer.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, beforeAll, afterAll } from 'vitest'; -import { LidoInterchainInterceptor } from '../generated/contractLib'; +import { LidoPuppeteer } from '../generated/contractLib'; import { QueryClient, StakingExtension, @@ -20,17 +20,17 @@ import { DelegationsResponse, Transaction, Transfer, -} from '../generated/contractLib/lidoInterchainInterceptor'; +} from '../generated/contractLib/lidoPuppeteer'; -const InterceptorClass = LidoInterchainInterceptor.Client; +const PuppeteerClass = LidoPuppeteer.Client; -describe('Interchain interceptor', () => { +describe('Interchain puppeteer', () => { const context: { park?: Cosmopark; contractAddress?: string; wallet?: DirectSecp256k1HdWallet; gaiaWallet?: DirectSecp256k1HdWallet; - contractClient?: InstanceType; + contractClient?: InstanceType; account?: AccountData; icaAddress?: string; client?: SigningCosmWasmClient; @@ -43,7 +43,7 @@ describe('Interchain interceptor', () => { } = {}; beforeAll(async () => { - context.park = await setupPark('interceptor', ['neutron', 'gaia'], true); + context.park = await setupPark('puppeteer', ['neutron', 'gaia'], true); context.wallet = await DirectSecp256k1HdWallet.fromMnemonic( context.park.config.wallets.demowallet1.mnemonic, { @@ -97,12 +97,12 @@ describe('Interchain interceptor', () => { const res = await client.upload( account.address, fs.readFileSync( - join(__dirname, '../../../artifacts/lido_interchain_interceptor.wasm'), + join(__dirname, '../../../artifacts/lido_puppeteer.wasm'), ), 1.5, ); expect(res.codeId).toBeGreaterThan(0); - const instantiateRes = await LidoInterchainInterceptor.Client.instantiate( + const instantiateRes = await LidoPuppeteer.Client.instantiate( client, account.address, res.codeId, @@ -119,7 +119,7 @@ describe('Interchain interceptor', () => { ); expect(instantiateRes.contractAddress).toHaveLength(66); context.contractAddress = instantiateRes.contractAddress; - context.contractClient = new LidoInterchainInterceptor.Client( + context.contractClient = new LidoPuppeteer.Client( client, context.contractAddress, ); diff --git a/packages/base/Cargo.toml b/packages/base/Cargo.toml index 206dfff3..0d9efc55 100644 --- a/packages/base/Cargo.toml +++ b/packages/base/Cargo.toml @@ -1,6 +1,6 @@ [package] authors = ["Sergey Ratiashvili "] -description = "Package for Lido Interchain Interceptor Base" +description = "Package for Lido Puppeteer Base" edition = "2021" name = "lido-staking-base" version = "1.0.0" diff --git a/packages/interchain-interceptor-base/README.md b/packages/interchain-interceptor-base/README.md deleted file mode 100644 index 754e5581..00000000 --- a/packages/interchain-interceptor-base/README.md +++ /dev/null @@ -1 +0,0 @@ -# LIDO Interchain interceptor base pakcage \ No newline at end of file diff --git a/packages/interchain-interceptor-base/Cargo.toml b/packages/puppeteer-base/Cargo.toml similarity index 97% rename from packages/interchain-interceptor-base/Cargo.toml rename to packages/puppeteer-base/Cargo.toml index ab6d6f7e..5077993b 100644 --- a/packages/interchain-interceptor-base/Cargo.toml +++ b/packages/puppeteer-base/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Sergey Ratiashvili "] description = "Contract to facilitate base interchain features" edition = "2021" -name = "lido-interchain-interceptor-base" +name = "lido-puppeteer-base" version = "1.0.0" exclude = [ diff --git a/packages/puppeteer-base/README.md b/packages/puppeteer-base/README.md new file mode 100644 index 00000000..a1eb35c1 --- /dev/null +++ b/packages/puppeteer-base/README.md @@ -0,0 +1 @@ +# LIDO Puppeteer base pakcage \ No newline at end of file diff --git a/packages/interchain-interceptor-base/src/error.rs b/packages/puppeteer-base/src/error.rs similarity index 100% rename from packages/interchain-interceptor-base/src/error.rs rename to packages/puppeteer-base/src/error.rs diff --git a/packages/interchain-interceptor-base/src/execute.rs b/packages/puppeteer-base/src/execute.rs similarity index 96% rename from packages/interchain-interceptor-base/src/execute.rs rename to packages/puppeteer-base/src/execute.rs index 0741a483..890e56eb 100644 --- a/packages/interchain-interceptor-base/src/execute.rs +++ b/packages/puppeteer-base/src/execute.rs @@ -13,10 +13,10 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::{ error::{ContractError, ContractResult}, msg::ExecuteMsg, - state::{BaseConfig, IcaState, InterchainIntercaptorBase, State, ICA_ID, LOCAL_DENOM}, + state::{BaseConfig, IcaState, PuppeteerBase, State, ICA_ID, LOCAL_DENOM}, }; -impl<'a, T, C> InterchainIntercaptorBase<'a, T, C> +impl<'a, T, C> PuppeteerBase<'a, T, C> where T: BaseConfig + Serialize + DeserializeOwned + Clone, C: std::fmt::Debug + Serialize + DeserializeOwned + Clone, diff --git a/packages/interchain-interceptor-base/src/lib.rs b/packages/puppeteer-base/src/lib.rs similarity index 100% rename from packages/interchain-interceptor-base/src/lib.rs rename to packages/puppeteer-base/src/lib.rs diff --git a/packages/interchain-interceptor-base/src/msg.rs b/packages/puppeteer-base/src/msg.rs similarity index 100% rename from packages/interchain-interceptor-base/src/msg.rs rename to packages/puppeteer-base/src/msg.rs diff --git a/packages/interchain-interceptor-base/src/query.rs b/packages/puppeteer-base/src/query.rs similarity index 94% rename from packages/interchain-interceptor-base/src/query.rs rename to packages/puppeteer-base/src/query.rs index e9095404..3ce3930d 100644 --- a/packages/interchain-interceptor-base/src/query.rs +++ b/packages/puppeteer-base/src/query.rs @@ -4,10 +4,10 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::{ msg::{DelegationsResponse, QueryMsg}, - state::{BaseConfig, InterchainIntercaptorBase, State, Transfer}, + state::{BaseConfig, PuppeteerBase, State, Transfer}, }; -impl<'a, T, C> InterchainIntercaptorBase<'a, T, C> +impl<'a, T, C> PuppeteerBase<'a, T, C> where T: BaseConfig + Serialize + DeserializeOwned + Clone, C: std::fmt::Debug + Serialize + DeserializeOwned + Clone, diff --git a/packages/interchain-interceptor-base/src/reply.rs b/packages/puppeteer-base/src/reply.rs similarity index 93% rename from packages/interchain-interceptor-base/src/reply.rs rename to packages/puppeteer-base/src/reply.rs index 8c37cb2e..6cb6f3fa 100644 --- a/packages/interchain-interceptor-base/src/reply.rs +++ b/packages/puppeteer-base/src/reply.rs @@ -4,10 +4,10 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::{ msg::SudoPayload, - state::{BaseConfig, InterchainIntercaptorBase, SUDO_PAYLOAD_REPLY_ID}, + state::{BaseConfig, PuppeteerBase, SUDO_PAYLOAD_REPLY_ID}, }; -impl<'a, T, C> InterchainIntercaptorBase<'a, T, C> +impl<'a, T, C> PuppeteerBase<'a, T, C> where T: BaseConfig + Serialize + DeserializeOwned + Clone, C: std::fmt::Debug + Serialize + DeserializeOwned + Clone, diff --git a/packages/interchain-interceptor-base/src/state.rs b/packages/puppeteer-base/src/state.rs similarity index 93% rename from packages/interchain-interceptor-base/src/state.rs rename to packages/puppeteer-base/src/state.rs index e34fbd51..f226cabf 100644 --- a/packages/interchain-interceptor-base/src/state.rs +++ b/packages/puppeteer-base/src/state.rs @@ -6,7 +6,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::msg::SudoPayload; -pub struct InterchainIntercaptorBase<'a, T, C> +pub struct PuppeteerBase<'a, T, C> where T: BaseConfig + Serialize + DeserializeOwned + Clone, C: std::fmt::Debug + Serialize + DeserializeOwned + Clone, @@ -22,7 +22,7 @@ where pub register_fee: Item<'a, Coin>, } -impl Default for InterchainIntercaptorBase<'static, T, C> +impl Default for PuppeteerBase<'static, T, C> where T: BaseConfig + Serialize + DeserializeOwned + Clone, C: std::fmt::Debug + Serialize + DeserializeOwned + Clone, @@ -32,7 +32,7 @@ where } } -impl<'a, T, C> InterchainIntercaptorBase<'a, T, C> +impl<'a, T, C> PuppeteerBase<'a, T, C> where T: BaseConfig + Serialize + DeserializeOwned + Clone, C: std::fmt::Debug + Serialize + DeserializeOwned + Clone, diff --git a/packages/interchain-interceptor-base/src/sudo.rs b/packages/puppeteer-base/src/sudo.rs similarity index 97% rename from packages/interchain-interceptor-base/src/sudo.rs rename to packages/puppeteer-base/src/sudo.rs index 4de23632..ba028c52 100644 --- a/packages/interchain-interceptor-base/src/sudo.rs +++ b/packages/puppeteer-base/src/sudo.rs @@ -20,10 +20,10 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::{ msg::OpenAckVersion, - state::{BaseConfig, IcaState, InterchainIntercaptorBase, State, Transfer}, + state::{BaseConfig, IcaState, PuppeteerBase, State, Transfer}, }; -impl<'a, T, C> InterchainIntercaptorBase<'a, T, C> +impl<'a, T, C> PuppeteerBase<'a, T, C> where T: BaseConfig + Serialize + DeserializeOwned + Clone, C: std::fmt::Debug + Serialize + DeserializeOwned + Clone,