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:
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