Skip to main content

Contracts

Two Soroban contracts make up the protocol. Source: blockfinax-stellar/contracts.

Currency pool​

CAEKJTUSZIWY5OMK6EVOSNPMEULI3MDO3BLP6Y5OKPHRNKM6KTH5YURM

Holds every pool, every underwriter balance and every protection position.

AreaWhat it does
Poolscreate_pool, tenors, structures, sale settings, creator earnings
Underwriter accountsPer pool and address: free, reserved, earned, paid, pending_withdraw, backing, max_tenor_days. At most 50 per pool.
Purchasesbuy_protection verifies an ed25519 quote signature, checks terms, selects backers, reserves, distributes the premium, records the position and its funders
Settlementsettle_position reads the oracle's agreed rate, computes the payout, charges funders pro rata, releases reserves
Payoutsclaim_payout pays the hedger less the payout fee
Withdrawalsrequest_withdrawal, cancel_withdrawal, execute_withdrawal on free money
Adminupgrade, set_paused, set_fees, set_pricing_key, set_pair, withdraw_treasury_fees, two-step ownership

Full list: Currency pool contract.

Pool oracle​

CBOXFJTK5DGVKOEMEYMHMLYKXUHL2ZETWZY3HEF3FO7PO3GD42YH4G5Q

Collects operator rates per position and records one agreed rate. Quorum at least 2, tolerance at most 1% for pools to accept it, freshness 900 s, per-operator cooldown 300 s. Agreement is the average of fresh submissions; any spread over tolerance clears the round.

See Oracle contract.

Deposit contracts (EVM funding networks)​

Source: BlockFinaXcode/contracts/evm/StellarDeposit.sol. Base Sepolia: factory 0x05672D3bD02b1ebBFA6F4f5C104A7f2b7d0a2291, implementation 0x937a715805Bd525CBBF2817f5Eb184a322D7016c.

ContractWhat it does
StellarDepositFactoryHolds the configuration (USDC, TokenMessengerV2, Circle's Stellar CctpForwarder, Stellar domain 27, minimum, fee cap) as immutables. Computes and creates each user's deposit address; flush creates it if needed and forwards its USDC. No owner.
StellarDepositThe logic each deposit address runs (an EIP-1167 clone). Initialised once, by the factory, with the user's Stellar wallet. flush burns its whole USDC balance through CCTP to that wallet.

See Deposit contracts.

Storage​

Soroban storageHolds
InstanceConfiguration: owner, token, oracle, pricing key, fee rates, creation fee, treasury fees, counters
PersistentPools, positions, underwriter accounts, funders per position, withdrawals, enabled pairs
TemporaryUsed quote nonces (they only need to outlive the 120 s quote window)

Persistent entries have their time-to-live extended on use; maintain_storage extends it for a pool's positions in bulk.

Invariants​

  • pool.reserved equals the sum of active positions' max_payout, and of underwriters' reserved.
  • Every position's max_payout equals the sum of its funders' reserve.
  • A payout never exceeds the position's max_payout.
  • An underwriter's free balance is never charged for a payout.