Contract 760468d232013dde9bbc9b98ce0b29b3dfcb4546e34081dda9d9e0947c1eef67

← Back to Index 📥 Download WASM

Meta

cliver 23.4.0#
rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.91.1

Instances

  • CAOEEGRZDOO4FBKBX3ARAKXTS7AQYMTI2AV2IDAV4AJHKQDVIBZSCILX
  • CBG4SUYFTQTGOX4FFOK77M3AVLFVVFL2N7CDVOVVOKA5UW2Q56VPOHJI
  • CDRGT7NMI3OB7QDG5MA5ZOP52WESEQK475OJDYYKFOPLRA7WIQ5IP6U5

Interface

Pause Contract Operations

Description:

Emergency function to pause all order creation and settlements.

Authorization:

  • admin: Must authorize the pause

Events:

  • ("Paused",) when contract is paused

Note:

  • Prevents new order creation
  • Existing orders can still be settled/refunded
fn pause(env: soroban_sdk::Env) -> Result<(), ContractError>

Unpause Contract Operations

Description:

Resumes normal contract operations after a pause.

Authorization:

  • admin: Must authorize the unpause

Events:

  • ("Unpaused",) when contract is unpaused
fn unpause(env: soroban_sdk::Env) -> Result<(), ContractError>

Check if Contract is Paused

Returns:

  • true if contract operations are paused
  • false if contract is operational
fn is_paused(env: soroban_sdk::Env) -> bool

Initialize Settings Contract

Description:

Sets up initial protocol configuration with admin, treasury, and relayer addresses.

Default Configuration:

  • Protocol fee: 1% (1000 basis points)
  • Max BPS: 100,000 (100%)
  • Paused: false

Authorization:

  • admin: Must authorize initialization

Parameters:

  • treasury: Address to receive protocol fees
  • relayer_address: Authorized address for settlement operations
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    treasury: soroban_sdk::Address,
    relayer_address: soroban_sdk::Address,
)

Get Current Fee Details

Returns:

  • Tuple of (protocol_fee_percent, max_bps)
  • Default: (1000, 100000) = 1% fee
fn get_fee_details(env: soroban_sdk::Env) -> (i64, i64)

Check if Token is Supported

Description:

Currently hardcoded to only support USDC. Can be extended for multi-token support.

Returns:

  • true if token is supported for orders
  • false if token is not supported
fn is_token_supported(env: soroban_sdk::Env, token: soroban_sdk::Address) -> bool

Upgrade Settings Manager WASM

Description:

Updates the settings manager contract's WASM code.

Authorization:

  • admin: Must authorize the upgrade

Note:

  • Maintains all existing settings and state
  • Only admin can perform upgrades
fn upgrade_lp_manager(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Get Relayer Address

Returns:

  • Current relayer address authorized for settlements
fn get_relayer_address(env: soroban_sdk::Env) -> soroban_sdk::Address

Update Protocol Fee Percentage

Description:

Changes the protocol fee percentage applied to all orders.

Authorization:

  • admin: Must authorize the change

Validation:

  • Fee must be between 0 and 100,000 basis points (0% to 100%)

Events:

  • ("ProtocolFeeUpdated",) with new fee percentage

Parameters:

  • protocol_fee_percent: New fee in basis points (e.g., 1000 = 1%)
fn update_protocol_fee(
    env: soroban_sdk::Env,
    protocol_fee_percent: i64,
) -> Result<(), ContractError>

Get Treasury Address

Returns:

  • Current treasury address for fee collection
fn get_treasury_address(env: soroban_sdk::Env) -> soroban_sdk::Address

Update Protocol Addresses

Description:

Updates treasury or relayer addresses with proper validation.

Authorization:

  • admin: Must authorize the change

Parameters:

  • what: Type of address to update (Treasury or Aggregator/Relayer)
  • value: New address value
fn update_protocol_address(
    env: soroban_sdk::Env,
    what: ProtocolAddressType,
    value: soroban_sdk::Address,
) -> Result<(), ContractError>

Imports

WebAssembly Text (WAT) ▶