diff --git a/Cargo.lock b/Cargo.lock index c56a48a..f9d37b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -445,36 +445,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cw-hub-bnusd" -version = "0.1.0" -dependencies = [ - "anyhow", - "bytes", - "common 0.1.0 (git+https://github.com/icon-project/IBC-Integration.git?branch=main)", - "cosmwasm-schema", - "cosmwasm-std", - "cosmwasm-storage", - "cw-common 0.1.0", - "cw-common 0.1.2", - "cw-mock-ibc-connection 0.1.0", - "cw-mock-ibc-core", - "cw-multi-test", - "cw-storage-plus 1.2.0", - "cw-xcall 0.2.1 (git+https://github.com/icon-project/xcall-multi.git?branch=main)", - "cw-xcall-lib 0.1.0 (git+https://github.com/icon-project/xcall-multi.git?branch=main)", - "cw-xcall-manager", - "cw2", - "cw20", - "cw20-base", - "debug_print", - "getrandom", - "hex", - "schemars", - "serde", - "thiserror", -] - [[package]] name = "cw-mock-ibc-connection" version = "0.1.0" @@ -555,6 +525,36 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cw-spoke-token" +version = "0.1.0" +dependencies = [ + "anyhow", + "bytes", + "common 0.1.0 (git+https://github.com/icon-project/IBC-Integration.git?branch=main)", + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-storage", + "cw-common 0.1.0", + "cw-common 0.1.2", + "cw-mock-ibc-connection 0.1.0", + "cw-mock-ibc-core", + "cw-multi-test", + "cw-storage-plus 1.2.0", + "cw-xcall 0.2.1 (git+https://github.com/icon-project/xcall-multi.git?branch=main)", + "cw-xcall-lib 0.1.0 (git+https://github.com/icon-project/xcall-multi.git?branch=main)", + "cw-xcall-manager", + "cw2", + "cw20", + "cw20-base", + "debug_print", + "getrandom", + "hex", + "schemars", + "serde", + "thiserror", +] + [[package]] name = "cw-storage-plus" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index 9be2277..a8fb871 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ # "contracts/core-contracts/*", - "contracts/token-contracts/cw-hub-bnusd", + "contracts/token-contracts/cw-spoke-token", "contracts/core-contracts/cw-asset-manager", "contracts/core-contracts/cw-xcall-manager", "contracts/cw-common", diff --git a/contracts/cw-common/src/hub_token_msg.rs b/contracts/cw-common/src/hub_token_msg.rs index 6564ec4..b3b61fd 100644 --- a/contracts/cw-common/src/hub_token_msg.rs +++ b/contracts/cw-common/src/hub_token_msg.rs @@ -10,6 +10,9 @@ pub struct InstantiateMsg { pub x_call: String, pub hub_address: String, pub manager: Addr, + pub name: String, + pub symbol: String, + pub decimals: u8, } #[cw_serde] diff --git a/contracts/token-contracts/cw-hub-bnusd/Cargo.toml b/contracts/token-contracts/cw-spoke-token/Cargo.toml similarity index 97% rename from contracts/token-contracts/cw-hub-bnusd/Cargo.toml rename to contracts/token-contracts/cw-spoke-token/Cargo.toml index cc9869c..b4d70be 100644 --- a/contracts/token-contracts/cw-hub-bnusd/Cargo.toml +++ b/contracts/token-contracts/cw-spoke-token/Cargo.toml @@ -1,7 +1,6 @@ [package] -name = "cw-hub-bnusd" +name = "cw-spoke-token" version = "0.1.0" -authors = ["Night Owl "] edition = "2021" exclude = [ diff --git a/contracts/token-contracts/cw-hub-bnusd/README.md b/contracts/token-contracts/cw-spoke-token/README.md similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/README.md rename to contracts/token-contracts/cw-spoke-token/README.md diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/cw-hub-bnusd.json b/contracts/token-contracts/cw-spoke-token/schema/cw-hub-bnusd.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/cw-hub-bnusd.json rename to contracts/token-contracts/cw-spoke-token/schema/cw-hub-bnusd.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/execute.json b/contracts/token-contracts/cw-spoke-token/schema/raw/execute.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/execute.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/execute.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/instantiate.json b/contracts/token-contracts/cw-spoke-token/schema/raw/instantiate.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/instantiate.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/instantiate.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/query.json b/contracts/token-contracts/cw-spoke-token/schema/raw/query.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/query.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/query.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_all_accounts.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_all_accounts.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_all_accounts.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_all_accounts.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_all_allowances.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_all_allowances.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_all_allowances.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_all_allowances.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_all_spender_allowances.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_all_spender_allowances.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_all_spender_allowances.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_all_spender_allowances.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_allowance.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_allowance.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_allowance.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_allowance.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_balance.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_balance.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_balance.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_balance.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_download_logo.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_download_logo.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_download_logo.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_download_logo.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_marketing_info.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_marketing_info.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_marketing_info.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_marketing_info.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_minter.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_minter.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_minter.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_minter.json diff --git a/contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_token_info.json b/contracts/token-contracts/cw-spoke-token/schema/raw/response_to_token_info.json similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/schema/raw/response_to_token_info.json rename to contracts/token-contracts/cw-spoke-token/schema/raw/response_to_token_info.json diff --git a/contracts/token-contracts/cw-hub-bnusd/src/bin/schema.rs b/contracts/token-contracts/cw-spoke-token/src/bin/schema.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/src/bin/schema.rs rename to contracts/token-contracts/cw-spoke-token/src/bin/schema.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/src/constants.rs b/contracts/token-contracts/cw-spoke-token/src/constants.rs similarity index 65% rename from contracts/token-contracts/cw-hub-bnusd/src/constants.rs rename to contracts/token-contracts/cw-spoke-token/src/constants.rs index a205778..893ae47 100644 --- a/contracts/token-contracts/cw-hub-bnusd/src/constants.rs +++ b/contracts/token-contracts/cw-spoke-token/src/constants.rs @@ -2,8 +2,5 @@ use cosmwasm_std::Uint128; pub const X_CROSS_TRANSFER: &str = "xCrossTransfer"; pub const X_CROSS_TRANSFER_REVERT: &str = "xCrossTransferRevert"; -pub const TOKEN_NAME: &str = "Balanced Dollar"; -pub const TOKEN_SYMBOL: &str = "bnUSD"; -pub const TOKEN_DECIMALS: u8 = 18; pub const TOKEN_TOTAL_SUPPLY: Uint128 = Uint128::zero(); pub const PROTOCOL: &str = "btp"; diff --git a/contracts/token-contracts/cw-hub-bnusd/src/contract.rs b/contracts/token-contracts/cw-spoke-token/src/contract.rs similarity index 99% rename from contracts/token-contracts/cw-hub-bnusd/src/contract.rs rename to contracts/token-contracts/cw-spoke-token/src/contract.rs index 22332de..27b2c48 100644 --- a/contracts/token-contracts/cw-hub-bnusd/src/contract.rs +++ b/contracts/token-contracts/cw-spoke-token/src/contract.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use crate::constants::{ - TOKEN_DECIMALS, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_TOTAL_SUPPLY, X_CROSS_TRANSFER, + TOKEN_TOTAL_SUPPLY, X_CROSS_TRANSFER, X_CROSS_TRANSFER_REVERT, }; use crate::error::ContractError; @@ -71,9 +71,9 @@ pub fn instantiate( NetworkAddress::from_str(&msg.hub_address).map_err(ContractError::Std)?; let token_info = TokenInfo { - name: TOKEN_NAME.to_string(), - symbol: TOKEN_SYMBOL.to_string(), - decimals: TOKEN_DECIMALS, + name: msg.name, + symbol: msg.symbol, + decimals: msg.decimals, total_supply: TOKEN_TOTAL_SUPPLY, mint: Some(MinterData { minter: x_call_addr.clone(), diff --git a/contracts/token-contracts/cw-hub-bnusd/src/cw20_adapter.rs b/contracts/token-contracts/cw-spoke-token/src/cw20_adapter.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/src/cw20_adapter.rs rename to contracts/token-contracts/cw-spoke-token/src/cw20_adapter.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/src/error.rs b/contracts/token-contracts/cw-spoke-token/src/error.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/src/error.rs rename to contracts/token-contracts/cw-spoke-token/src/error.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/src/events.rs b/contracts/token-contracts/cw-spoke-token/src/events.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/src/events.rs rename to contracts/token-contracts/cw-spoke-token/src/events.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/src/helpers.rs b/contracts/token-contracts/cw-spoke-token/src/helpers.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/src/helpers.rs rename to contracts/token-contracts/cw-spoke-token/src/helpers.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/src/lib.rs b/contracts/token-contracts/cw-spoke-token/src/lib.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/src/lib.rs rename to contracts/token-contracts/cw-spoke-token/src/lib.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/src/state.rs b/contracts/token-contracts/cw-spoke-token/src/state.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/src/state.rs rename to contracts/token-contracts/cw-spoke-token/src/state.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/tests/cross_transfer_test.rs b/contracts/token-contracts/cw-spoke-token/tests/cross_transfer_test.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/tests/cross_transfer_test.rs rename to contracts/token-contracts/cw-spoke-token/tests/cross_transfer_test.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/tests/cw20_flow_test.rs b/contracts/token-contracts/cw-spoke-token/tests/cw20_flow_test.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/tests/cw20_flow_test.rs rename to contracts/token-contracts/cw-spoke-token/tests/cw20_flow_test.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/tests/handle_call_message_test.rs b/contracts/token-contracts/cw-spoke-token/tests/handle_call_message_test.rs similarity index 100% rename from contracts/token-contracts/cw-hub-bnusd/tests/handle_call_message_test.rs rename to contracts/token-contracts/cw-spoke-token/tests/handle_call_message_test.rs diff --git a/contracts/token-contracts/cw-hub-bnusd/tests/setup.rs b/contracts/token-contracts/cw-spoke-token/tests/setup.rs similarity index 97% rename from contracts/token-contracts/cw-hub-bnusd/tests/setup.rs rename to contracts/token-contracts/cw-spoke-token/tests/setup.rs index de4ceb1..96874c4 100644 --- a/contracts/token-contracts/cw-hub-bnusd/tests/setup.rs +++ b/contracts/token-contracts/cw-spoke-token/tests/setup.rs @@ -41,6 +41,10 @@ pub struct TestContext { pub caller: Option, } +pub const TOKEN_NAME: &str = "Balanced Dollar"; +pub const TOKEN_SYMBOL: &str = "bnUSD"; +pub const TOKEN_DECIMALS: u8 = 18; + impl TestContext { pub fn set_xcall_app(&mut self, addr: Addr) -> Option { self.contracts.insert(TestApps::XCall, addr) @@ -211,6 +215,9 @@ pub fn init_token(mut ctx: TestContext, _x_call_address: String) -> TestContext x_call: Addr::unchecked(_x_call_address).into_string(), hub_address: "icon/cx9876543210fedcba9876543210fedcba98765432".to_owned(), manager: Addr::unchecked("manager"), + name: TOKEN_NAME.to_string(), + symbol: TOKEN_SYMBOL.to_string(), + decimals: TOKEN_DECIMALS, }, &[], "HubToken", diff --git a/scripts/generate_wasm.sh b/scripts/generate_wasm.sh index 3ef29b4..3f41d7c 100755 --- a/scripts/generate_wasm.sh +++ b/scripts/generate_wasm.sh @@ -40,7 +40,7 @@ for WASM in ./target/wasm32-unknown-unknown/release/*.wasm; do done cosmwasm-check "artifacts/archway/cw_asset_manager.wasm" -cosmwasm-check "artifacts/archway/cw_hub_bnusd.wasm" +cosmwasm-check "artifacts/archway/cw_spoke_token.wasm" # validate size echo "Check if size of wasm file exceeds $MAX_WASM_SIZE kilobytes..." @@ -53,3 +53,4 @@ for file in artifacts/archway/*.wasm; do echo "$file : $size KB" done echo "The size of all contracts is well within the $MAX_WASM_SIZE KB limit." +