Contract 8b310c3a822d4157e327d8805597a53d6919a7c6a18481bded2daf65ff16cce3

← Back to Index 📥 Download WASM

Meta

Description RaumFi V2 DEX
rssdkver 20.5.0#9e2c3022b4355b224a7a814e13ba51761eeb14bb
rsver 1.77.2

Instances

  • CAQRAFO72GE4RUSRAXHJKU54U5LVSL7P57OU6JGZZYSYMKCIMGTI67DU
  • CBKUO455RK2U32DMLDFL5UWU5RRHMH6HF6AVQX5EGPA3T4RYG3Q7TRL4
  • CBXZK6363UPH444OD6RNC6ZQ7RAUMKGXTGO574WMYTOW5TSPL4UFULSN

Interface

fn total_supply(env: soroban_sdk::Env) -> i128
fn allowance(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
    spender: soroban_sdk::Address,
) -> i128
fn approve(
    env: soroban_sdk::Env,
    address: soroban_sdk::Address,
    spender: soroban_sdk::Address,
    amount: i128,
    expiration_ledger: u32,
)
fn balance(env: soroban_sdk::Env, address: soroban_sdk::Address) -> i128
fn transfer(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)
fn transfer_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)
fn burn(env: soroban_sdk::Env, address: soroban_sdk::Address, amount: i128)
fn burn_from(
    env: soroban_sdk::Env,
    spender: soroban_sdk::Address,
    from: soroban_sdk::Address,
    amount: i128,
)
fn decimals(env: soroban_sdk::Env) -> u32
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String

Initializes a new RaumFi pair by setting token addresses, factory, and initial reserves.

Arguments

  • e - The runtime environment.
  • factory - The address of the RaumFi factory contract.
  • token_0 - The address of the first token in the pair.
  • token_1 - The address of the second token in the pair.
fn initialize(
    env: soroban_sdk::Env,
    factory: soroban_sdk::Address,
    token_0: soroban_sdk::Address,
    token_1: soroban_sdk::Address,
) -> Result<(), PairError>

Returns the address of the first token in the RaumFi pair.

fn token_0(env: soroban_sdk::Env) -> soroban_sdk::Address

Returns the address of the second token in the RaumFi pair.

fn token_1(env: soroban_sdk::Env) -> soroban_sdk::Address

Returns the address of the RaumFi factory contract.

fn factory(env: soroban_sdk::Env) -> soroban_sdk::Address

Deposits tokens into the RaumFi pair and mints LP tokens in return.

Arguments

  • e - The runtime environment.
  • to - The address where the minted LP tokens will be sent.

Returns

The amount of minted LP tokens. Possible errors:

  • PairError::NotInitialized: The RaumFi pair has not been initialized.
  • PairError::DepositInsufficientAmountToken0: Insufficient amount of token 0 sent.
  • PairError::DepositInsufficientAmountToken1: Insufficient amount of token 1 sent.
  • PairError::DepositInsufficientFirstLiquidity: Insufficient first liquidity minted.
  • PairError::DepositInsufficientLiquidityMinted: Insufficient liquidity minted.
  • PairError::UpdateOverflow: Overflow occurred during update.
fn deposit(env: soroban_sdk::Env, to: soroban_sdk::Address) -> Result

Executes a token swap within the RaumFi pair.

Arguments

  • e - The runtime environment.
  • amount_0_out - The desired amount of the first token to receive.
  • amount_1_out - The desired amount of the second token to receive.
  • to - The address where the swapped tokens will be sent. Returns an error if the swap cannot be executed. Possible errors include:
  • PairError::NotInitialized
  • PairError::SwapInsufficientOutputAmount
  • PairError::SwapNegativesOutNotSupported
  • PairError::SwapInsufficientLiquidity
  • PairError::SwapInvalidTo
  • PairError::SwapInsufficientInputAmount
  • PairError::SwapNegativesInNotSupported
  • PairError::SwapConstantNotMet: If the K constant condition is not met after the swap.
fn swap(
    env: soroban_sdk::Env,
    amount_0_out: i128,
    amount_1_out: i128,
    to: soroban_sdk::Address,
) -> Result<(), PairError>

Withdraws liquidity from the RaumFi pair, burning LP tokens and returning the corresponding tokens to the user.

Arguments

  • e - The runtime environment.
  • to - The address where the withdrawn tokens will be sent.

Returns

A tuple containing the amounts of token 0 and token 1 withdrawn from the pair.

fn withdraw(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
) -> Result<(i128, i128), PairError>

Skims excess tokens from reserves and sends them to the specified address.

Arguments

  • e - The runtime environment.
  • to - The address where the excess tokens will be sent.
fn skim(env: soroban_sdk::Env, to: soroban_sdk::Address)

Forces reserves to match current balances.

Arguments

  • e - The runtime environment.
fn sync(env: soroban_sdk::Env)

Returns the current reserves and the last block timestamp.

Arguments

  • e - The runtime environment.

Returns

A tuple containing the reserves of token 0 and token 1.

fn get_reserves(env: soroban_sdk::Env) -> (i128, i128)

Returns the value of the last product of reserves (K) stored in the contract.

Arguments

  • e - The runtime environment.

Returns

The value of the last product of reserves (K).

fn k_multiplier(env: soroban_sdk::Env) -> i128

Imports

WebAssembly Text (WAT) ▶