Buyer purchases a listed domain (ATOMIC) max_price provides slippage protection — reverts if listing price exceeds it
fn buy(
env: soroban_sdk::Env,
buyer: soroban_sdk::Address,
token_id: u32,
max_price: i128,
node: soroban_sdk::BytesN<32>,
) -> Result<(), MarketError>
Seller lists a domain for sale. Approval is handled atomically via Stellar Router SDK on the frontend.
fn list(
env: soroban_sdk::Env,
seller: soroban_sdk::Address,
token_id: u32,
price: i128,
) -> Result<(), MarketError>
Emergency pause — blocks list, buy, update_price, make_offer, accept_offer
fn pause(env: soroban_sdk::Env, admin: soroban_sdk::Address) -> Result<(), MarketError>
Seller removes a listing (always allowed, even when paused)
fn delist(
env: soroban_sdk::Env,
seller: soroban_sdk::Address,
token_id: u32,
) -> Result<(), MarketError>
Resume normal operations
fn unpause(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), MarketError>
Get contract config (admin tooling)
fn get_config(env: soroban_sdk::Env) -> Config
Query all active offers for a specific domain
fn get_offers(env: soroban_sdk::Env, token_id: u32) -> soroban_sdk::Vec
Buyer makes an offer on any domain. XLM is escrowed in the contract.
fn make_offer(
env: soroban_sdk::Env,
offerer: soroban_sdk::Address,
token_id: u32,
amount: i128,
node: soroban_sdk::BytesN<32>,
) -> Result<(), MarketError>
Change the commission fee rate and recipient
fn update_fee(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
fee_bps: u32,
fee_recipient: soroban_sdk::Address,
) -> Result<(), MarketError>
Get a single listing by token ID
fn get_listing(env: soroban_sdk::Env, token_id: u32) -> Option
Keep an escrow-bearing offer alive. No auth — anyone (the backend) may call this to re-extend the Offer entry's TTL (and its OfferIndex entry) back to OFFER_TTL so long-lived escrow never lapses. Reverts if the offer is gone.
fn touch_offer(
env: soroban_sdk::Env,
token_id: u32,
offerer: soroban_sdk::Address,
) -> Result<(), MarketError>
Complete a two-step admin transfer: the pending admin claims the role. Requires the caller's auth and that it matches the stored pending admin.
fn accept_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
) -> Result<(), MarketError>
Seller accepts an offer. NFD approval must be granted beforehand (frontend combines approve+accept via Stellar Router SDK).
fn accept_offer(
env: soroban_sdk::Env,
seller: soroban_sdk::Address,
token_id: u32,
offerer: soroban_sdk::Address,
min_amount: i128,
node: soroban_sdk::BytesN<32>,
) -> Result<(), MarketError>
Buyer cancels their offer and receives full refund (always allowed, even when paused)
fn cancel_offer(
env: soroban_sdk::Env,
offerer: soroban_sdk::Address,
token_id: u32,
) -> Result<(), MarketError>
Admin can force-delist stale listings (always allowed, even when paused)
fn force_delist(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
token_id: u32,
) -> Result<(), MarketError>
Get the configured domain registry, if set. None means the expiry check is currently skipped.
fn get_registry(env: soroban_sdk::Env) -> Option
Point the marketplace at the Soroban Domains V2 registry. Once set, buy,
make_offer, and accept_offer verify the supplied node against the
registry (token_id match + non-expiry). Until set, that check is skipped,
so this upgrade is safe to deploy before the registry is wired up.
fn set_registry(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
registry: soroban_sdk::Address,
) -> Result<(), MarketError>
Begin a two-step admin transfer: store new_admin as the PENDING admin.
The current admin is unchanged until the new key calls accept_admin.
fn update_admin(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
new_admin: soroban_sdk::Address,
) -> Result<(), MarketError>
Seller updates the price of a listing
fn update_price(
env: soroban_sdk::Env,
seller: soroban_sdk::Address,
token_id: u32,
new_price: i128,
) -> Result<(), MarketError>
Apply the staged upgrade. Only succeeds once the timelock has elapsed. Preserves all storage; clears the pending entry.
fn apply_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), MarketError>
Initialize the marketplace contract
fn __constructor(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
nfd_contract: soroban_sdk::Address,
xlm_sac: soroban_sdk::Address,
fee_recipient: soroban_sdk::Address,
fee_bps: u32,
) -> Result<(), MarketError>
Discard a staged upgrade before it is applied.
fn cancel_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
) -> Result<(), MarketError>
Get current fee config
fn get_fee_config(env: soroban_sdk::Env) -> FeeConfig
Stage a WASM upgrade behind the timelock. Records the new hash and the earliest ledger it may be applied (now + UPGRADE_DELAY). Overwrites any previously staged upgrade. The actual swap happens later via apply_upgrade.
fn propose_upgrade(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), MarketError>
Get all active listings
fn get_all_listings(env: soroban_sdk::Env) -> soroban_sdk::Vec<(u32, Listing)>
Get the pending admin (two-step transfer), if one is staged
fn get_pending_admin(env: soroban_sdk::Env) -> Option
Change the minimum listing/offer price
fn update_min_amount(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
min_amount: i128,
) -> Result<(), MarketError>
Admin force-cancels an offer. Refunds XLM to the original offerer (never to admin). Always allowed, even when paused.
fn force_cancel_offer(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
token_id: u32,
offerer: soroban_sdk::Address,
) -> Result<(), MarketError>
Get the staged upgrade, if any: (wasm_hash, earliest-apply ledger)
fn get_pending_upgrade(env: soroban_sdk::Env) -> Option<(soroban_sdk::BytesN<32>, u32)>