POST /v1/firm-quote returns an EIP-712 signature and ready-to-send calldata — the partner submits the transaction on-chain themselves. The on-chain commitFirmQuote call is the execution — commit and execute are a single atomic transaction.
Execution flow
1
Approve token spend (one-time per token)
Call
approve() on the input token’s ERC-20 contract, granting the FxEngine contract (see Contract details, or execution.contract from a firm quote) permission to spend the input token. Use type(uint256).max for a one-time unlimited approval. Approve before requesting the firm quote you will execute — firm quotes expire after 60 seconds.2
Get a firm quote (off-chain)
Call
POST /v1/firm-quote → receive quote, backend_signature, and execution (contract address + calldata).3
Submit on-chain transaction
Send a transaction to
execution.contract with execution.calldata. No manual struct assembly or signing required — the calldata encodes everything.4
Contract validates and settles
The FxEngine contract verifies Ratio’s backend signature, checks expiry and nonce, validates amounts, and performs the atomic swap in that same transaction.
5
Verify settlement
Call
GET /v1/executions?quote=0x{quote_id} (or ?tx=0x{tx_hash}) to confirm settlement. Returns 404 if not yet indexed — retry after a few seconds.On-chain execution
The partner sends the transaction using the values from the firm quote response:On-chain enforcement
The FxEngine contract enforces the following:msg.sendermust equalquote.partner— the partner is the caller, no separate executor- The signature must recover to an authorised
swapSignerinRatioConfig - Replay protection via
signerNoncesUsed[signer][quote.nonce]— eachquoteIdcan only be committed once block.timestamp <= quote.expiresAt- The quote’s risk state must not be
HALT - The quoted prices must be fresh and within the corridor’s allowed deviation from Orakl Network price feeds on Kaia
- The corridor must be enabled and
amountIn(in USD) must be within the corridor’s min/max fixFee + variableFee < amountInandspreadFee < amountOut