On-chain reference
Public surface of the OptionsMarket proxy and the
PythSettlementOracle contracts. The canonical ABIs are checked
into the repo at contracts/abis/ and republished with every
release; this page is a human-readable index.
Deployment addresses
Published per network in the project README. The OptionsMarket
is deployed behind an ERC1967Proxy; target the proxy address.
The PythSettlementOracle is a separate contract reachable via
OptionsMarket.oracle() at runtime.
OptionsMarket — user functions
| Function | Access | What it does |
|---|---|---|
buy(bytes packed, bytes signature) payable |
msg.sender == buyer |
Open a position against a solver's BuyCommitment. Requires msg.value == openFee. Mints an ERC-1155 position. |
buyback(bytes packed, bytes signature) |
msg.sender == user |
Close (or transfer) a position against a BuybackCommitment. Issuer buyback burns units; non-issuer buyback transfers to the new solver. |
settle(uint256 tokenId, address holder) |
Permissionless | Settle a matured position once the oracle has recorded a price for the maturity hour. Caller earns a settleReward from the bounty pool. |
emergencyCancel(uint256 tokenId, address holder) |
Permissionless | Refund the holder's tracked premium after the grace period if no price has been recorded. Caller earns a settleReward from the bounty pool. |
OptionsMarket — solver functions
| Function | Access | What it does |
|---|---|---|
depositCollateral(uint32 solverId, uint256 amount) |
Permissionless | Add USDC collateral under a solver's account. Anyone can top up on a solver's behalf. |
withdrawCollateral(uint32 solverId, uint256 amount, address to) |
Solver owner | Withdraw free capital. Splits into a fee-free principal portion and a profit portion subject to the 20% protocol fee. |
OptionsMarket — admin functions
All admin functions are gated by onlyAdmin and emit events for transparency.
The admin is initially the deployer and is transferred to a multisig before production.
| Function | What it does |
|---|---|
registerSolver(address signer, address payable owner) | Register a new solver. Returns the assigned solverId. |
pauseSolver(uint32 id) / unpauseSolver(uint32 id) | Toggle a solver's ability to sign new positions. Existing positions resolve normally. |
removeSolver(uint32 id) | Retire a solver permanently; existing positions held to maturity. |
transferAdmin(address newAdmin) | Hand admin rights to a new address. |
proposeOracle(ISettlementOracle newOracle) | Queue an oracle swap, subject to a 2-day timelock. |
cancelPendingOracle() | Abort a queued oracle swap. |
applyPendingOracle() | Activate the queued oracle once the timelock expires. Permissionless. |
setProfitFeeBps(uint16), setEmergencyGracePeriod(uint256), setOpenFee(uint256), setSettleReward(uint256) | Tune the named protocol parameter. |
withdrawTreasury(address to, uint256 amount) | Withdraw accumulated solver-profit fees. |
withdrawBountyPool(address payable to, uint256 amount) | Sweep excess ETH from the bounty pool. Over-sweeping never bricks settlement. |
pause() / unpause() | Halt buy and buyback. settle and emergencyCancel remain open. |
receive() | Anyone may top up the bounty pool by sending ETH directly to the contract. |
OptionsMarket — events
| Event | Emitted on |
|---|---|
PositionBought(buyer, solverId, tokenId, quantity, premium, nonce) | buy. The premium field is the only place to recover what the buyer paid. |
PositionBoughtBack(seller, solverId, tokenId, quantity, amountPaid, isIssuer, nonce) | buyback. |
PositionSettled(tokenId, holder, quantity, userWon, amountPaid) | settle. |
PositionEmergencyCanceled(tokenId, holder, quantity, refund) | emergencyCancel. |
TransferSingle / TransferBatch (ERC-1155) | Every mint, burn, and holder-to-holder transfer. Use these to reconstruct holdings. |
SolverRegistered, SolverPaused, SolverUnpaused, SolverRemoved | Registry mutations. |
CollateralDeposited(solverId, from, amount) | depositCollateral. |
CollateralWithdrawn(solverId, to, toUser, toTreasury, principalConsumed) | withdrawCollateral. |
ParameterUpdated(key, value) | Any of the set* admin functions. |
AdminTransferred(previousAdmin, newAdmin) | transferAdmin. |
OracleProposed(pendingOracle, effectiveAt) / OracleProposalCanceled / OracleUpdated | Oracle-swap lifecycle. |
BountyPoolFunded / BountyPoolWithdrawn / SettleRewardPaid | Bounty-pool flows. |
Paused / Unpaused | pause / unpause. |
OptionsMarket — public state
The contract exposes auto-generated getters for the following storage:
| Variable | Type | Meaning |
|---|---|---|
assetId | bytes32 | Asset identifier (e.g. keccak256("BTC")). |
quoteToken | IERC20 | Premium/collateral denomination (USDC). |
tickSize | uint256 | Per-asset tick (BTC: 100). |
oracle | ISettlementOracle | Active settlement oracle. |
pendingOracle | ISettlementOracle | Queued oracle (during timelock). |
pendingOracleEffectiveAt | uint256 | Activation timestamp for the queued oracle. |
profitFeeBps | uint16 | Solver profit fee in basis points. |
emergencyGracePeriod | uint256 | Seconds after maturity before emergency-cancel is allowed. |
openFee | uint256 | ETH required per buy(). |
settleReward | uint256 | ETH paid to settle / emergencyCancel callers. |
admin | address | Admin (multisig in production). |
accruedFees | uint256 | Solver-profit fees awaiting withdrawal. |
paused | bool | When true, buy/buyback revert. |
solvers(uint32) | SolverInfo | Solver registry. |
nextSolverId | uint32 | Counter for next registration. |
usedNonces(uint32, bytes32) | bool | Per-solver single-use nonce set. |
holderPremium(address, uint256) | uint256 | Premium attached to a holder's units of a token id. |
EIP-712 commitments
Solvers sign BuyCommitment or BuybackCommitment with EIP-712 typed data.
The packed wire form (sent on-chain to save calldata) is decoded back into the canonical struct
before signature verification. Reference codec lives at contracts/src/Commitments.sol.
Domain
{
"name": "OptionsMarket",
"version": "1",
"chainId": <deployment chain>,
"verifyingContract": <market proxy address>
}
Type strings
BuyCommitment(uint32 solverId,address buyer,uint32 lowerBound,uint32 upperBound,uint32 maturityHour,uint256 quantity,uint256 pricePerUnit,uint64 commitmentExpiry,bytes32 nonce)
BuybackCommitment(uint32 solverId,uint256 tokenId,address user,uint256 quantity,uint256 pricePerUnit,uint64 commitmentExpiry,bytes32 nonce)
Packed wire layout — BuyCommitment (140 bytes)
[ 0.. 32) quantity (uint256)
[ 32.. 64) pricePerUnit (uint256)
[ 64.. 96) nonce (bytes32)
[ 96..100) solverId (uint32)
[100..120) buyer (address)
[120..124) lowerBound (uint32)
[124..128) upperBound (uint32)
[128..132) maturityHour (uint32)
[132..140) commitmentExpiry (uint64)
Packed wire layout — BuybackCommitment (160 bytes)
[ 0.. 32) tokenId (uint256)
[ 32.. 64) quantity (uint256)
[ 64.. 96) pricePerUnit (uint256)
[ 96..128) nonce (bytes32)
[128..132) solverId (uint32)
[132..152) user (address)
[152..160) commitmentExpiry (uint64)
PythSettlementOracle
| Function | Access | What it does |
|---|---|---|
recordPrice(uint32 maturityHour, bytes[] updateData) payable |
Permissionless | Submit a Pyth price-update VAA for a maturity hour. msg.value covers Pyth's update fee. First valid recording is final. |
price(uint32 maturityHour) → (uint256 price, uint8 decimals) |
View | Read the recorded price (normalized to 18 decimals). Reverts if not yet recorded. |
Events
| Event | Emitted on |
|---|---|
SettlementPriceRecorded(maturityHour, price, publishTime, recorder) | recordPrice. |