mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-07-25 23:23:11 +00:00
incorporate lip_supply_init to this refactoring
This commit is contained in:
@@ -181,6 +181,11 @@ impl BalanceForTests {
|
||||
fn user_token_b_holding_new_definition() -> u128 {
|
||||
7_500
|
||||
}
|
||||
|
||||
fn lp_supply_init() -> u128 {
|
||||
// isqrt(vault_a_balance_init * vault_b_balance_init) = isqrt(5_000 * 2_500) = 3535
|
||||
(BalanceForTests::vault_a_balance_init() * BalanceForTests::vault_b_balance_init()).isqrt()
|
||||
}
|
||||
}
|
||||
|
||||
struct IdForTests;
|
||||
@@ -772,7 +777,7 @@ impl AccountForTests {
|
||||
balance: 0u128,
|
||||
data: Data::from(&TokenHolding::Fungible {
|
||||
definition_id: IdForTests::token_lp_definition_id(),
|
||||
balance: BalanceForTests::user_token_a_holding_new_definition(),
|
||||
balance: BalanceForTests::lp_supply_init(),
|
||||
}),
|
||||
nonce: 0,
|
||||
}
|
||||
@@ -784,7 +789,7 @@ impl AccountForTests {
|
||||
balance: 0u128,
|
||||
data: Data::from(&TokenDefinition::Fungible {
|
||||
name: String::from("LP Token"),
|
||||
total_supply: BalanceForTests::vault_a_balance_init(),
|
||||
total_supply: BalanceForTests::lp_supply_init(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: 0,
|
||||
@@ -801,7 +806,7 @@ impl AccountForTests {
|
||||
vault_a_id: IdForTests::vault_a_id(),
|
||||
vault_b_id: IdForTests::vault_b_id(),
|
||||
liquidity_pool_id: IdForTests::token_lp_definition_id(),
|
||||
liquidity_pool_supply: BalanceForTests::user_token_a_holding_new_definition(),
|
||||
liquidity_pool_supply: BalanceForTests::lp_supply_init(),
|
||||
reserve_a: BalanceForTests::vault_a_balance_init(),
|
||||
reserve_b: BalanceForTests::vault_b_balance_init(),
|
||||
fees: 0u128,
|
||||
@@ -1089,7 +1094,7 @@ fn test_simple_amm_new_definition_inactive_initialized_pool_init_user_lp() {
|
||||
let user_token_b_post = state.get_account_by_id(IdForTests::user_token_b_id());
|
||||
let user_token_lp_post = state.get_account_by_id(IdForTests::user_token_lp_id());
|
||||
|
||||
let expected_pool = AccountForTests::pool_definition_init();
|
||||
let expected_pool = AccountForTests::pool_definition_new_init();
|
||||
let expected_vault_a = AccountForTests::vault_a_init();
|
||||
let expected_vault_b = AccountForTests::vault_b_init();
|
||||
let expected_token_lp = AccountForTests::token_lp_definition_new_init();
|
||||
|
||||
Reference in New Issue
Block a user