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.
| Area | What it does |
|---|---|
| Pools | create_pool, tenors, structures, sale settings, creator earnings |
| Underwriter accounts | Per pool and address: free, reserved, earned, paid, pending_withdraw, backing, max_tenor_days. At most 50 per pool. |
| Purchases | buy_protection verifies an ed25519 quote signature, checks terms, selects backers, reserves, distributes the premium, records the position and its funders |
| Settlement | settle_position reads the oracle's agreed rate, computes the payout, charges funders pro rata, releases reserves |
| Payouts | claim_payout pays the hedger less the payout fee |
| Withdrawals | request_withdrawal, cancel_withdrawal, execute_withdrawal on free money |
| Admin | upgrade, 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.
| Contract | What it does |
|---|---|
StellarDepositFactory | Holds 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. |
StellarDeposit | The 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 storage | Holds |
|---|---|
| Instance | Configuration: owner, token, oracle, pricing key, fee rates, creation fee, treasury fees, counters |
| Persistent | Pools, positions, underwriter accounts, funders per position, withdrawals, enabled pairs |
| Temporary | Used 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.reservedequals the sum of active positions'max_payout, and of underwriters'reserved.- Every position's
max_payoutequals 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.