pub trait StableAmmApi<PoolId, CurrencyId, AccountId, Balance> {
// Required methods
fn stable_amm_calculate_currency_amount(
pool_id: PoolId,
amounts: &[Balance],
deposit: bool
) -> Result<Balance, DispatchError>;
fn stable_amm_calculate_swap_amount(
pool_id: PoolId,
i: usize,
j: usize,
in_balance: Balance
) -> Option<Balance>;
fn stable_amm_calculate_remove_liquidity(
pool_id: PoolId,
amount: Balance
) -> Option<Vec<Balance>>;
fn stable_amm_calculate_remove_liquidity_one_currency(
pool_id: PoolId,
amount: Balance,
index: u32
) -> Option<Balance>;
fn currency_index(pool_id: PoolId, currency: CurrencyId) -> Option<u32>;
fn add_liquidity(
who: &AccountId,
pool_id: PoolId,
amounts: &[Balance],
min_mint_amount: Balance,
to: &AccountId
) -> Result<Balance, DispatchError>;
fn swap(
who: &AccountId,
poo_id: PoolId,
from_index: u32,
to_index: u32,
in_amount: Balance,
min_out_amount: Balance,
to: &AccountId
) -> Result<Balance, DispatchError>;
fn remove_liquidity(
who: &AccountId,
poo_id: PoolId,
lp_amount: Balance,
min_amounts: &[Balance],
to: &AccountId
) -> DispatchResult;
fn remove_liquidity_one_currency(
who: &AccountId,
poo_id: PoolId,
lp_amount: Balance,
index: u32,
min_amount: Balance,
to: &AccountId
) -> Result<Balance, DispatchError>;
fn remove_liquidity_imbalance(
who: &AccountId,
pool_id: PoolId,
amounts: &[Balance],
max_burn_amount: Balance,
to: &AccountId
) -> DispatchResult;
fn swap_pool_from_base(
who: &AccountId,
pool_id: PoolId,
base_pool_id: PoolId,
in_index: u32,
out_index: u32,
dx: Balance,
min_dy: Balance,
to: &AccountId
) -> Result<Balance, DispatchError>;
fn swap_pool_to_base(
who: &AccountId,
pool_id: PoolId,
base_pool_id: PoolId,
in_index: u32,
out_index: u32,
dx: Balance,
min_dy: Balance,
to: &AccountId
) -> Result<Balance, DispatchError>;
}