settle.sauce.ts is a standalone, reusable program that ships in @eco-incorp/sauce and is exported as settleSource() from /recipes and as the raw file at @eco-incorp/sauce/recipes/settle.sauce.ts. It sweeps the Pot’s current balance of every listed token to one recipient, enforcing a minimum-output floor on tokens[0] before anything moves. The three values arrive as ABI-encoded runtime entry arguments appended after the program, so one compiled blob serves every token list, floor and recipient, which is what lets the /verify surface pin a single program hash.
Prerequisites
Complete Sauce setup and use the documented SDK and compiler versions. For execution, confirm the target deployment, Pot ownership, balances and Kitchen fee. Simulate the complete transaction and estimate its gas before submitting it. Save IERC20.json in anartifacts directory beside the source. Supply a nonempty tokens array; the program reads tokens[0] even when minOut is zero.
EVM program
settle.sauce.ts
- Composing after another program. A
V12Pot.cookruns exactly one program, so “do the thing, then sweep” is two top-levelcook()calls joined by an owner-authorised multicall in one transaction. The multicall contract must be the Pot’sownerand must propagate a reverting call’s revert data. It must never be a permissionless batcher: owning the batcher is owning the Pot. - The compiled program is a function of the file and the compiler pin only, never of the arguments. Keep
tokens,minOutandrecipientas parameters; moving any of them to a compile-timedefinewould fold it into the program and break the pinned-hash design. tokens[0]is the floor token by position.minOutis enforced against its balance before any transfer runs, and it is swept first with no external call between the check and the transfer, so the amount checked is the amount transferred.- Known and accepted property. The floor and the sweep read the Pot’s current balance, not a delta against a baseline; a pre-existing balance counts toward
minOutand rides to the recipient. The Pot ending clean is the point.
SVM twin
The SVM version is generated bysvmSettleSource(escrowCount) exported from @eco-incorp/sauce/svm rather than hand-written: on Solana a token account must be attached to the instruction and addressed by a literal account index, so the escrow count is a compile-time property and the sweeps are unrolled. SETTLE_MIN_OUT and SETTLE_SPL_COUNT arrive as compile-time defines. Balances are read from the escrow account’s data and moved with an SPL Token TransferChecked CPI, which works for classic SPL and Token-2022 mints; transfer-hook mints are out of scope.
settle.svm.sauce.ts
svmSettleSource(n) with the options in the package and byte-compare against what you were handed. There is no golden hash for the SVM program.
Troubleshooting
A minimum-output failure comparesminOut with the Pot’s entire balance of tokens[0], including any existing funds. Check token ordering and smallest-unit amounts. For Solana, check each escrow, mint, destination and authority against the generated manifest.
Next steps
settleSource, SETTLE_SOURCE_PATH, SAUCE_BASE_DIRS, and the svm subpath.