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.
admin: The address of the factory admin who can manage settingswasm_hash: Hash of the Lobster contract WASM for deterministic deploymentfee_bps: Default fee percentage in basis points (0-10000, where 10000 = 100%)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.
user: Address of the user who will own the pooltoken0: Address of the first token in the pairtoken1: Address of the second token in the pairThe address of the newly deployed Lobster contract
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.
The admin address stored during initialization
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.
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.
Total count of pools created (starts at 0)
fn get_pool_count(env: soroban_sdk::Env) -> u64
Retrieves pool information by its sequential ID.
id: Sequential pool ID (1-indexed)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.
addr: Address of the Lobster contractSome(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.
user: Address of the user/ownerVector 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.
token0: Address of the first tokentoken1: Address of the second tokenVector 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.
new_admin: New admin address to setOnly current admin
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Updates the WASM hash used for deploying new Lobster contracts.
wasm_hash: New WASM hash (32 bytes) to use for deploymentsOnly 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.
new_fee_bps: New fee value in basis points (0-10000, where 10000 = 100%)Only admin
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.
Only admin
fn execute_fee_change(env: soroban_sdk::Env)