Settlement Execution
Settlement occurs permissionlessly via the IntentSettlerV1’s fill function. It executes as an atomic flash-swap, pulling funds from the owner, invoking the solver’s callback, and guaranteeing the delivery of the required output.
The execution is strictly protected against reentrancy using an EIP-1153 transient storage guard (Reentrancy). This is why the protocol only supports EVM chains capable of transient storage.
Order of Operations
Section titled “Order of Operations”- Validation: The order is checked against
IntentLib.validate. The call reverts immediately if the order has beencancelled, if the current time is beforestartTimeor pastendTime, or if thesolveraddress is zero. - Pricing: The required minimum output is evaluated using
IntentLib.requiredOut(order, block.timestamp). - Pulling Input: Permit2’s
permitWitnessTransferFrompulls exactlyamountInoftokenInfrom theownerto the settler contract itself. This specific step consumes the Permit2 nonce. - Exact Receipt:
_requireExactReceiptverifies that the transfer arrived perfectly. The settler’s balance must have increased by exactlyamountIn, reverting withInexactInputReceivedotherwise. - Flash Callback: The
amountInis flash-transferred directly to thesolver. The settler then callsIIntentFiller(solver).fillIntentCallback(order, required, routerData). - Output Measurement: The settler measures
receivedOutby analyzing its own balance delta. If it received less thanrequired, it reverts withSlippageExceeded. - Delivery: The settler transfers everything received to the order’s
recipient. If the delivered amount is less thanrequired, it reverts withInsufficientRecipientDelivery. If the delivered amount doesn’t perfectly matchreceivedOut, it reverts withInexactOutputDelivered. - Conservation: Finally,
_requireConservedruns on both tokens. The settler contract must end the transaction holding exactly the same token balances it started with, or it reverts withSettlerBalanceChanged.
A recipient of the settler itself always fails
Section titled “A recipient of the settler itself always fails”recipient is whatever the owner signed, and the settler never substitutes its own. One value is
worth naming because it fails in a way that looks surprising: an order whose recipient is the
settler address can never settle. The delivery step measures the recipient’s balance before and
after, and an ERC-20 self-transfer leaves that balance flat, so delivered is 0 and the fill
reverts with InsufficientRecipientDelivery.
Surplus Distribution
Section titled “Surplus Distribution”Surplus belongs to the filler by construction, not by a payout rule.
The solver keeps its margin by never sending it to the settler. The fillIntentCallback is expected to return exactly the requiredOut to the settler and nothing more.
If the solver happens to overpay and returns more than the required floor, the settler transfers that excess entirely to the recipient. The surplus is never refunded to the solver. Refunding it would be an unnecessary round trip returning the solver its own money, introducing complex post-callback token interactions that create ordering hazards. By paying any overpayment directly to the recipient, the invariant is simple: everything that comes in goes to the party the order exists for.