diff --git a/Cargo.lock b/Cargo.lock index c7293902..5c16c79d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "terraswap-factory" -version = "1.2.0" +version = "1.2.1" dependencies = [ "cosmwasm-schema", "cosmwasm-std", diff --git a/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml b/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml index ffd10b12..e7b4097a 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "terraswap-factory" -version = "1.2.0" +version = "1.2.1" authors = [ "Terraform Labs, PTE.", "DELIGHT LABS", diff --git a/contracts/liquidity_hub/pool-network/terraswap_factory/src/commands.rs b/contracts/liquidity_hub/pool-network/terraswap_factory/src/commands.rs index 28c82951..bfcff909 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_factory/src/commands.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_factory/src/commands.rs @@ -1,5 +1,3 @@ -use crate::contract::{CREATE_PAIR_RESPONSE, CREATE_TRIO_RESPONSE}; - use cosmwasm_std::{ to_binary, wasm_execute, CosmosMsg, DepsMut, Env, MessageInfo, ReplyOn, Response, SubMsg, WasmMsg, @@ -10,13 +8,13 @@ use white_whale::pool_network::asset::{AssetInfo, PairType}; use white_whale::pool_network::pair::{ FeatureToggle, InstantiateMsg as PairInstantiateMsg, MigrateMsg as PairMigrateMsg, PoolFee, }; -use white_whale::pool_network::querier::query_balance; use white_whale::pool_network::trio::{ FeatureToggle as TrioFeatureToggle, InstantiateMsg as TrioInstantiateMsg, MigrateMsg as TrioMigrateMsg, PoolFee as TrioPoolFee, RampAmp, }; use white_whale::pool_network::{pair, trio}; +use crate::contract::{CREATE_PAIR_RESPONSE, CREATE_TRIO_RESPONSE}; use crate::error::ContractError; use crate::state::{ add_allow_native_token, pair_key, trio_key, Config, TmpPairInfo, TmpTrioInfo, CONFIG, PAIRS, @@ -369,15 +367,9 @@ pub fn remove_trio( /// Adds native/ibc token with decimals to the factory's whitelist so it can create pairs with that asset pub fn add_native_token_decimals( deps: DepsMut, - env: Env, denom: String, decimals: u8, ) -> Result { - let balance = query_balance(&deps.querier, env.contract.address, denom.to_string())?; - if balance.is_zero() { - return Err(ContractError::InvalidVerificationBalance {}); - } - add_allow_native_token(deps.storage, denom.to_string(), decimals)?; Ok(Response::new().add_attributes(vec![ diff --git a/contracts/liquidity_hub/pool-network/terraswap_factory/src/contract.rs b/contracts/liquidity_hub/pool-network/terraswap_factory/src/contract.rs index 04c0aa8d..f9e7d075 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_factory/src/contract.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_factory/src/contract.rs @@ -105,7 +105,7 @@ pub fn execute( ExecuteMsg::RemovePair { asset_infos } => commands::remove_pair(deps, env, asset_infos), ExecuteMsg::RemoveTrio { asset_infos } => commands::remove_trio(deps, env, asset_infos), ExecuteMsg::AddNativeTokenDecimals { denom, decimals } => { - commands::add_native_token_decimals(deps, env, denom, decimals) + commands::add_native_token_decimals(deps, denom, decimals) } ExecuteMsg::MigratePair { contract, code_id } => { commands::execute_migrate_pair(deps, contract, code_id) diff --git a/contracts/liquidity_hub/pool-network/terraswap_factory/src/testing.rs b/contracts/liquidity_hub/pool-network/terraswap_factory/src/testing.rs index 3aeeb81c..991753da 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_factory/src/testing.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_factory/src/testing.rs @@ -1240,26 +1240,6 @@ fn failed_add_allow_native_token_with_non_admin() { } } -#[test] -fn failed_add_allow_native_token_with_zero_factory_balance() { - let mut deps = mock_dependencies(&[coin(0u128, "uluna".to_string())]); - deps = init(deps); - - let msg = ExecuteMsg::AddNativeTokenDecimals { - denom: "uluna".to_string(), - decimals: 6u8, - }; - - let info = mock_info("addr0000", &[]); - - let res = execute(deps.as_mut(), mock_env(), info, msg); - match res { - Ok(_) => panic!("should return ContractError::InvalidVerificationBalance"), - Err(ContractError::InvalidVerificationBalance {}) => (), - _ => panic!("should return ContractError::InvalidVerificationBalance"), - } -} - #[test] fn append_add_allow_native_token_with_already_exist_token() { let mut deps = mock_dependencies(&[coin(1u128, "uluna".to_string())]);