@eco-incorp/sauce 0.99.6 → 0.99.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -16
- package/actions/action-program.schema.json +480 -379
- package/actions/dist/abis.d.ts +19 -18
- package/actions/dist/abis.d.ts.map +1 -1
- package/actions/dist/abis.js +29 -29
- package/actions/dist/compile.d.ts +4 -4
- package/actions/dist/compile.d.ts.map +1 -1
- package/actions/dist/compile.js +3 -1
- package/actions/dist/compose.d.ts +63 -6
- package/actions/dist/compose.d.ts.map +1 -1
- package/actions/dist/compose.js +100 -16
- package/actions/dist/index.d.ts +1 -1
- package/actions/dist/index.d.ts.map +1 -1
- package/actions/dist/names.d.ts +88 -0
- package/actions/dist/names.d.ts.map +1 -0
- package/actions/dist/names.js +324 -0
- package/actions/dist/program.d.ts.map +1 -1
- package/actions/dist/program.js +115 -5
- package/actions/dist/registry.d.ts +10 -8
- package/actions/dist/registry.d.ts.map +1 -1
- package/actions/dist/registry.js +10 -8
- package/actions/dist/schema.d.ts.map +1 -1
- package/actions/dist/schema.js +99 -12
- package/actions/dist/semantics.d.ts +12 -2
- package/actions/dist/semantics.d.ts.map +1 -1
- package/actions/dist/semantics.js +78 -8
- package/actions/dist/spec.d.ts +30 -0
- package/actions/dist/spec.d.ts.map +1 -1
- package/actions/dist/spec.js +151 -138
- package/actions/dist/split-swap.d.ts +10 -5
- package/actions/dist/split-swap.d.ts.map +1 -1
- package/actions/dist/split-swap.js +48 -7
- package/actions/dist/to-quote.d.ts +14 -5
- package/actions/dist/to-quote.d.ts.map +1 -1
- package/actions/dist/to-quote.js +210 -244
- package/actions/dist/to-sauce.d.ts +18 -4
- package/actions/dist/to-sauce.d.ts.map +1 -1
- package/actions/dist/to-sauce.js +232 -205
- package/actions/dist/types.d.ts +245 -147
- package/actions/dist/types.d.ts.map +1 -1
- package/actions/dist/types.js +4 -0
- package/docs/README.md +38 -0
- package/docs/api/README.md +37 -23
- package/docs/api/compiler.md +53 -12
- package/docs/api/contracts.md +105 -0
- package/docs/api/coverage.md +80 -57
- package/docs/api/router.md +238 -0
- package/docs/api/routes.md +31 -22
- package/docs/concepts/architecture.md +26 -3
- package/docs/concepts/saucescript.md +35 -55
- package/docs/examples/README.md +21 -14
- package/docs/examples/action-program.ts +51 -35
- package/docs/examples/cross-chain-cascade.sauce.ts +4 -0
- package/docs/examples/cross-chain-intent.sauce.ts +2 -1
- package/docs/examples/evm-execution.ts +2 -4
- package/docs/examples/first-intent.ts +7 -2
- package/docs/examples/pot-router.ts +19 -0
- package/docs/examples/registry-names.ts +52 -0
- package/docs/examples/router-route.sauce.ts +31 -0
- package/docs/examples/router-route.ts +72 -0
- package/docs/examples/router-swap.sauce.ts +16 -0
- package/docs/examples/router-swap.ts +47 -0
- package/docs/examples/venue-where-deployed.sauce.ts +14 -0
- package/docs/guides/actions.md +230 -120
- package/docs/guides/builders-and-actions.md +20 -14
- package/docs/guides/cli.md +1442 -0
- package/docs/guides/compiling.md +19 -7
- package/docs/guides/intents.md +228 -15
- package/docs/guides/mcp.md +539 -0
- package/docs/guides/nested-intents.md +21 -6
- package/docs/guides/protocols-and-tokens.md +218 -39
- package/docs/guides/quick-start.md +5 -0
- package/docs/guides/solana.md +199 -52
- package/docs/guides/verification.md +2 -2
- package/mcp/dist/config.js +78 -0
- package/mcp/dist/config.js.map +1 -0
- package/mcp/dist/entry.js +112 -0
- package/mcp/dist/entry.js.map +1 -0
- package/mcp/dist/files.js +64 -0
- package/mcp/dist/files.js.map +1 -0
- package/mcp/dist/guard.js +262 -0
- package/mcp/dist/guard.js.map +1 -0
- package/mcp/dist/http.js +111 -0
- package/mcp/dist/http.js.map +1 -0
- package/mcp/dist/intents.js +579 -0
- package/mcp/dist/intents.js.map +1 -0
- package/mcp/dist/prompts.js +153 -0
- package/mcp/dist/prompts.js.map +1 -0
- package/mcp/dist/reach.js +98 -0
- package/mcp/dist/reach.js.map +1 -0
- package/mcp/dist/resources.js +154 -0
- package/mcp/dist/resources.js.map +1 -0
- package/mcp/dist/sdk.js +34 -0
- package/mcp/dist/sdk.js.map +1 -0
- package/mcp/dist/server.js +119 -0
- package/mcp/dist/server.js.map +1 -0
- package/mcp/dist/setup.js +189 -0
- package/mcp/dist/setup.js.map +1 -0
- package/mcp/dist/skilltools.js +520 -0
- package/mcp/dist/skilltools.js.map +1 -0
- package/mcp/dist/terms.js +93 -0
- package/mcp/dist/terms.js.map +1 -0
- package/mcp/dist/tools.js +1497 -0
- package/mcp/dist/tools.js.map +1 -0
- package/mcp/dist/wallets.js +168 -0
- package/mcp/dist/wallets.js.map +1 -0
- package/package.json +18 -13
- package/sdk/dist/artifacts/V12Deployments.json +3 -1
- package/sdk/dist/artifacts/V12EngineGate.json +1 -2
- package/sdk/dist/artifacts/V12KitchenProxy.json +1 -0
- package/sdk/dist/chains/canonical.d.ts +15 -24
- package/sdk/dist/chains/canonical.d.ts.map +1 -1
- package/sdk/dist/chains/canonical.js +18 -29
- package/sdk/dist/chains/canonical.js.map +1 -1
- package/sdk/dist/cli/actions.d.ts +29 -0
- package/sdk/dist/cli/actions.d.ts.map +1 -0
- package/sdk/dist/cli/actions.js +122 -0
- package/sdk/dist/cli/actions.js.map +1 -0
- package/sdk/dist/cli/args.d.ts +118 -0
- package/sdk/dist/cli/args.d.ts.map +1 -0
- package/sdk/dist/cli/args.js +354 -0
- package/sdk/dist/cli/args.js.map +1 -0
- package/sdk/dist/cli/assume.d.ts +51 -0
- package/sdk/dist/cli/assume.d.ts.map +1 -0
- package/sdk/dist/cli/assume.js +207 -0
- package/sdk/dist/cli/assume.js.map +1 -0
- package/sdk/dist/cli/chain.d.ts +170 -0
- package/sdk/dist/cli/chain.d.ts.map +1 -0
- package/sdk/dist/cli/chain.js +457 -0
- package/sdk/dist/cli/chain.js.map +1 -0
- package/sdk/dist/cli/commands.d.ts +226 -0
- package/sdk/dist/cli/commands.d.ts.map +1 -0
- package/sdk/dist/cli/commands.js +637 -0
- package/sdk/dist/cli/commands.js.map +1 -0
- package/sdk/dist/cli/create.d.ts +70 -0
- package/sdk/dist/cli/create.d.ts.map +1 -0
- package/sdk/dist/cli/create.js +483 -0
- package/sdk/dist/cli/create.js.map +1 -0
- package/sdk/dist/cli/diagnostics.d.ts +12 -0
- package/sdk/dist/cli/diagnostics.d.ts.map +1 -0
- package/sdk/dist/cli/diagnostics.js +200 -0
- package/sdk/dist/cli/diagnostics.js.map +1 -0
- package/sdk/dist/cli/effects.d.ts +71 -0
- package/sdk/dist/cli/effects.d.ts.map +1 -0
- package/sdk/dist/cli/effects.js +279 -0
- package/sdk/dist/cli/effects.js.map +1 -0
- package/sdk/dist/cli/fill.d.ts +83 -0
- package/sdk/dist/cli/fill.d.ts.map +1 -0
- package/sdk/dist/cli/fill.js +734 -0
- package/sdk/dist/cli/fill.js.map +1 -0
- package/sdk/dist/cli/funding.d.ts +126 -0
- package/sdk/dist/cli/funding.d.ts.map +1 -0
- package/sdk/dist/cli/funding.js +514 -0
- package/sdk/dist/cli/funding.js.map +1 -0
- package/sdk/dist/cli/globals.d.ts +16 -0
- package/sdk/dist/cli/globals.d.ts.map +1 -0
- package/sdk/dist/cli/globals.js +197 -0
- package/sdk/dist/cli/globals.js.map +1 -0
- package/sdk/dist/cli/init.d.ts +34 -0
- package/sdk/dist/cli/init.d.ts.map +1 -0
- package/sdk/dist/cli/init.js +181 -0
- package/sdk/dist/cli/init.js.map +1 -0
- package/sdk/dist/cli/inputs.d.ts +72 -0
- package/sdk/dist/cli/inputs.d.ts.map +1 -0
- package/sdk/dist/cli/inputs.js +152 -0
- package/sdk/dist/cli/inputs.js.map +1 -0
- package/sdk/dist/cli/inspect.d.ts +48 -0
- package/sdk/dist/cli/inspect.d.ts.map +1 -0
- package/sdk/dist/cli/inspect.js +536 -0
- package/sdk/dist/cli/inspect.js.map +1 -0
- package/sdk/dist/cli/intent-commands.d.ts +71 -0
- package/sdk/dist/cli/intent-commands.d.ts.map +1 -0
- package/sdk/dist/cli/intent-commands.js +698 -0
- package/sdk/dist/cli/intent-commands.js.map +1 -0
- package/sdk/dist/cli/intent-svm.d.ts +15 -0
- package/sdk/dist/cli/intent-svm.d.ts.map +1 -0
- package/sdk/dist/cli/intent-svm.js +222 -0
- package/sdk/dist/cli/intent-svm.js.map +1 -0
- package/sdk/dist/cli/intents.d.ts +43 -0
- package/sdk/dist/cli/intents.d.ts.map +1 -0
- package/sdk/dist/cli/intents.js +89 -0
- package/sdk/dist/cli/intents.js.map +1 -0
- package/sdk/dist/cli/interactive.d.ts +11 -0
- package/sdk/dist/cli/interactive.d.ts.map +1 -0
- package/sdk/dist/cli/interactive.js +161 -0
- package/sdk/dist/cli/interactive.js.map +1 -0
- package/sdk/dist/cli/lifecycle-svm.d.ts +109 -0
- package/sdk/dist/cli/lifecycle-svm.d.ts.map +1 -0
- package/sdk/dist/cli/lifecycle-svm.js +299 -0
- package/sdk/dist/cli/lifecycle-svm.js.map +1 -0
- package/sdk/dist/cli/lifecycle.d.ts +439 -0
- package/sdk/dist/cli/lifecycle.d.ts.map +1 -0
- package/sdk/dist/cli/lifecycle.js +1721 -0
- package/sdk/dist/cli/lifecycle.js.map +1 -0
- package/sdk/dist/cli/main.d.ts +3 -0
- package/sdk/dist/cli/main.d.ts.map +1 -0
- package/sdk/dist/cli/main.js +8 -0
- package/sdk/dist/cli/main.js.map +1 -0
- package/sdk/dist/cli/mcp.d.ts +66 -0
- package/sdk/dist/cli/mcp.d.ts.map +1 -0
- package/sdk/dist/cli/mcp.js +169 -0
- package/sdk/dist/cli/mcp.js.map +1 -0
- package/sdk/dist/cli/password.d.ts +54 -0
- package/sdk/dist/cli/password.d.ts.map +1 -0
- package/sdk/dist/cli/password.js +148 -0
- package/sdk/dist/cli/password.js.map +1 -0
- package/sdk/dist/cli/policy.d.ts +130 -0
- package/sdk/dist/cli/policy.d.ts.map +1 -0
- package/sdk/dist/cli/policy.js +702 -0
- package/sdk/dist/cli/policy.js.map +1 -0
- package/sdk/dist/cli/pools.d.ts +140 -0
- package/sdk/dist/cli/pools.d.ts.map +1 -0
- package/sdk/dist/cli/pools.js +658 -0
- package/sdk/dist/cli/pools.js.map +1 -0
- package/sdk/dist/cli/price.d.ts +74 -0
- package/sdk/dist/cli/price.d.ts.map +1 -0
- package/sdk/dist/cli/price.js +321 -0
- package/sdk/dist/cli/price.js.map +1 -0
- package/sdk/dist/cli/prompt.d.ts +30 -0
- package/sdk/dist/cli/prompt.d.ts.map +1 -0
- package/sdk/dist/cli/prompt.js +53 -0
- package/sdk/dist/cli/prompt.js.map +1 -0
- package/sdk/dist/cli/publish.d.ts +48 -0
- package/sdk/dist/cli/publish.d.ts.map +1 -0
- package/sdk/dist/cli/publish.js +480 -0
- package/sdk/dist/cli/publish.js.map +1 -0
- package/sdk/dist/cli/receipt.d.ts +35 -0
- package/sdk/dist/cli/receipt.d.ts.map +1 -0
- package/sdk/dist/cli/receipt.js +63 -0
- package/sdk/dist/cli/receipt.js.map +1 -0
- package/sdk/dist/cli/rehearse.d.ts +80 -0
- package/sdk/dist/cli/rehearse.d.ts.map +1 -0
- package/sdk/dist/cli/rehearse.js +265 -0
- package/sdk/dist/cli/rehearse.js.map +1 -0
- package/sdk/dist/cli/report.d.ts +69 -0
- package/sdk/dist/cli/report.d.ts.map +1 -0
- package/sdk/dist/cli/report.js +206 -0
- package/sdk/dist/cli/report.js.map +1 -0
- package/sdk/dist/cli/returned.d.ts +16 -0
- package/sdk/dist/cli/returned.d.ts.map +1 -0
- package/sdk/dist/cli/returned.js +111 -0
- package/sdk/dist/cli/returned.js.map +1 -0
- package/sdk/dist/cli/run.d.ts +40 -0
- package/sdk/dist/cli/run.d.ts.map +1 -0
- package/sdk/dist/cli/run.js +3162 -0
- package/sdk/dist/cli/run.js.map +1 -0
- package/sdk/dist/cli/signer.d.ts +72 -0
- package/sdk/dist/cli/signer.d.ts.map +1 -0
- package/sdk/dist/cli/signer.js +243 -0
- package/sdk/dist/cli/signer.js.map +1 -0
- package/sdk/dist/cli/simulate.d.ts +11 -0
- package/sdk/dist/cli/simulate.d.ts.map +1 -0
- package/sdk/dist/cli/simulate.js +246 -0
- package/sdk/dist/cli/simulate.js.map +1 -0
- package/sdk/dist/cli/skills.d.ts +77 -0
- package/sdk/dist/cli/skills.d.ts.map +1 -0
- package/sdk/dist/cli/skills.js +527 -0
- package/sdk/dist/cli/skills.js.map +1 -0
- package/sdk/dist/cli/solana.d.ts +183 -0
- package/sdk/dist/cli/solana.d.ts.map +1 -0
- package/sdk/dist/cli/solana.js +1360 -0
- package/sdk/dist/cli/solana.js.map +1 -0
- package/sdk/dist/cli/store.d.ts +60 -0
- package/sdk/dist/cli/store.d.ts.map +1 -0
- package/sdk/dist/cli/store.js +196 -0
- package/sdk/dist/cli/store.js.map +1 -0
- package/sdk/dist/cli/support.d.ts +144 -0
- package/sdk/dist/cli/support.d.ts.map +1 -0
- package/sdk/dist/cli/support.js +217 -0
- package/sdk/dist/cli/support.js.map +1 -0
- package/sdk/dist/cli/svm-effects.d.ts +50 -0
- package/sdk/dist/cli/svm-effects.d.ts.map +1 -0
- package/sdk/dist/cli/svm-effects.js +196 -0
- package/sdk/dist/cli/svm-effects.js.map +1 -0
- package/sdk/dist/cli/terminal.d.ts +42 -0
- package/sdk/dist/cli/terminal.d.ts.map +1 -0
- package/sdk/dist/cli/terminal.js +136 -0
- package/sdk/dist/cli/terminal.js.map +1 -0
- package/sdk/dist/cli/verify.d.ts +32 -0
- package/sdk/dist/cli/verify.d.ts.map +1 -0
- package/sdk/dist/cli/verify.js +185 -0
- package/sdk/dist/cli/verify.js.map +1 -0
- package/sdk/dist/cli/wallet-commands.d.ts +59 -0
- package/sdk/dist/cli/wallet-commands.d.ts.map +1 -0
- package/sdk/dist/cli/wallet-commands.js +222 -0
- package/sdk/dist/cli/wallet-commands.js.map +1 -0
- package/sdk/dist/cli/wallet-send.d.ts +38 -0
- package/sdk/dist/cli/wallet-send.d.ts.map +1 -0
- package/sdk/dist/cli/wallet-send.js +303 -0
- package/sdk/dist/cli/wallet-send.js.map +1 -0
- package/sdk/dist/cli/wallets.d.ts +79 -0
- package/sdk/dist/cli/wallets.d.ts.map +1 -0
- package/sdk/dist/cli/wallets.js +297 -0
- package/sdk/dist/cli/wallets.js.map +1 -0
- package/sdk/dist/deployments/index.d.ts +4 -62
- package/sdk/dist/deployments/index.d.ts.map +1 -1
- package/sdk/dist/deployments/index.js +4 -84
- package/sdk/dist/deployments/index.js.map +1 -1
- package/sdk/dist/deployments/pot.d.ts +17 -7
- package/sdk/dist/deployments/pot.d.ts.map +1 -1
- package/sdk/dist/deployments/pot.js +25 -10
- package/sdk/dist/deployments/pot.js.map +1 -1
- package/sdk/dist/deployments/releases.d.ts +36 -0
- package/sdk/dist/deployments/releases.d.ts.map +1 -0
- package/sdk/dist/deployments/releases.js +61 -0
- package/sdk/dist/deployments/releases.js.map +1 -0
- package/sdk/dist/deployments/releases.json +76 -0
- package/sdk/dist/deployments/v12-addresses.d.ts +13 -0
- package/sdk/dist/deployments/v12-addresses.d.ts.map +1 -1
- package/sdk/dist/deployments/v12-addresses.js +16 -3
- package/sdk/dist/deployments/v12-addresses.js.map +1 -1
- package/sdk/dist/deposit/index.d.ts +6 -6
- package/sdk/dist/deposit/index.d.ts.map +1 -1
- package/sdk/dist/deposit/index.js +1 -1
- package/sdk/dist/deposit/index.js.map +1 -1
- package/sdk/dist/deposit/params.d.ts +4 -4
- package/sdk/dist/deposit/params.d.ts.map +1 -1
- package/sdk/dist/deposit/params.js +7 -4
- package/sdk/dist/deposit/params.js.map +1 -1
- package/sdk/dist/deposit/source.d.ts +3 -30
- package/sdk/dist/deposit/source.d.ts.map +1 -1
- package/sdk/dist/deposit/source.js +7 -83
- package/sdk/dist/deposit/source.js.map +1 -1
- package/sdk/dist/deposit/templates.d.ts +1 -2
- package/sdk/dist/deposit/templates.d.ts.map +1 -1
- package/sdk/dist/deposit/templates.js +10 -2
- package/sdk/dist/deposit/templates.js.map +1 -1
- package/sdk/dist/deposit/types.d.ts +14 -12
- package/sdk/dist/deposit/types.d.ts.map +1 -1
- package/sdk/dist/deposit/types.js +6 -0
- package/sdk/dist/deposit/types.js.map +1 -1
- package/sdk/dist/descriptors/accessors.d.ts +38 -35
- package/sdk/dist/descriptors/accessors.d.ts.map +1 -1
- package/sdk/dist/descriptors/accessors.js +16 -0
- package/sdk/dist/descriptors/accessors.js.map +1 -1
- package/sdk/dist/descriptors/call.d.ts +66 -14
- package/sdk/dist/descriptors/call.d.ts.map +1 -1
- package/sdk/dist/descriptors/call.js +94 -13
- package/sdk/dist/descriptors/call.js.map +1 -1
- package/sdk/dist/descriptors/contracts.generated.d.ts +3393 -0
- package/sdk/dist/descriptors/contracts.generated.d.ts.map +1 -0
- package/sdk/dist/descriptors/contracts.generated.js +728 -0
- package/sdk/dist/descriptors/contracts.generated.js.map +1 -0
- package/sdk/dist/descriptors/derive.d.ts +20 -11
- package/sdk/dist/descriptors/derive.d.ts.map +1 -1
- package/sdk/dist/descriptors/derive.js +68 -30
- package/sdk/dist/descriptors/derive.js.map +1 -1
- package/sdk/dist/descriptors/index.d.ts +6 -7
- package/sdk/dist/descriptors/index.d.ts.map +1 -1
- package/sdk/dist/descriptors/index.js +2 -2
- package/sdk/dist/descriptors/index.js.map +1 -1
- package/sdk/dist/descriptors/links.d.ts +23 -214
- package/sdk/dist/descriptors/links.d.ts.map +1 -1
- package/sdk/dist/descriptors/links.js +1 -232
- package/sdk/dist/descriptors/links.js.map +1 -1
- package/sdk/dist/descriptors/query.d.ts +1 -1
- package/sdk/dist/descriptors/query.d.ts.map +1 -1
- package/sdk/dist/descriptors/query.js +1 -1
- package/sdk/dist/descriptors/query.js.map +1 -1
- package/sdk/dist/descriptors/registry.d.ts +2 -5
- package/sdk/dist/descriptors/registry.d.ts.map +1 -1
- package/sdk/dist/descriptors/registry.js +11 -66
- package/sdk/dist/descriptors/registry.js.map +1 -1
- package/sdk/dist/embedded/resolve.d.ts +4 -4
- package/sdk/dist/embedded/resolve.d.ts.map +1 -1
- package/sdk/dist/embedded/resolve.js +12 -8
- package/sdk/dist/embedded/resolve.js.map +1 -1
- package/sdk/dist/embedded/skills.generated.d.ts +1 -1
- package/sdk/dist/embedded/skills.generated.d.ts.map +1 -1
- package/sdk/dist/embedded/skills.generated.js +137 -136
- package/sdk/dist/embedded/skills.generated.js.map +1 -1
- package/sdk/dist/embedded/sources.generated.d.ts.map +1 -1
- package/sdk/dist/embedded/sources.generated.js +40 -6
- package/sdk/dist/embedded/sources.generated.js.map +1 -1
- package/sdk/dist/evm/engine.d.ts +813 -10
- package/sdk/dist/evm/engine.d.ts.map +1 -1
- package/sdk/dist/evm/engine.js +127 -8
- package/sdk/dist/evm/engine.js.map +1 -1
- package/sdk/dist/index.d.ts +3 -2
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +6 -2
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/price.d.ts +40 -0
- package/sdk/dist/price.d.ts.map +1 -0
- package/sdk/dist/price.js +101 -0
- package/sdk/dist/price.js.map +1 -0
- package/sdk/dist/protocols/aerodrome/abis.d.ts +76 -0
- package/sdk/dist/protocols/aerodrome/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/aerodrome/abis.js +61 -0
- package/sdk/dist/protocols/aerodrome/abis.js.map +1 -1
- package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts +70 -0
- package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/aerodrome-slipstream/abis.js +54 -0
- package/sdk/dist/protocols/aerodrome-slipstream/abis.js.map +1 -1
- package/sdk/dist/protocols/camelot/abis.d.ts +178 -0
- package/sdk/dist/protocols/camelot/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/camelot/abis.js +139 -0
- package/sdk/dist/protocols/camelot/abis.js.map +1 -1
- package/sdk/dist/protocols/eco-routes/abis.d.ts +792 -50
- package/sdk/dist/protocols/eco-routes/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/eco-routes/abis.js +1058 -49
- package/sdk/dist/protocols/eco-routes/abis.js.map +1 -1
- package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts +44 -61
- package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts.map +1 -1
- package/sdk/dist/protocols/eco-routes/addresses.generated.js +45 -62
- package/sdk/dist/protocols/eco-routes/addresses.generated.js.map +1 -1
- package/sdk/dist/protocols/eco-routes/lookup.d.ts +10 -0
- package/sdk/dist/protocols/eco-routes/lookup.d.ts.map +1 -1
- package/sdk/dist/protocols/eco-routes/lookup.js +16 -0
- package/sdk/dist/protocols/eco-routes/lookup.js.map +1 -1
- package/sdk/dist/protocols/maverick/abis.d.ts +77 -0
- package/sdk/dist/protocols/maverick/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/maverick/abis.js +58 -0
- package/sdk/dist/protocols/maverick/abis.js.map +1 -1
- package/sdk/dist/protocols/maverick/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/maverick/addresses.js +4 -0
- package/sdk/dist/protocols/maverick/addresses.js.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v2/abis.d.ts +52 -0
- package/sdk/dist/protocols/pancakeswap-v2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v2/abis.js +43 -0
- package/sdk/dist/protocols/pancakeswap-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v3/abis.js +56 -0
- package/sdk/dist/protocols/pancakeswap-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/permit2/abis.d.ts +113 -0
- package/sdk/dist/protocols/permit2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/permit2/abis.js +63 -0
- package/sdk/dist/protocols/permit2/abis.js.map +1 -1
- package/sdk/dist/protocols/quickswap/abis.d.ts +148 -0
- package/sdk/dist/protocols/quickswap/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/quickswap/abis.js +119 -0
- package/sdk/dist/protocols/quickswap/abis.js.map +1 -1
- package/sdk/dist/protocols/sushiswap-v2/abis.d.ts +52 -0
- package/sdk/dist/protocols/sushiswap-v2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/sushiswap-v2/abis.js +42 -0
- package/sdk/dist/protocols/sushiswap-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/synthra-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/synthra-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/synthra-v3/abis.js +55 -0
- package/sdk/dist/protocols/synthra-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/trader-joe/abis.d.ts +133 -0
- package/sdk/dist/protocols/trader-joe/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/trader-joe/abis.js +101 -0
- package/sdk/dist/protocols/trader-joe/abis.js.map +1 -1
- package/sdk/dist/protocols/trader-joe/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/trader-joe/addresses.js +5 -0
- package/sdk/dist/protocols/trader-joe/addresses.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v2/abis.d.ts +52 -0
- package/sdk/dist/protocols/uniswap-v2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v2/abis.js +44 -0
- package/sdk/dist/protocols/uniswap-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/uniswap-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/abis.js +55 -0
- package/sdk/dist/protocols/uniswap-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/abis.d.ts +247 -0
- package/sdk/dist/protocols/uniswap-v4/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/abis.js +167 -0
- package/sdk/dist/protocols/uniswap-v4/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/addresses.js +50 -0
- package/sdk/dist/protocols/uniswap-v4/addresses.js.map +1 -1
- package/sdk/dist/protocols/unitflow-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/unitflow-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/unitflow-v3/abis.js +56 -0
- package/sdk/dist/protocols/unitflow-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/velodrome/abis.d.ts +76 -0
- package/sdk/dist/protocols/velodrome/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/velodrome/abis.js +61 -0
- package/sdk/dist/protocols/velodrome/abis.js.map +1 -1
- package/sdk/dist/recipes/cctp-split.sauce.ts +2 -2
- package/sdk/dist/recipes/plain-transfer.sauce.ts +2 -2
- package/sdk/dist/routes/accessor-index.d.ts +2 -2
- package/sdk/dist/routes/accessor-index.d.ts.map +1 -1
- package/sdk/dist/routes/accessor-index.js +4 -3
- package/sdk/dist/routes/accessor-index.js.map +1 -1
- package/sdk/dist/routes/ambient.d.ts +5 -0
- package/sdk/dist/routes/ambient.d.ts.map +1 -1
- package/sdk/dist/routes/ambient.js +20 -0
- package/sdk/dist/routes/ambient.js.map +1 -1
- package/sdk/dist/routes/ast-walk.d.ts +17 -3
- package/sdk/dist/routes/ast-walk.d.ts.map +1 -1
- package/sdk/dist/routes/ast-walk.js +24 -2
- package/sdk/dist/routes/ast-walk.js.map +1 -1
- package/sdk/dist/routes/available.d.ts +43 -0
- package/sdk/dist/routes/available.d.ts.map +1 -0
- package/sdk/dist/routes/available.js +230 -0
- package/sdk/dist/routes/available.js.map +1 -0
- package/sdk/dist/routes/builtins.generated.d.ts +180 -0
- package/sdk/dist/routes/builtins.generated.d.ts.map +1 -0
- package/sdk/dist/routes/builtins.generated.js +2 -0
- package/sdk/dist/routes/builtins.generated.js.map +1 -0
- package/sdk/dist/routes/chain-exports.generated.d.ts +13 -8
- package/sdk/dist/routes/chain-exports.generated.d.ts.map +1 -1
- package/sdk/dist/routes/chain-exports.generated.js.map +1 -1
- package/sdk/dist/routes/closure.d.ts.map +1 -1
- package/sdk/dist/routes/closure.js +13 -26
- package/sdk/dist/routes/closure.js.map +1 -1
- package/sdk/dist/routes/composed.d.ts.map +1 -1
- package/sdk/dist/routes/composed.js +20 -8
- package/sdk/dist/routes/composed.js.map +1 -1
- package/sdk/dist/routes/encode.d.ts +17 -0
- package/sdk/dist/routes/encode.d.ts.map +1 -1
- package/sdk/dist/routes/encode.js +14 -11
- package/sdk/dist/routes/encode.js.map +1 -1
- package/sdk/dist/routes/entry.d.ts +76 -0
- package/sdk/dist/routes/entry.d.ts.map +1 -0
- package/sdk/dist/routes/entry.js +478 -0
- package/sdk/dist/routes/entry.js.map +1 -0
- package/sdk/dist/routes/index.d.ts +19 -12
- package/sdk/dist/routes/index.d.ts.map +1 -1
- package/sdk/dist/routes/index.js +11 -8
- package/sdk/dist/routes/index.js.map +1 -1
- package/sdk/dist/routes/intent-body.d.ts +97 -0
- package/sdk/dist/routes/intent-body.d.ts.map +1 -0
- package/sdk/dist/routes/intent-body.js +441 -0
- package/sdk/dist/routes/intent-body.js.map +1 -0
- package/sdk/dist/routes/intent-dsl.d.ts +21 -6
- package/sdk/dist/routes/intent-dsl.d.ts.map +1 -1
- package/sdk/dist/routes/intent-dsl.js +34 -17
- package/sdk/dist/routes/intent-dsl.js.map +1 -1
- package/sdk/dist/routes/intent-sugar.d.ts +77 -4
- package/sdk/dist/routes/intent-sugar.d.ts.map +1 -1
- package/sdk/dist/routes/intent-sugar.js +318 -129
- package/sdk/dist/routes/intent-sugar.js.map +1 -1
- package/sdk/dist/routes/intent.d.ts +13 -1
- package/sdk/dist/routes/intent.d.ts.map +1 -1
- package/sdk/dist/routes/intent.js +37 -1
- package/sdk/dist/routes/intent.js.map +1 -1
- package/sdk/dist/routes/nest.d.ts +3 -2
- package/sdk/dist/routes/nest.d.ts.map +1 -1
- package/sdk/dist/routes/nest.js +5 -3
- package/sdk/dist/routes/nest.js.map +1 -1
- package/sdk/dist/routes/parse.d.ts +6 -0
- package/sdk/dist/routes/parse.d.ts.map +1 -0
- package/sdk/dist/routes/parse.js +39 -0
- package/sdk/dist/routes/parse.js.map +1 -0
- package/sdk/dist/routes/portal.d.ts +258 -4
- package/sdk/dist/routes/portal.d.ts.map +1 -1
- package/sdk/dist/routes/portal.js +588 -9
- package/sdk/dist/routes/portal.js.map +1 -1
- package/sdk/dist/routes/protocol-rewrite.d.ts +71 -1
- package/sdk/dist/routes/protocol-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/protocol-rewrite.js +178 -54
- package/sdk/dist/routes/protocol-rewrite.js.map +1 -1
- package/sdk/dist/routes/rs-compile.d.ts +25 -22
- package/sdk/dist/routes/rs-compile.d.ts.map +1 -1
- package/sdk/dist/routes/rs-compile.js +55 -49
- package/sdk/dist/routes/rs-compile.js.map +1 -1
- package/sdk/dist/routes/sauce-calls.d.ts +26 -12
- package/sdk/dist/routes/sauce-calls.d.ts.map +1 -1
- package/sdk/dist/routes/sauce-calls.js +16 -23
- package/sdk/dist/routes/sauce-calls.js.map +1 -1
- package/sdk/dist/routes/sauce-route.d.ts +74 -7
- package/sdk/dist/routes/sauce-route.d.ts.map +1 -1
- package/sdk/dist/routes/sauce-route.js +225 -75
- package/sdk/dist/routes/sauce-route.js.map +1 -1
- package/sdk/dist/routes/source-globals.d.ts +107 -0
- package/sdk/dist/routes/source-globals.d.ts.map +1 -0
- package/sdk/dist/routes/source-globals.generated.d.ts +5523 -933
- package/sdk/dist/routes/source-globals.generated.d.ts.map +1 -1
- package/sdk/dist/routes/source-globals.generated.js +3 -4
- package/sdk/dist/routes/source-globals.generated.js.map +1 -1
- package/sdk/dist/routes/source-globals.js +174 -0
- package/sdk/dist/routes/source-globals.js.map +1 -0
- package/sdk/dist/routes/stock-tokens.d.ts +69 -0
- package/sdk/dist/routes/stock-tokens.d.ts.map +1 -0
- package/sdk/dist/routes/stock-tokens.generated.d.ts +4 -0
- package/sdk/dist/routes/stock-tokens.generated.d.ts.map +1 -0
- package/sdk/dist/routes/stock-tokens.generated.js +1836 -0
- package/sdk/dist/routes/stock-tokens.generated.js.map +1 -0
- package/sdk/dist/routes/stock-tokens.js +65 -0
- package/sdk/dist/routes/stock-tokens.js.map +1 -0
- package/sdk/dist/routes/token-registry.d.ts +64 -8
- package/sdk/dist/routes/token-registry.d.ts.map +1 -1
- package/sdk/dist/routes/token-registry.js +202 -32
- package/sdk/dist/routes/token-registry.js.map +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/token-rewrite.js +5 -9
- package/sdk/dist/routes/token-rewrite.js.map +1 -1
- package/sdk/dist/routes/unknown-global.d.ts +32 -0
- package/sdk/dist/routes/unknown-global.d.ts.map +1 -0
- package/sdk/dist/routes/unknown-global.js +106 -0
- package/sdk/dist/routes/unknown-global.js.map +1 -0
- package/sdk/dist/routes/vault.d.ts +38 -8
- package/sdk/dist/routes/vault.d.ts.map +1 -1
- package/sdk/dist/routes/vault.js +47 -8
- package/sdk/dist/routes/vault.js.map +1 -1
- package/sdk/dist/sauce-script/builtins.d.ts +309 -0
- package/sdk/dist/sauce-script/declarations.d.ts +3 -0
- package/sdk/dist/sauce-script/declarations.d.ts.map +1 -0
- package/sdk/dist/sauce-script/declarations.js +229 -0
- package/sdk/dist/sauce-script/declarations.js.map +1 -0
- package/sdk/dist/sauce-script/index.d.ts +2714 -0
- package/sdk/dist/sauce-script/ts-plugin.cjs +85 -0
- package/sdk/dist/skills/loader.d.ts.map +1 -1
- package/sdk/dist/skills/loader.js +4 -3
- package/sdk/dist/skills/loader.js.map +1 -1
- package/sdk/dist/std/router/balancer-v2-vault.abi.json +78 -0
- package/sdk/dist/std/router/curve-cryptoswap.abi.json +29 -0
- package/sdk/dist/std/router/curve-stableswap.abi.json +29 -0
- package/sdk/dist/std/router/dodo-v2-pool.abi.json +39 -0
- package/sdk/dist/std/router/lb-pair.abi.json +55 -0
- package/sdk/dist/std/router/package.json +7 -0
- package/sdk/dist/std/router/router.evm.js +567 -0
- package/sdk/dist/std/router/sauce-router.abi.json +202 -0
- package/sdk/dist/std/router/uniswap-v2-pair.abi.json +49 -0
- package/sdk/dist/std/router/woo-pp-v2.abi.json +42 -0
- package/sdk/dist/std/token/permit2.abi.json +226 -0
- package/sdk/dist/std/token/token.evm.js +73 -0
- package/sdk/dist/std/token/token.svm.js +194 -41
- package/sdk/dist/svm/client.d.ts +62 -15
- package/sdk/dist/svm/client.d.ts.map +1 -1
- package/sdk/dist/svm/client.js +103 -42
- package/sdk/dist/svm/client.js.map +1 -1
- package/sdk/dist/svm/engine.d.ts +66 -5
- package/sdk/dist/svm/engine.d.ts.map +1 -1
- package/sdk/dist/svm/engine.js +73 -5
- package/sdk/dist/svm/engine.js.map +1 -1
- package/sdk/dist/svm/index.d.ts +2 -0
- package/sdk/dist/svm/index.d.ts.map +1 -1
- package/sdk/dist/svm/index.js +2 -0
- package/sdk/dist/svm/index.js.map +1 -1
- package/sdk/dist/svm/instructions.d.ts +72 -1
- package/sdk/dist/svm/instructions.d.ts.map +1 -1
- package/sdk/dist/svm/instructions.js +81 -2
- package/sdk/dist/svm/instructions.js.map +1 -1
- package/sdk/dist/svm/kitchen.d.ts +20 -1
- package/sdk/dist/svm/kitchen.d.ts.map +1 -1
- package/sdk/dist/svm/kitchen.js +47 -1
- package/sdk/dist/svm/kitchen.js.map +1 -1
- package/sdk/dist/svm/portal.d.ts +250 -0
- package/sdk/dist/svm/portal.d.ts.map +1 -0
- package/sdk/dist/svm/portal.js +462 -0
- package/sdk/dist/svm/portal.js.map +1 -0
- package/sdk/dist/svm/send.d.ts +18 -2
- package/sdk/dist/svm/send.d.ts.map +1 -1
- package/sdk/dist/svm/send.js +28 -3
- package/sdk/dist/svm/send.js.map +1 -1
- package/sdk/dist/svm/token-accounts.d.ts +49 -0
- package/sdk/dist/svm/token-accounts.d.ts.map +1 -0
- package/sdk/dist/svm/token-accounts.js +58 -0
- package/sdk/dist/svm/token-accounts.js.map +1 -0
- package/sdk/dist/svm/token-extensions.d.ts +18 -7
- package/sdk/dist/svm/token-extensions.d.ts.map +1 -1
- package/sdk/dist/svm/token-extensions.js +58 -5
- package/sdk/dist/svm/token-extensions.js.map +1 -1
- package/sdk/dist/token/evm.js +1 -1
- package/sdk/dist/token/index.d.ts +1 -1
- package/sdk/dist/token/index.js +1 -1
- package/sdk/dist/token/params.js +1 -1
- package/sdk/dist/token/source.js +3 -3
- package/sdk/dist/token/source.js.map +1 -1
- package/sdk/dist/token/types.d.ts +2 -2
- package/sdk/dist/token/types.js +2 -2
- package/sdk/src/protocols/aerodrome/AerodromePoolABI.json +105 -0
- package/sdk/src/protocols/aerodrome/abis.ts +62 -0
- package/sdk/src/protocols/aerodrome-slipstream/AerodromeSlipstreamPoolABI.json +96 -0
- package/sdk/src/protocols/aerodrome-slipstream/abis.ts +55 -0
- package/sdk/src/protocols/camelot/CamelotV2FactoryABI.json +25 -0
- package/sdk/src/protocols/camelot/CamelotV2PairABI.json +109 -0
- package/sdk/src/protocols/camelot/CamelotV3FactoryABI.json +25 -0
- package/sdk/src/protocols/camelot/CamelotV3PoolABI.json +92 -0
- package/sdk/src/protocols/camelot/abis.ts +143 -0
- package/sdk/src/protocols/eco-routes/PortalABI.json +1448 -0
- package/sdk/src/protocols/eco-routes/ProverABI.json +162 -0
- package/sdk/src/protocols/eco-routes/abis.ts +1060 -51
- package/sdk/src/protocols/eco-routes/addresses.generated.ts +45 -62
- package/sdk/src/protocols/eco-routes/lookup.ts +18 -0
- package/sdk/src/protocols/maverick/MaverickV2PoolABI.json +107 -0
- package/sdk/src/protocols/maverick/abis.ts +59 -0
- package/sdk/src/protocols/maverick/addresses.ts +4 -0
- package/sdk/src/protocols/pancakeswap-v2/PancakeSwapV2PairABI.json +72 -0
- package/sdk/src/protocols/pancakeswap-v2/abis.ts +44 -0
- package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3PoolABI.json +100 -0
- package/sdk/src/protocols/pancakeswap-v3/abis.ts +57 -0
- package/sdk/src/protocols/permit2/Permit2ABI.json +154 -0
- package/sdk/src/protocols/permit2/abis.ts +63 -0
- package/sdk/src/protocols/quickswap/QuickSwapV2FactoryABI.json +25 -0
- package/sdk/src/protocols/quickswap/QuickSwapV2PairABI.json +72 -0
- package/sdk/src/protocols/quickswap/QuickSwapV3FactoryABI.json +25 -0
- package/sdk/src/protocols/quickswap/QuickSwapV3PoolABI.json +88 -0
- package/sdk/src/protocols/quickswap/abis.ts +123 -0
- package/sdk/src/protocols/sushiswap-v2/SushiSwapV2PairABI.json +72 -0
- package/sdk/src/protocols/sushiswap-v2/abis.ts +43 -0
- package/sdk/src/protocols/synthra-v3/SynthraV3PoolABI.json +100 -0
- package/sdk/src/protocols/synthra-v3/abis.ts +56 -0
- package/sdk/src/protocols/trader-joe/LBPairABI.json +185 -0
- package/sdk/src/protocols/trader-joe/abis.ts +102 -0
- package/sdk/src/protocols/trader-joe/addresses.ts +5 -0
- package/sdk/src/protocols/uniswap-v2/UniswapV2PairABI.json +72 -0
- package/sdk/src/protocols/uniswap-v2/abis.ts +45 -0
- package/sdk/src/protocols/uniswap-v3/UniswapV3PoolABI.json +100 -0
- package/sdk/src/protocols/uniswap-v3/abis.ts +56 -0
- package/sdk/src/protocols/uniswap-v4/UniswapV4PoolManagerABI.json +38 -0
- package/sdk/src/protocols/uniswap-v4/UniswapV4StateViewABI.json +307 -0
- package/sdk/src/protocols/uniswap-v4/abis.ts +168 -0
- package/sdk/src/protocols/uniswap-v4/addresses.ts +50 -0
- package/sdk/src/protocols/unitflow-v3/UnitFlowV3PoolABI.json +100 -0
- package/sdk/src/protocols/unitflow-v3/abis.ts +57 -0
- package/sdk/src/protocols/velodrome/VelodromePoolABI.json +105 -0
- package/sdk/src/protocols/velodrome/abis.ts +62 -0
- package/skills/sauce-actions/SKILL.md +166 -0
- package/skills/sauce-actions/examples/swap-and-supply.json +24 -0
- package/skills/sauce-actions/examples/swap-by-key.json +15 -0
- package/skills/sauce-actions/references/actions.md +731 -0
- package/skills/sauce-chains/SKILL.md +137 -0
- package/skills/sauce-chains/examples/chains.sauce.ts +25 -0
- package/skills/sauce-chains/references/arbitrum.md +158 -0
- package/skills/sauce-chains/references/arc.md +107 -0
- package/skills/sauce-chains/references/aurora.md +33 -0
- package/skills/sauce-chains/references/avalanche.md +106 -0
- package/skills/sauce-chains/references/base-stocks.md +77 -0
- package/skills/sauce-chains/references/base.md +141 -0
- package/skills/sauce-chains/references/berachain.md +33 -0
- package/skills/sauce-chains/references/blast.md +60 -0
- package/skills/sauce-chains/references/boba.md +33 -0
- package/skills/sauce-chains/references/bsc.md +97 -0
- package/skills/sauce-chains/references/celo.md +57 -0
- package/skills/sauce-chains/references/core.md +33 -0
- package/skills/sauce-chains/references/cronos.md +33 -0
- package/skills/sauce-chains/references/ethereum-stocks.md +1741 -0
- package/skills/sauce-chains/references/ethereum.md +255 -0
- package/skills/sauce-chains/references/evmos.md +33 -0
- package/skills/sauce-chains/references/fantom.md +61 -0
- package/skills/sauce-chains/references/fuse.md +33 -0
- package/skills/sauce-chains/references/gnosis.md +57 -0
- package/skills/sauce-chains/references/index.md +58 -0
- package/skills/sauce-chains/references/ink.md +55 -0
- package/skills/sauce-chains/references/kava.md +33 -0
- package/skills/sauce-chains/references/klaytn.md +33 -0
- package/skills/sauce-chains/references/linea.md +65 -0
- package/skills/sauce-chains/references/manta.md +33 -0
- package/skills/sauce-chains/references/mantle.md +33 -0
- package/skills/sauce-chains/references/metis.md +54 -0
- package/skills/sauce-chains/references/mode.md +55 -0
- package/skills/sauce-chains/references/monad.md +79 -0
- package/skills/sauce-chains/references/moonbeam.md +33 -0
- package/skills/sauce-chains/references/opbnb.md +55 -0
- package/skills/sauce-chains/references/optimism.md +123 -0
- package/skills/sauce-chains/references/plasma.md +35 -0
- package/skills/sauce-chains/references/polygon.md +123 -0
- package/skills/sauce-chains/references/pulsechain.md +33 -0
- package/skills/sauce-chains/references/ronin.md +35 -0
- package/skills/sauce-chains/references/scroll.md +62 -0
- package/skills/sauce-chains/references/sei.md +55 -0
- package/skills/sauce-chains/references/solana.md +53 -0
- package/skills/sauce-chains/references/sonic.md +57 -0
- package/skills/sauce-chains/references/unichain.md +61 -0
- package/skills/sauce-chains/references/zetachain.md +33 -0
- package/skills/sauce-chains/references/zksync.md +59 -0
- package/skills/sauce-chains/references/zora.md +57 -0
- package/skills/sauce-cli/SKILL.md +366 -0
- package/skills/sauce-cli/examples/pay.sauce.ts +23 -0
- package/skills/sauce-cli/examples/split.sauce.ts +30 -0
- package/skills/sauce-distributed-swap/SKILL.md +392 -0
- package/skills/sauce-distributed-swap/examples/distributed-swap.mts +251 -0
- package/skills/sauce-distributed-swap/examples/distributed-swap.sauce.ts +115 -0
- package/skills/sauce-examples/SKILL.md +96 -0
- package/skills/sauce-globals/SKILL.md +175 -0
- package/skills/sauce-globals/examples/globals.mts +111 -0
- package/skills/sauce-globals/examples/globals.sauce.ts +47 -0
- package/skills/sauce-globals/references/chains.md +53 -0
- package/skills/sauce-globals/references/protocols.md +405 -0
- package/skills/sauce-globals/references/stocks.md +1824 -0
- package/skills/sauce-globals/references/tokens.md +53 -0
- package/skills/sauce-intents/SKILL.md +505 -0
- package/skills/sauce-intents/examples/cross-chain.sauce.ts +37 -0
- package/skills/sauce-intents/examples/fund-by-transfer.sauce.ts +54 -0
- package/skills/sauce-intents/examples/intents.mts +343 -0
- package/skills/sauce-intents/examples/swap-on-base.sauce.ts +135 -0
- package/skills/sauce-intents/references/portal.md +77 -0
- package/skills/sauce-overview/SKILL.md +161 -0
- package/skills/sauce-protocols/SKILL.md +118 -0
- package/skills/sauce-protocols/examples/protocols.mts +77 -0
- package/skills/sauce-protocols/examples/protocols.sauce.ts +27 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/aave-v2.md +35 -17
- package/skills/sauce-protocols/references/aave-v3.md +144 -0
- package/skills/sauce-protocols/references/aave-v4.md +50 -0
- package/skills/sauce-protocols/references/abracadabra.md +72 -0
- package/skills/sauce-protocols/references/across.md +73 -0
- package/skills/sauce-protocols/references/aerodrome-slipstream.md +50 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/aerodrome.md +43 -24
- package/skills/sauce-protocols/references/aevo.md +49 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/alchemix.md +10 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/ambient.md +14 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/arbitrum-bridge.md +11 -14
- package/{sdk/src/skills → skills/sauce-protocols/references}/arrakis.md +10 -26
- package/skills/sauce-protocols/references/axelar.md +56 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/balancer-v2.md +13 -29
- package/{sdk/src/skills → skills/sauce-protocols/references}/base-bridge.md +11 -16
- package/{sdk/src/skills → skills/sauce-protocols/references}/baseswap.md +12 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/beefy.md +10 -30
- package/{sdk/src/skills → skills/sauce-protocols/references}/benqi.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/camelot.md +13 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/cbeth.md +10 -22
- package/skills/sauce-protocols/references/cctp.md +47 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/celer.md +11 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/chainlink-ccip.md +11 -21
- package/skills/sauce-protocols/references/chainlink.md +47 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/circle-gateway.md +12 -38
- package/{sdk/src/skills → skills/sauce-protocols/references}/compound-v2.md +11 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/compound-v3.md +43 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/connext.md +11 -15
- package/{sdk/src/skills → skills/sauce-protocols/references}/convex.md +10 -28
- package/{sdk/src/skills → skills/sauce-protocols/references}/cowswap.md +12 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/crvusd.md +10 -19
- package/skills/sauce-protocols/references/curve.md +98 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/debridge.md +11 -33
- package/{sdk/src/skills → skills/sauce-protocols/references}/dodo.md +13 -18
- package/skills/sauce-protocols/references/eigenlayer.md +48 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/ens.md +10 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/erc20.md +10 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/erc3156.md +10 -13
- package/{sdk/src/skills → skills/sauce-protocols/references}/erc4626.md +11 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/ethena.md +10 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/etherfi.md +10 -32
- package/{sdk/src/skills → skills/sauce-protocols/references}/euler-v2.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/fenix.md +12 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/fluid.md +11 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/frax-ether.md +10 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/frax.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/gains-network.md +11 -28
- package/skills/sauce-protocols/references/gamma.md +57 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/gelato.md +12 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/gho.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/gmx-v1.md +12 -34
- package/{sdk/src/skills → skills/sauce-protocols/references}/gmx-v2.md +15 -28
- package/skills/sauce-protocols/references/harvest.md +41 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/hegic.md +10 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/hop.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/hyperlane.md +11 -21
- package/skills/sauce-protocols/references/index.md +355 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/instadapp.md +10 -18
- package/skills/sauce-protocols/references/kelp.md +46 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/kim.md +12 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/kyberswap-aggregator.md +12 -35
- package/skills/sauce-protocols/references/kyberswap.md +72 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/layerbank.md +11 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/layerzero.md +11 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/level-finance.md +10 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/lido.md +10 -28
- package/{sdk/src/skills → skills/sauce-protocols/references}/lifi.md +11 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/linea-bridge.md +11 -14
- package/{sdk/src/skills → skills/sauce-protocols/references}/liquity-v1.md +10 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/liquity-v2.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/lynex.md +12 -18
- package/skills/sauce-protocols/references/maker.md +57 -0
- package/skills/sauce-protocols/references/mantle-meth.md +43 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/maverick.md +13 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/moonwell.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/morpho-blue.md +44 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/mux-protocol.md +10 -30
- package/skills/sauce-protocols/references/olympus.md +39 -0
- package/skills/sauce-protocols/references/oneinch.md +81 -0
- package/skills/sauce-protocols/references/openocean.md +69 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/optimism-bridge.md +11 -16
- package/{sdk/src/skills → skills/sauce-protocols/references}/opyn.md +10 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/pancakeswap-v2.md +39 -41
- package/skills/sauce-protocols/references/pancakeswap-v3.md +72 -0
- package/skills/sauce-protocols/references/paraswap.md +39 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/pendle.md +47 -29
- package/skills/sauce-protocols/references/permit2.md +101 -0
- package/skills/sauce-protocols/references/perpetual-protocol.md +53 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/polygon-bridge.md +11 -17
- package/{sdk/src/skills → skills/sauce-protocols/references}/premia.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/puffer.md +10 -21
- package/skills/sauce-protocols/references/pyth.md +45 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/quickswap.md +13 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/radiant.md +11 -15
- package/{sdk/src/skills → skills/sauce-protocols/references}/ramses.md +12 -18
- package/skills/sauce-protocols/references/reflexer.md +52 -0
- package/skills/sauce-protocols/references/registry/aave-v2.md +43 -0
- package/skills/sauce-protocols/references/registry/aave-v3.md +62 -0
- package/skills/sauce-protocols/references/registry/aave-v4.md +80 -0
- package/skills/sauce-protocols/references/registry/abracadabra.md +54 -0
- package/skills/sauce-protocols/references/registry/across.md +57 -0
- package/skills/sauce-protocols/references/registry/aerodrome-slipstream.md +72 -0
- package/skills/sauce-protocols/references/registry/aerodrome.md +58 -0
- package/skills/sauce-protocols/references/registry/aevo.md +39 -0
- package/skills/sauce-protocols/references/registry/alchemix.md +46 -0
- package/skills/sauce-protocols/references/registry/ambient.md +40 -0
- package/skills/sauce-protocols/references/registry/arbitrum-bridge.md +40 -0
- package/skills/sauce-protocols/references/registry/arrakis.md +49 -0
- package/skills/sauce-protocols/references/registry/axelar.md +65 -0
- package/skills/sauce-protocols/references/registry/balancer-v2.md +50 -0
- package/skills/sauce-protocols/references/registry/base-bridge.md +42 -0
- package/skills/sauce-protocols/references/registry/baseswap.md +40 -0
- package/skills/sauce-protocols/references/registry/beefy.md +51 -0
- package/skills/sauce-protocols/references/registry/benqi.md +49 -0
- package/skills/sauce-protocols/references/registry/camelot.md +82 -0
- package/skills/sauce-protocols/references/registry/cbeth.md +43 -0
- package/skills/sauce-protocols/references/registry/cctp.md +48 -0
- package/skills/sauce-protocols/references/registry/celer.md +44 -0
- package/skills/sauce-protocols/references/registry/chainlink-ccip.md +45 -0
- package/skills/sauce-protocols/references/registry/chainlink.md +49 -0
- package/skills/sauce-protocols/references/registry/circle-gateway.md +70 -0
- package/skills/sauce-protocols/references/registry/compound-v2.md +53 -0
- package/skills/sauce-protocols/references/registry/compound-v3.md +52 -0
- package/skills/sauce-protocols/references/registry/connext.md +41 -0
- package/skills/sauce-protocols/references/registry/convex.md +51 -0
- package/skills/sauce-protocols/references/registry/cowswap.md +40 -0
- package/skills/sauce-protocols/references/registry/crvusd.md +40 -0
- package/skills/sauce-protocols/references/registry/curve.md +81 -0
- package/skills/sauce-protocols/references/registry/debridge.md +59 -0
- package/skills/sauce-protocols/references/registry/dodo.md +39 -0
- package/skills/sauce-protocols/references/registry/eco-routes.md +65 -0
- package/skills/sauce-protocols/references/registry/eigenlayer.md +58 -0
- package/skills/sauce-protocols/references/registry/ens.md +49 -0
- package/skills/sauce-protocols/references/registry/erc20.md +44 -0
- package/skills/sauce-protocols/references/registry/erc3156.md +38 -0
- package/skills/sauce-protocols/references/registry/erc4626.md +51 -0
- package/skills/sauce-protocols/references/registry/ethena.md +50 -0
- package/skills/sauce-protocols/references/registry/etherfi.md +57 -0
- package/skills/sauce-protocols/references/registry/euler-v2.md +49 -0
- package/skills/sauce-protocols/references/registry/fenix.md +39 -0
- package/skills/sauce-protocols/references/registry/fluid.md +48 -0
- package/skills/sauce-protocols/references/registry/frax-ether.md +49 -0
- package/skills/sauce-protocols/references/registry/frax.md +40 -0
- package/skills/sauce-protocols/references/registry/gains-network.md +43 -0
- package/skills/sauce-protocols/references/registry/gamma.md +56 -0
- package/skills/sauce-protocols/references/registry/gelato.md +45 -0
- package/skills/sauce-protocols/references/registry/gho.md +40 -0
- package/skills/sauce-protocols/references/registry/gmx-v1.md +59 -0
- package/skills/sauce-protocols/references/registry/gmx-v2.md +41 -0
- package/skills/sauce-protocols/references/registry/harvest.md +44 -0
- package/skills/sauce-protocols/references/registry/hegic.md +39 -0
- package/skills/sauce-protocols/references/registry/hop.md +49 -0
- package/skills/sauce-protocols/references/registry/hyperlane.md +48 -0
- package/skills/sauce-protocols/references/registry/instadapp.md +39 -0
- package/skills/sauce-protocols/references/registry/kelp.md +47 -0
- package/skills/sauce-protocols/references/registry/kim.md +39 -0
- package/skills/sauce-protocols/references/registry/kyberswap-aggregator.md +49 -0
- package/skills/sauce-protocols/references/registry/kyberswap.md +63 -0
- package/skills/sauce-protocols/references/registry/layerbank.md +54 -0
- package/skills/sauce-protocols/references/registry/layerzero.md +49 -0
- package/skills/sauce-protocols/references/registry/level-finance.md +41 -0
- package/skills/sauce-protocols/references/registry/lido.md +51 -0
- package/skills/sauce-protocols/references/registry/lifi.md +48 -0
- package/skills/sauce-protocols/references/registry/linea-bridge.md +40 -0
- package/skills/sauce-protocols/references/registry/liquity-v1.md +42 -0
- package/skills/sauce-protocols/references/registry/liquity-v2.md +40 -0
- package/skills/sauce-protocols/references/registry/lynex.md +39 -0
- package/skills/sauce-protocols/references/registry/maker.md +55 -0
- package/skills/sauce-protocols/references/registry/mantle-meth.md +48 -0
- package/skills/sauce-protocols/references/registry/maverick.md +60 -0
- package/skills/sauce-protocols/references/registry/moonwell.md +49 -0
- package/skills/sauce-protocols/references/registry/morpho-blue.md +47 -0
- package/skills/sauce-protocols/references/registry/mux-protocol.md +49 -0
- package/skills/sauce-protocols/references/registry/olympus.md +42 -0
- package/skills/sauce-protocols/references/registry/oneinch.md +45 -0
- package/skills/sauce-protocols/references/registry/openocean.md +44 -0
- package/skills/sauce-protocols/references/registry/optimism-bridge.md +42 -0
- package/skills/sauce-protocols/references/registry/opyn.md +42 -0
- package/skills/sauce-protocols/references/registry/pancakeswap-v2.md +71 -0
- package/skills/sauce-protocols/references/registry/pancakeswap-v3.md +76 -0
- package/skills/sauce-protocols/references/registry/paraswap.md +51 -0
- package/skills/sauce-protocols/references/registry/pendle.md +43 -0
- package/skills/sauce-protocols/references/registry/permit2.md +50 -0
- package/skills/sauce-protocols/references/registry/perpetual-protocol.md +49 -0
- package/skills/sauce-protocols/references/registry/polygon-bridge.md +43 -0
- package/skills/sauce-protocols/references/registry/premia.md +40 -0
- package/skills/sauce-protocols/references/registry/puffer.md +43 -0
- package/skills/sauce-protocols/references/registry/pyth.md +40 -0
- package/skills/sauce-protocols/references/registry/quickswap.md +80 -0
- package/skills/sauce-protocols/references/registry/radiant.md +41 -0
- package/skills/sauce-protocols/references/registry/ramses.md +39 -0
- package/skills/sauce-protocols/references/registry/reflexer.md +56 -0
- package/skills/sauce-protocols/references/registry/renzo.md +47 -0
- package/skills/sauce-protocols/references/registry/rocket-pool.md +49 -0
- package/skills/sauce-protocols/references/registry/sablier.md +40 -0
- package/skills/sauce-protocols/references/registry/safe.md +47 -0
- package/skills/sauce-protocols/references/registry/scroll-bridge.md +48 -0
- package/skills/sauce-protocols/references/registry/seamless.md +42 -0
- package/skills/sauce-protocols/references/registry/seaport.md +44 -0
- package/skills/sauce-protocols/references/registry/silo.md +48 -0
- package/skills/sauce-protocols/references/registry/socket.md +44 -0
- package/skills/sauce-protocols/references/registry/sommelier.md +43 -0
- package/skills/sauce-protocols/references/registry/spark.md +42 -0
- package/skills/sauce-protocols/references/registry/spookyswap.md +40 -0
- package/skills/sauce-protocols/references/registry/squid.md +45 -0
- package/skills/sauce-protocols/references/registry/stader.md +47 -0
- package/skills/sauce-protocols/references/registry/stargate.md +45 -0
- package/skills/sauce-protocols/references/registry/superfluid.md +49 -0
- package/skills/sauce-protocols/references/registry/sushiswap-v2.md +71 -0
- package/skills/sauce-protocols/references/registry/swell.md +49 -0
- package/skills/sauce-protocols/references/registry/synapse.md +46 -0
- package/skills/sauce-protocols/references/registry/syncswap.md +38 -0
- package/skills/sauce-protocols/references/registry/synthetix-v3.md +48 -0
- package/skills/sauce-protocols/references/registry/synthra-v3.md +77 -0
- package/skills/sauce-protocols/references/registry/thales.md +51 -0
- package/skills/sauce-protocols/references/registry/thena.md +39 -0
- package/skills/sauce-protocols/references/registry/thruster.md +38 -0
- package/skills/sauce-protocols/references/registry/tokemak.md +45 -0
- package/skills/sauce-protocols/references/registry/trader-joe.md +66 -0
- package/skills/sauce-protocols/references/registry/uniswap-v2.md +77 -0
- package/skills/sauce-protocols/references/registry/uniswap-v3.md +113 -0
- package/skills/sauce-protocols/references/registry/uniswap-v4.md +117 -0
- package/skills/sauce-protocols/references/registry/unitflow-v3.md +65 -0
- package/skills/sauce-protocols/references/registry/velodrome.md +58 -0
- package/skills/sauce-protocols/references/registry/venus.md +62 -0
- package/skills/sauce-protocols/references/registry/vertex.md +46 -0
- package/skills/sauce-protocols/references/registry/wormhole.md +59 -0
- package/skills/sauce-protocols/references/registry/yearn-v3.md +46 -0
- package/skills/sauce-protocols/references/registry/zerolend.md +41 -0
- package/skills/sauce-protocols/references/registry/zerox.md +44 -0
- package/skills/sauce-protocols/references/registry/zksync-bridge.md +40 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/renzo.md +10 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/rocket-pool.md +10 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/sablier.md +10 -27
- package/skills/sauce-protocols/references/safe.md +42 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/scroll-bridge.md +11 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/seamless.md +11 -16
- package/skills/sauce-protocols/references/seaport.md +38 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/silo.md +11 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/socket.md +11 -18
- package/skills/sauce-protocols/references/sommelier.md +40 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/spark.md +11 -16
- package/{sdk/src/skills → skills/sauce-protocols/references}/spookyswap.md +12 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/squid.md +11 -21
- package/skills/sauce-protocols/references/stader.md +39 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/stargate.md +11 -22
- package/{sdk/src/skills → skills/sauce-protocols/references}/superfluid.md +10 -28
- package/{sdk/src/skills → skills/sauce-protocols/references}/sushiswap-v2.md +38 -43
- package/skills/sauce-protocols/references/swell.md +49 -0
- package/skills/sauce-protocols/references/synapse.md +54 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/syncswap.md +12 -17
- package/{sdk/src/skills → skills/sauce-protocols/references}/synthetix-v3.md +10 -29
- package/skills/sauce-protocols/references/synthra-v3.md +63 -0
- package/skills/sauce-protocols/references/thales.md +58 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/thena.md +12 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/thruster.md +13 -18
- package/skills/sauce-protocols/references/tokemak.md +40 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/trader-joe.md +13 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/uniswap-v2.md +46 -44
- package/skills/sauce-protocols/references/uniswap-v3.md +188 -0
- package/skills/sauce-protocols/references/uniswap-v4.md +155 -0
- package/skills/sauce-protocols/references/unitflow-v3.md +63 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/velodrome.md +12 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/venus.md +12 -31
- package/skills/sauce-protocols/references/vertex.md +42 -0
- package/skills/sauce-protocols/references/wormhole.md +57 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/yearn-v3.md +10 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/zerolend.md +11 -15
- package/skills/sauce-protocols/references/zerox.md +39 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/zksync-bridge.md +11 -14
- package/skills/sauce-script/SKILL.md +407 -0
- package/skills/sauce-script/examples/IOracle.json +12 -0
- package/skills/sauce-script/examples/saucescript.mts +167 -0
- package/skills/sauce-script/examples/twap.sauce.ts +29 -0
- package/skills/sauce-script/references/builtins.json +823 -0
- package/skills/sauce-script/references/builtins.md +674 -0
- package/skills/sauce-solana/SKILL.md +322 -0
- package/skills/sauce-solana/examples/solana.mts +166 -0
- package/skills/sauce-solana/examples/solana.sauce.ts +45 -0
- package/skills/sauce-solana/examples/token-2022.sauce.ts +38 -0
- package/skills/sauce-swaps/SKILL.md +200 -0
- package/skills/sauce-swaps/examples/swap-leg.sauce.ts +50 -0
- package/skills/sauce-swaps/examples/swaps.mts +124 -0
- package/skills/sauce-typescript/SKILL.md +178 -0
- package/skills/sauce-typescript/examples/actions.mts +100 -0
- package/skills/sauce-typescript/examples/compiler.mts +69 -0
- package/skills/sauce-typescript/examples/cook.mts +65 -0
- package/skills/sauce-typescript/examples/verify.mts +104 -0
- package/dev-tools/README.md +0 -16
- package/dev-tools/artifacts/IERC20.json +0 -1
- package/dev-tools/artifacts/ISauceRouter.json +0 -1
- package/dev-tools/artifacts/IUniswapV3Pool.json +0 -1
- package/dev-tools/artifacts/Router.json +0 -1
- package/dev-tools/hardhat.config.cjs +0 -18
- package/dev-tools/sauce/js/add.js +0 -4
- package/dev-tools/sauce/js/call.js +0 -8
- package/dev-tools/sauce/js/erc20.js +0 -18
- package/dev-tools/sauce/js/example.js +0 -6
- package/dev-tools/sauce/js/fibonacci.js +0 -13
- package/dev-tools/sauce/ts/add.ts +0 -4
- package/dev-tools/sauce/ts/call.ts +0 -8
- package/dev-tools/sauce/ts/erc20.ts +0 -18
- package/dev-tools/sauce/ts/example.ts +0 -6
- package/dev-tools/sauce/ts/fibonacci.ts +0 -13
- package/dev-tools/sauce/ts/saucescript.d.ts +0 -1
- package/dev-tools/sauce/ts/tsconfig.json +0 -12
- package/dev-tools/scripts/deploy.ts +0 -107
- package/dev-tools/scripts/init.js +0 -132
- package/dev-tools/scripts/run.ts +0 -67
- package/dev-tools/scripts/start-fork.sh +0 -92
- package/dev-tools/scripts/start-local.sh +0 -120
- package/dev-tools/scripts/stop-local.sh +0 -40
- package/dev-tools/scripts/sync-artifacts.js +0 -46
- package/dev-tools/scripts/sync-price.ts +0 -58
- package/dev-tools/src/contracts.ts +0 -59
- package/dev-tools/src/runner.ts +0 -355
- package/dev-tools/src/svm-local.ts +0 -305
- package/dev-tools/src/sync-price.ts +0 -217
- package/sdk/dist/deployments/v12.generated.d.ts +0 -95
- package/sdk/dist/deployments/v12.generated.d.ts.map +0 -1
- package/sdk/dist/deployments/v12.generated.js +0 -50
- package/sdk/dist/deployments/v12.generated.js.map +0 -1
- package/sdk/dist/swap/index.d.ts +0 -29
- package/sdk/dist/swap/index.d.ts.map +0 -1
- package/sdk/dist/swap/index.js +0 -27
- package/sdk/dist/swap/index.js.map +0 -1
- package/sdk/dist/swap/params.d.ts +0 -29
- package/sdk/dist/swap/params.d.ts.map +0 -1
- package/sdk/dist/swap/params.js +0 -123
- package/sdk/dist/swap/params.js.map +0 -1
- package/sdk/dist/swap/source.d.ts +0 -30
- package/sdk/dist/swap/source.d.ts.map +0 -1
- package/sdk/dist/swap/source.js +0 -101
- package/sdk/dist/swap/source.js.map +0 -1
- package/sdk/dist/swap/types.d.ts +0 -160
- package/sdk/dist/swap/types.d.ts.map +0 -1
- package/sdk/dist/swap/types.js +0 -106
- package/sdk/dist/swap/types.js.map +0 -1
- package/sdk/src/skills/aave-v3.md +0 -134
- package/sdk/src/skills/aave-v4.md +0 -91
- package/sdk/src/skills/abracadabra.md +0 -93
- package/sdk/src/skills/across.md +0 -90
- package/sdk/src/skills/aerodrome-slipstream.md +0 -57
- package/sdk/src/skills/aevo.md +0 -58
- package/sdk/src/skills/axelar.md +0 -80
- package/sdk/src/skills/chainlink.md +0 -62
- package/sdk/src/skills/curve.md +0 -141
- package/sdk/src/skills/eigenlayer.md +0 -71
- package/sdk/src/skills/gamma.md +0 -79
- package/sdk/src/skills/harvest.md +0 -49
- package/sdk/src/skills/index.md +0 -299
- package/sdk/src/skills/kelp.md +0 -60
- package/sdk/src/skills/kyberswap.md +0 -100
- package/sdk/src/skills/loader.ts +0 -46
- package/sdk/src/skills/maker.md +0 -79
- package/sdk/src/skills/mantle-meth.md +0 -60
- package/sdk/src/skills/olympus.md +0 -46
- package/sdk/src/skills/oneinch.md +0 -64
- package/sdk/src/skills/openocean.md +0 -86
- package/sdk/src/skills/pancakeswap-v3.md +0 -104
- package/sdk/src/skills/paraswap.md +0 -67
- package/sdk/src/skills/permit2.md +0 -73
- package/sdk/src/skills/perpetual-protocol.md +0 -73
- package/sdk/src/skills/pyth.md +0 -58
- package/sdk/src/skills/reflexer.md +0 -73
- package/sdk/src/skills/safe.md +0 -56
- package/sdk/src/skills/seaport.md +0 -65
- package/sdk/src/skills/sommelier.md +0 -47
- package/sdk/src/skills/stader.md +0 -53
- package/sdk/src/skills/swell.md +0 -65
- package/sdk/src/skills/synapse.md +0 -63
- package/sdk/src/skills/synthra-v3.md +0 -57
- package/sdk/src/skills/thales.md +0 -74
- package/sdk/src/skills/tokemak.md +0 -48
- package/sdk/src/skills/uniswap-v3.md +0 -202
- package/sdk/src/skills/uniswap-v4.md +0 -125
- package/sdk/src/skills/unitflow-v3.md +0 -62
- package/sdk/src/skills/vertex.md +0 -55
- package/sdk/src/skills/wormhole.md +0 -76
- package/sdk/src/skills/zerox.md +0 -51
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sauce-distributed-swap
|
|
3
|
+
description: Writing a Sauce program that spreads one exact-input swap over several price-limited pools as a limit order, a limit buy that never pays more than a maximum price for any unit, fees included, and never strands input. Covers the rules (cover the venues that hold the pair, skip missing, empty and past-limit pools, a fee-adjusted limit per pool, minimum and average-price checks, refund only the unspent budget), one helper per pool with loops that only find pools, why no sorting is needed, a complete program over Aerodrome Slipstream and Uniswap V3 on Base, maxPrice for tokens of any decimals (an 8-decimal tokenized stock such as SPCXc), finding a token and its pools, the three rehearsals before sending, and more venues. Use when asked for a distributed, split or multi-venue swap, "swap across protocols", "buy up to a price", a limit order, a minimum-amount-out or max-average-price check, or one trade routed through several pools.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# A distributed swap: one limit order over several pools
|
|
7
|
+
|
|
8
|
+
The caller gives **one price: the most they pay for any unit, fees included**. Every pool trades
|
|
9
|
+
until its own price reaches that price, and the budget it does not take stays in the Pot for the
|
|
10
|
+
next pool. The price does the splitting: the program never computes an amount per pool and never
|
|
11
|
+
sorts.
|
|
12
|
+
|
|
13
|
+
To see a pair's pools before a swap (each venue's pools, fees, prices both ways and depth), run
|
|
14
|
+
`sauce pools --chain <chain> <tokenA> <tokenB> --config sauce.config.json`.
|
|
15
|
+
|
|
16
|
+
## The rules
|
|
17
|
+
|
|
18
|
+
A correct distributed swap, whatever its tokens, chain or venues:
|
|
19
|
+
|
|
20
|
+
1. **Covers the venues that hold the pair on the chain**, not every venue that exists. A venue's
|
|
21
|
+
pools are found through its factory, by namespace: `UniswapV3.Factory.getPool(a, b, fee)` per
|
|
22
|
+
fee tier, `AerodromeSlipstream.CLFactoryGaugesV3.getPool(a, b, tickSpacing)` per tick spacing.
|
|
23
|
+
`0` means no pool.
|
|
24
|
+
2. **Skips a missing pool, an empty one and one already past its own limit.** A pool with no
|
|
25
|
+
liquidity at its current price has nothing to sell there. A pool whose price is already at or
|
|
26
|
+
past its own limit has nothing to sell within it, and handed such a limit it reverts `SPL`,
|
|
27
|
+
which would revert the whole program.
|
|
28
|
+
3. **Gives each pool its own limit, adjusted for its fee.** A pool's price limit bounds its price,
|
|
29
|
+
and its fee comes on top: under the caller's price as it is, a 0.3% pool's last unit would cost
|
|
30
|
+
0.3% more. So each pool's limit is the caller's sqrt price moved toward the trade by
|
|
31
|
+
`√(1 − fee)`: **`limit ÷ √(1 − fee)` paying token0, `limit × √(1 − fee)` paying token1**. The
|
|
32
|
+
pool's last unit, fee paid, then costs exactly `maxPrice`, and every earlier unit less. The fee
|
|
33
|
+
is read from the pool: a Slipstream pool's is set per pool and changes over time.
|
|
34
|
+
4. **Offers each pool everything still unspent** and lets the limit stop it. These pools are paid
|
|
35
|
+
in their swap callback, and the Router pays exactly what the pool asks for: a pool that stops at
|
|
36
|
+
its limit takes less, and the rest is still in the Pot.
|
|
37
|
+
5. **Checks the total**: at least `minTokens` bought, and an average no dearer than `maxAvgPrice`.
|
|
38
|
+
6. **Refunds only what is left of the budget**, to `refundTo`: never the Pot's whole balance of
|
|
39
|
+
the token, which on an owner's Pot may hold more of it for other uses.
|
|
40
|
+
|
|
41
|
+
**One helper per pool; the loops only find pools.** Everything a pool needs, whatever its venue,
|
|
42
|
+
is the same: read it, skip it or work out its limit, swap. Write that once, as one function that
|
|
43
|
+
takes the pool, and let each venue's loop do nothing but look pools up and hand them over. A
|
|
44
|
+
function earns its place only with logic of its own used more than once; one that only wraps a
|
|
45
|
+
call adds nothing to read and costs a call frame of gas. Call bindings and library functions
|
|
46
|
+
directly where they are used.
|
|
47
|
+
|
|
48
|
+
- **Read a pool through its typed binding, called with the pool's address**:
|
|
49
|
+
`UniswapV3.Pool(pool).liquidity()`, or `AerodromeSlipstream.Pool(pool)` for a Slipstream pool,
|
|
50
|
+
whose `slot0` has no `feeProtocol`. The binding and the method are one expression; a binding is
|
|
51
|
+
not a value to keep in a variable. Take only the output you need, by name,
|
|
52
|
+
`.slot0().sqrtPriceX96`, or by position, `const [sqrtPriceX96] = UniswapV3.Pool(pool).slot0();`,
|
|
53
|
+
never all of them.
|
|
54
|
+
- **A function that returns a value returns it on every path**, or the program does not compile:
|
|
55
|
+
`` `trade` does not return on every path ``. End every early exit with `return 0n;`.
|
|
56
|
+
|
|
57
|
+
**Why no sorting.** A pool trades only while its price, after its fee, beats `maxPrice`, so every
|
|
58
|
+
unit any pool sells is within it, in any order. The order decides only which pool gets the budget
|
|
59
|
+
when it runs out before every pool reaches its limit: put the venue with the deepest, cheapest
|
|
60
|
+
pools first. With enough budget for every pool to reach its limit, every pool's last unit costs
|
|
61
|
+
the same, exactly `maxPrice`: the best split there is, whatever the order.
|
|
62
|
+
|
|
63
|
+
## The program
|
|
64
|
+
|
|
65
|
+
[examples/distributed-swap.sauce.ts](examples/distributed-swap.sauce.ts) is one complete
|
|
66
|
+
implementation of those rules, over Base's Aerodrome Slipstream and Uniswap V3 pools; its header
|
|
67
|
+
gives every input with its units and a command that buys SPCXc with USDC. Its code:
|
|
68
|
+
|
|
69
|
+
```sauce chain=base
|
|
70
|
+
import { uniswapV3 } from "@sauce/router";
|
|
71
|
+
|
|
72
|
+
// One pool, from either venue: skipped when missing, empty or already past its own limit, else
|
|
73
|
+
// offered all of the budget still unspent, up to its own limit. Returns what it bought.
|
|
74
|
+
// `slipstream` picks the pool's ABI: a Slipstream pool's slot0 has no feeProtocol.
|
|
75
|
+
function trade(
|
|
76
|
+
pool: Address,
|
|
77
|
+
slipstream: bool,
|
|
78
|
+
payToken: Address,
|
|
79
|
+
buyToken: Address,
|
|
80
|
+
kept: Uint256,
|
|
81
|
+
limit: Uint256,
|
|
82
|
+
recipient: Address,
|
|
83
|
+
): Uint256 {
|
|
84
|
+
const unspent = Token(payToken).balanceOf(ctx.self()) - kept;
|
|
85
|
+
if (pool == 0n || unspent == 0n) {
|
|
86
|
+
return 0n;
|
|
87
|
+
}
|
|
88
|
+
let liquidity = 0n;
|
|
89
|
+
let price = 0n;
|
|
90
|
+
let fee = 0n;
|
|
91
|
+
if (slipstream) {
|
|
92
|
+
liquidity = AerodromeSlipstream.Pool(pool).liquidity();
|
|
93
|
+
price = AerodromeSlipstream.Pool(pool).slot0().sqrtPriceX96;
|
|
94
|
+
fee = AerodromeSlipstream.Pool(pool).fee();
|
|
95
|
+
} else {
|
|
96
|
+
liquidity = UniswapV3.Pool(pool).liquidity();
|
|
97
|
+
price = UniswapV3.Pool(pool).slot0().sqrtPriceX96;
|
|
98
|
+
fee = UniswapV3.Pool(pool).fee();
|
|
99
|
+
}
|
|
100
|
+
// The pool's own limit: the caller's moved by √(1 − fee), so that its last unit, fee paid,
|
|
101
|
+
// costs exactly maxPrice. Paying token0 pushes the price down, token1 pushes it up.
|
|
102
|
+
const paysToken0 = payToken < buyToken;
|
|
103
|
+
const root = Math.sqrt((1000000n - fee) * 10n ** 30n); // √(1 − fee), times 1e18
|
|
104
|
+
const own = paysToken0
|
|
105
|
+
? Math.mulDiv(limit, 10n ** 18n, root)
|
|
106
|
+
: Math.mulDiv(limit, root, 10n ** 18n);
|
|
107
|
+
const better = paysToken0 ? price > own : price < own;
|
|
108
|
+
if (liquidity == 0n || !better) {
|
|
109
|
+
return 0n;
|
|
110
|
+
}
|
|
111
|
+
return uniswapV3(pool, payToken, buyToken, unspent, own, 0n, recipient);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function main(
|
|
115
|
+
payToken: Address,
|
|
116
|
+
buyToken: Address,
|
|
117
|
+
budget: Uint256,
|
|
118
|
+
maxPrice: Uint256,
|
|
119
|
+
minTokens: Uint256,
|
|
120
|
+
maxAvgPrice: Uint256,
|
|
121
|
+
recipient: Address,
|
|
122
|
+
refundTo: Address,
|
|
123
|
+
): bytes {
|
|
124
|
+
const self = ctx.self();
|
|
125
|
+
const pay = Token(payToken);
|
|
126
|
+
require(maxPrice > 0n, "maxPrice is 0");
|
|
127
|
+
require(pay.balanceOf(self) >= budget, "budget is not in the Pot");
|
|
128
|
+
const kept = pay.balanceOf(self) - budget; // the Pot's other payToken, never spent
|
|
129
|
+
let bought = 0n;
|
|
130
|
+
|
|
131
|
+
// maxPrice as a pool's sqrt price (token1 per token0, times 2^96): where a unit costs maxPrice.
|
|
132
|
+
let limit = Math.sqrt(Math.mulDiv(maxPrice, 1n << 192n, 10n ** 18n));
|
|
133
|
+
if (payToken < buyToken) {
|
|
134
|
+
limit = Math.sqrt(Math.mulDiv(1n << 192n, 10n ** 18n, maxPrice));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// The loops only find pools; trade() decides and swaps. Slipstream, keyed by tick spacing.
|
|
138
|
+
for (const spacing of [1n, 10n, 50n, 80n, 100n, 150n, 200n, 500n, 2000n]) {
|
|
139
|
+
const pool = AerodromeSlipstream.CLFactoryGaugesV3.getPool(payToken, buyToken, spacing);
|
|
140
|
+
bought += trade(pool, true, payToken, buyToken, kept, limit, recipient);
|
|
141
|
+
}
|
|
142
|
+
// Uniswap V3, keyed by fee tier: the seven Base's factory enables.
|
|
143
|
+
for (const fee of [100n, 200n, 300n, 400n, 500n, 3000n, 10000n]) {
|
|
144
|
+
const pool = UniswapV3.Factory.getPool(payToken, buyToken, fee);
|
|
145
|
+
bought += trade(pool, false, payToken, buyToken, kept, limit, recipient);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Settle: what was bought is already with the recipient; what is left of the budget goes back.
|
|
149
|
+
const unspent = pay.balanceOf(self) - kept;
|
|
150
|
+
const spent = budget - unspent;
|
|
151
|
+
require(bought >= minTokens, "bought below minTokens");
|
|
152
|
+
require(maxAvgPrice == 0n || spent * 10n ** 18n <= maxAvgPrice * bought, "average too high");
|
|
153
|
+
if (unspent > 0n) {
|
|
154
|
+
pay.transfer(refundTo, unspent);
|
|
155
|
+
}
|
|
156
|
+
return abi.encode(spent, bought, unspent);
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Step by step:
|
|
161
|
+
|
|
162
|
+
- **Inputs.** Everything that changes per trade is a `main` parameter, passed with `--args`: the
|
|
163
|
+
two tokens, the budget, `maxPrice`, the two checks and the two addresses. The program names no
|
|
164
|
+
token, so one file buys any token with any other.
|
|
165
|
+
- **The budget.** It must already be in the Pot (`sauce run --fund` pulls it in with the cook).
|
|
166
|
+
`kept` is whatever else of `payToken` the Pot holds, so only the budget is ever offered or
|
|
167
|
+
refunded.
|
|
168
|
+
- **`maxPrice` as a sqrt price.** `maxPrice` is payToken per buyToken; a pool's `sqrtPriceX96` is
|
|
169
|
+
the square root of token1 per token0 (token0 is the lower address), times 2^96. Paying token1,
|
|
170
|
+
`limit` is `√(maxPrice × 2^192 ÷ 1e18)`; paying token0, the price is upside down,
|
|
171
|
+
`√(2^192 × 1e18 ÷ maxPrice)`. `Math.mulDiv` keeps the full product before dividing.
|
|
172
|
+
- **The loops** look the pair up on Slipstream's `CLFactoryGaugesV3`, one pool per tick spacing,
|
|
173
|
+
then on Uniswap V3's factory, one per fee tier, and hand each pool to `trade`. Slipstream comes
|
|
174
|
+
first: for the pair this program is written for, its pool is the deep one.
|
|
175
|
+
- **`trade`** reads what is left of the budget and returns `0n` for a missing pool or an empty
|
|
176
|
+
budget, so a missing pool is never read. It reads the pool's liquidity, price and fee through the
|
|
177
|
+
venue's binding (`slipstream` says which), works out the pool's own limit, returns `0n` for an
|
|
178
|
+
empty pool or one whose price is not better than that limit, and otherwise swaps. Paying token0
|
|
179
|
+
pushes the price down; paying token1 pushes it up. The root is rounded down, so each limit sits a
|
|
180
|
+
hair inside the exact one: the pool stops a little sooner, never later.
|
|
181
|
+
- **Swap.** `uniswapV3` swaps through the Pot's Router, exact input, with the pool's own limit and
|
|
182
|
+
no floor of its own (`0n`): the totals are checked once, after both loops. A Slipstream pool
|
|
183
|
+
speaks Uniswap V3's swap and callback, so the same function drives it. The output goes straight
|
|
184
|
+
to `recipient`, and `uniswapV3` returns what it received.
|
|
185
|
+
- **Settle.** A `require` reverts the whole cook, every swap included. What is left of the budget
|
|
186
|
+
goes to `refundTo`. `main` returns `abi.encode(spent, bought, unspent)`, which the cook returns
|
|
187
|
+
as 96 bytes, one 32-byte word each.
|
|
188
|
+
|
|
189
|
+
**The chains it compiles on.** Each venue is a namespace contract, and naming one a chain lacks is a
|
|
190
|
+
compile error (`Contract 'CLFactoryGaugesV3' (aerodrome-slipstream) is not deployed on
|
|
191
|
+
'ethereum'`). `AerodromeSlipstream.CLFactoryGaugesV3` is on Base alone, so this program compiles for
|
|
192
|
+
Base. For another chain, write the loops for the venues that chain has: Ethereum has
|
|
193
|
+
`UniswapV3.Factory` and no Slipstream, so the Uniswap V3 loop alone.
|
|
194
|
+
|
|
195
|
+
## The token and its pools
|
|
196
|
+
|
|
197
|
+
**The token by its name.** `npx sauce globals --chain base` lists every token a program on Base can
|
|
198
|
+
name, tokenized stocks included, each with its address and decimals: SPCXc is Coinbase's
|
|
199
|
+
tokenized SpaceX, `0xb2000000000000000000007b9fcbd005511aCBd5`, 8 decimals. The same lists are in
|
|
200
|
+
[../sauce-globals/references/tokens.md](../sauce-globals/references/tokens.md) and
|
|
201
|
+
[../sauce-globals/references/stocks.md](../sauce-globals/references/stocks.md). A token the
|
|
202
|
+
registry does not name comes from the user or its issuer, never from a search summary, and is
|
|
203
|
+
checked on chain before use: its `name()`, `symbol()` and `decimals()`. Decimals decide
|
|
204
|
+
`maxPrice`.
|
|
205
|
+
|
|
206
|
+
**The venues that hold the pair.** On Base, the price-limited venues are Aerodrome Slipstream's
|
|
207
|
+
three CL factories (`AerodromeSlipstream.CLFactory`, `.CLFactoryGaugeCaps`, `.CLFactoryGaugesV3`),
|
|
208
|
+
Uniswap V3, PancakeSwap V3 and Uniswap V4. Look the pair up before writing the loops: a one-line
|
|
209
|
+
program rehearsed with `sauce simulate` prints what `main` returns, a pool's address (`0` for none)
|
|
210
|
+
or its liquidity.
|
|
211
|
+
|
|
212
|
+
```sauce chain=base
|
|
213
|
+
// The pair's Slipstream pool at one tick spacing on one factory; 0 when there is none.
|
|
214
|
+
function main(a: Address, b: Address, spacing: Uint256): Address {
|
|
215
|
+
return AerodromeSlipstream.CLFactoryGaugesV3.getPool(a, b, spacing);
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Read on chain on 2026-10-01: SPCXc against USDC had its deep pool on `CLFactoryGaugesV3` at tick
|
|
220
|
+
spacing 10 (fee 0.05%) and a Uniswap V3 pool at 1%, which is why the program covers those two
|
|
221
|
+
venues.
|
|
222
|
+
|
|
223
|
+
## Inputs and units
|
|
224
|
+
|
|
225
|
+
`main(payToken, buyToken, budget, maxPrice, minTokens, maxAvgPrice, recipient, refundTo)`, every
|
|
226
|
+
amount in a token's base units: on Base USDC has 6 decimals, WETH 18 and SPCXc 8, so `1000000000` is
|
|
227
|
+
1,000 USDC and `660000000` is 6.6 SPCXc.
|
|
228
|
+
|
|
229
|
+
**`maxPrice`** is payToken base units per buyToken base unit, times 1e18:
|
|
230
|
+
|
|
231
|
+
`maxPrice = price × 10^(18 + payDecimals − buyDecimals)`, with `price` in whole payToken per whole
|
|
232
|
+
buyToken. Paying USDC (6), that is the price × 10^16 for SPCXc (8) and × 10^6 for WETH (18).
|
|
233
|
+
|
|
234
|
+
| Trade | Price | `maxPrice` |
|
|
235
|
+
| ----------------------------------------- | --------------------- | ------------------------------- |
|
|
236
|
+
| Buy SPCXc with USDC | at most 150 USDC | **1500000000000000000** |
|
|
237
|
+
| Buy WETH with USDC | at most 2,713.5 USDC | **2713500000** |
|
|
238
|
+
| Buy USDC with WETH (sell WETH at a floor) | at least 2,686.5 USDC | **372231528010422482784291829** |
|
|
239
|
+
|
|
240
|
+
The last is the same order seen from the other side: 1 WETH for at least 2,686.5 USDC is at most
|
|
241
|
+
`1 ÷ 2,686.5` WETH per USDC, so `10^18 × 1e18 ÷ (2,686.5 × 10^6)`, rounded down. `maxAvgPrice` is
|
|
242
|
+
in the same units; `0` turns it off.
|
|
243
|
+
|
|
244
|
+
**Each pool's own limit.** On Base WETH is token0 (the lower address) and USDC token1. The
|
|
245
|
+
program's arithmetic, back in USDC per WETH: the price at which that pool's last unit, after its
|
|
246
|
+
fee, costs exactly `maxPrice`.
|
|
247
|
+
|
|
248
|
+
| Fee | Buying WETH at most 2,713.5, the pool stops at | Selling WETH at least 2,686.5, the pool stops at |
|
|
249
|
+
| ----------- | ---------------------------------------------- | ------------------------------------------------ |
|
|
250
|
+
| 100 (0.01%) | 2,713.23 | 2,686.77 |
|
|
251
|
+
| 500 (0.05%) | 2,712.14 | 2,687.84 |
|
|
252
|
+
| 3000 (0.3%) | 2,705.36 | 2,694.58 |
|
|
253
|
+
| 10000 (1%) | 2,686.36 | 2,713.64 |
|
|
254
|
+
|
|
255
|
+
So buying at most 2,713.5, a 1% pool trades only while its own price is below 2,686.36: a pool
|
|
256
|
+
whose fee alone puts it past `maxPrice` sits out. As sqrt prices, 2,713.5 USDC per WETH is
|
|
257
|
+
**4127095293177970497328754** and 2,686.5 is **4106511148422261116904015**, the limits the program
|
|
258
|
+
derives from those two `maxPrice` values. `sauce price --chain base WETH USDC 2713.5` prints a
|
|
259
|
+
price's `sqrtPriceX96`, and `--sqrt-price-x96 <value>` reads a pool's back as a price.
|
|
260
|
+
|
|
261
|
+
## Getting the price right
|
|
262
|
+
|
|
263
|
+
`maxPrice` is the one number that protects the trade. Set it from the market, close to it.
|
|
264
|
+
|
|
265
|
+
- **The reference is the best price a buyer pays, fee included, among pools deep enough for the
|
|
266
|
+
order.** Paying token1, a pool's price after its fee is its price divided by `1 − fee`; paying
|
|
267
|
+
token0, the same upside down. Not a pool with no liquidity, whose price is stale, and not the
|
|
268
|
+
deepest pool's mid price: a pool's mid sits up to its fee away from the cheap pools.
|
|
269
|
+
- **`maxPrice` is that reference plus the slippage you accept**, on the price itself: 0.5% above
|
|
270
|
+
2,700 USDC per WETH is 2,713.5, and a WETH sold for at least 0.5% below it is 2,686.5.
|
|
271
|
+
- **Keep it tight.** A loose `maxPrice` reaches the thin, dear pools too, and they fill in loop
|
|
272
|
+
order. A `maxPrice` at or below the best price any pool offers trades nothing and refunds the
|
|
273
|
+
whole budget, without reverting.
|
|
274
|
+
|
|
275
|
+
**`minTokens`, consistent with `maxPrice`.** Every unit costs `maxPrice` or less, so spending the
|
|
276
|
+
whole budget buys at least `budget × 1e18 ÷ maxPrice`:
|
|
277
|
+
|
|
278
|
+
- **To spend all of the budget or nothing**: `minTokens = budget × 1e18 ÷ maxPrice`, rounded up.
|
|
279
|
+
Buying WETH with 3,000 USDC at most 2,713.5: `1105583195135433942`. When the pools cannot take
|
|
280
|
+
all of it within `maxPrice`, the cook reverts.
|
|
281
|
+
- **To buy as much as fills within `maxPrice`**: `minTokens` is the least worth the gas, or `0`, and
|
|
282
|
+
the rest of the budget comes back.
|
|
283
|
+
- **`maxAvgPrice`** caps the average whatever the fill size: set it between the reference and
|
|
284
|
+
`maxPrice`. At `maxPrice` itself it adds nothing the per-pool limits do not already guarantee.
|
|
285
|
+
|
|
286
|
+
## Running it
|
|
287
|
+
|
|
288
|
+
The budget must be in the Pot before the program runs: send it there from any wallet, or let
|
|
289
|
+
`sauce run --fund` pull it from the signer in the same cook (`sauce-cli`). **Rehearse three times
|
|
290
|
+
before sending**, with no key and nothing sent: the trade as meant, one with `minTokens` above what
|
|
291
|
+
fills, which reverts `bought below minTokens`, and one with `maxAvgPrice` below the average, which
|
|
292
|
+
reverts `average too high`. That shows both checks work. Buying SPCXc with 1,000 USDC at most 150
|
|
293
|
+
each, with the price near 148.8 on 2026-10-01:
|
|
294
|
+
|
|
295
|
+
```sh
|
|
296
|
+
npx sauce simulate distributed-swap.sauce.ts --chain base --owner <address> \
|
|
297
|
+
--config sauce.config.json --assume-balance USDC:1000 \
|
|
298
|
+
--args 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0xb2000000000000000000007b9fcbd005511aCBd5 \
|
|
299
|
+
1000000000 1500000000000000000 660000000 1495000000000000000 <recipient> <refundTo>
|
|
300
|
+
npx sauce simulate distributed-swap.sauce.ts --chain base --owner <address> \
|
|
301
|
+
--config sauce.config.json --assume-balance USDC:1000 \
|
|
302
|
+
--args 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0xb2000000000000000000007b9fcbd005511aCBd5 \
|
|
303
|
+
1000000000 1500000000000000000 1000000000 1495000000000000000 <recipient> <refundTo>
|
|
304
|
+
npx sauce simulate distributed-swap.sauce.ts --chain base --owner <address> \
|
|
305
|
+
--config sauce.config.json --assume-balance USDC:1000 \
|
|
306
|
+
--args 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0xb2000000000000000000007b9fcbd005511aCBd5 \
|
|
307
|
+
1000000000 1500000000000000000 660000000 1400000000000000000 <recipient> <refundTo>
|
|
308
|
+
npx sauce run distributed-swap.sauce.ts --chain base --config sauce.config.json \
|
|
309
|
+
--keystore <keystore> --fund USDC:1000 --fund-mode permit \
|
|
310
|
+
--args 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0xb2000000000000000000007b9fcbd005511aCBd5 \
|
|
311
|
+
1000000000 1500000000000000000 660000000 1495000000000000000 <recipient> <refundTo>
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
The second asks for 10 SPCXc, more than 1,000 USDC buys at 150; the third caps the average at 140,
|
|
315
|
+
below the market. Each is one cook on the owner's Pot: `sauce tx` with the same `--args` and
|
|
316
|
+
`--owner <address>` prints it unsigned, `{ chainId, to, data, value }`, for any signer to send
|
|
317
|
+
instead. SPCXc is built into the Base node, so rehearse against Base itself, not a local copy of
|
|
318
|
+
the chain.
|
|
319
|
+
|
|
320
|
+
For the initial release the swap is sent only on Ethereum or Base: on a preview chain such as
|
|
321
|
+
Arbitrum or Optimism a program compiles and simulates, and `sauce tx` and `sauce run` refuse it
|
|
322
|
+
with the chain-support request to post (`sauce-chains`).
|
|
323
|
+
|
|
324
|
+
**Reading a rehearsal.** `sauce simulate` prints what `main` returned and what the cook moved.
|
|
325
|
+
Buying WETH with 2,000 USDC over two pools, pool addresses as `<pool A>` and `<pool B>`:
|
|
326
|
+
|
|
327
|
+
```text
|
|
328
|
+
The cook succeeds from <owner>: gas used 642327, returns <96 bytes>
|
|
329
|
+
Token transfers:
|
|
330
|
+
0.167790241413064662 WETH: <pool A> -> <Pot> (the Pot)
|
|
331
|
+
455.100231 USDC: <Pot> (the Pot) -> <pool A>
|
|
332
|
+
0.167790241413064662 WETH: <Pot> (the Pot) -> <recipient>
|
|
333
|
+
0.570768248770730456 WETH: <pool B> -> <Pot> (the Pot)
|
|
334
|
+
1544.899769 USDC: <Pot> (the Pot) -> <pool B>
|
|
335
|
+
0.570768248770730456 WETH: <Pot> (the Pot) -> <recipient>
|
|
336
|
+
Net balance changes:
|
|
337
|
+
<pool A>: -0.167790241413064662 WETH, +455.100231 USDC
|
|
338
|
+
<Pot> (the Pot): -2000 USDC
|
|
339
|
+
<recipient>: +0.738558490183795118 WETH
|
|
340
|
+
<pool B>: -0.570768248770730456 WETH, +1544.899769 USDC
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
- **The 96 bytes after `returns`** are three words: `spent` (here 2,000 USDC), `bought`
|
|
344
|
+
(0.738558490183795118 WETH) and `unspent` (0).
|
|
345
|
+
- **Each pool that traded** took payToken and gave buyToken. A pool you expected and do not see
|
|
346
|
+
sat out: missing, empty, already past its limit, or the budget ran out first.
|
|
347
|
+
- **A partial fill** ends with one more transfer: what is left of the budget, from the Pot to
|
|
348
|
+
`refundTo`.
|
|
349
|
+
- **The average** is `spent ÷ bought` in whole tokens (2,708.0 USDC per WETH here), to compare with
|
|
350
|
+
`maxPrice` before sending.
|
|
351
|
+
|
|
352
|
+
**Gas.** Measured on a local chain against real Uniswap V3 pools: about 640,000 gas for the cook with
|
|
353
|
+
two pools swapped and no initialized tick crossed. Discovery is 16 lookups, nine tick spacings and
|
|
354
|
+
seven fee tiers; each pool found adds its reads; every initialized tick a swap crosses adds to its
|
|
355
|
+
swap. The gas is the same on any chain; what it costs is the chain's gas price.
|
|
356
|
+
|
|
357
|
+
## More venues
|
|
358
|
+
|
|
359
|
+
Each venue is one more loop that finds pools and hands them to `trade`; a venue whose pools read
|
|
360
|
+
differently gets its branch in `trade`.
|
|
361
|
+
|
|
362
|
+
- **Base's other Slipstream factories**, `AerodromeSlipstream.CLFactory` and
|
|
363
|
+
`AerodromeSlipstream.CLFactoryGaugeCaps`, each with pools of their own (Base's WETH/USDC
|
|
364
|
+
Slipstream pools are on `CLFactory`). A pair can have a pool at the same tick spacing under each,
|
|
365
|
+
with its own fee. A singleton binding takes another address too, so one loop can walk all three:
|
|
366
|
+
`for (const factory of [AerodromeSlipstream.CLFactory, AerodromeSlipstream.CLFactoryGaugeCaps, AerodromeSlipstream.CLFactoryGaugesV3])`
|
|
367
|
+
and `AerodromeSlipstream.CLFactory.at(factory).getPool(a, b, spacing)`.
|
|
368
|
+
- **PancakeSwap V3**: `PancakeswapV3.Factory.getPool(a, b, fee)`, tiers 100, 500, 2500 and 10000,
|
|
369
|
+
swapped with the same `uniswapV3`.
|
|
370
|
+
- **Uniswap V4, hookless**: a pool is a key, `{ currency0, currency1, fee, tickSpacing, hooks }`,
|
|
371
|
+
with no address and no factory to ask. Its id is
|
|
372
|
+
`crypto.keccak256(abi.encode(currency0, currency1, fee, tickSpacing, 0n))`, and
|
|
373
|
+
`UniswapV4.StateView.getLiquidity(id)` and `UniswapV4.StateView.getSlot0(id)` read it. Its fee is
|
|
374
|
+
the LP fee plus any protocol fee for the direction (`getSlot0`'s `protocolFee` holds paying
|
|
375
|
+
token0's in its low 12 bits and paying token1's in the next 12; the swap fee is
|
|
376
|
+
`protocolFee + lpFee - protocolFee * lpFee / 1000000`). Swapped with
|
|
377
|
+
`uniswapV4(UniswapV4.PoolManager, payToken, buyToken, amount, fee, tickSpacing, 0n, limit, 0n, recipient)`.
|
|
378
|
+
- **Not here**: pools with no price limit (V2-style pairs, Curve, Balancer, DODO, Trader Joe LB,
|
|
379
|
+
WOOFi) fill in full at whatever price, and Maverick V2 bounds by tick, not by sqrt price.
|
|
380
|
+
|
|
381
|
+
## Before sending
|
|
382
|
+
|
|
383
|
+
- `maxPrice` is the best fee-inclusive price among pools with liquidity plus the slippage you
|
|
384
|
+
accept, in payToken base units per buyToken base unit, times 1e18: `10^(18 + payDecimals −
|
|
385
|
+
buyDecimals)` times the price.
|
|
386
|
+
- `minTokens` follows the recipe: `budget × 1e18 ÷ maxPrice` to spend everything, less to accept a
|
|
387
|
+
partial fill.
|
|
388
|
+
- Three rehearsals: the trade, a `minTokens` revert and a `maxAvgPrice` revert.
|
|
389
|
+
|
|
390
|
+
[examples/distributed-swap.mts](examples/distributed-swap.mts) compiles the program for Base and
|
|
391
|
+
pins this page to it: the code above, the venues, `maxPrice` and the limits it gives, each pool's
|
|
392
|
+
own limit, `minTokens`, and the commands' arguments.
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// Compiles distributed-swap.sauce.ts for Base the way `sauce compile` does, and builds the cooks
|
|
2
|
+
// `sauce tx` would print for buying SPCXc with 1,000 USDC at most 150 each and selling WETH for
|
|
3
|
+
// USDC at least 2,686.5 each. Checks that the SKILL.md shows the program's own code, and that its
|
|
4
|
+
// venues, `maxPrice` values, the limits the program derives from them, each pool's own limit,
|
|
5
|
+
// `minTokens`, the compile error on a chain without a venue, and the arguments of its commands (and
|
|
6
|
+
// the program header's) are what the program and the arithmetic give. Asserts what can be checked
|
|
7
|
+
// offline; sends nothing.
|
|
8
|
+
//
|
|
9
|
+
// node distributed-swap.mts --owner <Pot owner> --recipient <address>
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
priceFromSqrtPriceX96,
|
|
14
|
+
routes,
|
|
15
|
+
sqrtPriceX96FromPrice,
|
|
16
|
+
v12PredictPot,
|
|
17
|
+
} from "@eco-incorp/sauce";
|
|
18
|
+
import { resolveSdkModule } from "@eco-incorp/sauce/compiler";
|
|
19
|
+
import { v12EngineAddress } from "@eco-incorp/sauce/deployments";
|
|
20
|
+
import { v12Pot } from "@eco-incorp/sauce/evm/engine";
|
|
21
|
+
import { bytesToHex, concatHex, getAddress } from "viem";
|
|
22
|
+
|
|
23
|
+
type Address = `0x${string}`;
|
|
24
|
+
function address(name: string): Address {
|
|
25
|
+
const i = process.argv.indexOf(`--${name}`);
|
|
26
|
+
const value = i === -1 ? undefined : process.argv[i + 1];
|
|
27
|
+
if (value === undefined || !/^0x[0-9a-fA-F]{40}$/.test(value))
|
|
28
|
+
throw new Error(`pass --${name} <address>`);
|
|
29
|
+
return getAddress(value);
|
|
30
|
+
}
|
|
31
|
+
function check(condition: unknown, message: string): asserts condition {
|
|
32
|
+
if (!condition) throw new Error(`check failed: ${message}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const owner = address("owner"); // who owns the Pot and sends the cook
|
|
36
|
+
const recipient = address("recipient");
|
|
37
|
+
const pot = v12PredictPot(owner); // the owner's Pot (`sauce pot --owner <owner>` prints the same)
|
|
38
|
+
const engine = getAddress(v12EngineAddress());
|
|
39
|
+
const source = readFileSync(new URL("./distributed-swap.sauce.ts", import.meta.url), "utf8");
|
|
40
|
+
const skill = readFileSync(new URL("../SKILL.md", import.meta.url), "utf8");
|
|
41
|
+
|
|
42
|
+
// The SKILL.md shows the program's code exactly: the file less its header comment.
|
|
43
|
+
const code = source.slice(source.indexOf("import "));
|
|
44
|
+
const shown = /```sauce chain=[\w,]+\n([\s\S]*?)```/.exec(skill);
|
|
45
|
+
check(shown !== null && shown[1] === code, "the SKILL.md's program is the example file's code");
|
|
46
|
+
|
|
47
|
+
// The Router takes a price limit on the flat V3 entry and services the pool's callback, which
|
|
48
|
+
// Uniswap V3 and Slipstream pools both make.
|
|
49
|
+
interface AbiFunction {
|
|
50
|
+
name: string;
|
|
51
|
+
inputs: { name: string }[];
|
|
52
|
+
}
|
|
53
|
+
const served = resolveSdkModule("./artifacts/ISauceRouter.json");
|
|
54
|
+
if (served === undefined) throw new Error("the SDK serves ISauceRouter.json");
|
|
55
|
+
const parsed = JSON.parse(new TextDecoder().decode(served)) as
|
|
56
|
+
AbiFunction[] | { abi: AbiFunction[] };
|
|
57
|
+
const router = Array.isArray(parsed) ? parsed : parsed.abi;
|
|
58
|
+
check(
|
|
59
|
+
router.some((f) => f.name === "swapV3" && f.inputs.some((i) => i.name === "sqrtPriceLimitX96")),
|
|
60
|
+
"swapV3 takes sqrtPriceLimitX96",
|
|
61
|
+
);
|
|
62
|
+
check(
|
|
63
|
+
router.some((f) => f.name === "uniswapV3SwapCallback"),
|
|
64
|
+
"the Router implements uniswapV3SwapCallback",
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
// Every pool read is a typed binding, never a selector: Uniswap V3's, and Slipstream's own, with
|
|
68
|
+
// the fee read from the pool. One helper, `trade`, serves every pool; the loops only find pools.
|
|
69
|
+
check(!/evm\.static|hex`/.test(code), "the program reads no pool by selector");
|
|
70
|
+
for (const venue of ["UniswapV3", "AerodromeSlipstream"])
|
|
71
|
+
for (const read of ["liquidity()", "slot0().sqrtPriceX96", "fee()"])
|
|
72
|
+
check(code.includes(`${venue}.Pool(pool).${read}`), `the program reads ${venue} ${read}`);
|
|
73
|
+
check(code.match(/^function /gm)?.length === 2, "the program has trade and main, nothing else");
|
|
74
|
+
check(code.match(/trade\(pool, (true|false), /g)?.length === 2, "each venue's loop calls trade");
|
|
75
|
+
|
|
76
|
+
// The venues it walks: Slipstream's nine spacings, then the seven tiers Base's Uniswap V3 factory
|
|
77
|
+
// enables, 16 lookups.
|
|
78
|
+
const TIERS = [100n, 200n, 300n, 400n, 500n, 3000n, 10000n];
|
|
79
|
+
const SPACINGS = [1n, 10n, 50n, 80n, 100n, 150n, 200n, 500n, 2000n];
|
|
80
|
+
const list = (xs: bigint[]) => `[${xs.map((x) => `${x}n`).join(", ")}]`;
|
|
81
|
+
check(code.includes(`for (const spacing of ${list(SPACINGS)})`), "the program walks nine spacings");
|
|
82
|
+
check(code.includes(`for (const fee of ${list(TIERS)})`), "and Base's seven tiers");
|
|
83
|
+
check(
|
|
84
|
+
code.indexOf("CLFactoryGaugesV3.getPool") < code.indexOf("UniswapV3.Factory.getPool"),
|
|
85
|
+
"Slipstream, the pair's deep venue, comes first",
|
|
86
|
+
);
|
|
87
|
+
check(
|
|
88
|
+
skill.includes(`Discovery is ${TIERS.length + SPACINGS.length} lookups`),
|
|
89
|
+
"the skill counts the lookups",
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
function isqrt(n: bigint) {
|
|
93
|
+
if (n < 2n) return n;
|
|
94
|
+
let x = n;
|
|
95
|
+
let y = (x + 1n) / 2n;
|
|
96
|
+
while (y < x) [x, y] = [y, (y + n / y) / 2n];
|
|
97
|
+
return x;
|
|
98
|
+
}
|
|
99
|
+
const E18 = 10n ** 18n;
|
|
100
|
+
const Q192 = 2n ** 192n;
|
|
101
|
+
// A decimal price rounded to two places, as the skill writes it: 2686.774… is 2,686.77.
|
|
102
|
+
const two = (price: string) => {
|
|
103
|
+
const [whole, fraction = ""] = price.split(".");
|
|
104
|
+
const thousandths = BigInt(whole!) * 1000n + BigInt(fraction.padEnd(3, "0").slice(0, 3));
|
|
105
|
+
const hundredths = (thousandths + 5n) / 10n;
|
|
106
|
+
return `${(hundredths / 100n).toLocaleString("en-US")}.${String(hundredths % 100n).padStart(2, "0")}`;
|
|
107
|
+
};
|
|
108
|
+
// A table row of the skill, by its cells, whatever their padding.
|
|
109
|
+
const escape = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
110
|
+
const row = (...cells: string[]) =>
|
|
111
|
+
new RegExp(`^\\|${cells.map((cell) => ` *${escape(cell)} *`).join("\\|")}\\|$`, "m");
|
|
112
|
+
|
|
113
|
+
// The program's arithmetic, in TypeScript: maxPrice to a sqrt price, then each pool's own limit.
|
|
114
|
+
const limitOf = (maxPrice: bigint, paysToken0: boolean) =>
|
|
115
|
+
paysToken0 ? isqrt((Q192 * E18) / maxPrice) : isqrt((maxPrice * Q192) / E18);
|
|
116
|
+
const poolLimit = (limit: bigint, fee: bigint, paysToken0: boolean) => {
|
|
117
|
+
const root = isqrt((1_000_000n - fee) * 10n ** 30n);
|
|
118
|
+
return paysToken0 ? (limit * E18) / root : (limit * root) / E18;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const chain = routes.chain("base").chain;
|
|
122
|
+
const program = routes.compileSauceProgram("base", source);
|
|
123
|
+
check(
|
|
124
|
+
/import \{ uniswapV3 \} from "@sauce\/router"/.test(program.source),
|
|
125
|
+
"every swap is a @sauce/router call",
|
|
126
|
+
);
|
|
127
|
+
check(
|
|
128
|
+
/__sauce_transfer\(pay, refundTo, unspent\)/.test(program.source),
|
|
129
|
+
"the refund is a SafeERC20 transfer of what is left of the budget",
|
|
130
|
+
);
|
|
131
|
+
// On a chain without Slipstream's factory, naming it is the compile error the skill quotes.
|
|
132
|
+
let refused = "";
|
|
133
|
+
try {
|
|
134
|
+
routes.compileSauceProgram("ethereum", source);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
refused = String(error);
|
|
137
|
+
}
|
|
138
|
+
const quoted = "Contract 'CLFactoryGaugesV3' (aerodrome-slipstream) is not deployed on 'ethereum'";
|
|
139
|
+
check(refused.includes(quoted), `Ethereum refuses the Slipstream venue: ${refused}`);
|
|
140
|
+
check(skill.replace(/\s+/g, " ").includes(quoted), "the skill quotes that error");
|
|
141
|
+
|
|
142
|
+
const registered = (symbol: string) => {
|
|
143
|
+
const token = routes.TOKEN_REGISTRY[chain.id]!.find((t) => t.symbol === symbol)!;
|
|
144
|
+
return { ...token, address: getAddress(token.address) };
|
|
145
|
+
};
|
|
146
|
+
const weth = registered("WETH");
|
|
147
|
+
const usdc = registered("USDC");
|
|
148
|
+
check(BigInt(weth.address) < BigInt(usdc.address), "on Base, WETH is token0");
|
|
149
|
+
const tokens = { baseDecimals: weth.decimals, quoteDecimals: usdc.decimals, baseIsToken0: true };
|
|
150
|
+
|
|
151
|
+
// SPCXc, Coinbase's tokenized SpaceX on Base: a token global, with 8 decimals.
|
|
152
|
+
const spcxc = registered("SPCXc");
|
|
153
|
+
check(spcxc.decimals === 8, "SPCXc has 8 decimals");
|
|
154
|
+
check(skill.includes(spcxc.address) && source.includes(spcxc.address), "both name SPCXc's address");
|
|
155
|
+
|
|
156
|
+
// maxPrice: the price in whole tokens times 10^(18 + payDecimals - buyDecimals).
|
|
157
|
+
const buyWeth = (27135n * 10n ** BigInt(18 + usdc.decimals - weth.decimals)) / 10n; // 2,713.5
|
|
158
|
+
const buySpcxc = 150n * 10n ** BigInt(18 + usdc.decimals - spcxc.decimals); // 150 USDC
|
|
159
|
+
const avgSpcxc = (1495n * 10n ** BigInt(18 + usdc.decimals - spcxc.decimals)) / 10n; // 149.5
|
|
160
|
+
const capSpcxc = 140n * 10n ** BigInt(18 + usdc.decimals - spcxc.decimals); // 140, below the market
|
|
161
|
+
const sellWeth = (E18 * E18 * 10n) / (26865n * 10n ** BigInt(usdc.decimals)); // 1 ÷ 2,686.5
|
|
162
|
+
check(10n ** BigInt(18 + usdc.decimals - spcxc.decimals) === 10n ** 16n, "SPCXc's scale is 1e16");
|
|
163
|
+
check(buyWeth === 2_713_500_000n, "maxPrice buying WETH at most 2,713.5 USDC");
|
|
164
|
+
check(buySpcxc === 1_500_000_000_000_000_000n, "maxPrice buying SPCXc at most 150 USDC");
|
|
165
|
+
check(sellWeth === 372231528010422482784291829n, "maxPrice selling WETH at least 2,686.5 USDC");
|
|
166
|
+
for (const value of [buyWeth, buySpcxc, sellWeth])
|
|
167
|
+
check(skill.includes(String(value)), `the skill quotes ${value}`);
|
|
168
|
+
|
|
169
|
+
// The limits the program derives from those are the pool prices at 2,713.5 and 2,686.5.
|
|
170
|
+
const ceiling = limitOf(buyWeth, false); // paying USDC, token1
|
|
171
|
+
const floor = limitOf(sellWeth, true); // paying WETH, token0
|
|
172
|
+
check(ceiling === sqrtPriceX96FromPrice("2713.5", tokens), "2,713.5 as the program's limit");
|
|
173
|
+
const exactFloor = sqrtPriceX96FromPrice("2686.5", tokens);
|
|
174
|
+
check(floor - exactFloor <= 1n, "2,686.5 as the program's limit, maxPrice rounded down");
|
|
175
|
+
for (const value of [ceiling, exactFloor])
|
|
176
|
+
check(skill.includes(String(value)), `the skill quotes ${value}`);
|
|
177
|
+
|
|
178
|
+
// Each pool's own limit, back as a price, is the skill's table, the four standard tiers; the pool's
|
|
179
|
+
// last unit there, after its fee, costs maxPrice: at it or inside it, to 0.001%.
|
|
180
|
+
for (const fee of [100n, 500n, 3000n, 10000n]) {
|
|
181
|
+
const buying = poolLimit(ceiling, fee, false);
|
|
182
|
+
const selling = poolLimit(floor, fee, true);
|
|
183
|
+
const cells = [
|
|
184
|
+
`${fee} (${Number(fee) / 10_000}%)`,
|
|
185
|
+
two(priceFromSqrtPriceX96(buying, tokens)),
|
|
186
|
+
two(priceFromSqrtPriceX96(selling, tokens)),
|
|
187
|
+
];
|
|
188
|
+
check(row(...cells).test(skill), `the skill's row for fee ${fee}: ${cells.join(" | ")}`);
|
|
189
|
+
// Paying token1: a token0 costs price ÷ (1 − fee), at most maxPrice.
|
|
190
|
+
const boughtAt = buying * buying * 1_000_000n * E18;
|
|
191
|
+
const buyBound = buyWeth * Q192 * (1_000_000n - fee);
|
|
192
|
+
check(boughtAt <= buyBound && boughtAt * 100_001n >= buyBound * 100_000n, `fee ${fee}: buying`);
|
|
193
|
+
// Paying token0: a token1 costs 1 ÷ (price × (1 − fee)), at most maxPrice.
|
|
194
|
+
const soldAt = Q192 * 1_000_000n * E18;
|
|
195
|
+
const sellBound = sellWeth * selling * selling * (1_000_000n - fee);
|
|
196
|
+
check(soldAt <= sellBound && soldAt * 100_001n >= sellBound * 100_000n, `fee ${fee}: selling`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// minTokens to spend all of 3,000 USDC or nothing: budget × 1e18 ÷ maxPrice, rounded up.
|
|
200
|
+
const budget = 3000n * 10n ** BigInt(usdc.decimals);
|
|
201
|
+
const allOrNothing = (budget * E18 + buyWeth - 1n) / buyWeth;
|
|
202
|
+
check(allOrNothing === 1105583195135433942n, "minTokens for all of 3,000 USDC at 2,713.5");
|
|
203
|
+
check(skill.includes(String(allOrNothing)), "the skill quotes it");
|
|
204
|
+
// The commands pass these values, in main's order: 1,000 USDC of SPCXc at most 150, at least 6.6
|
|
205
|
+
// SPCXc and an average of at most 149.5; then 10 SPCXc, more than the budget buys at 150 (the
|
|
206
|
+
// minTokens revert), and an average capped at 140 (the maxAvgPrice revert).
|
|
207
|
+
const spend = 1000n * 10n ** BigInt(usdc.decimals);
|
|
208
|
+
const atLeast = (66n * 10n ** BigInt(spcxc.decimals)) / 10n; // 6.6 SPCXc
|
|
209
|
+
const tooMany = 10n * 10n ** BigInt(spcxc.decimals); // 10 SPCXc
|
|
210
|
+
check(atLeast <= (spend * E18) / buySpcxc && tooMany > (spend * E18) / buySpcxc, "the minTokens");
|
|
211
|
+
const args = (minTokens: bigint, maxAvgPrice: bigint) =>
|
|
212
|
+
`--args ${usdc.address} ${spcxc.address} \\\n ${spend} ${buySpcxc} ${minTokens} ${maxAvgPrice} <recipient> <refundTo>`;
|
|
213
|
+
for (const [minTokens, maxAvgPrice, what] of [
|
|
214
|
+
[atLeast, avgSpcxc, "the trade"],
|
|
215
|
+
[tooMany, avgSpcxc, "the minTokens revert"],
|
|
216
|
+
[atLeast, capSpcxc, "the maxAvgPrice revert"],
|
|
217
|
+
] as const)
|
|
218
|
+
check(skill.includes(args(minTokens, maxAvgPrice)), `the skill rehearses ${what}`);
|
|
219
|
+
check(
|
|
220
|
+
source.includes(args(atLeast, avgSpcxc).replace("\n ", "\n// ")),
|
|
221
|
+
"the program header's Base command passes the same",
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
// main's arguments, encoded as `--args` encodes them, appended to the program; then the cook the
|
|
225
|
+
// owner sends, with the Kitchen's fee as its value.
|
|
226
|
+
for (const [payToken, buyToken, amount, maxPrice] of [
|
|
227
|
+
[usdc.address, spcxc.address, spend, buySpcxc],
|
|
228
|
+
[weth.address, usdc.address, E18, sellWeth],
|
|
229
|
+
] as const) {
|
|
230
|
+
const args = routes.encodeEntryArguments(program, [
|
|
231
|
+
payToken,
|
|
232
|
+
buyToken,
|
|
233
|
+
amount,
|
|
234
|
+
maxPrice,
|
|
235
|
+
0n,
|
|
236
|
+
0n,
|
|
237
|
+
recipient,
|
|
238
|
+
recipient,
|
|
239
|
+
]);
|
|
240
|
+
const data = v12Pot.encodeCook(
|
|
241
|
+
engine,
|
|
242
|
+
concatHex([bytesToHex(program.bytecode), bytesToHex(args)]),
|
|
243
|
+
);
|
|
244
|
+
check(
|
|
245
|
+
routes.decodeEntryArguments(program, args)[3] === maxPrice,
|
|
246
|
+
"the arguments decode back to what was encoded",
|
|
247
|
+
);
|
|
248
|
+
console.log(
|
|
249
|
+
`base: ${program.bytecode.length} bytes; cook to ${pot}, ${(data.length - 2) / 2} bytes of calldata`,
|
|
250
|
+
);
|
|
251
|
+
}
|