Skip to content

Commit

Permalink
fix: integration tests after ED overhaul (#1601)
Browse files Browse the repository at this point in the history
* tests: fix FI

* tests: fix LP transfer non tranche
  • Loading branch information
wischli authored Oct 26, 2023
1 parent d4510e6 commit d0d9388
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let amount = 100_000_000;
let amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand All @@ -112,14 +112,6 @@ mod same_currencies {
let currency_id = AUSD_CURRENCY_ID;
let currency_decimals = currency_decimals::AUSD;

let sending_domain_locator = Domain::convert(DEFAULT_DOMAIN_ADDRESS_MOONBEAM.domain());
let pool_account =
pallet_pool_system::pool_types::PoolLocator { pool_id }.into_account_truncating();

Tokens::mint_into(AUSD_CURRENCY_ID, &sending_domain_locator, AUSD_ED).unwrap();
Tokens::mint_into(AUSD_CURRENCY_ID, &investor, AUSD_ED).unwrap();
Tokens::mint_into(AUSD_CURRENCY_ID, &pool_account, AUSD_ED).unwrap();

// Create new pool
create_currency_pool(pool_id, currency_id, currency_decimals.into());

Expand Down Expand Up @@ -159,7 +151,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let invest_amount: u128 = 100_000_000;
let invest_amount: u128 = 10 * dollar(12);
let decrease_amount = invest_amount / 3;
let final_amount = invest_amount - decrease_amount;
let investor: AccountId =
Expand Down Expand Up @@ -241,7 +233,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let invest_amount = 100_000_000;
let invest_amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand Down Expand Up @@ -338,7 +330,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let amount = 100_000_000;
let amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand Down Expand Up @@ -490,7 +482,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let invest_amount = 100_000_000;
let invest_amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand Down Expand Up @@ -748,7 +740,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let amount = 100_000_000;
let amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand Down Expand Up @@ -801,7 +793,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let redeem_amount = 100_000_000;
let redeem_amount = 10 * dollar(12);
let decrease_amount = redeem_amount / 3;
let final_amount = redeem_amount - decrease_amount;
let investor: AccountId =
Expand Down Expand Up @@ -914,7 +906,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let redeem_amount = 100_000_000;
let redeem_amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand Down Expand Up @@ -1010,7 +1002,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let amount = 100_000_000;
let amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand Down Expand Up @@ -1164,7 +1156,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let redeem_amount = 100_000_000;
let redeem_amount = 10 * dollar(12);
let investor: AccountId =
AccountConverter::<DevelopmentRuntime, LocationToAccountId>::convert((
DOMAIN_MOONBEAM,
Expand Down Expand Up @@ -1388,7 +1380,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let invest_amount: u128 = 100_000_000;
let invest_amount: u128 = 10 * dollar(12);
let decrease_amount = invest_amount + 1;
let investor: AccountId = AccountConverter::<
DevelopmentRuntime,
Expand Down Expand Up @@ -1430,7 +1422,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let redeem_amount: u128 = 100_000_000;
let redeem_amount: u128 = 10 * dollar(12);
let decrease_amount = redeem_amount + 1;
let investor: AccountId = AccountConverter::<
DevelopmentRuntime,
Expand Down Expand Up @@ -1473,7 +1465,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let amount: u128 = 100_000_000;
let amount: u128 = 10 * dollar(12);
let investor: AccountId = AccountConverter::<
DevelopmentRuntime,
LocationToAccountId,
Expand Down Expand Up @@ -1509,7 +1501,7 @@ mod same_currencies {
tranche_id: default_tranche_id(pool_id),
investor: investor.clone().into(),
currency: general_currency_index(currency_id),
amount: 1,
amount: AUSD_ED,
};
assert_noop!(
LiquidityPools::submit(DEFAULT_DOMAIN_ADDRESS_MOONBEAM, increase_msg),
Expand Down Expand Up @@ -1541,7 +1533,7 @@ mod same_currencies {
Development::execute_with(|| {
setup_pre_requirements();
let pool_id = DEFAULT_POOL_ID;
let amount: u128 = 100_000_000;
let amount: u128 = 10 * dollar(12);
let investor: AccountId = AccountConverter::<
DevelopmentRuntime,
LocationToAccountId,
Expand Down Expand Up @@ -1644,7 +1636,7 @@ mod same_currencies {
tranche_id: default_tranche_id(pool_id),
investor: investor.clone().into(),
currency: general_currency_index(foreign_currency),
amount: 1,
amount: AUSD_ED,
};
assert_noop!(
LiquidityPools::submit(DEFAULT_DOMAIN_ADDRESS_MOONBEAM, increase_msg),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use xcm_emulator::TestExt;

use crate::{
liquidity_pools::pallet::development::{
setup::{dollar, ALICE, BOB},
setup::{dollar, ALICE, BOB, CHARLIE},
test_net::{Development, Moonbeam, RelayChain, TestNet},
tests::liquidity_pools::setup::{
asset_metadata, create_ausd_pool, create_currency_pool,
Expand All @@ -73,13 +73,17 @@ fn transfer_non_tranche_tokens_from_local() {
// Register GLMR and fund BOB
setup_pre_requirements();

let initial_balance = 100_000_000;
let initial_balance = 2 * AUSD_ED;
let amount = initial_balance / 2;
let dest_address = DEFAULT_DOMAIN_ADDRESS_MOONBEAM;
let currency_id = AUSD_CURRENCY_ID;
let source_account = BOB;
let source_account = CHARLIE;

// Mint sufficient balance
assert_eq!(
OrmlTokens::free_balance(currency_id, &source_account.into()),
0
);
assert_ok!(OrmlTokens::mint_into(
currency_id,
&source_account.into(),
Expand Down

0 comments on commit d0d9388

Please sign in to comment.