Where to start
Before you use an example
Install the Sauce SDK tools, then follow the selected example’s prerequisites. You can also connect a coding agent to help adapt and simulate a program. An example runs on one chain through your Pot. Token and protocol names resolve for that chain at compile time; the example lists its target chains. An unhandled failure reverts the cook’s state changes. On EVM chains, a program can also catch a failed attempt and continue, as the fallback swap shows. When you adapt an example:- Supply
main’s parameters in the documented order. Token amounts use the token’s smallest unit:1000000is 1 USDC. - Distinguish simulated balances from real funds.
--assume-balanceaffects only the simulation; on EVM chains,--fundpulls tokens from your wallet into the Pot during the cook, subject to the required approval. - Set recipients, price limits and minimum outputs for your use case. Sample prices are not current quotes.
- Check the chain and deployment references before sending. Compilation and a local simulation do not establish live deployment availability.
Payments
Pay USDC
Pay one recipient and verify the USDC received. Base, Ethereum, Arc.
Pay a list
Pay a list of recipients while keeping total payments within a cap. Base.
Payroll by weight
Split a USDC budget by weight and send the rounding remainder to the last recipient. Base, Ethereum.
Swap, then pay
Sell WETH for USDC, pay an exact invoice, and return the change in both tokens. Base.
Sweep the Pot
Transfer all of the Pot’s USDC, WETH and native coin to one recipient. Base, Ethereum.
Native USDC on Arc
Pay USDC as native value on Arc and measure it at 18 and at 6 decimals. Arc.
Swaps
Quote, swap and supply
Compare two WETH-to-USDC quotes, swap on the higher quote and supply the output to Aave V3. Base.
Distributed swap
Buy WETH with USDC across several pools, applying a price limit that accounts for each pool’s fee. Base.
Try a venue, fall back
Attempt a Uniswap V3 swap; if it fails the checks, undo the attempt and try Aerodrome Slipstream. Base.
Multi-venue route
Swap WETH to USDC, then USDC to USDT, with a minimum output for each swap. Ethereum.
Oracle-guarded swap
Check a pool price against Chainlink before selling WETH. Ethereum.
Buy tokenized stock
Compare pools for a tokenized-stock purchase, enforce a price cap and return unspent USDC. Ethereum.
Price survey
Compare price readings from Chainlink and Uniswap with a simulation. Ethereum.
Lending and yield
Supply idle USDC
Maintain a USDC reserve by supplying excess funds to Aave V3 or withdrawing a shortfall. Base, Ethereum.
Borrow with a health-factor floor
Supply WETH, borrow USDC, and revert unless the health factor stays above a floor. Base.
Repay by health factor
Repay USDC debt on Aave V3 when the health factor is below a target. Base, Ethereum.
USDC to sDAI
Swap USDC for DAI on Curve’s 3pool and deposit the DAI into sDAI, with a minimum on the shares. Ethereum.
Portfolio checks and automation
These programs evaluate conditions when you run them. To repeat them or react to market changes, you need an external scheduler or caller.Dollar-cost averaging
Run one step of a recurring purchase plan: buy WETH within a price limit or skip the purchase. Base, Ethereum.
Stop-loss
Check a stop-loss or take-profit threshold and sell WETH when it is reached. Ethereum.
Rebalance
Trade toward a target WETH/USDC allocation when the balance leaves a chosen band. Base, Ethereum.
Holdings per chain
Read token balances using the same program compiled separately for each chain. Base, Ethereum.
Buy the dip
Measure a price decline from a reference and buy WETH when it crosses a threshold. Ethereum.
Solana
Solana swap
Swap USDC for wrapped SOL (WSOL) on Orca and send the output to a recipient. Solana.
Solana payment
Transfer USDC and a Token-2022 asset, then inspect the amounts received. Solana.
Solana distributed swap
Buy a token across several pools while enforcing price and output limits. Solana.
Wrap SOL
Wrap the owner’s SOL in the Pot and check the resulting WSOL balance. Solana.
Advanced integrations
Actions: swap and supply
Describe a swap and Aave supply as JSON actions that compile to SauceScript. Base.
Low-level calls
Use raw calldata, a custom ABI, a gas limit and error handling. Base.
Troubleshooting
Next steps
- Run your first Sauce program: install the CLI, compile and simulate a first program.
- Introduction to Sauce: what a program, a Pot and a cook are.
- Protocols reference: every protocol namespace and the chains it is deployed on.
