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

fix: integration tests after ED overhaul #1601

Merged
merged 2 commits into from
Oct 26, 2023
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
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);
lemunozm marked this conversation as resolved.
Show resolved Hide resolved
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();
lemunozm marked this conversation as resolved.
Show resolved Hide resolved

// 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;
lemunozm marked this conversation as resolved.
Show resolved Hide resolved

// 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
Loading