Contract cc277ada4bb379d8e822dab0186f5f3f8baebbbc23364d369297de0508a26813

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.91.0-nightly

Instances

  • CABBLSQONKYI6DKJEBZCTCZ6EFZO6ZRKFH5BPYT3LCKWIOMLW32CCARP
  • CBUU4MUZHWPCRLSPHHYN5YLNMEX67EYSFBN5GQJ4VVTKMFUBNS6YZAV4

Interface

Reentrancy guard exit: clears the temporary flag.

fn exit_reentrancy(env: soroban_sdk::Env)

Initializes the Factory contract with admin, WASM hash for deployment, and fee configuration.

Parameters

  • admin: The address of the factory admin who can manage settings
  • wasm_hash: Hash of the Lobster contract WASM for deterministic deployment
  • fee_bps: Default fee percentage in basis points (0-10000, where 10000 = 100%)

Panics

  • If contract is already initialized
  • If fee_bps exceeds 10000
fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    wasm_hash: soroban_sdk::BytesN<32>,
    fee_bps: u32,
)

Creates a new Lobster pool for a user with the specified token pair. Deploys a new Lobster contract instance deterministically and registers it.

Parameters

  • user: Address of the user who will own the pool
  • token0: Address of the first token in the pair
  • token1: Address of the second token in the pair

Returns

The address of the newly deployed Lobster contract

Panics

  • If contract is not initialized
  • If token0 and token1 are the same
  • If a pool already exists for this user and token pair
  • If reentrancy is detected
fn create_pool(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token0: soroban_sdk::Address,
    token1: soroban_sdk::Address,
) -> soroban_sdk::Address

Returns the address of the factory admin.

Returns

The admin address stored during initialization

Panics

If contract is not initialized

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

Returns the WASM hash used for deploying new Lobster contracts.

Returns

The WASM hash (32 bytes) stored during initialization, or zero hash if not set

fn get_wasm_hash(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>

Returns the total number of pools created by this factory.

Returns

Total count of pools created (starts at 0)

fn get_pool_count(env: soroban_sdk::Env) -> u64

Retrieves pool information by its sequential ID.

Parameters

  • id: Sequential pool ID (1-indexed)

Returns

Some(LobsterPools) if pool exists, None otherwise

fn get_pool_by_id(env: soroban_sdk::Env, id: u64) -> Option

Retrieves pool information by the Lobster contract address.

Parameters

  • addr: Address of the Lobster contract

Returns

Some(LobsterPools) if pool exists, None otherwise

fn get_pool_by_address(
    env: soroban_sdk::Env,
    addr: soroban_sdk::Address,
) -> Option

Retrieves all pools owned by a specific user.

Parameters

  • user: Address of the user/owner

Returns

Vector of all LobsterPools owned by the user (empty if none)

fn get_pools_by_user(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
) -> soroban_sdk::Vec

Retrieves all pools for a specific token pair. Checks both (token0, token1) and (token1, token0) orderings.

Parameters

  • token0: Address of the first token
  • token1: Address of the second token

Returns

Vector of all LobsterPools for this token pair (empty if none)

fn get_pools_by_tokens(
    env: soroban_sdk::Env,
    token0: soroban_sdk::Address,
    token1: soroban_sdk::Address,
) -> soroban_sdk::Vec

Updates the factory admin address.

Parameters

  • new_admin: New admin address to set

Access

Only current admin

Panics

  • If contract is not initialized
  • If caller is not the current admin
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Updates the WASM hash used for deploying new Lobster contracts.

Parameters

  • wasm_hash: New WASM hash (32 bytes) to use for deployments

Access

Only admin

Panics

  • If contract is not initialized
  • If caller is not the admin
fn set_wasm_hash(env: soroban_sdk::Env, wasm_hash: soroban_sdk::BytesN<32>)

Announces a fee change, starting a 2-week delay period before execution. This provides transparency and allows users to prepare for fee changes.

Parameters

  • new_fee_bps: New fee value in basis points (0-10000, where 10000 = 100%)

Access

Only admin

Panics

  • If contract is not initialized
  • If caller is not the admin
  • If new_fee_bps exceeds 10000
  • If a fee change is already pending
fn announce_fee_change(env: soroban_sdk::Env, new_fee_bps: u32)

Executes the previously announced fee change after the 2-week delay period. Updates the fee and clears the pending change.

Access

Only admin

Panics

  • If contract is not initialized
  • If caller is not the admin
  • If no fee change has been announced
  • If the delay period has not yet passed
fn execute_fee_change(env: soroban_sdk::Env)

Imports

WebAssembly Text (WAT) ▶