Aquarius Soroban Methods
Address
The Aquarius Smart Contract serving as an entry point for all the AMM functionality is CBQDHNBFBZYE4MKPWBSJOPIYLW4SFSXAXUTSXJN76GNKYVYPCKWC6QUK
Methods to use
Deposit
The deposit function is used to increase pool liquidity by exchanging tokens onto pool liquidity share token:
Arguments
- user: The address of the user executing withdraw - tokens: Ordered tokens vector - pool_index: Pool hash (see get pools list section) - desired_amounts: Vector of desired amounts to deposit - min_shares: Minimum amount of shares to receive on deposit
The function returns the actual amounts of deposited tokens and minted shares amount
Withdraw
The withdraw function is used to remove liquidity from pool, by exchanging pool liquidity share onto pool tokens
Arguments
- user: The address of the user executing withdraw. - tokens: Ordered tokens vector - pool_index: Pool hash (see get pools list section) - share_amount: Amount of shares to withdraw - min_amounts: Vector of minimum amounts to withdraw
The function returns the actual amounts of withdrawn tokens
Swap Chained
The swap_chained function in the Soroban Rust smart contract is used to execute a chain of token swaps to exchange an input token for an output token. The function signature is as follows:
Arguments
- user: The address of the user executing the swaps. - swaps_chain: (No need to generate it manually since this is available in find-path response as SCVal XDR encoded value) The series of swaps to be executed. Each swap is represented by a tuple containing:
A vector of token addresses liquidity pool belongs to
Pool index hash
The token to obtain
- token_in: The address of the input token to be swapped. - in_amount: The amount of the input token to be swapped. - out_min: The minimum amount of the output token to be received.
The function returns the amount of the output token received after all swaps have been executed.
Limitations
Up to 4 pools are allowed currently due to Soroban limitations. No contract validation error shall be raised, but transaction wonโt pass simulation and fail with BudgetExceed error.
Last updated