mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-27 07:01:14 +00:00
chore(amm): new_definition allows only uninitialized pools
This commit is contained in:
@@ -1048,107 +1048,6 @@ fn amm_remove_liquidity_insufficient_user_lp_fails() {
|
||||
assert!(state.transition_from_public_transaction(&tx, 0).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn amm_new_definition_zero_supply_initialized_pool_and_uninit_user_lp() {
|
||||
let mut state = state_for_amm_tests_with_new_def();
|
||||
state.force_insert_account(Ids::vault_a(), Accounts::vault_a_reinitializable());
|
||||
state.force_insert_account(Ids::vault_b(), Accounts::vault_b_reinitializable());
|
||||
state.force_insert_account(
|
||||
Ids::pool_definition(),
|
||||
Accounts::pool_definition_zero_supply_reinitializable(),
|
||||
);
|
||||
state.force_insert_account(
|
||||
Ids::token_lp_definition(),
|
||||
Accounts::token_lp_definition_reinitializable(),
|
||||
);
|
||||
|
||||
execute_new_definition(&mut state, Balances::fee_tier());
|
||||
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::pool_definition()),
|
||||
Accounts::pool_definition_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::vault_a()),
|
||||
Accounts::vault_a_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::vault_b()),
|
||||
Accounts::vault_b_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::token_lp_definition()),
|
||||
Accounts::token_lp_definition_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::lp_lock_holding()),
|
||||
Accounts::lp_lock_holding_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::user_a()),
|
||||
Accounts::user_a_holding_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::user_b()),
|
||||
Accounts::user_b_holding_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::user_lp()),
|
||||
Accounts::user_lp_holding_new_init()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn amm_new_definition_zero_supply_initialized_pool_init_user_lp() {
|
||||
let mut state = state_for_amm_tests_with_new_def();
|
||||
state.force_insert_account(Ids::vault_a(), Accounts::vault_a_reinitializable());
|
||||
state.force_insert_account(Ids::vault_b(), Accounts::vault_b_reinitializable());
|
||||
state.force_insert_account(
|
||||
Ids::pool_definition(),
|
||||
Accounts::pool_definition_zero_supply_reinitializable(),
|
||||
);
|
||||
state.force_insert_account(
|
||||
Ids::token_lp_definition(),
|
||||
Accounts::token_lp_definition_reinitializable(),
|
||||
);
|
||||
state.force_insert_account(Ids::user_lp(), Accounts::user_lp_holding_init_zero());
|
||||
|
||||
execute_new_definition(&mut state, Balances::fee_tier());
|
||||
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::pool_definition()),
|
||||
Accounts::pool_definition_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::vault_a()),
|
||||
Accounts::vault_a_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::vault_b()),
|
||||
Accounts::vault_b_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::token_lp_definition()),
|
||||
Accounts::token_lp_definition_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::lp_lock_holding()),
|
||||
Accounts::lp_lock_holding_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::user_a()),
|
||||
Accounts::user_a_holding_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::user_b()),
|
||||
Accounts::user_b_holding_new_init()
|
||||
);
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::user_lp()),
|
||||
Accounts::user_lp_holding_new_init()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn amm_new_definition_uninitialized_pool() {
|
||||
let mut state = state_for_amm_tests_with_new_def();
|
||||
|
||||
Reference in New Issue
Block a user