From 48ff2d3a2427b931cd2670632dd1276434460efd Mon Sep 17 00:00:00 2001 From: Kerber0x Date: Tue, 12 Mar 2024 13:35:27 +0000 Subject: [PATCH] chore: remove token_factory feature flag --- .github/workflows/ci-test-fmt-check.yaml | 62 +++++++- .../workflows/release-artifacts-on-tag.yaml | 12 +- .../liquidity_hub/epoch-manager/Cargo.toml | 1 - .../fee-distributor-mock/Cargo.toml | 1 - .../liquidity_hub/fee_collector/Cargo.toml | 1 - .../liquidity_hub/fee_distributor/Cargo.toml | 1 - .../pool-network/frontend_helper/Cargo.toml | 1 - .../pool-network/incentive/Cargo.toml | 1 - .../pool-network/incentive_factory/Cargo.toml | 1 - .../pool-network/stableswap_3pool/Cargo.toml | 1 - .../stableswap_3pool/src/commands.rs | 38 +---- .../stableswap_3pool/src/helpers.rs | 32 +--- .../src/tests/provide_liquidity.rs | 14 +- .../stableswap_3pool/src/tests/testing.rs | 10 +- .../stableswap_3pool/src/tests/withdrawals.rs | 14 +- .../pool-network/terraswap_factory/Cargo.toml | 1 - .../pool-network/terraswap_pair/Cargo.toml | 1 - .../terraswap_pair/src/commands.rs | 38 +---- .../terraswap_pair/src/helpers.rs | 14 +- .../terraswap_pair/src/migrations.rs | 4 +- .../src/tests/provide_liquidity.rs | 16 +- .../terraswap_pair/src/tests/testing.rs | 10 +- .../terraswap_pair/src/tests/withdrawals.rs | 16 +- .../pool-network/terraswap_router/Cargo.toml | 1 - .../pool-network/terraswap_token/Cargo.toml | 1 - .../vault-network/vault/Cargo.toml | 1 - .../vault-network/vault/src/contract.rs | 14 +- .../vault/src/execute/deposit.rs | 26 +--- .../vault/src/execute/receive/mod.rs | 12 +- .../vault/src/execute/receive/withdraw.rs | 20 +-- .../vault-network/vault_factory/Cargo.toml | 1 - .../vault-network/vault_router/Cargo.toml | 1 - contracts/liquidity_hub/whale_lair/Cargo.toml | 1 - packages/white-whale-std/Cargo.toml | 9 +- .../white-whale-std/src/pool_network/asset.rs | 12 +- .../white-whale-std/src/pool_network/denom.rs | 140 ------------------ .../white-whale-std/src/pool_network/mod.rs | 2 - scripts/build_release.sh | 9 +- 38 files changed, 147 insertions(+), 393 deletions(-) delete mode 100644 packages/white-whale-std/src/pool_network/denom.rs diff --git a/.github/workflows/ci-test-fmt-check.yaml b/.github/workflows/ci-test-fmt-check.yaml index 590ff9b81..41f8f36a4 100644 --- a/.github/workflows/ci-test-fmt-check.yaml +++ b/.github/workflows/ci-test-fmt-check.yaml @@ -14,8 +14,8 @@ env: CARGO_TERM_COLOR: always jobs: - test_and_check-token_factory_feature: - name: Test and check Token factory feature + test_and_check-vanilla: + name: Test and check vanilla runs-on: ubuntu-latest steps: @@ -43,11 +43,61 @@ jobs: override: true components: rustfmt, clippy - - name: Run cargo-tarpaulin token_factory feature + - name: Run cargo-tarpaulin vanilla uses: actions-rs/tarpaulin@v0.1 with: version: "0.15.0" - args: '--features "token_factory" --locked -- --test-threads 4' + args: '--locked -- --test-threads 4' + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --locked -- -D warnings + + #- name: Run cosmwasm linter + # run: cargo dylint cw_lint --workspace + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + test_and_check-osmosis_token_factory_feature: + name: Test and check Osmosis Token factory feature + runs-on: ubuntu-latest + + steps: + # Cancel any existing runs to save on CI time + # - name: Cancel Previous Runs + # uses: styfle/cancel-workflow-action@0.9.1 + # with: + # access_token: ${{ github.token }} + # Checkout code, with submodules using PAT + - name: Checkout sources + uses: actions/checkout@v3 + + # Use Rust Cache to speed up subsequent jobs with no cargo lock changes + - name: Use Rust cache + uses: Swatinem/rust-cache@v2 + with: + key: "test" + + # Install rust + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.70.0 + override: true + components: rustfmt, clippy + + - name: Run cargo-tarpaulin osmosis_token_factory feature + uses: actions-rs/tarpaulin@v0.1 + with: + version: "0.15.0" + args: '--features "osmosis_token_factory" --locked -- --test-threads 4' - name: Upload to codecov.io uses: codecov/codecov-action@v3 @@ -59,7 +109,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --locked -- -D warnings + args: --features "osmosis_token_factory" --locked -- -D warnings #- name: Run cosmwasm linter # run: cargo dylint cw_lint --workspace @@ -115,7 +165,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --locked -- -D warnings + args: --features "injective" --locked -- -D warnings #- name: Run cosmwasm linter # run: cargo dylint cw_lint --workspace diff --git a/.github/workflows/release-artifacts-on-tag.yaml b/.github/workflows/release-artifacts-on-tag.yaml index 8a558ac17..f25e806be 100644 --- a/.github/workflows/release-artifacts-on-tag.yaml +++ b/.github/workflows/release-artifacts-on-tag.yaml @@ -13,10 +13,18 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive - - name: Build Artifacts + - name: Build Artifacts vanilla run: | $GITHUB_WORKSPACE/scripts/build_release.sh -c vanilla tar -zcvf cosmwasm-artifacts_no-token-factory.tar.gz artifacts + - name: Build Artifacts osmosis_token_factory + run: | + $GITHUB_WORKSPACE/scripts/build_release.sh -c migaloo + tar -zcvf cosmwasm-artifacts_osmosis_token_factory.tar.gz artifacts + - name: Build Artifacts injective + run: | + $GITHUB_WORKSPACE/scripts/build_release.sh -c injective + tar -zcvf cosmwasm-artifacts_injective.tar.gz artifacts - name: Get Artifacts Versions run: $GITHUB_WORKSPACE/scripts/get_artifacts_versions.sh > artifact_versions.txt - name: Create Release @@ -27,4 +35,6 @@ jobs: generate_release_notes: true files: | cosmwasm-artifacts_no-token-factory.tar.gz + cosmwasm-artifacts_osmosis_token_factory.tar.gz + cosmwasm-artifacts_injective.tar.gz artifact_versions.txt diff --git a/contracts/liquidity_hub/epoch-manager/Cargo.toml b/contracts/liquidity_hub/epoch-manager/Cargo.toml index 0c502f52a..0a963cbe3 100644 --- a/contracts/liquidity_hub/epoch-manager/Cargo.toml +++ b/contracts/liquidity_hub/epoch-manager/Cargo.toml @@ -16,7 +16,6 @@ exclude = [ crate-type = ["cdylib", "rlib"] [features] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] diff --git a/contracts/liquidity_hub/fee-distributor-mock/Cargo.toml b/contracts/liquidity_hub/fee-distributor-mock/Cargo.toml index 197d8bbe4..cb99f6a03 100644 --- a/contracts/liquidity_hub/fee-distributor-mock/Cargo.toml +++ b/contracts/liquidity_hub/fee-distributor-mock/Cargo.toml @@ -29,7 +29,6 @@ overflow-checks = true [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports diff --git a/contracts/liquidity_hub/fee_collector/Cargo.toml b/contracts/liquidity_hub/fee_collector/Cargo.toml index 85a06caab..385ff319e 100644 --- a/contracts/liquidity_hub/fee_collector/Cargo.toml +++ b/contracts/liquidity_hub/fee_collector/Cargo.toml @@ -24,7 +24,6 @@ crate-type = ["cdylib", "rlib"] [features] # for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] diff --git a/contracts/liquidity_hub/fee_distributor/Cargo.toml b/contracts/liquidity_hub/fee_distributor/Cargo.toml index 317a46c6d..c947913f4 100644 --- a/contracts/liquidity_hub/fee_distributor/Cargo.toml +++ b/contracts/liquidity_hub/fee_distributor/Cargo.toml @@ -24,7 +24,6 @@ crate-type = ["cdylib", "rlib"] [features] # for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] diff --git a/contracts/liquidity_hub/pool-network/frontend_helper/Cargo.toml b/contracts/liquidity_hub/pool-network/frontend_helper/Cargo.toml index c8dfb70ca..d5f8e589e 100644 --- a/contracts/liquidity_hub/pool-network/frontend_helper/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/frontend_helper/Cargo.toml @@ -21,7 +21,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] # for quicker tests, cargo test --lib # for more explicit tests, cargo test --features=backtraces diff --git a/contracts/liquidity_hub/pool-network/incentive/Cargo.toml b/contracts/liquidity_hub/pool-network/incentive/Cargo.toml index cc1413856..b5795d575 100644 --- a/contracts/liquidity_hub/pool-network/incentive/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/incentive/Cargo.toml @@ -21,7 +21,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] # for quicker tests, cargo test --lib # for more explicit tests, cargo test --features=backtraces diff --git a/contracts/liquidity_hub/pool-network/incentive_factory/Cargo.toml b/contracts/liquidity_hub/pool-network/incentive_factory/Cargo.toml index 1904d4859..4b695cf1e 100644 --- a/contracts/liquidity_hub/pool-network/incentive_factory/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/incentive_factory/Cargo.toml @@ -21,7 +21,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] # for quicker tests, cargo test --lib # for more explicit tests, cargo test --features=backtraces diff --git a/contracts/liquidity_hub/pool-network/stableswap_3pool/Cargo.toml b/contracts/liquidity_hub/pool-network/stableswap_3pool/Cargo.toml index 7c51acc2a..82b053730 100644 --- a/contracts/liquidity_hub/pool-network/stableswap_3pool/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/stableswap_3pool/Cargo.toml @@ -23,7 +23,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] # for quicker tests, cargo test --lib # for more explicit tests, cargo test --features=backtraces diff --git a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/commands.rs b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/commands.rs index 106046668..f4218fcea 100644 --- a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/commands.rs +++ b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/commands.rs @@ -5,23 +5,13 @@ use cosmwasm_std::{ use cw20::{Cw20ExecuteMsg, Cw20ReceiveMsg}; use crate::contract::{MAX_AMP, MAX_AMP_CHANGE, MIN_AMP, MIN_RAMP_BLOCKS}; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use cosmwasm_std::coins; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use white_whale_std::pool_network::asset::is_factory_token; use white_whale_std::pool_network::asset::{ Asset, AssetInfo, AssetInfoRaw, TrioInfoRaw, MINIMUM_LIQUIDITY_AMOUNT, }; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::{Coin, MsgBurn, MsgMint}; #[cfg(feature = "injective")] use white_whale_std::pool_network::denom_injective::{Coin, MsgBurn, MsgMint}; #[cfg(feature = "osmosis_token_factory")] @@ -670,11 +660,7 @@ fn mint_lp_token_msg( sender: String, amount: Uint128, ) -> Result, ContractError> { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] if is_factory_token(liquidity_token.as_str()) { let mut messages = vec![]; messages.push(>::into(MsgMint { @@ -701,11 +687,7 @@ fn mint_lp_token_msg( })]) } - #[cfg(all( - not(feature = "token_factory"), - not(feature = "osmosis_token_factory"), - not(feature = "injective") - ))] + #[cfg(all(not(feature = "osmosis_token_factory"), not(feature = "injective")))] Ok(vec![CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: liquidity_token, msg: to_json_binary(&Cw20ExecuteMsg::Mint { recipient, amount })?, @@ -720,11 +702,7 @@ fn burn_lp_token_msg( sender: String, amount: Uint128, ) -> Result { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] if is_factory_token(liquidity_token.as_str()) { Ok(>::into(MsgBurn { sender, @@ -741,11 +719,7 @@ fn burn_lp_token_msg( })) } - #[cfg(all( - not(feature = "token_factory"), - not(feature = "osmosis_token_factory"), - not(feature = "injective") - ))] + #[cfg(all(not(feature = "osmosis_token_factory"), not(feature = "injective")))] Ok(CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: liquidity_token, msg: to_json_binary(&Cw20ExecuteMsg::Burn { amount })?, diff --git a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/helpers.rs b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/helpers.rs index 35ec76149..bf5c993a4 100644 --- a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/helpers.rs +++ b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/helpers.rs @@ -6,21 +6,11 @@ use cosmwasm_std::{ use cw20::MinterResponse; use cw_storage_plus::Item; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use cosmwasm_std::CosmosMsg; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use white_whale_std::pool_network::asset::is_factory_token; use white_whale_std::pool_network::asset::{Asset, AssetInfo, AssetInfoRaw}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgCreateDenom; #[cfg(feature = "injective")] use white_whale_std::pool_network::denom_injective::MsgCreateDenom; #[cfg(feature = "osmosis_token_factory")] @@ -277,11 +267,7 @@ pub fn instantiate_fees( /// Gets the total supply of the given liquidity token pub fn get_total_share(deps: &Deps, liquidity_token: String) -> StdResult { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] let total_share = if is_factory_token(liquidity_token.as_str()) { //bank query total deps.querier.query_supply(&liquidity_token)?.amount @@ -292,11 +278,7 @@ pub fn get_total_share(deps: &Deps, liquidity_token: String) -> StdResult>::into( MsgCreateDenom { diff --git a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/provide_liquidity.rs b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/provide_liquidity.rs index a2499b8fb..5e69bb05f 100644 --- a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/provide_liquidity.rs +++ b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/provide_liquidity.rs @@ -1,9 +1,9 @@ use crate::contract::{execute, instantiate, reply}; use crate::error::ContractError; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use crate::state::LP_SYMBOL; use cosmwasm_std::testing::{mock_env, mock_info, MOCK_CONTRACT_ADDR}; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use cosmwasm_std::{coin, BankMsg}; use cosmwasm_std::{ to_json_binary, Coin, CosmosMsg, Decimal, Reply, Response, StdError, SubMsg, SubMsgResponse, @@ -12,8 +12,8 @@ use cosmwasm_std::{ use cw20::Cw20ExecuteMsg; use white_whale_std::fee::Fee; use white_whale_std::pool_network::asset::{Asset, AssetInfo, MINIMUM_LIQUIDITY_AMOUNT}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgMint; +#[cfg(feature = "osmosis_token_factory")] +use white_whale_std::pool_network::denom_osmosis::MsgMint; use white_whale_std::pool_network::mock_querier::mock_dependencies; use white_whale_std::pool_network::trio::{ExecuteMsg, InstantiateMsg, PoolFee}; @@ -548,7 +548,7 @@ fn provide_liquidity_cw20_lp() { let _res = execute(deps.as_mut(), env, info, msg).unwrap(); } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn provide_liquidity_token_factory_lp() { let lp_denom = format!("{}/{MOCK_CONTRACT_ADDR}/{LP_SYMBOL}", "factory"); @@ -661,7 +661,7 @@ fn provide_liquidity_token_factory_lp() { let mint_initial_lp_msg_expected = >::into(MsgMint { sender: MOCK_CONTRACT_ADDR.to_string(), - amount: Some(white_whale_std::pool_network::denom::Coin { + amount: Some(white_whale_std::pool_network::denom_osmosis::Coin { denom: lp_denom.clone(), amount: (MINIMUM_LIQUIDITY_AMOUNT * Uint128::from(3u8)).to_string(), }), @@ -669,7 +669,7 @@ fn provide_liquidity_token_factory_lp() { let mint_msg_expected = >::into(MsgMint { sender: MOCK_CONTRACT_ADDR.to_string(), - amount: Some(white_whale_std::pool_network::denom::Coin { + amount: Some(white_whale_std::pool_network::denom_osmosis::Coin { denom: lp_denom.clone(), amount: "6000".to_string(), }), diff --git a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/testing.rs b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/testing.rs index c96dc98a3..a9a6eab07 100644 --- a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/testing.rs +++ b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/testing.rs @@ -5,14 +5,14 @@ use cosmwasm_std::{ }; use cw20::MinterResponse; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use crate::state::LP_SYMBOL; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use cosmwasm_std::CosmosMsg; use white_whale_std::fee::Fee; use white_whale_std::pool_network::asset::{Asset, AssetInfo, TrioInfo}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgCreateDenom; +#[cfg(feature = "osmosis_token_factory")] +use white_whale_std::pool_network::denom_osmosis::MsgCreateDenom; use white_whale_std::pool_network::mock_querier::mock_dependencies; use white_whale_std::pool_network::swap::assert_max_spread; use white_whale_std::pool_network::token::InstantiateMsg as TokenInstantiateMsg; @@ -136,7 +136,7 @@ fn proper_initialization_cw20_lp() { ); } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn proper_initialization_tokenfactory_lp() { let mut deps = mock_dependencies(&[]); diff --git a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/withdrawals.rs b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/withdrawals.rs index b99653d41..c064a7187 100644 --- a/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/withdrawals.rs +++ b/contracts/liquidity_hub/pool-network/stableswap_3pool/src/tests/withdrawals.rs @@ -1,9 +1,9 @@ use crate::contract::{execute, instantiate, reply}; use crate::error::ContractError; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use crate::state::LP_SYMBOL; use crate::state::{get_fees_for_asset, store_fee, COLLECTED_PROTOCOL_FEES}; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use cosmwasm_std::coin; use cosmwasm_std::testing::{mock_env, mock_info, MOCK_CONTRACT_ADDR}; use cosmwasm_std::{ @@ -13,8 +13,8 @@ use cosmwasm_std::{ use cw20::{Cw20ExecuteMsg, Cw20ReceiveMsg}; use white_whale_std::fee::Fee; use white_whale_std::pool_network::asset::AssetInfo; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgBurn; +#[cfg(feature = "osmosis_token_factory")] +use white_whale_std::pool_network::denom_osmosis::MsgBurn; use white_whale_std::pool_network::mock_querier::mock_dependencies; use white_whale_std::pool_network::trio::{Cw20HookMsg, ExecuteMsg, InstantiateMsg, PoolFee}; @@ -210,7 +210,7 @@ fn withdraw_liquidity_cw20_lp() { ); } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn withdraw_liquidity_token_factory_lp() { let lp_denom = format!("{}/{MOCK_CONTRACT_ADDR}/{LP_SYMBOL}", "factory"); @@ -313,7 +313,7 @@ fn withdraw_liquidity_token_factory_lp() { }); let msg_burn_liquidity_expected = >::into(MsgBurn { sender: MOCK_CONTRACT_ADDR.to_string(), - amount: Some(white_whale_std::pool_network::denom::Coin { + amount: Some(white_whale_std::pool_network::denom_osmosis::Coin { denom: lp_denom.clone(), amount: "6000".to_string(), }), @@ -334,7 +334,7 @@ fn withdraw_liquidity_token_factory_lp() { ); } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn withdraw_liquidity_token_factory_lp_wrong_asset() { let lp_denom = format!("{}/{MOCK_CONTRACT_ADDR}/{LP_SYMBOL}", "factory"); diff --git a/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml b/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml index fdc5f24b0..7cb1dbcc7 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/terraswap_factory/Cargo.toml @@ -26,7 +26,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] # for quicker tests, cargo test --lib # for more explicit tests, cargo test --features=backtraces diff --git a/contracts/liquidity_hub/pool-network/terraswap_pair/Cargo.toml b/contracts/liquidity_hub/pool-network/terraswap_pair/Cargo.toml index 289e120a4..35b73d3d9 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_pair/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/terraswap_pair/Cargo.toml @@ -30,7 +30,6 @@ crate-type = ["cdylib", "rlib"] backtraces = ["cosmwasm-std/backtraces"] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] [dependencies] diff --git a/contracts/liquidity_hub/pool-network/terraswap_pair/src/commands.rs b/contracts/liquidity_hub/pool-network/terraswap_pair/src/commands.rs index f7a0dfab4..9e922544b 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_pair/src/commands.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_pair/src/commands.rs @@ -1,10 +1,6 @@ #[cfg(feature = "osmosis")] use anybuf::Anybuf; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use cosmwasm_std::coins; use cosmwasm_std::{ from_json, to_json_binary, Addr, CosmosMsg, Decimal, DepsMut, Env, MessageInfo, OverflowError, @@ -12,17 +8,11 @@ use cosmwasm_std::{ }; use cw20::{Cw20ExecuteMsg, Cw20ReceiveMsg}; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use white_whale_std::pool_network::asset::is_factory_token; use white_whale_std::pool_network::asset::{ get_total_share, Asset, AssetInfo, AssetInfoRaw, PairInfoRaw, MINIMUM_LIQUIDITY_AMOUNT, }; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::{Coin, MsgBurn, MsgMint}; #[cfg(feature = "injective")] use white_whale_std::pool_network::denom_injective::{Coin, MsgBurn, MsgMint}; #[cfg(feature = "osmosis_token_factory")] @@ -635,11 +625,7 @@ fn mint_lp_token_msg( sender: String, amount: Uint128, ) -> Result, ContractError> { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] if is_factory_token(liquidity_token.as_str()) { let mut messages = vec![]; messages.push(>::into(MsgMint { @@ -666,11 +652,7 @@ fn mint_lp_token_msg( })]) } - #[cfg(all( - not(feature = "token_factory"), - not(feature = "osmosis_token_factory"), - not(feature = "injective") - ))] + #[cfg(all(not(feature = "osmosis_token_factory"), not(feature = "injective")))] Ok(vec![CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: liquidity_token, msg: to_json_binary(&Cw20ExecuteMsg::Mint { recipient, amount })?, @@ -685,11 +667,7 @@ fn burn_lp_token_msg( sender: String, amount: Uint128, ) -> Result { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] if is_factory_token(liquidity_token.as_str()) { Ok(>::into(MsgBurn { sender, @@ -705,11 +683,7 @@ fn burn_lp_token_msg( funds: vec![], })) } - #[cfg(all( - not(feature = "token_factory"), - not(feature = "osmosis_token_factory"), - not(feature = "injective") - ))] + #[cfg(all(not(feature = "osmosis_token_factory"), not(feature = "injective")))] Ok(CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: liquidity_token, msg: to_json_binary(&Cw20ExecuteMsg::Burn { amount })?, diff --git a/contracts/liquidity_hub/pool-network/terraswap_pair/src/helpers.rs b/contracts/liquidity_hub/pool-network/terraswap_pair/src/helpers.rs index 13b327096..19474b7ac 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_pair/src/helpers.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_pair/src/helpers.rs @@ -1,11 +1,7 @@ use std::ops::Mul; use cosmwasm_schema::cw_serde; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use cosmwasm_std::CosmosMsg; use cosmwasm_std::{ to_json_binary, Decimal, Decimal256, DepsMut, Env, ReplyOn, Response, StdError, StdResult, @@ -15,8 +11,6 @@ use cw20::MinterResponse; use cw_storage_plus::Item; use white_whale_std::pool_network::asset::{Asset, AssetInfo, AssetInfoRaw, PairType}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgCreateDenom; #[cfg(feature = "injective")] use white_whale_std::pool_network::denom_injective::MsgCreateDenom; #[cfg(feature = "osmosis_token_factory")] @@ -534,11 +528,7 @@ pub fn create_lp_token( Ok(pair_info) })?; - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] return Ok( Response::new().add_message(>::into( MsgCreateDenom { diff --git a/contracts/liquidity_hub/pool-network/terraswap_pair/src/migrations.rs b/contracts/liquidity_hub/pool-network/terraswap_pair/src/migrations.rs index 1067efcad..5dc1be769 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_pair/src/migrations.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_pair/src/migrations.rs @@ -16,7 +16,9 @@ use white_whale_std::pool_network::asset::{AssetInfo, AssetInfoRaw, PairType}; use white_whale_std::pool_network::pair::{Config, FeatureToggle}; use crate::helpers::instantiate_fees; -use crate::state::{ALL_TIME_BURNED_FEES, CONFIG, PAIR_INFO}; +#[cfg(all(not(feature = "injective"), not(feature = "osmosis")))] +use crate::state::PAIR_INFO; +use crate::state::{ALL_TIME_BURNED_FEES, CONFIG}; #[cfg(all(not(feature = "injective"), not(feature = "osmosis")))] /// Migrate state of the factory from PascalCase to snake_case for the following items: diff --git a/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/provide_liquidity.rs b/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/provide_liquidity.rs index 25d48e4a1..98c05b749 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/provide_liquidity.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/provide_liquidity.rs @@ -1,5 +1,5 @@ use cosmwasm_std::testing::{mock_env, mock_info, MOCK_CONTRACT_ADDR}; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use cosmwasm_std::{coin, BankMsg}; use cosmwasm_std::{ to_json_binary, Coin, CosmosMsg, Decimal, Reply, Response, StdError, SubMsg, SubMsgResponse, @@ -8,17 +8,17 @@ use cosmwasm_std::{ use cw20::Cw20ExecuteMsg; use white_whale_std::fee::Fee; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use white_whale_std::pool_network; use white_whale_std::pool_network::asset::{Asset, AssetInfo, PairType, MINIMUM_LIQUIDITY_AMOUNT}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgMint; +#[cfg(feature = "osmosis_token_factory")] +use white_whale_std::pool_network::denom_osmosis::MsgMint; use white_whale_std::pool_network::mock_querier::mock_dependencies; use white_whale_std::pool_network::pair::{ExecuteMsg, InstantiateMsg, PoolFee}; use crate::contract::{execute, instantiate, reply}; use crate::error::ContractError; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use crate::state::LP_SYMBOL; #[cfg(feature = "injective")] @@ -703,7 +703,7 @@ fn provide_liquidity_invalid_minimum_lp_amount() { } } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn provide_liquidity_tokenfactory_lp() { let lp_denom = format!("{}/{MOCK_CONTRACT_ADDR}/{LP_SYMBOL}", "factory"); @@ -802,7 +802,7 @@ fn provide_liquidity_tokenfactory_lp() { let mint_initial_lp_msg_expected = >::into(MsgMint { sender: MOCK_CONTRACT_ADDR.to_string(), - amount: Some(pool_network::denom::Coin { + amount: Some(pool_network::denom_osmosis::Coin { denom: lp_denom.clone(), amount: MINIMUM_LIQUIDITY_AMOUNT.to_string(), }), @@ -810,7 +810,7 @@ fn provide_liquidity_tokenfactory_lp() { let mint_msg_expected = >::into(MsgMint { sender: MOCK_CONTRACT_ADDR.to_string(), - amount: Some(pool_network::denom::Coin { + amount: Some(pool_network::denom_osmosis::Coin { denom: lp_denom.clone(), amount: "1000".to_string(), }), diff --git a/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/testing.rs b/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/testing.rs index 86df7ad01..ef665f0ef 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/testing.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/testing.rs @@ -1,5 +1,5 @@ use cosmwasm_std::testing::{mock_env, mock_info, MOCK_CONTRACT_ADDR}; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use cosmwasm_std::CosmosMsg; use cosmwasm_std::{ from_json, to_json_binary, Addr, Decimal, Reply, ReplyOn, StdError, SubMsg, SubMsgResponse, @@ -9,8 +9,8 @@ use cw20::MinterResponse; use white_whale_std::fee::Fee; use white_whale_std::pool_network::asset::{Asset, AssetInfo, PairInfo, PairType}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgCreateDenom; +#[cfg(feature = "osmosis_token_factory")] +use white_whale_std::pool_network::denom_osmosis::MsgCreateDenom; use white_whale_std::pool_network::mock_querier::mock_dependencies; use white_whale_std::pool_network::pair::ExecuteMsg::UpdateConfig; use white_whale_std::pool_network::pair::{Config, InstantiateMsg, PoolFee, QueryMsg}; @@ -21,7 +21,7 @@ use crate::contract::{execute, instantiate, query, reply}; use crate::error::ContractError; use crate::helpers::assert_slippage_tolerance; use crate::queries::query_pair_info; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use crate::state::LP_SYMBOL; #[cfg(not(feature = "osmosis"))] @@ -127,7 +127,7 @@ fn proper_initialization_cw20_lp() { ); } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn proper_initialization_token_factory_lp() { let mut deps = mock_dependencies(&[]); diff --git a/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/withdrawals.rs b/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/withdrawals.rs index 0c9a26803..bf134e01c 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/withdrawals.rs +++ b/contracts/liquidity_hub/pool-network/terraswap_pair/src/tests/withdrawals.rs @@ -5,16 +5,16 @@ use cosmwasm_std::{ }; use cw20::{Cw20ExecuteMsg, Cw20ReceiveMsg}; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use crate::state::LP_SYMBOL; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use cosmwasm_std::coin; use white_whale_std::fee::Fee; -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] use white_whale_std::pool_network; use white_whale_std::pool_network::asset::{AssetInfo, PairType}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgBurn; +#[cfg(feature = "osmosis_token_factory")] +use white_whale_std::pool_network::denom_osmosis::MsgBurn; use white_whale_std::pool_network::mock_querier::mock_dependencies; use white_whale_std::pool_network::pair::{Cw20HookMsg, ExecuteMsg, InstantiateMsg, PoolFee}; @@ -469,7 +469,7 @@ fn test_withdrawal_wrong_message() { } } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn withdraw_xyk_liquidity_token_factory_lp() { let lp_denom = format!("{}/{MOCK_CONTRACT_ADDR}/{LP_SYMBOL}", "factory"); @@ -561,7 +561,7 @@ fn withdraw_xyk_liquidity_token_factory_lp() { }); let msg_burn_liquidity_expected = >::into(MsgBurn { sender: MOCK_CONTRACT_ADDR.to_string(), - amount: Some(pool_network::denom::Coin { + amount: Some(pool_network::denom_osmosis::Coin { denom: lp_denom.clone(), amount: "1000".to_string(), }), @@ -581,7 +581,7 @@ fn withdraw_xyk_liquidity_token_factory_lp() { ); } -#[cfg(feature = "token_factory")] +#[cfg(feature = "osmosis_token_factory")] #[test] fn withdraw_xyk_liquidity_token_factory_lp_wrong_asset() { let lp_denom = format!("{}/{MOCK_CONTRACT_ADDR}/{LP_SYMBOL}", "factory"); diff --git a/contracts/liquidity_hub/pool-network/terraswap_router/Cargo.toml b/contracts/liquidity_hub/pool-network/terraswap_router/Cargo.toml index 94a656824..ff29bb036 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_router/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/terraswap_router/Cargo.toml @@ -29,7 +29,6 @@ crate-type = ["cdylib", "rlib"] backtraces = ["cosmwasm-std/backtraces"] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] [dependencies] diff --git a/contracts/liquidity_hub/pool-network/terraswap_token/Cargo.toml b/contracts/liquidity_hub/pool-network/terraswap_token/Cargo.toml index 7e73d272c..bf1d8fb50 100644 --- a/contracts/liquidity_hub/pool-network/terraswap_token/Cargo.toml +++ b/contracts/liquidity_hub/pool-network/terraswap_token/Cargo.toml @@ -15,7 +15,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all init/handle/query exports diff --git a/contracts/liquidity_hub/vault-network/vault/Cargo.toml b/contracts/liquidity_hub/vault-network/vault/Cargo.toml index f49989fbf..607ced5d3 100644 --- a/contracts/liquidity_hub/vault-network/vault/Cargo.toml +++ b/contracts/liquidity_hub/vault-network/vault/Cargo.toml @@ -16,7 +16,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] backtraces = ["cosmwasm-std/backtraces"] diff --git a/contracts/liquidity_hub/vault-network/vault/src/contract.rs b/contracts/liquidity_hub/vault-network/vault/src/contract.rs index 39b7178ed..bf13c6d5f 100644 --- a/contracts/liquidity_hub/vault-network/vault/src/contract.rs +++ b/contracts/liquidity_hub/vault-network/vault/src/contract.rs @@ -23,14 +23,8 @@ use crate::{ }; use crate::execute::receive::withdraw::withdraw; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use cosmwasm_std::CosmosMsg; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::MsgCreateDenom; #[cfg(feature = "injective")] use white_whale_std::pool_network::denom_injective::MsgCreateDenom; #[cfg(feature = "osmosis_token_factory")] @@ -101,11 +95,7 @@ pub fn instantiate( Ok(config) })?; - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] return Ok( response.add_message(>::into(MsgCreateDenom { sender: env.contract.address.to_string(), diff --git a/contracts/liquidity_hub/vault-network/vault/src/execute/deposit.rs b/contracts/liquidity_hub/vault-network/vault/src/execute/deposit.rs index 16553fadd..d19f7425b 100644 --- a/contracts/liquidity_hub/vault-network/vault/src/execute/deposit.rs +++ b/contracts/liquidity_hub/vault-network/vault/src/execute/deposit.rs @@ -1,24 +1,14 @@ -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use cosmwasm_std::coins; use cosmwasm_std::{ to_json_binary, CosmosMsg, DepsMut, Env, MessageInfo, Response, Uint128, Uint256, WasmMsg, }; use cw20::{AllowanceResponse, Cw20ExecuteMsg}; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use white_whale_std::pool_network::asset::is_factory_token; use white_whale_std::pool_network::asset::AssetInfo; use white_whale_std::pool_network::asset::{get_total_share, MINIMUM_LIQUIDITY_AMOUNT}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::{Coin, MsgMint}; #[cfg(feature = "injective")] use white_whale_std::pool_network::denom_injective::{Coin, MsgMint}; #[cfg(feature = "osmosis_token_factory")] @@ -166,11 +156,7 @@ fn mint_lp_token_msg( sender: String, amount: Uint128, ) -> Result, VaultError> { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] if is_factory_token(liquidity_asset.as_str()) { let mut messages = vec![]; messages.push(>::into(MsgMint { @@ -197,11 +183,7 @@ fn mint_lp_token_msg( })]) } - #[cfg(all( - not(feature = "token_factory"), - not(feature = "osmosis_token_factory"), - not(feature = "injective") - ))] + #[cfg(all(not(feature = "osmosis_token_factory"), not(feature = "injective")))] Ok(vec![CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: liquidity_asset, msg: to_json_binary(&Cw20ExecuteMsg::Mint { recipient, amount })?, diff --git a/contracts/liquidity_hub/vault-network/vault/src/execute/receive/mod.rs b/contracts/liquidity_hub/vault-network/vault/src/execute/receive/mod.rs index 19e3a0195..0a1062a70 100644 --- a/contracts/liquidity_hub/vault-network/vault/src/execute/receive/mod.rs +++ b/contracts/liquidity_hub/vault-network/vault/src/execute/receive/mod.rs @@ -36,11 +36,7 @@ pub fn receive( mod test { use cosmwasm_std::{to_json_binary, Addr, Uint128}; - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use cosmwasm_std::testing::mock_info; use white_whale_std::pool_network::asset::AssetInfo; @@ -99,11 +95,7 @@ mod test { assert_eq!(res.unwrap_err(), VaultError::Unauthorized {}) } - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] #[test] fn cannot_receive_from_not_liquidity_token() { let (mut deps, env) = mock_instantiate( diff --git a/contracts/liquidity_hub/vault-network/vault/src/execute/receive/withdraw.rs b/contracts/liquidity_hub/vault-network/vault/src/execute/receive/withdraw.rs index 3da8e5d0d..f8b739393 100644 --- a/contracts/liquidity_hub/vault-network/vault/src/execute/receive/withdraw.rs +++ b/contracts/liquidity_hub/vault-network/vault/src/execute/receive/withdraw.rs @@ -3,15 +3,9 @@ use cosmwasm_std::{ }; use cw20::{BalanceResponse, Cw20ExecuteMsg, Cw20QueryMsg}; -#[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" -))] +#[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] use white_whale_std::pool_network::asset::is_factory_token; use white_whale_std::pool_network::asset::{get_total_share, AssetInfo}; -#[cfg(feature = "token_factory")] -use white_whale_std::pool_network::denom::{Coin, MsgBurn}; #[cfg(feature = "injective")] use white_whale_std::pool_network::denom_injective::{Coin, MsgBurn}; #[cfg(feature = "osmosis_token_factory")] @@ -100,11 +94,7 @@ fn burn_lp_asset_msg( sender: String, amount: Uint128, ) -> Result { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] if is_factory_token(liquidity_asset.as_str()) { Ok(>::into(MsgBurn { sender, @@ -120,11 +110,7 @@ fn burn_lp_asset_msg( funds: vec![], })) } - #[cfg(all( - not(feature = "token_factory"), - not(feature = "osmosis_token_factory"), - not(feature = "injective") - ))] + #[cfg(all(not(feature = "osmosis_token_factory"), not(feature = "injective")))] Ok(CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: liquidity_asset, msg: to_json_binary(&Cw20ExecuteMsg::Burn { amount })?, diff --git a/contracts/liquidity_hub/vault-network/vault_factory/Cargo.toml b/contracts/liquidity_hub/vault-network/vault_factory/Cargo.toml index 0a0495142..3073377e2 100644 --- a/contracts/liquidity_hub/vault-network/vault_factory/Cargo.toml +++ b/contracts/liquidity_hub/vault-network/vault_factory/Cargo.toml @@ -18,7 +18,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] backtraces = ["cosmwasm-std/backtraces"] diff --git a/contracts/liquidity_hub/vault-network/vault_router/Cargo.toml b/contracts/liquidity_hub/vault-network/vault_router/Cargo.toml index 500d9e124..932f988e9 100644 --- a/contracts/liquidity_hub/vault-network/vault_router/Cargo.toml +++ b/contracts/liquidity_hub/vault-network/vault_router/Cargo.toml @@ -18,7 +18,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] backtraces = ["cosmwasm-std/backtraces"] diff --git a/contracts/liquidity_hub/whale_lair/Cargo.toml b/contracts/liquidity_hub/whale_lair/Cargo.toml index f47dc8acb..646cb3448 100644 --- a/contracts/liquidity_hub/whale_lair/Cargo.toml +++ b/contracts/liquidity_hub/whale_lair/Cargo.toml @@ -24,7 +24,6 @@ crate-type = ["cdylib", "rlib"] [features] injective = ["white-whale-std/injective"] osmosis = ["osmosis_token_factory"] -token_factory = ["white-whale-std/token_factory"] osmosis_token_factory = ["white-whale-std/osmosis_token_factory"] # for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] diff --git a/packages/white-whale-std/Cargo.toml b/packages/white-whale-std/Cargo.toml index d03dfb75c..68d40de8d 100644 --- a/packages/white-whale-std/Cargo.toml +++ b/packages/white-whale-std/Cargo.toml @@ -15,15 +15,10 @@ homepage.workspace = true documentation.workspace = true [features] -# for quicker tests, cargo test --lib -# for more explicit tests, cargo test --features=backtraces backtraces = ["cosmwasm-std/backtraces"] -injective = ["token_factory"] +injective = ["cosmwasm-std/stargate", "cosmwasm-std/cosmwasm_1_1"] osmosis = ["osmosis_token_factory"] -token_factory = ["cosmwasm-std/stargate", "cosmwasm-std/cosmwasm_1_1"] -osmosis_token_factory = [ - "token_factory", -] # this is for the osmosis token factory proto definitions, which defer from the standard token factory :) +osmosis_token_factory = ["cosmwasm-std/stargate", "cosmwasm-std/cosmwasm_1_1"] [dependencies] cosmwasm-std.workspace = true diff --git a/packages/white-whale-std/src/pool_network/asset.rs b/packages/white-whale-std/src/pool_network/asset.rs index 4e48076af..c531424ae 100644 --- a/packages/white-whale-std/src/pool_network/asset.rs +++ b/packages/white-whale-std/src/pool_network/asset.rs @@ -620,11 +620,7 @@ impl TrioInfoRaw { /// Gets the total supply of the given liquidity asset pub fn get_total_share(deps: &Deps, liquidity_asset: String) -> StdResult { - #[cfg(any( - feature = "token_factory", - feature = "osmosis_token_factory", - feature = "injective" - ))] + #[cfg(any(feature = "osmosis_token_factory", feature = "injective"))] let total_share = if is_factory_token(liquidity_asset.as_str()) { //bank query total deps.querier.query_supply(&liquidity_asset)?.amount @@ -635,11 +631,7 @@ pub fn get_total_share(deps: &Deps, liquidity_asset: String) -> StdResult. The resulting denom's admin is -/// originally set to be the creator, but this can be changed later. The token -/// denom does not indicate the current admin. -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - serde::Serialize, - serde::Deserialize, - schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.tokenfactory.v1beta1.MsgCreateDenom")] -pub struct MsgCreateDenom { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// subdenom can be up to 44 "alphanumeric" characters long. - #[prost(string, tag = "2")] - pub subdenom: ::prost::alloc::string::String, -} - -/// MsgCreateDenomResponse is the return value of MsgCreateDenom -/// It returns the full string of the newly created denom -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - serde::Serialize, - serde::Deserialize, - schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.tokenfactory.v1beta1.MsgCreateDenomResponse")] -pub struct MsgCreateDenomResponse { - #[prost(string, tag = "1")] - pub new_token_denom: ::prost::alloc::string::String, -} - -/// MsgMint is the sdk.Msg type for allowing an admin account to mint -/// more of a token. For now, we only support minting to the sender account -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - serde::Serialize, - serde::Deserialize, - schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.tokenfactory.v1beta1.MsgMint")] -pub struct MsgMint { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub amount: ::core::option::Option, -} - -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - serde::Serialize, - serde::Deserialize, - schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.tokenfactory.v1beta1.MsgMintResponse")] -pub struct MsgMintResponse {} - -/// MsgBurn is the sdk.Msg type for allowing an admin account to burn -/// a token. For now, we only support burning from the sender account. -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - serde::Serialize, - serde::Deserialize, - schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.tokenfactory.v1beta1.MsgBurn")] -pub struct MsgBurn { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub amount: ::core::option::Option, -} - -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - serde::Serialize, - serde::Deserialize, - schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.tokenfactory.v1beta1.MsgBurnResponse")] -pub struct MsgBurnResponse {} diff --git a/packages/white-whale-std/src/pool_network/mod.rs b/packages/white-whale-std/src/pool_network/mod.rs index e86c64560..cecb9b74d 100644 --- a/packages/white-whale-std/src/pool_network/mod.rs +++ b/packages/white-whale-std/src/pool_network/mod.rs @@ -1,6 +1,4 @@ pub mod asset; -#[cfg(feature = "token_factory")] -pub mod denom; #[cfg(feature = "injective")] pub mod denom_injective; #[cfg(feature = "osmosis_token_factory")] diff --git a/scripts/build_release.sh b/scripts/build_release.sh index ca8198af0..c3cb7df6e 100755 --- a/scripts/build_release.sh +++ b/scripts/build_release.sh @@ -48,12 +48,9 @@ osmosis) fi ;; -juno | terra | chihuahua) +juno | terra | chihuahua | migaloo) flag="-osmosis_token_factory" ;; -migaloo) - flag="-token_factory" - ;; injective) flag="-injective" ;; @@ -83,9 +80,9 @@ docker_options=( # Optimized builds if [[ "$arch" == "aarch64" || "$arch" == "arm64" ]]; then - docker_command=("docker" "run" "${docker_options[@]}" "cosmwasm/optimizer-arm64:0.15.0$flag") + docker_command=("docker" "run" "${docker_options[@]}" "cosmwasm/optimizer-arm64:0.15.1$flag") else - docker_command=("docker" "run" "${docker_options[@]}" "cosmwasm/optimizer:0.15.0$flag") + docker_command=("docker" "run" "${docker_options[@]}" "cosmwasm/optimizer:0.15.1$flag") fi echo "${docker_command[@]}"