Contract 1079bee7206a3e29f8cfa1d5603c528f699640c88c155438d066f2dfcdba60d9

← Back to Index 📥 Download WASM

Meta

rssdkver 21.0.1-preview.3#ff05c3d4cbed97db50142372e9d7a4fa4a8d1d5d
rsver 1.79.0

Instances

  • CAWNTPMEKVH4U2KWXMFX2VUADFVREONACIRNQF7EVHL76NE62JWSPIAQ
  • CB46LMUQIPA5NEHU3TKT5E37SHBMRNQ6JZN2JCMDE2YO2KO54FJFQ5AU
  • CBTQQAPWU3X6PMCYE5OESIIL67EIZTVKTS47DMZXRB3CZIZFYWFBKMBC

Interface

Initializes the AddLiquidityTimelock contract.

Arguments

  • e - The environment context.
  • admin - The address of the admin.
  • router_address - The address of the Soroswap router.
  • end_timestamp - The end timestamp for the timelock.

Returns

  • Result<(), CombinedLiquidityTimelockError> - Returns Ok(()) if the initialization is successful, otherwise returns an error indicating the failure reason.
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    router_address: soroban_sdk::Address,
    end_timestamp: u64,
) -> Result<(), CombinedLiquidityTimelockError>

Adds liquidity to a liquidity pool in the Soroswap protocol.

This function adds liquidity by transferring the specified amounts of tokens to the liquidity pool. It ensures that the contract is initialized, the amounts are non-negative, and the deadline is not exceeded. The function also authorizes the transfer of tokens, calculates the exact amounts of tokens to be used, and handles any remaining balances. An event is emitted upon successful addition of liquidity.

This functions adds liquidity on behalf of the caller to a Soroswap.Finance liquidity pool, however the liquidity pool tokens are hold by the current contract until they are claimed

Arguments

  • e - The contract environment (Env) in which the contract is executing.
  • token_a - The address of the first token to add liquidity for.
  • token_b - The address of the second token to add liquidity for.
  • amount_a_desired - The desired amount of the first token to add.
  • amount_b_desired - The desired amount of the second token to add.
  • `amo
fn add_liquidity(
    env: soroban_sdk::Env,
    token_a: soroban_sdk::Address,
    token_b: soroban_sdk::Address,
    amount_a_desired: i128,
    amount_b_desired: i128,
    amount_a_min: i128,
    amount_b_min: i128,
    from: soroban_sdk::Address,
    deadline: u64,
) -> Result<(i128, i128, i128), CombinedLiquidityTimelockError>
fn claim(
    env: soroban_sdk::Env,
    pair_address: soroban_sdk::Address,
) -> Result<(), CombinedLiquidityTimelockError>
fn get_admin(
    env: soroban_sdk::Env,
) -> Result
fn get_release_time(
    env: soroban_sdk::Env,
) -> Result

Sorts two token addresses in a consistent order.

Arguments

  • token_a - The address of the first token.
  • token_b - The address of the second token.

Returns

Returns Result<(Address, Address), SoroswapLibraryError> where Ok contains a tuple with the sorted token addresses, and Err indicates an error such as identical tokens.

fn sort_tokens(
    env: soroban_sdk::Env,
    token_a: soroban_sdk::Address,
    token_b: soroban_sdk::Address,
) -> Result<(soroban_sdk::Address, soroban_sdk::Address), SoroswapLibraryError>

Calculates the deterministic address for a pair without making any external calls. check https://github.com/paltalabs/deterministic-address-soroban

Arguments

  • e - The environment.
  • factory - The factory address.
  • token_a - The address of the first token.
  • token_b - The address of the second token.

Returns

Returns Result<Address, SoroswapLibraryError> where Ok contains the deterministic address for the pair, and Err indicates an error such as identical tokens or an issue with sorting.

fn pair_for(
    env: soroban_sdk::Env,
    factory: soroban_sdk::Address,
    token_a: soroban_sdk::Address,
    token_b: soroban_sdk::Address,
) -> Result

Fetches and sorts the reserves for a pair of tokens.

Arguments

  • e - The environment.
  • factory - The factory address.
  • token_a - The address of the first token.
  • token_b - The address of the second token.

Returns

Returns Result<(i128, i128), SoroswapLibraryError> where Ok contains a tuple of sorted reserves, and Err indicates an error such as identical tokens or an issue with sorting.

fn get_reserves(
    env: soroban_sdk::Env,
    factory: soroban_sdk::Address,
    token_a: soroban_sdk::Address,
    token_b: soroban_sdk::Address,
) -> Result<(i128, i128), SoroswapLibraryError>

Given some amount of an asset and pair reserves, returns an equivalent amount of the other asset.

Arguments

  • amount_a - The amount of the first asset.
  • reserve_a - Reserves of the first asset in the pair.
  • reserve_b - Reserves of the second asset in the pair.

Returns

Returns Result<i128, SoroswapLibraryError> where Ok contains the calculated equivalent amount, and Err indicates an error such as insufficient amount or liquidity

fn quote(
    env: soroban_sdk::Env,
    amount_a: i128,
    reserve_a: i128,
    reserve_b: i128,
) -> Result

Given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset.

Arguments

  • amount_in - The input amount of the asset.
  • reserve_in - Reserves of the input asset in the pair.
  • reserve_out - Reserves of the output asset in the pair.

Returns

Returns Result<i128, SoroswapLibraryError> where Ok contains the calculated maximum output amount, and Err indicates an error such as insufficient input amount or liquidity.

fn get_amount_out(
    env: soroban_sdk::Env,
    amount_in: i128,
    reserve_in: i128,
    reserve_out: i128,
) -> Result

Given an output amount of an asset and pair reserves, returns a required input amount of the other asset.

Arguments

  • amount_out - The output amount of the asset.
  • reserve_in - Reserves of the input asset in the pair.
  • reserve_out - Reserves of the output asset in the pair.

Returns

Returns Result<i128, SoroswapLibraryError> where Ok contains the required input amount, and Err indicates an error such as insufficient output amount or liquidity.

fn get_amount_in(
    env: soroban_sdk::Env,
    amount_out: i128,
    reserve_in: i128,
    reserve_out: i128,
) -> Result

Performs chained get_amount_out calculations on any number of pairs.

Arguments

  • e - The environment.
  • factory - The factory address.
  • amount_in - The input amount.
  • path - Vector of token addresses representing the path.

Returns

Returns Result<Vec<i128>, SoroswapLibraryError> where Ok contains a vector of calculated amounts, and Err indicates an error such as an invalid path.

fn get_amounts_out(
    env: soroban_sdk::Env,
    factory: soroban_sdk::Address,
    amount_in: i128,
    path: soroban_sdk::Vec,
) -> Result, SoroswapLibraryError>

Performs chained get_amount_in calculations on any number of pairs.

Arguments

  • e - The environment.
  • factory - The factory address.
  • amount_out - The output amount.
  • path - Vector of token addresses representing the path.

Returns

Returns Result<Vec<i128>, SoroswapLibraryError> where Ok contains a vector of calculated amounts, and Err indicates an error such as an invalid path.

fn get_amounts_in(
    env: soroban_sdk::Env,
    factory: soroban_sdk::Address,
    amount_out: i128,
    path: soroban_sdk::Vec,
) -> Result, SoroswapLibraryError>

Imports

WebAssembly Text (WAT) ▶