fn total_supply(env: soroban_sdk::Env) -> i128
fn allowance(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
spender: soroban_sdk::Address,
) -> i128
fn approve(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
spender: soroban_sdk::Address,
amount: i128,
expiration_ledger: u32,
)
fn balance(env: soroban_sdk::Env, id: 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, from: 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 Soroswap pair by setting token addresses, factory, and initial reserves.
e - The runtime environment.factory - The address of the Soroswap 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<(), SoroswapPairError>
Returns the address of the first token in the Soroswap pair.
fn token_0(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns the address of the second token in the Soroswap pair.
fn token_1(env: soroban_sdk::Env) -> soroban_sdk::Address
Returns the address of the Soroswap factory contract.
fn factory(env: soroban_sdk::Env) -> soroban_sdk::Address
Deposits tokens into the Soroswap pair and mints LP tokens in return.
e - The runtime environment.to - The address where the minted LP tokens will be sent.The amount of minted LP tokens. Possible errors:
SoroswapPairError::NotInitialized: The Soroswap pair has not been initialized.SoroswapPairError::DepositInsufficientAmountToken0: Insufficient amount of token 0 sent.SoroswapPairError::DepositInsufficientAmountToken1: Insufficient amount of token 1 sent.SoroswapPairError::DepositInsufficientFirstLiquidity: Insufficient first liquidity minted.SoroswapPairError::DepositInsufficientLiquidityMinted: Insufficient liquidity minted.SoroswapPairError::UpdateOverflow: Overflow occurred during update.fn deposit(
env: soroban_sdk::Env,
to: soroban_sdk::Address,
) -> Result
Executes a token swap within the Soroswap pair.
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:SoroswapPairError::NotInitializedSoroswapPairError::SwapInsufficientOutputAmountSoroswapPairError::SwapNegativesOutNotSupportedSoroswapPairError::SwapInsufficientLiquiditySoroswapPairError::SwapInvalidToSoroswapPairError::SwapInsufficientInputAmountSoroswapPairError::SwapNegativesInNotSupportedSoroswapPairError::SwapKConstantNotMet: 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<(), SoroswapPairError>
Withdraws liquidity from the Soroswap pair, burning LP tokens and returning the corresponding tokens to the user.
e - The runtime environment.to - The address where the withdrawn tokens will be sent.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), SoroswapPairError>
Skims excess tokens from reserves and sends them to the specified address.
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.
e - The runtime environment.fn sync(env: soroban_sdk::Env)
Returns the current reserves and the last block timestamp.
e - The runtime environment.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.
e - The runtime environment.The value of the last product of reserves (K).
fn k_last(env: soroban_sdk::Env) -> i128