AshSwap Docs

Crypto Pool

This pool type will contain not-equivalent-value tokens

Contract Interface


pub type PoolResultType<BigUint> = ManagedVec<BigUint, EsdtTokenPayment<BigUint>>;

Add liquidity

fn add_liquidity(&self, min_mint_amount: BigUint, opt_receiver: OptionalValue<ManagedAddress>) -> BigUint;

Remove liquidity

fn remove_liquidity(&self, min_amounts: ManagedVec<BigUint>, opt_receiver: OptionalValue<ManagedAddress>) -> ManagedVec<BigUint>


fn exchange(&self, min_dy: BigUint) -> BigUint;
dy: the minimum amount of the output token

Estimate the return of exchanging

fn get_dy(self, i: usize, j: usize, dx: BigUint) -> MultiValue2<BigUint, BigUint>
dx: input token amount
i: input token index
j: output token index

Get pool state

#[derive(TopEncode, TopDecode, PartialEq, TypeAbi, Debug)]
pub enum State { Inactive, Active, ActiveNoSwaps }
fn state(&self) -> State;

Get LP token identifier

fn get_lp_token_identifier(&self) -> TokenIdentifier

Get pool tokens

fn get_tokens(&self) -> ManagedVec<TokenIdentifier>

Get token balances

fn get_balances(&self) -> ManagedVec<BigUint>