Contract 5fb4102e0e08593eb91c7c6139efb0bdbc8302ab3012f253d06c39168773bae8

← Back to Index 📥 Download WASM

Meta

cliver 23.4.1#a152ec2488c25136808ad28277c24b3a0765ffd4
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.92.0

Instances

  • CAFTDA2AO6GSKMB4CGN5H3BPFEBPDG7YRJQEVHPQGGFIPJFRKZUQADSH

Interface

Update the fee in basis points (admin only). Max 10 000 (= 100%).

fn set_fee(env: soroban_sdk::Env, fee_bps: u32) -> Result<(), RampitError>

Return the admin address.

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

Return the full Order struct for the given id (or error).

TTL note: Read-only queries intentionally do not bump the persistent entry's TTL. If the order is near expiry in ledger storage, a write operation (release / refund / cancel) will bump it. Frontends that need guaranteed availability should call a write path or use extend_ttl via a separate admin utility.

fn get_order(
    env: soroban_sdk::Env,
    order_id: soroban_sdk::Bytes,
) -> Result

Transfer admin role to a new address. Only the current admin can call this. Critical for key rotation if the admin key is compromised.

fn set_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
) -> Result<(), RampitError>

One-time setup. Sets admin, relayer and fee (in basis points). Must be called before any other function.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    relayer: soroban_sdk::Address,
    fee_bps: u32,
) -> Result<(), RampitError>

Return the current fee in basis points.

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

Return the current relayer address.

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

Replace the relayer address (admin only).

fn set_relayer(
    env: soroban_sdk::Env,
    new_relayer: soroban_sdk::Address,
) -> Result<(), RampitError>

Cancel a pending order before it expires. Only the order's user may cancel. Auth is checked first so that unauthenticated callers cannot probe order state.

fn cancel_order(
    env: soroban_sdk::Env,
    order_id: soroban_sdk::Bytes,
) -> Result<(), RampitError>

Withdraw accumulated platform fees for a given token to the admin address.

fn collect_fees(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
) -> Result<(), RampitError>

Lock tokens from the user into the escrow contract and create a new order with Pending status.

fn create_order(
    env: soroban_sdk::Env,
    order_id: soroban_sdk::Bytes,
    user: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
    rate: i128,
    expiry: u64,
    direction: Direction,
) -> Result<(), RampitError>

Return the full escrowed amount to the user.

Authorization rules:

  • The relayer may refund at any time.
  • The user may self-refund only after the order has expired.

A caller parameter is required because Soroban has no implicit msg.sender; we verify caller.require_auth() and then check whether the caller is the relayer or the order's user.

fn refund_order(
    env: soroban_sdk::Env,
    order_id: soroban_sdk::Bytes,
    caller: soroban_sdk::Address,
) -> Result<(), RampitError>

Called by the relayer once fiat payment is confirmed. Deducts the platform fee, sends the net amount to the user, and marks the order Released.

fn release_order(
    env: soroban_sdk::Env,
    order_id: soroban_sdk::Bytes,
) -> Result<(), RampitError>

Return the accumulated (uncollected) fee balance for a token.

fn get_accumulated_fees(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128

Imports

WebAssembly Text (WAT) ▶