Crypto Pool

This pool type will contain not-equivalent-value tokens

Contract Interface

1. Notations & Structs

1.1. PoolResultType

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

1.2. AddLiquidityEvent

pub struct AddLiquidityEvent<M: ManagedTypeApi> {
    pub token_amounts: ManagedVec<M, BigUint<M>>,
    pub fee: BigUint<M>,
    pub lp_token_supply: BigUint<M>,
    pub lp_token_amount: BigUint<M>,
}

1.3. RemoveLiquidityEvent

pub struct RemoveLiquidityEvent<M: ManagedTypeApi> {
    pub token_amounts: ManagedVec<M, BigUint<M>>,
    pub lp_token_supply: BigUint<M>,
    pub lp_token_amount: BigUint<M>,
}

1.4. TokenExchangeEvent

2. Write functions

2.1. Add liquidity

2.2. Remove liquidity

2.3. Exchange

dy: the minimum amount of the output token

3. Read functions

3.1. Estimate the return of exchanging

dx: input token amount

i: input token index

j: output token index

3.2. Get pool state

3.3. Get LP token identifier

3.4. Get LP token supply

Get pool tokens

3.5. Get token balances

4. Events

4.1. Token exchange

4.2. Add liquidity

4.3. Remove liquidity

Last updated

Was this helpful?