From f5aaf95b8340ad6ea1c9e489ae11309458ea4005 Mon Sep 17 00:00:00 2001 From: andrei-marinica Date: Mon, 7 Jun 2021 09:56:16 +0300 Subject: [PATCH 1/3] continuous integration - mandos-go --- .github/workflows/actions.yml | 10 +- Cargo.toml | 2 + dex/Cargo.toml | 18 ++ dex/tests/dex_mandos_go_test.rs | 189 ++++++++++++++++++ distribution/Cargo.toml | 18 ++ .../tests/distribution_mandos_go_test.rs | 153 ++++++++++++++ 6 files changed, 385 insertions(+), 5 deletions(-) create mode 100644 dex/Cargo.toml create mode 100644 dex/tests/dex_mandos_go_test.rs create mode 100644 distribution/Cargo.toml create mode 100644 distribution/tests/distribution_mandos_go_test.rs diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index c940356e8..f8df9ddc4 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -21,16 +21,16 @@ jobs: source .github/workflows/env pip3 install erdpy mkdir $HOME/elrondsdk + erdpy config set dependencies.arwentools.tag v1.3.3 erdpy deps install arwentools - name: Build the wasm contracts run: | source .github/workflows/env ./build-wasm.sh - # # Running the mandos tests through Arwen is not yet stable enough - # - name: Run the wasm mandos tests - # run: | - # source .github/workflows/env - # mandos-test . + - name: Run Arwen tests + run: | + source .github/workflows/env + cargo test --features elrond-wasm-debug/arwen-tests rust_test: name: Rust tests runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index ff4812c71..df8adbdce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ + "dex", "dex/dex-common", "dex/elrond_dex_farm", "dex/elrond_dex_farm/abi", @@ -10,6 +11,7 @@ members = [ "dex/multi_token_farm", "dex/multi_token_farm/abi", + "distribution", "distribution/distrib-common", "distribution/modules", "distribution/sc-distribution-rs", diff --git a/dex/Cargo.toml b/dex/Cargo.toml new file mode 100644 index 000000000..deef91cc5 --- /dev/null +++ b/dex/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "dex-tests" +version = "0.0.0" +edition = "2018" +publish = false + +[dependencies.elrond-wasm] +version = "0.17" + +[dependencies.elrond-wasm-derive] +version = "0.17" + +[dependencies.elrond-wasm-node] +version = "0.17" +optional = true + +[dev-dependencies.elrond-wasm-debug] +version = "0.17" diff --git a/dex/tests/dex_mandos_go_test.rs b/dex/tests/dex_mandos_go_test.rs new file mode 100644 index 000000000..cce4b2d9d --- /dev/null +++ b/dex/tests/dex_mandos_go_test.rs @@ -0,0 +1,189 @@ +#[test] +fn accept_esdt_payment_go() { + elrond_wasm_debug::mandos_go("mandos/accept_esdt_payment.scen.json"); +} + +#[test] +fn accept_esdt_payment_wrong_token_go() { + elrond_wasm_debug::mandos_go("mandos/accept_esdt_payment_wrong_token.scen.json"); +} + +#[test] +fn add_liquidity_go() { + elrond_wasm_debug::mandos_go("mandos/add_liquidity.scen.json"); +} + +#[test] +fn calculate_rewards_for_given_position_go() { + elrond_wasm_debug::mandos_go("mandos/calculate_rewards_for_given_position.scen.json"); +} + +#[test] +fn check_fee_disabled_after_swap_go() { + elrond_wasm_debug::mandos_go("mandos/check_fee_disabled_after_swap.scen.json"); +} + +#[test] +fn check_fee_enabled_after_swap_go() { + elrond_wasm_debug::mandos_go("mandos/check_fee_enabled_after_swap.scen.json"); +} + +#[test] +fn claim_rewards_go() { + elrond_wasm_debug::mandos_go("mandos/claim_rewards.scen.json"); +} + +#[test] +fn complete_setup_go() { + elrond_wasm_debug::mandos_go("mandos/complete_setup.scen.json"); +} + +#[test] +fn create_pair_twice_go() { + elrond_wasm_debug::mandos_go("mandos/create_pair_twice.scen.json"); +} + +#[test] +fn enter_farm_go() { + elrond_wasm_debug::mandos_go("mandos/enter_farm.scen.json"); +} + +#[test] +fn enter_mex_farm_go() { + elrond_wasm_debug::mandos_go("mandos/enter_mex_farm.scen.json"); +} + +#[test] +fn exit_farm_go() { + elrond_wasm_debug::mandos_go("mandos/exit_farm.scen.json"); +} + +#[test] +fn exit_farm_too_soon_go() { + elrond_wasm_debug::mandos_go("mandos/exit_farm_too_soon.scen.json"); +} + +#[test] +fn exit_mex_farm_go() { + elrond_wasm_debug::mandos_go("mandos/exit_mex_farm.scen.json"); +} + +#[test] +fn farm_reward_distr_scen_1_go() { + elrond_wasm_debug::mandos_go("mandos/farm_reward_distr_scen_1.scen.json"); +} + +#[test] +fn farm_reward_distr_scen_2_go() { + elrond_wasm_debug::mandos_go("mandos/farm_reward_distr_scen_2.scen.json"); +} + +#[test] +fn farm_reward_distr_scen_3_go() { + elrond_wasm_debug::mandos_go("mandos/farm_reward_distr_scen_3.scen.json"); +} + +#[test] +fn farm_reward_distr_scen_4_go() { + elrond_wasm_debug::mandos_go("mandos/farm_reward_distr_scen_4.scen.json"); +} + +#[test] +fn farm_reward_distr_scen_5_go() { + elrond_wasm_debug::mandos_go("mandos/farm_reward_distr_scen_5.scen.json"); +} + +#[test] +fn farm_with_egld_token_go() { + elrond_wasm_debug::mandos_go("mandos/farm_with_egld_token.scen.json"); +} + +#[test] +fn farm_wrong_lp_token_go() { + elrond_wasm_debug::mandos_go("mandos/farm_wrong_lp_token.scen.json"); +} + +#[test] +fn get_amounts_go() { + elrond_wasm_debug::mandos_go("mandos/get_amounts.scen.json"); +} + +#[test] +fn get_amounts_no_liquidity_go() { + elrond_wasm_debug::mandos_go("mandos/get_amounts_no_liquidity.scen.json"); +} + +#[test] +fn get_pair_non_existent_go() { + elrond_wasm_debug::mandos_go("mandos/get_pair_non_existent.scen.json"); +} + +#[test] +fn get_pair_views_go() { + elrond_wasm_debug::mandos_go("mandos/get_pair_views.scen.json"); +} + +#[test] +fn owner_pause_farm_go() { + elrond_wasm_debug::mandos_go("mandos/owner_pause_farm.scen.json"); +} + +#[test] +fn owner_resume_farm_go() { + elrond_wasm_debug::mandos_go("mandos/owner_resume_farm.scen.json"); +} + +#[test] +fn reclaim_temporary_funds_go() { + elrond_wasm_debug::mandos_go("mandos/reclaim_temporary_funds.scen.json"); +} + +#[test] +fn remove_liquidity_go() { + elrond_wasm_debug::mandos_go("mandos/remove_liquidity.scen.json"); +} + +#[test] +fn remove_liquidity_twice_go() { + elrond_wasm_debug::mandos_go("mandos/remove_liquidity_twice.scen.json"); +} + +#[test] +fn router_pause_self_go() { + elrond_wasm_debug::mandos_go("mandos/router_pause_self.scen.json"); +} + +#[test] +fn router_resume_self_go() { + elrond_wasm_debug::mandos_go("mandos/router_resume_self.scen.json"); +} + +#[test] +fn send_with_no_funds_go() { + elrond_wasm_debug::mandos_go("mandos/send_with_no_funds.scen.json"); +} + +#[test] +fn swap_fixed_input_go() { + elrond_wasm_debug::mandos_go("mandos/swap_fixed_input.scen.json"); +} + +#[test] +fn swap_fixed_input_after_removed_liquidity_go() { + elrond_wasm_debug::mandos_go("mandos/swap_fixed_input_after_removed_liquidity.scen.json"); +} + +#[test] +fn swap_fixed_output_go() { + elrond_wasm_debug::mandos_go("mandos/swap_fixed_output.scen.json"); +} + +#[test] +fn swap_same_token_go() { + elrond_wasm_debug::mandos_go("mandos/swap_same_token.scen.json"); +} + +#[test] +fn swap_wrong_token_go() { + elrond_wasm_debug::mandos_go("mandos/swap_wrong_token.scen.json"); +} diff --git a/distribution/Cargo.toml b/distribution/Cargo.toml new file mode 100644 index 000000000..8621a35d2 --- /dev/null +++ b/distribution/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "distribution-tests" +version = "0.0.0" +edition = "2018" +publish = false + +[dependencies.elrond-wasm] +version = "0.17" + +[dependencies.elrond-wasm-derive] +version = "0.17" + +[dependencies.elrond-wasm-node] +version = "0.17" +optional = true + +[dev-dependencies.elrond-wasm-debug] +version = "0.17" diff --git a/distribution/tests/distribution_mandos_go_test.rs b/distribution/tests/distribution_mandos_go_test.rs new file mode 100644 index 000000000..ae9153319 --- /dev/null +++ b/distribution/tests/distribution_mandos_go_test.rs @@ -0,0 +1,153 @@ +#[test] +fn accept_esdt_payment_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/accept_esdt_payment_proxy.scen.json"); +} + +#[test] +fn add_liquidity_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/add_liquidity_proxy.scen.json"); +} + +#[test] +fn claim_locked_assets_basic_go() { + elrond_wasm_debug::mandos_go("mandos/claim_locked_assets_basic.scen.json"); +} + +#[test] +fn claim_mex_rewards_proxy_after_mint_rewards_go() { + elrond_wasm_debug::mandos_go("mandos/claim_mex_rewards_proxy_after_mint_rewards.scen.json"); +} + +#[test] +fn claim_only_last_four_go() { + elrond_wasm_debug::mandos_go("mandos/claim_only_last_four.scen.json"); +} + +#[test] +fn claim_rewards_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/claim_rewards_proxy.scen.json"); +} + +#[test] +fn claim_rewards_proxy_after_enter_with_lock_go() { + elrond_wasm_debug::mandos_go("mandos/claim_rewards_proxy_after_enter_with_lock.scen.json"); +} + +#[test] +fn claim_rewards_proxy_after_enter_with_lock_after_mint_rewards_go() { + elrond_wasm_debug::mandos_go( + "mandos/claim_rewards_proxy_after_enter_with_lock_after_mint_rewards.scen.json", + ); +} + +#[test] +fn claim_rewards_proxy_after_mint_rewards_go() { + elrond_wasm_debug::mandos_go("mandos/claim_rewards_proxy_after_mint_rewards.scen.json"); +} + +#[test] +fn clear_unclaimable_assets_go() { + elrond_wasm_debug::mandos_go("mandos/clear_unclaimable_assets.scen.json"); +} + +#[test] +fn enter_farm_and_lock_rewards_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/enter_farm_and_lock_rewards_proxy.scen.json"); +} + +#[test] +fn enter_farm_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/enter_farm_proxy.scen.json"); +} + +#[test] +fn enter_mex_farm_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/enter_mex_farm_proxy.scen.json"); +} + +#[test] +fn exit_farm_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/exit_farm_proxy.scen.json"); +} + +#[test] +fn exit_farm_proxy_after_mint_rewards_go() { + elrond_wasm_debug::mandos_go("mandos/exit_farm_proxy_after_mint_rewards.scen.json"); +} + +#[test] +fn exit_farm_proxy_with_lock_rewards_go() { + elrond_wasm_debug::mandos_go("mandos/exit_farm_proxy_with_lock_rewards.scen.json"); +} + +#[test] +fn exit_farm_proxy_with_lock_rewards_after_mint_rewards_go() { + elrond_wasm_debug::mandos_go( + "mandos/exit_farm_proxy_with_lock_rewards_after_mint_rewards.scen.json", + ); +} + +#[test] +fn exit_mex_farm_proxy_after_mint_rewards_go() { + elrond_wasm_debug::mandos_go("mandos/exit_mex_farm_proxy_after_mint_rewards.scen.json"); +} + +#[test] +fn multiple_claim_assets_go() { + elrond_wasm_debug::mandos_go("mandos/multiple_claim_assets.scen.json"); +} + +#[test] +fn reclaim_temporary_funds_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/reclaim_temporary_funds_proxy.scen.json"); +} + +#[test] +fn remove_liquidity_proxy_go() { + elrond_wasm_debug::mandos_go("mandos/remove_liquidity_proxy.scen.json"); +} + +#[test] +fn remove_liquidity_proxy_after_swap_mex_go() { + elrond_wasm_debug::mandos_go("mandos/remove_liquidity_proxy_after_swap_mex.scen.json"); +} + +#[test] +fn remove_liquidity_proxy_after_swap_wegld_go() { + elrond_wasm_debug::mandos_go("mandos/remove_liquidity_proxy_after_swap_wegld.scen.json"); +} + +#[test] +fn set_user_distribution_go() { + elrond_wasm_debug::mandos_go("mandos/set_user_distribution.scen.json"); +} + +#[test] +fn set_user_distribution_above_cap_go() { + elrond_wasm_debug::mandos_go("mandos/set_user_distribution_above_cap.scen.json"); +} + +#[test] +fn set_user_distribution_duplicate_go() { + elrond_wasm_debug::mandos_go("mandos/set_user_distribution_duplicate.scen.json"); +} + +#[test] +fn set_user_distribution_with_unlock_go() { + elrond_wasm_debug::mandos_go("mandos/set_user_distribution_with_unlock.scen.json"); +} + +#[test] +fn undo_last_community_distribution_go() { + elrond_wasm_debug::mandos_go("mandos/undo_last_community_distribution.scen.json"); +} + +#[test] +fn undo_user_distribution_between_epochs_go() { + elrond_wasm_debug::mandos_go("mandos/undo_user_distribution_between_epochs.scen.json"); +} + +#[test] +fn unlock_assets_basic_go() { + elrond_wasm_debug::mandos_go("mandos/unlock_assets_basic.scen.json"); +} From eb1b013571e01cf262b89ab931d0e13e936b0eea Mon Sep 17 00:00:00 2001 From: andrei-marinica Date: Mon, 7 Jun 2021 14:31:16 +0300 Subject: [PATCH 2/3] module crates refactor --- Cargo.toml | 3 +- distribution/modules/{ => asset}/Cargo.toml | 15 +++++--- distribution/modules/{ => asset}/src/asset.rs | 2 ++ distribution/modules/global-op/Cargo.toml | 24 +++++++++++++ .../modules/{ => global-op}/src/global_op.rs | 2 ++ distribution/modules/src/lib.rs | 7 ---- distribution/sc-distribution-rs/Cargo.toml | 35 +++++++++++-------- distribution/sc-distribution-rs/src/lib.rs | 2 -- distribution/sc-proxy-dex/Cargo.toml | 25 ++++++------- sc-locked-asset-factory/Cargo.toml | 28 ++++++++------- sc-locked-asset-factory/src/cache.rs | 1 - sc-locked-asset-factory/src/lib.rs | 1 - sc-locked-asset-factory/src/locked_asset.rs | 1 - 13 files changed, 87 insertions(+), 59 deletions(-) rename distribution/modules/{ => asset}/Cargo.toml (55%) rename distribution/modules/{ => asset}/src/asset.rs (97%) create mode 100644 distribution/modules/global-op/Cargo.toml rename distribution/modules/{ => global-op}/src/global_op.rs (98%) delete mode 100644 distribution/modules/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index df8adbdce..44cc2a56a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,8 @@ members = [ "distribution", "distribution/distrib-common", - "distribution/modules", + "distribution/modules/asset", + "distribution/modules/global-op", "distribution/sc-distribution-rs", "distribution/sc-distribution-rs/abi", "distribution/sc-proxy-dex", diff --git a/distribution/modules/Cargo.toml b/distribution/modules/asset/Cargo.toml similarity index 55% rename from distribution/modules/Cargo.toml rename to distribution/modules/asset/Cargo.toml index eaa8bbbde..41bc23c06 100644 --- a/distribution/modules/Cargo.toml +++ b/distribution/modules/asset/Cargo.toml @@ -1,11 +1,17 @@ [package] -name = "modules" +name = "asset" version = "0.0.0" authors = [ "catalin-neagu ",] edition = "2018" [lib] -path = "src/lib.rs" +path = "src/asset.rs" + +[features] +wasm-output-mode = [ "elrond-wasm-node",] + +[dependencies.distrib-common] +path = "../../distrib-common" [dependencies.elrond-wasm] version = "0.17" @@ -13,5 +19,6 @@ version = "0.17" [dependencies.elrond-wasm-derive] version = "0.17" -[dependencies.distrib-common] -path = "../distrib-common" +[dependencies.elrond-wasm-node] +version = "0.17" +optional = true diff --git a/distribution/modules/src/asset.rs b/distribution/modules/asset/src/asset.rs similarity index 97% rename from distribution/modules/src/asset.rs rename to distribution/modules/asset/src/asset.rs index 7e9a73286..59a1c2a9e 100644 --- a/distribution/modules/src/asset.rs +++ b/distribution/modules/asset/src/asset.rs @@ -1,3 +1,5 @@ +#![no_std] + elrond_wasm::imports!(); elrond_wasm::derive_imports!(); diff --git a/distribution/modules/global-op/Cargo.toml b/distribution/modules/global-op/Cargo.toml new file mode 100644 index 000000000..f290d31c7 --- /dev/null +++ b/distribution/modules/global-op/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "global-op" +version = "0.0.0" +authors = [ "catalin-neagu ",] +edition = "2018" + +[lib] +path = "src/global_op.rs" + +[features] +wasm-output-mode = [ "elrond-wasm-node",] + +[dependencies.distrib-common] +path = "../../distrib-common" + +[dependencies.elrond-wasm] +version = "0.17" + +[dependencies.elrond-wasm-derive] +version = "0.17" + +[dependencies.elrond-wasm-node] +version = "0.17" +optional = true diff --git a/distribution/modules/src/global_op.rs b/distribution/modules/global-op/src/global_op.rs similarity index 98% rename from distribution/modules/src/global_op.rs rename to distribution/modules/global-op/src/global_op.rs index 91d3707d6..63f273315 100644 --- a/distribution/modules/src/global_op.rs +++ b/distribution/modules/global-op/src/global_op.rs @@ -1,3 +1,5 @@ +#![no_std] + elrond_wasm::imports!(); elrond_wasm::derive_imports!(); diff --git a/distribution/modules/src/lib.rs b/distribution/modules/src/lib.rs deleted file mode 100644 index 724439f35..000000000 --- a/distribution/modules/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![no_std] - -pub mod asset; -pub mod global_op; - -pub use asset::*; -pub use global_op::*; diff --git a/distribution/sc-distribution-rs/Cargo.toml b/distribution/sc-distribution-rs/Cargo.toml index 906333ba7..fc9044509 100644 --- a/distribution/sc-distribution-rs/Cargo.toml +++ b/distribution/sc-distribution-rs/Cargo.toml @@ -1,15 +1,30 @@ [package] -name = "sc_distribution_rs" -version = "0.0.0" -authors = [ "you",] edition = "2018" +name = "sc_distribution_rs" publish = false +version = "0.0.0" [lib] path = "src/lib.rs" [features] -wasm-output-mode = [ "elrond-wasm-node",] +wasm-output-mode = [ + "elrond-wasm-node", + "asset/wasm-output-mode", + "global-op/wasm-output-mode", +] + +[dependencies.distrib-common] +path = "../distrib-common" + +[dependencies.asset] +path = "../modules/asset" + +[dependencies.global-op] +path = "../modules/global-op" + +[dependencies.sc-locked-asset-factory] +path = "../../sc-locked-asset-factory" [dependencies.elrond-wasm] version = "0.17" @@ -18,18 +33,8 @@ version = "0.17" version = "0.17" [dependencies.elrond-wasm-node] -version = "0.17" optional = true - -[dependencies.distrib-common] -path = "../distrib-common" - -[dependencies.modules] -path = "../modules" - -[dependencies.sc-locked-asset-factory] -path = "../../sc-locked-asset-factory" +version = "0.17" [dev-dependencies.elrond-wasm-debug] version = "0.17" - diff --git a/distribution/sc-distribution-rs/src/lib.rs b/distribution/sc-distribution-rs/src/lib.rs index 83e44a8bc..6bd7c3890 100644 --- a/distribution/sc-distribution-rs/src/lib.rs +++ b/distribution/sc-distribution-rs/src/lib.rs @@ -3,8 +3,6 @@ elrond_wasm::imports!(); elrond_wasm::derive_imports!(); -use modules::*; - type Epoch = u64; const GAS_CHECK_FREQUENCY: usize = 100; diff --git a/distribution/sc-proxy-dex/Cargo.toml b/distribution/sc-proxy-dex/Cargo.toml index 32cb67f3e..24f75e3b7 100644 --- a/distribution/sc-proxy-dex/Cargo.toml +++ b/distribution/sc-proxy-dex/Cargo.toml @@ -1,7 +1,6 @@ [package] name = "sc-proxy-dex" version = "0.0.0" -authors = [ "you",] edition = "2018" publish = false @@ -11,22 +10,9 @@ path = "src/lib.rs" [features] wasm-output-mode = [ "elrond-wasm-node",] -[dependencies.elrond-wasm] -version = "0.17" - -[dependencies.elrond-wasm-derive] -version = "0.17" - -[dependencies.elrond-wasm-node] -version = "0.17" -optional = true - [dependencies.distrib-common] path = "../distrib-common" -[dependencies.modules] -path = "../modules" - [dependencies.dex-common] path = "../../dex/dex-common" @@ -36,5 +22,16 @@ path = "../../dex/elrond_dex_pair" [dependencies.elrond_dex_farm] path = "../../dex/elrond_dex_farm" + +[dependencies.elrond-wasm] +version = "0.17" + +[dependencies.elrond-wasm-derive] +version = "0.17" + +[dependencies.elrond-wasm-node] +version = "0.17" +optional = true + [dev-dependencies.elrond-wasm-debug] version = "0.17" diff --git a/sc-locked-asset-factory/Cargo.toml b/sc-locked-asset-factory/Cargo.toml index c7d902350..5f34b4c2a 100644 --- a/sc-locked-asset-factory/Cargo.toml +++ b/sc-locked-asset-factory/Cargo.toml @@ -1,15 +1,26 @@ [package] name = "sc-locked-asset-factory" +publish = false version = "0.0.0" -authors = [ "you",] edition = "2018" -publish = false [lib] path = "src/lib.rs" [features] -wasm-output-mode = [ "elrond-wasm-node",] +wasm-output-mode = [ + "elrond-wasm-node", + "asset/wasm-output-mode", +] + +[dependencies.distrib-common] +path = "../distribution/distrib-common" + +[dependencies.asset] +path = "../distribution/modules/asset" + +[dependencies.dex-common] +path = "../dex/dex-common" [dependencies.elrond-wasm] version = "0.17" @@ -18,17 +29,8 @@ version = "0.17" version = "0.17" [dependencies.elrond-wasm-node] -version = "0.17" optional = true - -[dependencies.distrib-common] -path = "../distribution/distrib-common" - -[dependencies.modules] -path = "../distribution/modules" - -[dependencies.dex-common] -path = "../dex/dex-common" +version = "0.17" [dev-dependencies.elrond-wasm-debug] version = "0.17" diff --git a/sc-locked-asset-factory/src/cache.rs b/sc-locked-asset-factory/src/cache.rs index f41ada456..7cb8903f9 100644 --- a/sc-locked-asset-factory/src/cache.rs +++ b/sc-locked-asset-factory/src/cache.rs @@ -5,7 +5,6 @@ type Nonce = u64; use super::locked_asset; use super::locked_asset::*; -use modules::*; #[elrond_wasm_derive::module] pub trait CacheModule: asset::AssetModule + locked_asset::LockedAssetModule { diff --git a/sc-locked-asset-factory/src/lib.rs b/sc-locked-asset-factory/src/lib.rs index 47f867744..64d31db26 100644 --- a/sc-locked-asset-factory/src/lib.rs +++ b/sc-locked-asset-factory/src/lib.rs @@ -10,7 +10,6 @@ type Nonce = u64; use dex_common::*; use distrib_common::*; -use modules::*; const EPOCHS_IN_MONTH: u64 = 30; diff --git a/sc-locked-asset-factory/src/locked_asset.rs b/sc-locked-asset-factory/src/locked_asset.rs index 5a1f2672d..05ed64b85 100644 --- a/sc-locked-asset-factory/src/locked_asset.rs +++ b/sc-locked-asset-factory/src/locked_asset.rs @@ -5,7 +5,6 @@ type Nonce = u64; type Epoch = u64; use distrib_common::*; -use modules::*; const ADDITIONAL_AMOUNT_TO_CREATE: u64 = 1; From cdd3e2ead119b5224f1ff71609d1d43bf27a671d Mon Sep 17 00:00:00 2001 From: andrei-marinica Date: Mon, 7 Jun 2021 14:43:05 +0300 Subject: [PATCH 3/3] imports cleanup --- dex/elrond_dex_farm/src/lib.rs | 12 ++++++------ dex/elrond_dex_pair/src/fee.rs | 2 +- dex/elrond_dex_pair/src/lib.rs | 4 ++-- dex/elrond_dex_pair/src/liquidity_pool.rs | 2 +- dex/elrond_dex_router/src/lib.rs | 2 +- dex/multi_token_farm/src/lib.rs | 10 +++++----- distribution/sc-proxy-dex/src/proxy_farm.rs | 6 ++++-- distribution/sc-proxy-dex/src/proxy_pair.rs | 4 ++-- sc-locked-asset-factory/src/cache.rs | 2 +- sc-locked-asset-factory/src/lib.rs | 16 +++++++--------- sc-locked-asset-factory/src/locked_asset.rs | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/dex/elrond_dex_farm/src/lib.rs b/dex/elrond_dex_farm/src/lib.rs index 1c1a305cb..0d29910ae 100644 --- a/dex/elrond_dex_farm/src/lib.rs +++ b/dex/elrond_dex_farm/src/lib.rs @@ -2,6 +2,12 @@ #![allow(non_snake_case)] #![allow(clippy::too_many_arguments)] +mod config; +mod rewards; + +use config::State; +use dex_common::{FftTokenAmountPair, GenericEsdtAmountPair}; + elrond_wasm::imports!(); elrond_wasm::derive_imports!(); @@ -12,12 +18,6 @@ const DEFAULT_MINUMUM_FARMING_EPOCHS: u8 = 3; const DEFAULT_LOCKED_REWARDS_LIQUIDITY_MUTIPLIER: u8 = 2; const DEFAULT_TRANSFER_EXEC_GAS_LIMIT: u64 = 35000000; -mod config; -mod rewards; - -use config::*; -use dex_common::*; - type EnterFarmResultType = GenericEsdtAmountPair; type ClaimRewardsResultType = MultiResult2, GenericEsdtAmountPair>; diff --git a/dex/elrond_dex_pair/src/fee.rs b/dex/elrond_dex_pair/src/fee.rs index b4bf5a833..1358041dc 100644 --- a/dex/elrond_dex_pair/src/fee.rs +++ b/dex/elrond_dex_pair/src/fee.rs @@ -5,7 +5,7 @@ use super::amm; use super::config; use super::liquidity_pool; use core::iter::FromIterator; -use dex_common::*; +use dex_common::TokenPair; const SWAP_NO_FEE_AND_FORWARD_FUNC_NAME: &[u8] = b"swapNoFeeAndForward"; diff --git a/dex/elrond_dex_pair/src/lib.rs b/dex/elrond_dex_pair/src/lib.rs index c617e6dbb..020c7431e 100644 --- a/dex/elrond_dex_pair/src/lib.rs +++ b/dex/elrond_dex_pair/src/lib.rs @@ -12,8 +12,8 @@ mod config; mod fee; mod liquidity_pool; -use config::*; -use dex_common::*; +use config::State; +use dex_common::FftTokenAmountPair; type AddLiquidityResultType = MultiResult3< FftTokenAmountPair, diff --git a/dex/elrond_dex_pair/src/liquidity_pool.rs b/dex/elrond_dex_pair/src/liquidity_pool.rs index 872b32af1..3c64a3813 100644 --- a/dex/elrond_dex_pair/src/liquidity_pool.rs +++ b/dex/elrond_dex_pair/src/liquidity_pool.rs @@ -3,7 +3,7 @@ elrond_wasm::derive_imports!(); use super::amm; use super::config; -use dex_common::*; +use dex_common::FftTokenAmountPair; const MINIMUM_LIQUIDITY: u64 = 1_000; diff --git a/dex/elrond_dex_router/src/lib.rs b/dex/elrond_dex_router/src/lib.rs index b0f2cba96..2b516c031 100644 --- a/dex/elrond_dex_router/src/lib.rs +++ b/dex/elrond_dex_router/src/lib.rs @@ -5,7 +5,7 @@ elrond_wasm::imports!(); elrond_wasm::derive_imports!(); mod factory; -pub use crate::factory::*; +use factory::PairTokens; const LP_TOKEN_DECIMALS: usize = 18; const LP_TOKEN_INITIAL_SUPPLY: u64 = 1000; diff --git a/dex/multi_token_farm/src/lib.rs b/dex/multi_token_farm/src/lib.rs index 1c25acd9d..0069ee5ea 100644 --- a/dex/multi_token_farm/src/lib.rs +++ b/dex/multi_token_farm/src/lib.rs @@ -2,19 +2,19 @@ #![allow(non_snake_case)] #![allow(clippy::type_complexity)] +mod liquidity_pool; +mod rewards; + elrond_wasm::imports!(); elrond_wasm::derive_imports!(); +use dex_common::{FftTokenAmountPair, GenericEsdtAmountPair}; type Epoch = u64; type Nonce = u64; + const PENALTY_PERCENT: u64 = 10; const EXIT_FARM_NO_PENALTY_MIN_EPOCHS: u64 = 3; -mod liquidity_pool; -mod rewards; - -use dex_common::*; - #[derive(TopEncode, TopDecode, PartialEq, TypeAbi)] pub enum State { Inactive, diff --git a/distribution/sc-proxy-dex/src/proxy_farm.rs b/distribution/sc-proxy-dex/src/proxy_farm.rs index 730dc2738..c9323d3e9 100644 --- a/distribution/sc-proxy-dex/src/proxy_farm.rs +++ b/distribution/sc-proxy-dex/src/proxy_farm.rs @@ -4,11 +4,13 @@ elrond_wasm::imports!(); elrond_wasm::derive_imports!(); type Nonce = u64; -use distrib_common::*; + +use dex_common::FftTokenAmountPair; +use dex_common::GenericEsdtAmountPair; +use distrib_common::WrappedFarmTokenAttributes; use super::proxy_common; use super::proxy_pair; -pub use dex_common::*; const ACCEPT_PAY_FUNC_NAME: &[u8] = b"acceptPay"; diff --git a/distribution/sc-proxy-dex/src/proxy_pair.rs b/distribution/sc-proxy-dex/src/proxy_pair.rs index ef1bbb941..91d0b5b67 100644 --- a/distribution/sc-proxy-dex/src/proxy_pair.rs +++ b/distribution/sc-proxy-dex/src/proxy_pair.rs @@ -10,8 +10,8 @@ use core::iter::FromIterator; const ACCEPT_PAY_FUNC_NAME: &[u8] = b"acceptPay"; const MAX_USER_TEMPORARY_SIZE: usize = 10; -use dex_common::*; -use distrib_common::*; +use dex_common::{FftTokenAmountPair, GenericEsdtAmountPair}; +use distrib_common::WrappedLpTokenAttributes; use super::proxy_common; diff --git a/sc-locked-asset-factory/src/cache.rs b/sc-locked-asset-factory/src/cache.rs index 7cb8903f9..c787f757e 100644 --- a/sc-locked-asset-factory/src/cache.rs +++ b/sc-locked-asset-factory/src/cache.rs @@ -4,7 +4,7 @@ elrond_wasm::derive_imports!(); type Nonce = u64; use super::locked_asset; -use super::locked_asset::*; +use super::locked_asset::UnlockSchedule; #[elrond_wasm_derive::module] pub trait CacheModule: asset::AssetModule + locked_asset::LockedAssetModule { diff --git a/sc-locked-asset-factory/src/lib.rs b/sc-locked-asset-factory/src/lib.rs index a08c35705..5c697b106 100644 --- a/sc-locked-asset-factory/src/lib.rs +++ b/sc-locked-asset-factory/src/lib.rs @@ -1,22 +1,20 @@ #![no_std] +mod cache; +mod locked_asset; + elrond_wasm::imports!(); elrond_wasm::derive_imports!(); const DEFAULT_TRANSFER_EXEC_GAS_LIMIT: u64 = 35000000; +const EPOCHS_IN_MONTH: u64 = 30; type Epoch = u64; type Nonce = u64; -use dex_common::*; -use distrib_common::*; - -const EPOCHS_IN_MONTH: u64 = 30; - -mod cache; -mod locked_asset; - -use locked_asset::*; +use dex_common::GenericEsdtAmountPair; +use distrib_common::UnlockMilestone; +use locked_asset::UnlockSchedule; #[elrond_wasm_derive::contract] pub trait LockedAssetFactory: diff --git a/sc-locked-asset-factory/src/locked_asset.rs b/sc-locked-asset-factory/src/locked_asset.rs index 05ed64b85..f7b3a0679 100644 --- a/sc-locked-asset-factory/src/locked_asset.rs +++ b/sc-locked-asset-factory/src/locked_asset.rs @@ -4,7 +4,7 @@ elrond_wasm::derive_imports!(); type Nonce = u64; type Epoch = u64; -use distrib_common::*; +use distrib_common::UnlockMilestone; const ADDITIONAL_AMOUNT_TO_CREATE: u64 = 1;