Skip to content

Commit

Permalink
fix: generalize spoke token
Browse files Browse the repository at this point in the history
  • Loading branch information
gcranju committed Nov 21, 2024
1 parent 5bc8b8c commit 55a99ee
Show file tree
Hide file tree
Showing 32 changed files with 48 additions and 41 deletions.
60 changes: 30 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 3 additions & 0 deletions contracts/cw-common/src/hub_token_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "cw-hub-bnusd"
name = "cw-spoke-token"
version = "0.1.0"
authors = ["Night Owl <nightowl121@protonmail.com>"]
edition = "2021"

exclude = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ pub struct TestContext {
pub caller: Option<String>,
}

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<Addr> {
self.contracts.insert(TestApps::XCall, addr)
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion scripts/generate_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand All @@ -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."

0 comments on commit 55a99ee

Please sign in to comment.