Contract 5db738b05d9148128a240b0e2c1cb935c2805192bf98a579421aacda364c8dae

← Back to Index 📥 Download WASM

Meta

rssdkver 20.2.0#6e198b79a51c48ccc8f22b02dcc4046d8cb7a887
rsver 1.75.0

Instances

  • CA4HEQTL2WPEUYKYKCDOHCDNIV4QHNJ7EL4J4NQ6VADP7SYHVRYZ7AW2
  • CC3XSQU7A3PRR6FO6YIKUMU7TO6FHU7LCJ7DOWA7MMOONZMHDHCHZCKW
  • CCDATRT2EY6Y2KAZ7HM7BRZVZCB6RHL56PQUBWGBS2ML2JAK7VXFLCJY
  • CCIQM2O3YJQEKS7I77AS5IO3CU6UCBAUWHLWRBWVV336ZCSTKRNBKPHW
  • CDBRTEJMOUJQHFZCAW4JPXZ75HCRHZAQXG75ZMGQ2LMNXA5ID7RQIFSX

Interface

Returns the recipient of the fee.

Arguments

  • e - An instance of the Env struct.

Errors

Returns an error if the Factory is not yet initialized.

fn fee_to(env: soroban_sdk::Env) -> Result

Returns the address allowed to change the fee recipient.

Arguments

  • e - An instance of the Env struct.

Errors

Returns an error if the Factory is not yet initialized.

fn fee_to_setter(env: soroban_sdk::Env) -> Result

Checks if fees are enabled.

Arguments

  • e - An instance of the Env struct.

Errors

Returns an error if the Factory is not yet initialized.

fn fees_enabled(env: soroban_sdk::Env) -> Result

Returns the total number of pairs created through the factory so far.

Arguments

  • e - An instance of the Env struct.

Errors

Returns an error if the Factory is not yet initialized.

fn all_pairs_length(env: soroban_sdk::Env) -> Result

Returns the address of the pair for token_a and token_b, if it has been created.

Arguments

  • e - An instance of the Env struct.
  • token_a - The address of the first token in the pair.
  • token_b - The address of the second token in the pair.

Errors

Returns an error if the Factory is not yet initialized or if the pair does not exist

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

Returns the address of the nth pair (0-indexed) created through the factory, or address(0) if not enough pairs have been created yet.

Arguments

  • e - An instance of the Env struct.
  • n - The index of the pair to retrieve.

Errors

Returns an error if the Factory is not yet initialized or if index n does not exist.

fn all_pairs(
    env: soroban_sdk::Env,
    n: u32,
) -> Result

Checks if a pair exists for the given token_a and token_b.

Arguments

  • e - An instance of the Env struct.
  • token_a - The address of the first token in the pair.
  • token_b - The address of the second token in the pair.

Errors

Returns an error if the Factory is not yet initialized.

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

Sets the fee_to_setter address and initializes the factory.

Arguments

  • e - An instance of the Env struct.
  • setter - The address to set as the current fee_to_setter.
  • pair_wasm_hash - The Wasm hash of the pair.

Errors

Returns an error if the Factory is already initialized.

fn initialize(
    env: soroban_sdk::Env,
    setter: soroban_sdk::Address,
    pair_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), FactoryError>

Sets the fee_to address.

Arguments

  • e - An instance of the Env struct.
  • to - The address to set as the fee_to.

Errors

Returns an error if the Factory is not yet initialized or if the caller is not the current fee_to_setter.

fn set_fee_to(
    env: soroban_sdk::Env,
    to: soroban_sdk::Address,
) -> Result<(), FactoryError>

Sets the fee_to_setter address.

Arguments

  • e - An instance of the Env struct.
  • new_setter - The address to set as the new fee_to_setter.

Errors

Returns an error if the Factory is not yet initialized or if the caller is not the existing fee_to_setter.

fn set_fee_to_setter(
    env: soroban_sdk::Env,
    new_setter: soroban_sdk::Address,
) -> Result<(), FactoryError>

Sets whether fees are enabled or disabled.

Arguments

  • e - An instance of the Env struct.
  • is_enabled - A boolean indicating whether fees are enabled or disabled.

Errors

Returns an error if the Factory is not yet initialized or if the caller is not the current fee_to_setter.

fn set_fees_enabled(
    env: soroban_sdk::Env,
    is_enabled: bool,
) -> Result<(), FactoryError>

Creates a pair for token_a and token_b if one doesn't exist already.

Arguments

  • e - An instance of the Env struct.
  • token_a - The address of the first token in the pair.
  • token_b - The address of the second token in the pair.

Errors

Returns an error if the pair is not yet initialized, if token_a and token_b have identical addresses, or if the pair already exists between token_a and token_b.

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

Imports

WebAssembly Text (WAT) ▶