Security
What the app verifies before a transaction reaches your wallet, what the API verifies before it returns a quote, what the contracts guarantee, who controls them, the risks to keep in mind, and what you should check yourself.
Updated · Markdown version
Tirio is non-custodial. A swap is a single transaction from your wallet to the Router, and the Router and the Executor hold no user funds between transactions. An order is the one case where tokens wait on chain: they sit in the Orders contract, under rules its owner cannot change, until the order fills, expires or you cancel it. The checks below make sure every transaction does exactly what the app showed you. Tirio is in public beta.
What the app checks before anything reaches your wallet
The Router and Orders addresses are built into the app as fixed constants: Router, 0x9B1c368F5d33a8D051587c7576b150132680ADC0, and Orders, 0x06360a557290f64aeC55B7a06b788eD8723e71f9, both deployed on BNB Chain only. The app never takes a target address from the API. It compares the addresses the API reports in /health (router, orders) with its own, and if the API ever names a different contract, the app pauses swaps or orders instead of following it.
Every quote the app receives is validated in the browser before it is displayed or sent:
tx.tomust be the Router built into the app.- The quote's
tokenIn,tokenOutandamountInmust equal what you requested. tx.valuemust equal the amount you pay for a native input (the maximum input when you buy an exact amount; the Router refunds the rest) and be zero for an ERC-20 input.minOutmust equalamountOut × (10000 − slippageBps) / 10000(at least one unit) when you sell an exact amount, andamountOutitself when you buy one;maxInmust equal the expected input plus your slippage in buy mode and be absent otherwise. The deadline may be at most an hour ahead.- The calldata must decode as a Router
swap(SwapParams, route, permit)call, and the decodedtokenIn,tokenOut,amountIn(maxInin buy mode),recipient(your connected account),minOutanddeadlinemust match the quote and the request. The calldata must carry exactly the partner and partner fee of the link you opened (otherwise the 3 bps Tirio fee to the Tirio treasury address), the quote'sfeesmust name the same partner and fee and take it from one side of the swap, and the calldata may use only the flags the API uses (0,1,3, plus5and7when a partner is set) and anexpectedOutthat is zero or the quoted output. An offered permit must have its zeroed 65-byte signature slot atsignatureOffset, and the message you would sign is checked field by field: the chain id, the token (or Permit2) as the signing domain, your account as owner, the Router as spender, the paid amount as value and the quote's deadline for an EIP-2612 permit; the Router as spender, the input token, an amount that covers the swap, the quote's deadline and an expiration of at most 31 days for a Permit2PermitSingle. A pure wrap or unwrap must be a one-to-onedeposit()orwithdraw(amount)on the wrapped token.
A quote that fails any of these checks is rejected and never shown as a price.
When you press Swap, the app first runs the exact transaction through eth_call against a public RPC. A revert is decoded into a plain message (for example insufficient output or an expired deadline) and nothing is sent; if the check cannot complete at all, because no RPC answers, the app also stops and reports it as not sent. Only then does the wallet prompt open, with exactly the to, data, value and gas from the quote, and the quote on screen is no longer refreshed while you sign.
By default a token is approved once to Permit2 and every swap after that carries a signature instead of an approval; tokens with EIP-2612 permits need no approval at all. With the Direct setting the Router is approved for the exact amount of each swap, or without limit if you turn on unlimited approval. Wallets connect through EIP-6963 discovery, the Coinbase Wallet SDK or WalletConnect; the app itself sends no telemetry.
What the app checks for orders
Every order placement the API returns is checked in the same way before you can sign it:
tx.tomust be the Orders contract built into the app, andtx.valuemust equal the amount for a native input and be zero otherwise.- The calldata must decode as
place(Place, permit), every field of thePlacestruct must equal the form (tokens, amount, price, bounds, trigger, smallest fill, slices, interval, expiry, first slice, partner, kind and the order book switch), and the calldata must be exactly the canonical encoding of that struct. - An approval may name only Permit2 or the Orders contract. An offered permit must have its zeroed signature slot inside the permit, and its message must name this chain, your token (or Permit2), your account, the Orders contract as spender and an amount that covers the order. Calldata that carries a permit the response does not offer to sign is refused, unless it is an unsigned Permit2 transfer.
- The price you type is converted into the contract's
minOutwith rounding in your favour.
Cancel, cancel all, pause, resume and edit are built by the API and accepted only when their calldata is byte for byte the call the app encodes itself, sent to the Orders contract with no value. A claim is encoded by the app alone. Every order transaction, like every swap, is first simulated with eth_call; a revert is decoded into a plain message (for example "The route paid less than the order's floor") and nothing is sent.
The order forms' warnings fail closed. A limit or stop order waits until the market price for your amount has arrived, and the form warns when a limit price is more than 5 % worse than the market, when a stop price is at or above the market (it would sell at once), when a take-profit price is at or below the market (it would fill at once), or when the market price cannot be read. Each warning has to be accepted with I understand before the order can be placed, and the acceptance covers only that exact order: a new amount, price or warning asks again. While an order is signed or mined, the form and the trade page ignore changes.
What the API checks before it returns a quote
- Fresh state. Routing uses the latest pool state, and state more than a few seconds old is never used. If the API falls behind the chain, quotes pause with a 503 instead of returning stale prices.
- Exact math. Pools are quoted locally with the same math they use on chain; concentrated-liquidity pools are walked tick by tick.
- On-chain simulation. The quote you sign (
/quote) is simulated as the complete transaction witheth_callat the latest block before it is returned. The simulated output and gas replace the estimates, and a route that fails in simulation is never returned. A quote markedsimulated: trueis a route that ran successfully at that block. The indicative price shown while you type (/price) is not simulated. If the simulation cannot run, which is rare, the quote is returned withsimulated: false, the app marks it Not simulated with a warning and still simulates the transaction itself before your wallet opens. - Transfer-tax probing. Tokens are probed for buy and sell taxes, and a detected tax is applied inside the quote. When a tax cannot be measured, the quote says so instead of guessing. Orders refuse taxed tokens and tokens whose tax cannot be measured.
Honest badges
The app shows how a quote was made rather than hiding it: Exact quote when every leg was quoted exactly, Estimated when some legs are estimates, Simulated when the full transaction was simulated on chain or Not simulated when the simulation could not run, plus the remaining validity in seconds. Tax notices name the taxed side and say whether the tax is known. High price impact is called out from 5 % and must be explicitly accepted from 15 %.
What the contracts guarantee
For swaps:
- The Router moves only your
tokenIn, only up to the amount of the swap you sent, and only inside that swap. - The output goes straight to the recipient, or through the Router when you sell an exact amount for a token without transfer tax or the output is the native coin; either way the swap reverts unless the recipient receives at least
minOut. When the output passes through the Router with an expected output, the Router keeps anything above the expected output up to 1 % of it (positive slippage) and forwards the rest. - A transaction sent after its deadline reverts.
- The Executor holds no allowances and ends every swap with a zero balance.
- The Router's protocol fee is 0 today; the app's 3 bps Tirio fee is charged as a partner fee. The contract caps the protocol fee at 100 bps, a partner fee at 1000 bps and the kept positive slippage at 1 % of the expected output. The Router itself is not upgradeable.
For orders:
- Escrow. The Orders contract takes tokens only from the wallet that places an order, and only its amount. Those tokens leave the contract only to fill the order at no less than its net floor, to refund you when you cancel or when it expires, or to pay a balance you claim. Only you can cancel, pause, resume or edit your order.
- Floors. Every fill must give you at least your price after fees, in proportion to the amount filled: the limit price, the stop's worst price, the take-profit price or the DCA price protection. Stop legs and DCA slices are also checked against an independent price reference: a stop fills only once the reference reaches its stop price, and each of their fills must get you within your max deviation of the reference after fees. A fill that pays less reverts.
- Keeper. The keeper's key can only fill orders and signal that it is alive. If it stopped for longer than the grace period (15 minutes at deployment), anyone could fill limit orders and take-profit legs at no less than their floors; stop legs and DCA slices never leave the keeper. If the key were stolen, the worst it could do is fill orders at their floors, including that price check.
- Owner. The owner can set the keeper, the order fee (at most 100 bps, 10 bps at deployment), per-pair fees, the protocol share of partner fees (at most 20 %), the grace period and whether new orders are accepted, and withdraw the fees the contract collected. The owner cannot touch escrowed tokens or claimable balances, change an order, block a cancel or an expiry, or change the contract's code. A fee change can never pay you less than your price, because the floor is net of fees.
- Payouts. A payment that cannot be delivered never blocks a fill, a cancel or an expiry; it is kept for you to claim.
See Contracts for details.
Who controls the contracts
The Router and Orders contracts have an owner with the powers below. None of them reaches the tokens in your wallet or in an open order.
- Router owner: set the protocol fee (
setFeeBps, at most 100 bps), the partner's and Router's shares of partner fees and positive slippage (setShares), fee exemptions (setFeeExempt), the Executor (setExecutor), and withdraw accumulated fees (withdraw). A new Executor still runs only inside swaps users signed, can pull at most each swap's budget, and the Router still enforcesminOutand the deadline. - Orders owner: the powers listed above under For orders.
Check the current values yourself:
cast call 0x9B1c368F5d33a8D051587c7576b150132680ADC0 "owner()(address)" --rpc-url https://bsc-dataseed.bnbchain.org
cast call 0x9B1c368F5d33a8D051587c7576b150132680ADC0 "feeBps()(uint16)" --rpc-url https://bsc-dataseed.bnbchain.org
cast call 0x06360a557290f64aeC55B7a06b788eD8723e71f9 "owner()(address)" --rpc-url https://bsc-dataseed.bnbchain.orgRisks to keep in mind
- Front-running. The slippage setting (0.5 % by default) bounds what a sandwich can take, because the swap reverts below your minimum. A wallet or RPC endpoint with MEV protection can send the transaction privately.
- Positive slippage. On exact-in swaps without transfer tax, an output above the quote is kept by Tirio up to 1 % of the quote; an output below the quote is yours down to the minimum.
- Bad tokens. Tirio can trade any token you paste. Transfer taxes are detected where they can be measured, but a token can still block transfers, change its rules or lose its value.
- Outages. Tirio is in public beta and there is no SLA. When the API cannot serve quotes the app pauses swaps, and when the keeper is down stops and DCA slices wait for it.
- Contract risk. The contracts are covered by fuzz, invariant and mainnet-fork tests, and coverage of the sources is measured before every release. Like any smart contract, they can still contain bugs.
The Risk Disclosure lists these risks in full.
What you should check yourself
- The contract in your wallet prompt. Every Tirio swap targets the Router,
0x9B1c368F5d33a8D051587c7576b150132680ADC0, and every order transaction the Orders contract,0x06360a557290f64aeC55B7a06b788eD8723e71f9, both on BNB Chain. A wrap or unwrap targets the wrapped token instead. Any other target is not Tirio. - The token address, especially for unlisted tokens you pasted. Anyone can deploy a token with any name.
- The approval amount. The default Permit2 approval is unlimited towards Permit2, and each swap then needs your signature; a Permit2 signature grants the Router an allowance for 30 days. A Direct approval covers one swap unless you chose unlimited, which lets the Router move any amount of that token until you revoke it. Revoke by approving zero or with your wallet's allowance tools.
- Minimum received and price impact before you confirm a swap. The minimum is what the contract enforces; the quoted output is what you can expect.
- Your floors before you place an order: the limit price, the stop's worst price and the DCA price protection are what the contract enforces, and the worst case if the market or the keeper misbehaves.
- Slippage. Higher settings accept a worse outcome and leave more room for MEV; taxed tokens usually need 1 % or more.