From ced188caf622784ecddf669c02f867bb9128e4ec Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:38:45 -0700 Subject: [PATCH 01/14] add admin address to deploy script configs --- scripts/configs/neutron.toml | 5 ++++- scripts/configs/osmosis.toml | 5 ++++- scripts/configs/terra.toml | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/configs/neutron.toml b/scripts/configs/neutron.toml index 9ca9fa04..adbca842 100644 --- a/scripts/configs/neutron.toml +++ b/scripts/configs/neutron.toml @@ -1,9 +1,12 @@ # Enter your mnemonic here MNEMONIC = "" -# Commut Hash +# Commit Hash of the commit used to build the contracts COMMIT_HASH = "" +# Admin address to execute migrations from +ADMIN_ADDRESS = "" + MAINNET_REST_URL = "https://rest-kralum.neutron-1.neutron.org" MAINNET_RPC_URL = "https://rpc-kralum.neutron-1.neutron.org" MAINNET_CHAIN_ID = "neutron-1" diff --git a/scripts/configs/osmosis.toml b/scripts/configs/osmosis.toml index e83ca3c8..def00313 100644 --- a/scripts/configs/osmosis.toml +++ b/scripts/configs/osmosis.toml @@ -1,9 +1,12 @@ # Enter your mnemonic here MNEMONIC = "" -# Commut Hash +# Commit Hash of the commit used to build the contracts COMMIT_HASH = "" +# Admin address to execute migrations from +ADMIN_ADDRESS = "" + MAINNET_REST_URL = "https://osmosis-api.polkachu.com" MAINNET_RPC_URL = "https://osmosis-rpc.polkachu.com/" MAINNET_CHAIN_ID = "osmosis-1" diff --git a/scripts/configs/terra.toml b/scripts/configs/terra.toml index 07336a58..f1e5d314 100644 --- a/scripts/configs/terra.toml +++ b/scripts/configs/terra.toml @@ -1,9 +1,12 @@ # Enter your mnemonic here MNEMONIC = "" -# Commut Hash +# Commit Hash of the commit used to build the contracts COMMIT_HASH = "" +# Admin address to execute migrations from +ADMIN_ADDRESS = "" + MAINNET_REST_URL = "https://phoenix-lcd.terra.dev" MAINNET_RPC_URL = "https://terra-rpc.polkachu.com/" MAINNET_CHAIN_ID = "phoenix-1" From caa0147de4be8ddb9fd9db6267191b2acafd9ec9 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:40:11 -0700 Subject: [PATCH 02/14] reformat / fix lints to clean up script --- scripts/deploy.py | 242 ++++++++++++++++++++-------------------------- 1 file changed, 104 insertions(+), 138 deletions(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index 47627825..d5cf2c2f 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -4,7 +4,7 @@ import httpx import time from hashlib import sha256 -from base64 import b64encode, b64decode +from base64 import b64encode from datetime import datetime from bip_utils import Bip39SeedGenerator, Bip44, Bip44Coins from google.protobuf import any_pb2 @@ -39,7 +39,9 @@ # Raise exception if config not found if not found_config: - raise Exception(f"Could not find config for chain {CHAIN}; Must enter a chain as 1st command line argument.") + raise Exception( + f"Could not find config for chain {CHAIN}; Must enter a chain as 1st cli arg." + ) # Create deployed-contracts folder if it doesn't exist if not os.path.exists("../deployed-contracts"): @@ -65,7 +67,9 @@ CHAIN_ID = config["TESTNET_CHAIN_ID"] SWAP_VENUES = config["testnet_swap_venues"] else: - raise Exception("Must specify either 'mainnet' or 'testnet' for 2nd command line argument.") + raise Exception( + "Must specify either 'mainnet' or 'testnet' for 2nd cli arg." + ) ADDRESS_PREFIX = config["ADDRESS_PREFIX"] DENOM = config["DENOM"] @@ -81,6 +85,9 @@ # Pregenerated Contract Addresses ENTRY_POINT_PRE_GENERATED_ADDRESS = config["ENTRY_POINT_PRE_GENERATED_ADDRESS"] +# Admin address for future migrations +# ADMIN_ADDRESS = config["ADMIN_ADDRESS"] + MNEMONIC = config["MNEMONIC"] del config["MNEMONIC"] @@ -114,7 +121,12 @@ def main(): toml.dump(DEPLOYED_CONTRACTS_INFO, f) # IBC Contracts - ibc_transfer_adapter_contract_code_id = store_contract(client, wallet, IBC_TRANSFER_ADAPTER_PATH, "ibc_transfer_adapter", PERMISSIONED_UPLOADER_ADDRESS) + ibc_transfer_adapter_contract_code_id = store_contract( + client, wallet, + IBC_TRANSFER_ADAPTER_PATH, + "ibc_transfer_adapter", + PERMISSIONED_UPLOADER_ADDRESS + ) ibc_transfer_adapter_contract_address = instantiate_contract( client, wallet, @@ -131,8 +143,13 @@ def main(): # Swap Contracts for venue in SWAP_VENUES: - swap_adapter_contract_code_id = store_contract(client, wallet, venue["swap_adapter_path"], f"swap_adapter_{venue['name']}", PERMISSIONED_UPLOADER_ADDRESS) - + swap_adapter_contract_code_id = store_contract( + client, + wallet, + venue["swap_adapter_path"], + f"swap_adapter_{venue['name']}", + PERMISSIONED_UPLOADER_ADDRESS + ) swap_adapter_instantiate_args = { "entry_point_contract_address": ENTRY_POINT_PRE_GENERATED_ADDRESS } @@ -158,7 +175,13 @@ def main(): ) # Entry Point Contract - entry_point_contract_code_id = store_contract(client, wallet, ENTRY_POINT_CONTRACT_PATH, "entry_point", PERMISSIONED_UPLOADER_ADDRESS) + entry_point_contract_code_id = store_contract( + client, + wallet, + ENTRY_POINT_CONTRACT_PATH, + "entry_point", + PERMISSIONED_UPLOADER_ADDRESS + ) instantiate2_contract( client=client, wallet=wallet, @@ -169,6 +192,7 @@ def main(): pre_gen_address=ENTRY_POINT_PRE_GENERATED_ADDRESS ) + def create_tx(msg, client, wallet, @@ -183,116 +207,17 @@ def create_tx(msg, account = client.query_account(str(wallet.address())) # Seal, Sign, and Complete Tx - tx.seal(signing_cfgs=[SigningCfg.direct(wallet.public_key(), account.sequence)], fee = fee, gas_limit=gas_limit) + tx.seal( + signing_cfgs=[SigningCfg.direct(wallet.public_key(), account.sequence)], + fee=fee, + gas_limit=gas_limit + ) tx.sign(wallet.signer(), client.network_config.chain_id, account.number) tx.complete() return tx - -def create_wasm_store_tx(client, - wallet, - address: str, - gas_fee: str, - gas_limit: int, - file: str, - permissioned_uploader_address: str | None = None - ) -> tuple[bytes, str]: - if permissioned_uploader_address is not None: - msg_store_code = MsgStoreCode( - sender=permissioned_uploader_address, - wasm_byte_code=open(file, "rb").read(), - instantiate_permission=None - ) - msg = create_exec_msg(msg=msg_store_code, grantee_address=address) - else: - msg = MsgStoreCode( - sender=address, - wasm_byte_code=open(file, "rb").read(), - instantiate_permission=None - ) - - return create_tx(msg=msg, - client=client, - wallet=wallet, - gas_limit=gas_limit, - fee=gas_fee) - -def create_wasm_instantiate_tx( - client, - wallet, - address: str, - gas_fee: str, - gas_limit: int, - code_id: int, - args: dict, - label: str, - ) -> tuple[bytes, str]: - - msg = MsgInstantiateContract( - sender=str(address), - code_id=code_id, - msg=json_encode(args).encode("UTF8"), - label=label, - ) - - return create_tx(msg=msg, - client=client, - wallet=wallet, - gas_limit=gas_limit, - fee=gas_fee) -def create_wasm_instantiate2_tx( - client, - wallet, - address: str, - gas_fee: str, - gas_limit: int, - code_id: int, - args: dict, - label: str, - ) -> tuple[bytes, str]: - - msg = MsgInstantiateContract2( - sender=address, - code_id=code_id, - msg=json_encode(args).encode("UTF8"), - label=label, - salt=SALT, - fix_msg=False, - ) - - return create_tx(msg=msg, - client=client, - wallet=wallet, - gas_limit=gas_limit, - fee=gas_fee) - - -def create_wasm_execute_tx( - client, - wallet, - contract_address: str, - args: dict, - address: str, - gas_fee: str, - gas_limit: int, - funds_coin: Coin | None, - ) -> tuple[bytes, str]: - msg = create_cosmwasm_execute_msg( - contract_address=contract_address, - args=args, - sender_address=address - ) - if funds_coin: - msg.funds.append(funds_coin) - return create_tx(msg=msg, - client=client, - wallet=wallet, - gas_limit=gas_limit, - fee=gas_fee) - - def create_wallet(client) -> LocalWallet: """ Create a wallet from a mnemonic and return it""" if CHAIN == "terra": @@ -305,7 +230,10 @@ def create_wallet(client) -> LocalWallet: else: seed_bytes = Bip39SeedGenerator(MNEMONIC).Generate() bip44_def_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.COSMOS).DeriveDefaultPath() - wallet = LocalWallet(PrivateKey(bip44_def_ctx.PrivateKey().Raw().ToBytes()), prefix=ADDRESS_PREFIX) + wallet = LocalWallet( + PrivateKey(bip44_def_ctx.PrivateKey().Raw().ToBytes()), + prefix=ADDRESS_PREFIX + ) balance = client.query_bank_balance(str(wallet.address()), DENOM) print("Wallet Address: ", wallet.address(), " with account balance: ", balance) return wallet @@ -326,16 +254,33 @@ def init_deployed_contracts_info(): toml.dump(DEPLOYED_CONTRACTS_INFO, f) -def store_contract(client, wallet, file_path, name, permissioned_uploader_address) -> int: +def store_contract( + client, + wallet, + file_path, + name, + permissioned_uploader_address +) -> int: gas_limit = 5000000 - store_tx = create_wasm_store_tx( - client=client, - wallet=wallet, - address=str(wallet.address()), - gas_fee=f"{int(GAS_PRICE*gas_limit)}{DENOM}", + if permissioned_uploader_address is not None: + msg_store_code = MsgStoreCode( + sender=permissioned_uploader_address, + wasm_byte_code=open(file, "rb").read(), + instantiate_permission=None + ) + msg = create_exec_msg(msg=msg_store_code, grantee_address=str(wallet.address())) + else: + msg = MsgStoreCode( + sender=str(wallet.address()), + wasm_byte_code=open(file, "rb").read(), + instantiate_permission=None + ) + store_tx = create_tx( + msg=msg, + client=client, + wallet=wallet, gas_limit=gas_limit, - file=file_path, - permissioned_uploader_address=permissioned_uploader_address + fee=f"{int(GAS_PRICE*gas_limit)}{DENOM}" ) tx_hash = sha256(store_tx.tx.SerializeToString()).hexdigest() print("Tx hash: ", tx_hash) @@ -351,15 +296,19 @@ def store_contract(client, wallet, file_path, name, permissioned_uploader_addres def instantiate_contract(client, wallet, code_id, args, label, name) -> str: gas_limit = 300000 - instantiate_tx = create_wasm_instantiate_tx( - client=client, - wallet=wallet, - address=str(wallet.address()), - gas_fee=f"{int(GAS_PRICE*gas_limit)}{DENOM}", - gas_limit=gas_limit, + msg = MsgInstantiateContract( + sender=str(wallet.address()), + #admin=ADMIN_ADDRESS, code_id=code_id, - args=args, - label=label + msg=json_encode(args).encode("UTF8"), + label=label, + ) + instantiate_tx = create_tx( + msg=msg, + client=client, + wallet=wallet, + gas_limit=gas_limit, + fee=f"{int(GAS_PRICE*gas_limit)}{DENOM}" ) tx_hash = sha256(instantiate_tx.tx.SerializeToString()).hexdigest() print("Tx hash: ", tx_hash) @@ -373,17 +322,31 @@ def instantiate_contract(client, wallet, code_id, args, label, name) -> str: return contract_address -def instantiate2_contract(client, wallet, code_id, args, label, name, pre_gen_address) -> str: +def instantiate2_contract( + client, + wallet, + code_id, + args, + label, + name, + pre_gen_address +) -> str: gas_limit = 300000 - instantiate_2_tx = create_wasm_instantiate2_tx( - client=client, - wallet=wallet, - address=str(wallet.address()), - gas_fee=f"{int(GAS_PRICE*gas_limit)}{DENOM}", - gas_limit=gas_limit, + msg = MsgInstantiateContract2( + sender=str(wallet.address()), + #admin=ADMIN_ADDRESS, code_id=code_id, - args=args, - label=label + msg=json_encode(args).encode("UTF8"), + label=label, + salt=SALT, + fix_msg=False, + ) + instantiate_2_tx = create_tx( + msg=msg, + client=client, + wallet=wallet, + gas_limit=gas_limit, + fee=f"{int(GAS_PRICE*gas_limit)}{DENOM}" ) tx_hash = sha256(instantiate_2_tx.tx.SerializeToString()).hexdigest() print("Tx hash: ", tx_hash) @@ -421,7 +384,10 @@ def broadcast_tx(tx) -> httpx.Response: httpx.post(RPC_URL, json=data, timeout=60) print("Sleeping for 20 seconds...") time.sleep(20) - resp = httpx.get(REST_URL + f"/cosmos/tx/v1beta1/txs/{sha256(tx_bytes).hexdigest()}", timeout=60) + resp = httpx.get( + REST_URL + f"/cosmos/tx/v1beta1/txs/{sha256(tx_bytes).hexdigest()}", + timeout=60 + ) return resp From 180a2ba8402e535a0fb72393fcbf23294138e808 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:40:43 -0700 Subject: [PATCH 03/14] add admin param to instantiate/instantiate2 msgs --- scripts/deploy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index d5cf2c2f..72cf6ad9 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -86,7 +86,7 @@ ENTRY_POINT_PRE_GENERATED_ADDRESS = config["ENTRY_POINT_PRE_GENERATED_ADDRESS"] # Admin address for future migrations -# ADMIN_ADDRESS = config["ADMIN_ADDRESS"] +ADMIN_ADDRESS = config["ADMIN_ADDRESS"] MNEMONIC = config["MNEMONIC"] del config["MNEMONIC"] @@ -298,7 +298,7 @@ def instantiate_contract(client, wallet, code_id, args, label, name) -> str: gas_limit = 300000 msg = MsgInstantiateContract( sender=str(wallet.address()), - #admin=ADMIN_ADDRESS, + admin=ADMIN_ADDRESS, code_id=code_id, msg=json_encode(args).encode("UTF8"), label=label, @@ -334,7 +334,7 @@ def instantiate2_contract( gas_limit = 300000 msg = MsgInstantiateContract2( sender=str(wallet.address()), - #admin=ADMIN_ADDRESS, + admin=ADMIN_ADDRESS, code_id=code_id, msg=json_encode(args).encode("UTF8"), label=label, From 02c512a756a4d165721ede0ecd36377ccfe9ddf0 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:26:02 -0700 Subject: [PATCH 04/14] bump contract versions to 0.3.0 --- Cargo.lock | 16 +++++++++------- Cargo.toml | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e85462d5..a27c20ab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1054,7 +1054,7 @@ dependencies = [ [[package]] name = "skip" -version = "0.2.1" +version = "0.3.0" dependencies = [ "astroport", "cosmos-sdk-proto 0.19.0", @@ -1070,12 +1070,13 @@ dependencies = [ [[package]] name = "skip-api-entry-point" -version = "0.2.1" +version = "0.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.1.0", "cw-utils 1.0.1", + "cw2 1.1.0", "cw20 1.1.0", "skip", "test-case", @@ -1084,11 +1085,12 @@ dependencies = [ [[package]] name = "skip-api-ibc-adapter-ibc-hooks" -version = "0.2.1" +version = "0.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.1.0", + "cw2 1.1.0", "ibc-proto", "prost", "serde-cw-value", @@ -1100,7 +1102,7 @@ dependencies = [ [[package]] name = "skip-api-ibc-adapter-neutron-transfer" -version = "0.2.1" +version = "0.3.0" dependencies = [ "cosmos-sdk-proto 0.19.0", "cosmwasm-schema", @@ -1116,7 +1118,7 @@ dependencies = [ [[package]] name = "skip-api-swap-adapter-astroport" -version = "0.2.1" +version = "0.3.0" dependencies = [ "astroport", "cosmwasm-schema", @@ -1131,7 +1133,7 @@ dependencies = [ [[package]] name = "skip-api-swap-adapter-lido-satellite" -version = "0.2.1" +version = "0.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", @@ -1145,7 +1147,7 @@ dependencies = [ [[package]] name = "skip-api-swap-adapter-osmosis-poolmanager" -version = "0.2.1" +version = "0.3.0" dependencies = [ "cosmwasm-schema", "cosmwasm-std", diff --git a/Cargo.toml b/Cargo.toml index 74396f14..fd4c1e87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ ] [workspace.package] -version = "0.2.1" +version = "0.3.0" authors = ["Skip"] edition = "2021" rust-version = "1.71.0" @@ -35,7 +35,7 @@ osmosis-std = "0.15.3" prost = "0.11" serde-cw-value = "0.7.0" serde-json-wasm = "0.5.1" -skip = { version = "0.2.0", path = "./packages/skip" } +skip = { version = "0.3.0", path = "./packages/skip" } test-case = "3.1.0" thiserror = "1" From 7e62cc96f46adf6256dd2d65166dd3e723ceee6b Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:26:53 -0700 Subject: [PATCH 05/14] set contract version in entrypoint --- contracts/entry-point/Cargo.toml | 1 + contracts/entry-point/src/contract.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/contracts/entry-point/Cargo.toml b/contracts/entry-point/Cargo.toml index a07ff677..cbc82f61 100644 --- a/contracts/entry-point/Cargo.toml +++ b/contracts/entry-point/Cargo.toml @@ -22,6 +22,7 @@ library = [] [dependencies] cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true } cw20 = { workspace = true } cw-storage-plus = { workspace = true } cw-utils = { workspace = true } diff --git a/contracts/entry-point/src/contract.rs b/contracts/entry-point/src/contract.rs index 4550b432..9305192e 100644 --- a/contracts/entry-point/src/contract.rs +++ b/contracts/entry-point/src/contract.rs @@ -11,12 +11,17 @@ use crate::{ use cosmwasm_std::{ entry_point, to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, }; +use cw2::set_contract_version; use skip::entry_point::{ExecuteMsg, InstantiateMsg, QueryMsg}; /////////////////// /// INSTANTIATE /// /////////////////// +// Contract name and version used for migration. +const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut, @@ -24,6 +29,9 @@ pub fn instantiate( _info: MessageInfo, msg: InstantiateMsg, ) -> ContractResult { + // Set contract version + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + // Create response object to return let mut response: Response = Response::new().add_attribute("action", "instantiate"); From 5e29b5c6751ad1f281b5dcfe874ea87fa0c8d52d Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:29:07 -0700 Subject: [PATCH 06/14] add contract version to ibc adapter contracts --- Cargo.lock | 1 + contracts/adapters/ibc/ibc-hooks/Cargo.toml | 1 + contracts/adapters/ibc/ibc-hooks/src/contract.rs | 8 ++++++++ contracts/adapters/ibc/neutron-transfer/Cargo.toml | 1 + contracts/adapters/ibc/neutron-transfer/src/contract.rs | 8 ++++++++ 5 files changed, 19 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a27c20ab..8fbdf50d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1108,6 +1108,7 @@ dependencies = [ "cosmwasm-schema", "cosmwasm-std", "cw-storage-plus 1.1.0", + "cw2 1.1.0", "neutron-proto", "neutron-sdk 0.5.0", "prost", diff --git a/contracts/adapters/ibc/ibc-hooks/Cargo.toml b/contracts/adapters/ibc/ibc-hooks/Cargo.toml index 9072bbc4..89d55608 100644 --- a/contracts/adapters/ibc/ibc-hooks/Cargo.toml +++ b/contracts/adapters/ibc/ibc-hooks/Cargo.toml @@ -22,6 +22,7 @@ library = [] [dependencies] cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true } cw-storage-plus = { workspace = true } ibc-proto = { workspace = true } prost = { workspace = true } diff --git a/contracts/adapters/ibc/ibc-hooks/src/contract.rs b/contracts/adapters/ibc/ibc-hooks/src/contract.rs index 82e29c86..4f4ecc90 100644 --- a/contracts/adapters/ibc/ibc-hooks/src/contract.rs +++ b/contracts/adapters/ibc/ibc-hooks/src/contract.rs @@ -9,6 +9,7 @@ use cosmwasm_std::{ entry_point, to_binary, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, SubMsg, SubMsgResult, }; +use cw2::set_contract_version; use ibc_proto::ibc::applications::transfer::v1::{MsgTransfer, MsgTransferResponse}; use prost::Message; use serde_cw_value::Value; @@ -25,6 +26,10 @@ const REPLY_ID: u64 = 1; /// INSTANTIATE /// /////////////////// +// Contract name and version used for migration. +const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut, @@ -32,6 +37,9 @@ pub fn instantiate( _info: MessageInfo, msg: InstantiateMsg, ) -> ContractResult { + // Set contract version + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; diff --git a/contracts/adapters/ibc/neutron-transfer/Cargo.toml b/contracts/adapters/ibc/neutron-transfer/Cargo.toml index ae5ad3ce..90c3d3f7 100644 --- a/contracts/adapters/ibc/neutron-transfer/Cargo.toml +++ b/contracts/adapters/ibc/neutron-transfer/Cargo.toml @@ -22,6 +22,7 @@ library = [] [dependencies] cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true } cw-storage-plus = { workspace = true } neutron-proto = { workspace = true } neutron-sdk = { workspace = true } diff --git a/contracts/adapters/ibc/neutron-transfer/src/contract.rs b/contracts/adapters/ibc/neutron-transfer/src/contract.rs index 716f5b25..5f368b2a 100644 --- a/contracts/adapters/ibc/neutron-transfer/src/contract.rs +++ b/contracts/adapters/ibc/neutron-transfer/src/contract.rs @@ -6,6 +6,7 @@ use cosmwasm_std::{ entry_point, to_binary, BankMsg, Binary, Coin, Deps, DepsMut, Env, MessageInfo, Reply, Response, SubMsg, SubMsgResult, }; +use cw2::set_contract_version; use neutron_proto::neutron::transfer::{MsgTransfer, MsgTransferResponse}; use neutron_sdk::sudo::msg::{RequestPacket, TransferSudoMsg}; use prost::Message; @@ -21,6 +22,10 @@ const REPLY_ID: u64 = 1; /// INSTANTIATE /// /////////////////// +// Contract name and version used for migration. +const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut, @@ -28,6 +33,9 @@ pub fn instantiate( _info: MessageInfo, msg: InstantiateMsg, ) -> ContractResult { + // Set contract version + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; From 42a20ec5f26b04db95c2639a4e3dac63de4e4707 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:32:37 -0700 Subject: [PATCH 07/14] add contract version to swap adapter contracts --- Cargo.lock | 3 +++ contracts/adapters/swap/astroport/Cargo.toml | 1 + contracts/adapters/swap/astroport/src/contract.rs | 8 ++++++++ contracts/adapters/swap/lido-satellite/Cargo.toml | 1 + contracts/adapters/swap/lido-satellite/src/contract.rs | 8 ++++++++ contracts/adapters/swap/osmosis-poolmanager/Cargo.toml | 1 + .../adapters/swap/osmosis-poolmanager/src/contract.rs | 8 ++++++++ 7 files changed, 30 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 8fbdf50d..977beb98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1126,6 +1126,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus 1.1.0", "cw-utils 1.0.1", + "cw2 1.1.0", "cw20 1.1.0", "skip", "test-case", @@ -1140,6 +1141,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus 1.1.0", "cw-utils 1.0.1", + "cw2 1.1.0", "lido-satellite", "skip", "test-case", @@ -1154,6 +1156,7 @@ dependencies = [ "cosmwasm-std", "cw-storage-plus 1.1.0", "cw-utils 1.0.1", + "cw2 1.1.0", "osmosis-std", "skip", "test-case", diff --git a/contracts/adapters/swap/astroport/Cargo.toml b/contracts/adapters/swap/astroport/Cargo.toml index 5f65f54b..46ee290b 100644 --- a/contracts/adapters/swap/astroport/Cargo.toml +++ b/contracts/adapters/swap/astroport/Cargo.toml @@ -23,6 +23,7 @@ library = [] astroport = { workspace = true } cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true } cw20 = { workspace = true } cw-storage-plus = { workspace = true } cw-utils = { workspace = true } diff --git a/contracts/adapters/swap/astroport/src/contract.rs b/contracts/adapters/swap/astroport/src/contract.rs index e1199d09..19dcbdc4 100644 --- a/contracts/adapters/swap/astroport/src/contract.rs +++ b/contracts/adapters/swap/astroport/src/contract.rs @@ -13,6 +13,7 @@ use cosmwasm_std::{ entry_point, from_binary, to_binary, Addr, Api, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Response, Uint128, WasmMsg, }; +use cw2::set_contract_version; use cw20::{Cw20Coin, Cw20ReceiveMsg}; use cw_utils::one_coin; use skip::{ @@ -28,6 +29,10 @@ use skip::{ /// INSTANTIATE /// /////////////////// +// Contract name and version used for migration. +const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut, @@ -35,6 +40,9 @@ pub fn instantiate( _info: MessageInfo, msg: InstantiateMsg, ) -> ContractResult { + // Set contract version + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; diff --git a/contracts/adapters/swap/lido-satellite/Cargo.toml b/contracts/adapters/swap/lido-satellite/Cargo.toml index 1880abe6..f08e2e1f 100644 --- a/contracts/adapters/swap/lido-satellite/Cargo.toml +++ b/contracts/adapters/swap/lido-satellite/Cargo.toml @@ -22,6 +22,7 @@ library = [] [dependencies] cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true } cw-storage-plus = { workspace = true } cw-utils = { workspace = true } lido-satellite = { workspace = true } diff --git a/contracts/adapters/swap/lido-satellite/src/contract.rs b/contracts/adapters/swap/lido-satellite/src/contract.rs index 87c93f4f..e7fe6ff0 100644 --- a/contracts/adapters/swap/lido-satellite/src/contract.rs +++ b/contracts/adapters/swap/lido-satellite/src/contract.rs @@ -9,6 +9,7 @@ use cosmwasm_std::{ entry_point, to_binary, Binary, Coin, Decimal, Deps, DepsMut, Env, MessageInfo, Response, WasmMsg, }; +use cw2::set_contract_version; use cw_utils::one_coin; use skip::{ asset::Asset, @@ -23,6 +24,10 @@ use skip::{ /// INSTANTIATE /// /////////////////// +// Contract name and version used for migration. +const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut, @@ -30,6 +35,9 @@ pub fn instantiate( _info: MessageInfo, msg: InstantiateMsg, ) -> ContractResult { + // Set contract version + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; diff --git a/contracts/adapters/swap/osmosis-poolmanager/Cargo.toml b/contracts/adapters/swap/osmosis-poolmanager/Cargo.toml index e4cdf8e1..a3aea215 100644 --- a/contracts/adapters/swap/osmosis-poolmanager/Cargo.toml +++ b/contracts/adapters/swap/osmosis-poolmanager/Cargo.toml @@ -22,6 +22,7 @@ library = [] [dependencies] cosmwasm-schema = { workspace = true } cosmwasm-std = { workspace = true } +cw2 = { workspace = true } cw-storage-plus = { workspace = true } cw-utils = { workspace = true } osmosis-std = { workspace = true } diff --git a/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs b/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs index c9fbbbd9..259b8983 100644 --- a/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs +++ b/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs @@ -6,6 +6,7 @@ use cosmwasm_std::{ entry_point, to_binary, Binary, Coin, CosmosMsg, Decimal, Deps, DepsMut, Empty, Env, MessageInfo, Response, Uint128, WasmMsg, }; +use cw2::set_contract_version; use cw_utils::one_coin; use osmosis_std::types::osmosis::poolmanager::v1beta1::{ EstimateSwapExactAmountInResponse, EstimateSwapExactAmountOutResponse, MsgSwapExactAmountIn, @@ -26,6 +27,10 @@ use std::str::FromStr; /// INSTANTIATE /// /////////////////// +// Contract name and version used for migration. +const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[cfg_attr(not(feature = "library"), entry_point)] pub fn instantiate( deps: DepsMut, @@ -33,6 +38,9 @@ pub fn instantiate( _info: MessageInfo, msg: InstantiateMsg, ) -> ContractResult { + // Set contract version + set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; From 67e9e019b0bee0519c5366795921afbbf82ce750 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:35:23 -0700 Subject: [PATCH 08/14] remove unused python import --- scripts/deploy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index 72cf6ad9..ff27218c 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -10,7 +10,6 @@ from google.protobuf import any_pb2 from cosmpy.aerial.client import LedgerClient, NetworkConfig -from cosmpy.aerial.contract import create_cosmwasm_execute_msg from cosmpy.aerial.tx import Transaction, SigningCfg from cosmpy.aerial.wallet import LocalWallet from cosmpy.crypto.keypairs import PrivateKey From e0304bb013d1cd6d1d207ad92069565a35b5c80b Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:35:53 -0700 Subject: [PATCH 09/14] remove another unused import in python --- scripts/deploy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index ff27218c..7d8efa67 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -13,7 +13,6 @@ from cosmpy.aerial.tx import Transaction, SigningCfg from cosmpy.aerial.wallet import LocalWallet from cosmpy.crypto.keypairs import PrivateKey -from cosmpy.protos.cosmos.base.v1beta1.coin_pb2 import Coin from cosmpy.protos.cosmwasm.wasm.v1.tx_pb2 import ( MsgStoreCode, MsgInstantiateContract, From ed9bfd205d71954c457934ed3b6946c9d46e0d47 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:42:52 -0700 Subject: [PATCH 10/14] add migrate message to entry point contract --- contracts/entry-point/src/contract.rs | 13 +++++++++++-- packages/skip/src/entry_point.rs | 8 ++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/contracts/entry-point/src/contract.rs b/contracts/entry-point/src/contract.rs index 9305192e..0f3fb5da 100644 --- a/contracts/entry-point/src/contract.rs +++ b/contracts/entry-point/src/contract.rs @@ -12,7 +12,16 @@ use cosmwasm_std::{ entry_point, to_binary, Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdResult, }; use cw2::set_contract_version; -use skip::entry_point::{ExecuteMsg, InstantiateMsg, QueryMsg}; +use skip::entry_point::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; + +/////////////// +/// MIGRATE /// +/////////////// + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult { + unimplemented!() +} /////////////////// /// INSTANTIATE /// @@ -31,7 +40,7 @@ pub fn instantiate( ) -> ContractResult { // Set contract version set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - + // Create response object to return let mut response: Response = Response::new().add_attribute("action", "instantiate"); diff --git a/packages/skip/src/entry_point.rs b/packages/skip/src/entry_point.rs index 1c97fc50..21e42c28 100644 --- a/packages/skip/src/entry_point.rs +++ b/packages/skip/src/entry_point.rs @@ -8,6 +8,14 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::{Addr, Binary, Uint128}; use cw20::Cw20ReceiveMsg; +/////////////// +/// MIGRATE /// +/////////////// + +// The MigrateMsg struct defines the migration parameters for the entry point contract. +#[cw_serde] +pub struct MigrateMsg {} + /////////////////// /// INSTANTIATE /// /////////////////// From 8e92a2688c14037c77f1129772894026ea2e2475 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 14:42:57 -0700 Subject: [PATCH 11/14] run make fmt --- contracts/adapters/ibc/ibc-hooks/src/contract.rs | 2 +- contracts/adapters/ibc/neutron-transfer/src/contract.rs | 2 +- contracts/adapters/swap/astroport/src/contract.rs | 2 +- contracts/adapters/swap/lido-satellite/src/contract.rs | 2 +- contracts/adapters/swap/osmosis-poolmanager/src/contract.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/adapters/ibc/ibc-hooks/src/contract.rs b/contracts/adapters/ibc/ibc-hooks/src/contract.rs index 4f4ecc90..75bf3ce2 100644 --- a/contracts/adapters/ibc/ibc-hooks/src/contract.rs +++ b/contracts/adapters/ibc/ibc-hooks/src/contract.rs @@ -39,7 +39,7 @@ pub fn instantiate( ) -> ContractResult { // Set contract version set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; diff --git a/contracts/adapters/ibc/neutron-transfer/src/contract.rs b/contracts/adapters/ibc/neutron-transfer/src/contract.rs index 5f368b2a..066e9276 100644 --- a/contracts/adapters/ibc/neutron-transfer/src/contract.rs +++ b/contracts/adapters/ibc/neutron-transfer/src/contract.rs @@ -35,7 +35,7 @@ pub fn instantiate( ) -> ContractResult { // Set contract version set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; diff --git a/contracts/adapters/swap/astroport/src/contract.rs b/contracts/adapters/swap/astroport/src/contract.rs index 19dcbdc4..60e84738 100644 --- a/contracts/adapters/swap/astroport/src/contract.rs +++ b/contracts/adapters/swap/astroport/src/contract.rs @@ -42,7 +42,7 @@ pub fn instantiate( ) -> ContractResult { // Set contract version set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; diff --git a/contracts/adapters/swap/lido-satellite/src/contract.rs b/contracts/adapters/swap/lido-satellite/src/contract.rs index e7fe6ff0..6fc2847a 100644 --- a/contracts/adapters/swap/lido-satellite/src/contract.rs +++ b/contracts/adapters/swap/lido-satellite/src/contract.rs @@ -37,7 +37,7 @@ pub fn instantiate( ) -> ContractResult { // Set contract version set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; diff --git a/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs b/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs index 259b8983..899e107c 100644 --- a/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs +++ b/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs @@ -40,7 +40,7 @@ pub fn instantiate( ) -> ContractResult { // Set contract version set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; - + // Validate entry point contract address let checked_entry_point_contract_address = deps.api.addr_validate(&msg.entry_point_contract_address)?; From 269d6d4e45f020d7112bbbce2c418777fb862bc6 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 16:02:14 -0700 Subject: [PATCH 12/14] add migrate msg to adapter contract --- contracts/adapters/ibc/ibc-hooks/src/contract.rs | 11 ++++++++++- .../adapters/ibc/neutron-transfer/src/contract.rs | 11 ++++++++++- contracts/adapters/swap/astroport/src/contract.rs | 13 +++++++++++-- .../adapters/swap/lido-satellite/src/contract.rs | 11 ++++++++++- .../swap/osmosis-poolmanager/src/contract.rs | 11 ++++++++++- contracts/entry-point/src/contract.rs | 2 +- packages/skip/src/ibc.rs | 8 ++++++++ packages/skip/src/swap.rs | 8 ++++++++ 8 files changed, 68 insertions(+), 7 deletions(-) diff --git a/contracts/adapters/ibc/ibc-hooks/src/contract.rs b/contracts/adapters/ibc/ibc-hooks/src/contract.rs index 75bf3ce2..fe34f646 100644 --- a/contracts/adapters/ibc/ibc-hooks/src/contract.rs +++ b/contracts/adapters/ibc/ibc-hooks/src/contract.rs @@ -14,7 +14,7 @@ use ibc_proto::ibc::applications::transfer::v1::{MsgTransfer, MsgTransferRespons use prost::Message; use serde_cw_value::Value; use skip::{ - ibc::{AckID, ExecuteMsg, IbcInfo, IbcLifecycleComplete, InstantiateMsg, QueryMsg}, + ibc::{AckID, ExecuteMsg, IbcInfo, IbcLifecycleComplete, InstantiateMsg, MigrateMsg, QueryMsg}, proto_coin::ProtoCoin, sudo::{OsmosisSudoMsg as SudoMsg, SudoType}, }; @@ -22,6 +22,15 @@ use skip::{ const IBC_MSG_TRANSFER_TYPE_URL: &str = "/ibc.applications.transfer.v1.MsgTransfer"; const REPLY_ID: u64 = 1; +/////////////// +/// MIGRATE /// +/////////////// + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult { + unimplemented!() +} + /////////////////// /// INSTANTIATE /// /////////////////// diff --git a/contracts/adapters/ibc/neutron-transfer/src/contract.rs b/contracts/adapters/ibc/neutron-transfer/src/contract.rs index 066e9276..6601cfd7 100644 --- a/contracts/adapters/ibc/neutron-transfer/src/contract.rs +++ b/contracts/adapters/ibc/neutron-transfer/src/contract.rs @@ -11,13 +11,22 @@ use neutron_proto::neutron::transfer::{MsgTransfer, MsgTransferResponse}; use neutron_sdk::sudo::msg::{RequestPacket, TransferSudoMsg}; use prost::Message; use skip::{ - ibc::{AckID, ExecuteMsg, IbcInfo, InstantiateMsg, QueryMsg}, + ibc::{AckID, ExecuteMsg, IbcInfo, InstantiateMsg, MigrateMsg, QueryMsg}, proto_coin::ProtoCoin, sudo::SudoType, }; const REPLY_ID: u64 = 1; +/////////////// +/// MIGRATE /// +/////////////// + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult { + unimplemented!() +} + /////////////////// /// INSTANTIATE /// /////////////////// diff --git a/contracts/adapters/swap/astroport/src/contract.rs b/contracts/adapters/swap/astroport/src/contract.rs index 60e84738..cc2a803b 100644 --- a/contracts/adapters/swap/astroport/src/contract.rs +++ b/contracts/adapters/swap/astroport/src/contract.rs @@ -20,11 +20,20 @@ use skip::{ asset::Asset, swap::{ execute_transfer_funds_back, AstroportInstantiateMsg as InstantiateMsg, Cw20HookMsg, - ExecuteMsg, QueryMsg, SimulateSwapExactAssetInResponse, SimulateSwapExactAssetOutResponse, - SwapOperation, + ExecuteMsg, MigrateMsg, QueryMsg, SimulateSwapExactAssetInResponse, + SimulateSwapExactAssetOutResponse, SwapOperation, }, }; +/////////////// +/// MIGRATE /// +/////////////// + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult { + unimplemented!() +} + /////////////////// /// INSTANTIATE /// /////////////////// diff --git a/contracts/adapters/swap/lido-satellite/src/contract.rs b/contracts/adapters/swap/lido-satellite/src/contract.rs index 6fc2847a..a47aa06f 100644 --- a/contracts/adapters/swap/lido-satellite/src/contract.rs +++ b/contracts/adapters/swap/lido-satellite/src/contract.rs @@ -15,11 +15,20 @@ use skip::{ asset::Asset, swap::{ execute_transfer_funds_back, ExecuteMsg, LidoSatelliteInstantiateMsg as InstantiateMsg, - QueryMsg, SimulateSwapExactAssetInResponse, SimulateSwapExactAssetOutResponse, + MigrateMsg, QueryMsg, SimulateSwapExactAssetInResponse, SimulateSwapExactAssetOutResponse, SwapOperation, }, }; +/////////////// +/// MIGRATE /// +/////////////// + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult { + unimplemented!() +} + /////////////////// /// INSTANTIATE /// /////////////////// diff --git a/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs b/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs index 899e107c..2a40dbf8 100644 --- a/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs +++ b/contracts/adapters/swap/osmosis-poolmanager/src/contract.rs @@ -16,13 +16,22 @@ use skip::{ asset::Asset, proto_coin::ProtoCoin, swap::{ - convert_swap_operations, execute_transfer_funds_back, ExecuteMsg, + convert_swap_operations, execute_transfer_funds_back, ExecuteMsg, MigrateMsg, OsmosisInstantiateMsg as InstantiateMsg, QueryMsg, SimulateSwapExactAssetInResponse, SimulateSwapExactAssetOutResponse, SwapOperation, }, }; use std::str::FromStr; +/////////////// +/// MIGRATE /// +/////////////// + +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult { + unimplemented!() +} + /////////////////// /// INSTANTIATE /// /////////////////// diff --git a/contracts/entry-point/src/contract.rs b/contracts/entry-point/src/contract.rs index 0f3fb5da..0e53a09a 100644 --- a/contracts/entry-point/src/contract.rs +++ b/contracts/entry-point/src/contract.rs @@ -19,7 +19,7 @@ use skip::entry_point::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; /////////////// #[cfg_attr(not(feature = "library"), entry_point)] -pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult { +pub fn migrate(_deps: DepsMut, _env: Env, _msg: MigrateMsg) -> ContractResult { unimplemented!() } diff --git a/packages/skip/src/ibc.rs b/packages/skip/src/ibc.rs index 358dfa02..3a191bd6 100644 --- a/packages/skip/src/ibc.rs +++ b/packages/skip/src/ibc.rs @@ -6,6 +6,14 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use cosmwasm_std::{Coin, Coins, StdError}; use neutron_proto::neutron::feerefunder::Fee as NeutronFee; +/////////////// +/// MIGRATE /// +/////////////// + +// The MigrateMsg struct defines the migration parameters for the entry point contract. +#[cw_serde] +pub struct MigrateMsg {} + /////////////////// /// INSTANTIATE /// /////////////////// diff --git a/packages/skip/src/swap.rs b/packages/skip/src/swap.rs index 20a236cf..70d71e80 100644 --- a/packages/skip/src/swap.rs +++ b/packages/skip/src/swap.rs @@ -11,6 +11,14 @@ use osmosis_std::types::osmosis::poolmanager::v1beta1::{ SwapAmountInRoute as OsmosisSwapAmountInRoute, SwapAmountOutRoute as OsmosisSwapAmountOutRoute, }; +/////////////// +/// MIGRATE /// +/////////////// + +// The MigrateMsg struct defines the migration parameters for the entry point contract. +#[cw_serde] +pub struct MigrateMsg {} + /////////////////// /// INSTANTIATE /// /////////////////// From 3b110d7057ff690e3e56c64d611673283b2d1ac8 Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 16:15:53 -0700 Subject: [PATCH 13/14] run make schema --- schema/skip-api-entry-point.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/skip-api-entry-point.json b/schema/skip-api-entry-point.json index 86d80f60..ef2282b9 100644 --- a/schema/skip-api-entry-point.json +++ b/schema/skip-api-entry-point.json @@ -1,6 +1,6 @@ { "contract_name": "skip-api-entry-point", - "contract_version": "0.2.1", + "contract_version": "0.3.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", From 508c73c6a39f9346086934b7f6a8ceb81a5a3fdf Mon Sep 17 00:00:00 2001 From: Jeremy Liu <31809888+NotJeremyLiu@users.noreply.github.com> Date: Wed, 3 Jan 2024 17:32:37 -0700 Subject: [PATCH 14/14] use correct var name --- scripts/deploy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.py b/scripts/deploy.py index 7d8efa67..50870b82 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -263,14 +263,14 @@ def store_contract( if permissioned_uploader_address is not None: msg_store_code = MsgStoreCode( sender=permissioned_uploader_address, - wasm_byte_code=open(file, "rb").read(), + wasm_byte_code=open(file_path, "rb").read(), instantiate_permission=None ) msg = create_exec_msg(msg=msg_store_code, grantee_address=str(wallet.address())) else: msg = MsgStoreCode( sender=str(wallet.address()), - wasm_byte_code=open(file, "rb").read(), + wasm_byte_code=open(file_path, "rb").read(), instantiate_permission=None ) store_tx = create_tx(