Find something... ⌘K

Maxy architecture / Smart contracts

Contract architecture

The contracts behind a Maxy swap, what each enforces, and who can change them. It is for security reviewers and teams that read the chain themselves. Addresses: Contracts.

ContractWhereEnforces
Settler (BitcoinIntentSettler)One per EVM chain: Base, Arbitrum, BNB Chain, Avalanche, Robinhood ChainHolds every escrow. Pays it out only against a verified Bitcoin payment, or back after a deadline
VerifierOne per EVM chain, read by that chain's settlerTracks Bitcoin's header chain and checks payment proofs against it
Permit2The same address on every chainMoves USDC on the gasless route, only as the user's signed witness allows
Solana settlement programSolanaHolds SOL escrows, with its own Bitcoin node

The settler

The user signs an intent, an EIP-712 message on the domain BitcoinIntentSettler, version 6, for that chain and that settler. Its hash is the order id, on chain and in the API. The settler enforces:

  • The intent. Only the paying wallet (maker) can authorise an escrow, by signing the intent. The wallet, a solver on the gasless route or a contract caller can then open it, and each nonce is used once.
  • The price band. When a solver commits, anything escrowed above the settlement amount goes straight back to the user.
  • The commit deadline. A solver can commit only within 2 hours of the quote, and posts a bond when it does, 1% by default.
  • Four exits. An escrow leaves only by these:
ExitToWhenFunction
Settlethe solverit proves it paid the BTC to the signed script, with the required confirmationsfillIntentWithFeeToken
Cancelthe userno solver committed: the user any time, anyone after the escrow deadlinecancelBuyEscrow, cancelNativeBuyEscrow
Slashthe user, plus the bonda solver committed and did not prove payment within the order's settlementTimeoutBlocks: 36 Bitcoin blocks, about 6 hours, on API ordersslashExpired
Refundthe userthe Bitcoin deadline passed and there was no bondrefundExpired

Once their deadline has passed, cancel, slash and refund are open calls with no caller check: anyone may send them, and the coins go only to the user. A third party that sends a slash earns half the solver's bond, and a user who sends it keeps the whole bond. Pausing the settler never blocks them, so no escrow can be trapped. Who sends them in practice: Refunds.

Each route on chain

RouteThe escrow is opened byIt is released by
evm-btc-escrowThe user's wallet, with openNativeBuyIntent carrying the ETH, BNB or AVAXThe solver's proof of its BTC payment
evm-btc-gaslessThe solver: Permit2 moves the user's USDC under the signed witness, and the solver pays the gasThe solver's proof of its BTC payment
btc-evmThe solver, locking the user's payout before any Bitcoin address is givenA proof of the user's BTC payment, which anyone may send, paying the user. Unpaid, it returns to the solver after the deadline
sol-btc, btc-solThe Solana program, holding the user's or the solver's SOLA payment proof checked by the program's Bitcoin node

A contract can open an escrow for a user: see Opening an escrow from a contract.

The verifier

The verifier is an on-chain Bitcoin node: a contract that validates and stores Bitcoin's block headers and checks payment proofs against them, for an output paying scriptHash, the script the user signed for: Bitcoin verification.

Who can change what

ContractUpgradeableHow
SettlerYes: an EIP-1967 transparent proxyUpgrades go through a 48-hour timelock on all five chains
Settler settings—A governance role can allow or remove bond tokens and settlement assets; changes to the bond split are timelocked 72 hours
Settler pause—A pauser role can stop new escrows and commits. Pausing never blocks cancel, settle, slash or refund
VerifierNo: not a proxyAn admin can set the minimum confirmations (1 on every chain) and its settings
Solana settlement programNo: immutableThe upgrade authority is revoked. Governance roles are held by three multisigs

No one can replace the settler's code in a hurry. Every upgrade passes through a 48-hour timelock on all five chains, so partners and users always have two days to review a change before it can take effect. Pausing the settler never blocks a cancel, a slash or a refund, so no escrow can be trapped. Every timelock and role, with addresses and a check: Upgrades and roles.

Maxy cannot move an escrow except by the four exits, sign for the user, or change what the user signed.