Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continuous integration - mandos-go #82

Merged
merged 4 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"dex",
"dex/dex-common",
"dex/elrond_dex_farm",
"dex/elrond_dex_farm/abi",
Expand All @@ -10,8 +11,10 @@ members = [
"dex/multi_token_farm",
"dex/multi_token_farm/abi",

"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",
Expand Down
18 changes: 18 additions & 0 deletions dex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 6 additions & 6 deletions dex/elrond_dex_farm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!();

Expand All @@ -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<BigUint> = GenericEsdtAmountPair<BigUint>;
type ClaimRewardsResultType<BigUint> =
MultiResult2<GenericEsdtAmountPair<BigUint>, GenericEsdtAmountPair<BigUint>>;
Expand Down
2 changes: 1 addition & 1 deletion dex/elrond_dex_pair/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions dex/elrond_dex_pair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BigUint> = MultiResult3<
FftTokenAmountPair<BigUint>,
Expand Down
2 changes: 1 addition & 1 deletion dex/elrond_dex_pair/src/liquidity_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion dex/elrond_dex_router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions dex/multi_token_farm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
189 changes: 189 additions & 0 deletions dex/tests/dex_mandos_go_test.rs
Original file line number Diff line number Diff line change
@@ -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");
}
18 changes: 18 additions & 0 deletions distribution/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
[package]
name = "modules"
name = "asset"
version = "0.0.0"
authors = [ "catalin-neagu <catalin.neagu@elrond.com>",]
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"

[dependencies.elrond-wasm-derive]
version = "0.17"

[dependencies.distrib-common]
path = "../distrib-common"
[dependencies.elrond-wasm-node]
version = "0.17"
optional = true
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![no_std]

elrond_wasm::imports!();
elrond_wasm::derive_imports!();

Expand Down
Loading