Returns the whole remaining escrow to the maker, on the maker's own authorization, at any time.
fn cancel(env: soroban_sdk::Env, id: u64) -> i128
Fills take_amount of the sell asset, returning what the taker paid.
The taker names the delivery, not the payment, because the delivery is the
escrowed quantity: it makes remaining_sell the single decrementing
counter and drains escrow to exactly zero on a full fill, leaving no dust
sweep and no unclaimable sliver.
State is written before any external call. The buy leg's delta is checked
because the maker cannot inspect it and cannot walk away once filled; the
commission leg's is not, because a lying token costs only the recipient,
whom the maker chose. A maker payout that nets to zero is skipped rather
than refused — panicking there would strand the very dust tail the
min_fill waiver exists to keep takeable.
fn settle(
env: soroban_sdk::Env,
taker: soroban_sdk::Address,
id: u64,
take_amount: i128,
) -> i128
Returns an expired Swap's remaining escrow to the maker. Permissionless: the funds can only ever reach the maker, so triggering it grants a third party no power they did not already have, and it means an abandoned Swap does not depend on its maker still being around.
fn reclaim(env: soroban_sdk::Env, id: u64) -> i128
fn get_swap(env: soroban_sdk::Env, id: u64) -> SwapView
Sets the administrator, whose only power is the creation kill-switch. It can never touch escrow, block a settle, cancel a Swap, or upgrade the contract — an open Swap stays settleable no matter what the admin does.
Requiring the admin's own authorization stops an address being named administrator without its consent.
fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)
Escrows terms.sell_amount and opens a Swap, returning its id.
Validation runs before any transfer, and the escrow pull is bracketed by a balance read that panics on a short delta. A fee-skimming sell token is therefore not escrowable at all, which is the right outcome twice over: the taker's guarantee stays exact, and so does the pro-rata denominator every later fill divides by.
fee_amount is Bitbond's service fee, charged once here and unrelated to
terms.commission, which is the maker's own brokerage on each settle. The
fee moves before the escrow so a failed fee cannot leave funds locked.
fn create_swap(
env: soroban_sdk::Env,
maker: soroban_sdk::Address,
terms: SwapTerms,
fee_token: soroban_sdk::Address,
fee_recipient: soroban_sdk::Address,
fee_amount: i128,
) -> u64
fn get_maker_index(
env: soroban_sdk::Env,
maker: soroban_sdk::Address,
page: u32,
) -> IndexPage
fn get_taker_index(
env: soroban_sdk::Env,
taker: soroban_sdk::Address,
page: u32,
) -> IndexPage
fn get_swaps_by_maker(
env: soroban_sdk::Env,
maker: soroban_sdk::Address,
page: u32,
) -> SwapPage
fn get_swaps_by_taker(
env: soroban_sdk::Env,
taker: soroban_sdk::Address,
page: u32,
) -> SwapPage
fn is_creation_paused(env: soroban_sdk::Env) -> bool
The kill-switch. Stops new Swaps only — every existing one stays settleable, cancelable and reclaimable, so pausing can never trap escrow.
fn set_creation_paused(env: soroban_sdk::Env, paused: bool)