Runtime behavior
RialtoRouter settles a winning leg by calling swapExactIn through a generic RawCall action:- Input delivery. For ERC20 input, the router approves your contract for exactly
amountIn immediately before the call, so you pull it with
transferFrom(router, you, amountIn). The router revokes the approval to 0 right
after. For native-ETH input, the router calls
swapExactIn{value: amountIn}, so the function is payable. - Honor the amountIn parameter. It is the authoritative input amount for this fill. Pull and price against exactly the amountIn passed in; do not assume a fixed or pre-agreed size.
- Output delivery. Send the output token to to, which is the RialtoRouter address. The router measures its own balance delta of the output token and requires received >= amountOutMin, reverting the whole swap otherwise.
- deadline. Unix seconds. Enforcing it on your side is optional, since Rialto already bounds the swap’s validity window. Treat 0 as no deadline.
- Refunds. If you pull less than amountIn, the router refunds the unspent input, but the cleanest contract pulls and uses exactly amountIn.
Parameters
| Param | Type | Meaning |
|---|---|---|
| zeroForOne | bool | Same convention as the quote. |
| amountIn | uint256 | Exact input to pull, router-supplied and authoritative. |
| amountOutMin | uint256 | Revert if you cannot deliver at least this. |
| to | address | Recipient of the output, always the RialtoRouter. |
| deadline | uint256 | Unix-seconds expiry. |
| returns | uint256 | Actual output delivered. |
