@eco-incorp/sauce 0.99.5 → 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 +30 -5
- package/docs/concepts/saucescript.md +53 -56
- 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 +24 -15
- package/docs/guides/cli.md +1442 -0
- package/docs/guides/compiling.md +24 -10
- package/docs/guides/intents.md +260 -17
- package/docs/guides/mcp.md +539 -0
- package/docs/guides/nested-intents.md +21 -6
- package/docs/guides/protocols-and-tokens.md +235 -36
- 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/plugin/index.d.ts +3 -2
- package/sdk/dist/plugin/index.d.ts.map +1 -1
- package/sdk/dist/plugin/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/cbeth/functions.d.ts +2 -2
- package/sdk/dist/protocols/cbeth/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/cbeth/functions.js +4 -6
- package/sdk/dist/protocols/cbeth/functions.js.map +1 -1
- package/sdk/dist/protocols/crvusd/functions.d.ts +2 -2
- package/sdk/dist/protocols/crvusd/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/crvusd/functions.js +6 -6
- 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/erc20/functions.d.ts +3 -3
- package/sdk/dist/protocols/erc20/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/erc20/functions.js +6 -9
- package/sdk/dist/protocols/erc20/functions.js.map +1 -1
- package/sdk/dist/protocols/frax/functions.d.ts +2 -2
- package/sdk/dist/protocols/frax/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/frax/functions.js +6 -6
- package/sdk/dist/protocols/gho/functions.d.ts +2 -2
- package/sdk/dist/protocols/gho/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/gho/functions.js +4 -6
- package/sdk/dist/protocols/gho/functions.js.map +1 -1
- package/sdk/dist/protocols/liquity-v2/functions.d.ts +2 -2
- package/sdk/dist/protocols/liquity-v2/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/liquity-v2/functions.js +4 -6
- package/sdk/dist/protocols/liquity-v2/functions.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 +5 -3
- package/sdk/dist/recipes/plain-transfer.sauce.ts +5 -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 +21 -3
- package/sdk/dist/routes/ast-walk.d.ts.map +1 -1
- package/sdk/dist/routes/ast-walk.js +33 -4
- 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 +21 -14
- package/sdk/dist/routes/index.d.ts.map +1 -1
- package/sdk/dist/routes/index.js +12 -9
- 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 +358 -152
- 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 +249 -96
- 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 +5530 -936
- 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 +208 -33
- package/sdk/dist/routes/token-registry.js.map +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts +63 -28
- package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/token-rewrite.js +387 -123
- 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/api.d.ts +7 -4
- package/sdk/dist/token/api.d.ts.map +1 -1
- package/sdk/dist/token/api.js.map +1 -1
- package/sdk/dist/token/evm.js +2 -2
- package/sdk/dist/token/index.d.ts +4 -4
- package/sdk/dist/token/index.js +4 -4
- 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/cbeth/functions.ts +4 -6
- package/sdk/src/protocols/crvusd/functions.ts +6 -6
- 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/erc20/functions.ts +6 -9
- package/sdk/src/protocols/frax/functions.ts +6 -6
- package/sdk/src/protocols/gho/functions.ts +4 -6
- package/sdk/src/protocols/liquity-v2/functions.ts +4 -6
- 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/skills/sauce-protocols/references/cbeth.md +48 -0
- 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/skills/sauce-protocols/references/crvusd.md +49 -0
- 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 +18 -34
- 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/skills/sauce-protocols/references/frax.md +48 -0
- 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/skills/sauce-protocols/references/gho.md +50 -0
- 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/skills/sauce-protocols/references/liquity-v2.md +48 -0
- 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/cbeth.md +0 -62
- package/sdk/src/skills/chainlink.md +0 -62
- package/sdk/src/skills/crvusd.md +0 -58
- package/sdk/src/skills/curve.md +0 -141
- package/sdk/src/skills/eigenlayer.md +0 -71
- package/sdk/src/skills/frax.md +0 -57
- package/sdk/src/skills/gamma.md +0 -79
- package/sdk/src/skills/gho.md +0 -61
- 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/liquity-v2.md +0 -59
- 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,407 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sauce-script
|
|
3
|
+
description: Writing SauceScript programs (.sauce.ts files) — the checked TypeScript subset Sauce compiles to on-chain bytecode, with a complete reference of its types, operators, statements and builtins (ctx, crypto, Math, abi, evm, svm, value methods, account properties, contract bindings, limits). Covers the two program forms (function main(...) with runtime arguments, and a file of top-level statements whose values are defines, the form for intent files), what compiling a file for a chain adds (its names and token syntax, the source otherwise as written), module constants as overridable defaults, helper functions, what syntax compiles and what to write instead, require/throw and atomic failure, catching a failed external call, and reading compile errors. Use when writing or editing any Sauce program, when a Sauce compile fails ("unsupported construct", "is not a declared variable", "expected a number, found a bool", "Unexpected token"), or when asked what SauceScript can or cannot express.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing SauceScript
|
|
7
|
+
|
|
8
|
+
A Sauce program is SauceScript: it looks like TypeScript, compiles to bytecode, and a Sauce engine
|
|
9
|
+
runs it atomically inside one transaction. This skill is the language.
|
|
10
|
+
|
|
11
|
+
**Look a builtin up in [references/builtins.md](references/builtins.md) before using it.** It lists
|
|
12
|
+
every type, literal, operator and statement, every `ctx`, `crypto`, `Math`, `abi`, `evm` and `svm`
|
|
13
|
+
builtin, the methods on values, account properties, contract bindings and limits, each with its
|
|
14
|
+
targets, an example and the exact error a misuse gives. Every example in it compiles and every
|
|
15
|
+
rejection it lists is refused. [references/builtins.json](references/builtins.json) is the same list
|
|
16
|
+
for a program to read. The names a chain supplies (`USDC`, `Token(...)`, `UniswapV3.Factory`,
|
|
17
|
+
`Ethereum(...)`) are in `sauce-globals`.
|
|
18
|
+
|
|
19
|
+
## Two program forms
|
|
20
|
+
|
|
21
|
+
A program lives in a `.sauce.ts` file and is compiled **for a chain** (`--chain`), which decides
|
|
22
|
+
what every registry name means. A file takes one of two forms:
|
|
23
|
+
|
|
24
|
+
| Form | Values | Use it for |
|
|
25
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
26
|
+
| **`function main(…)`** | `main`'s parameters, passed at run time (`--args`); module constants for choices made per compile | reusable programs: one bytecode serves every input, such as a swap's tokens, amount and limit |
|
|
27
|
+
| **Top-level script** | names the file leaves undeclared, each set by a define (`--define NAME=VALUE`); no runtime arguments | intent files (`sauce-intents`), which are only statements, and one-off programs |
|
|
28
|
+
|
|
29
|
+
A program with runtime inputs declares `main`, and may declare helper functions and import ABIs.
|
|
30
|
+
(The `chain=…` after an example's opening fence here only says which chains it is checked on; it
|
|
31
|
+
is not part of the file.)
|
|
32
|
+
|
|
33
|
+
```sauce chain=base,arbitrum
|
|
34
|
+
// A compile-time choice: a module constant, which a define of the same name replaces.
|
|
35
|
+
const FEE_BPS = 30n;
|
|
36
|
+
|
|
37
|
+
// A helper. It returns a value on every path.
|
|
38
|
+
function afterFee(amount: Uint256, bps: Uint256): Uint256 {
|
|
39
|
+
return amount - (amount * bps) / 10000n;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Runtime inputs: main's parameters, passed with the transaction.
|
|
43
|
+
function main(recipient: Address, floor: Uint256) {
|
|
44
|
+
const held = USDC.balanceOf(ctx.self());
|
|
45
|
+
if (held < floor) {
|
|
46
|
+
throw "below floor";
|
|
47
|
+
}
|
|
48
|
+
USDC.transfer(recipient, afterFee(held, FEE_BPS));
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**`main` may return a value**, which the cook returns to whoever called it, so an `eth_call` of
|
|
53
|
+
the cook reads it before anything is sent (`sauce simulate` prints it after `returns`). Declare
|
|
54
|
+
the type: `main(): Address`, `: Uint256` or `: bool` comes back as one 32-byte word, a record as its
|
|
55
|
+
fields one word each, an array as its elements one word each, with no length or offset in front,
|
|
56
|
+
and `: bytes` as the bytes themselves, unwrapped, so `return abi.encode(spent, bought)` gives two
|
|
57
|
+
words. A `void` `main` returns nothing.
|
|
58
|
+
|
|
59
|
+
That makes a rehearsal a way to read a chain: a program that only looks something up and returns
|
|
60
|
+
it, rehearsed with `sauce simulate`, prints the answer and sends nothing.
|
|
61
|
+
|
|
62
|
+
```sauce chain=base,arbitrum
|
|
63
|
+
// The Uniswap V3 WETH/USDC pool at the 0.05% tier (500 millionths), or 0 where there is none.
|
|
64
|
+
function main(): Address {
|
|
65
|
+
return UniswapV3.Factory.getPool(WETH, USDC, 500n);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
A top-level script runs its statements in order, after its imports, and may declare helper
|
|
70
|
+
functions beside them. Every value it does not compute is a define: the name stays undeclared in
|
|
71
|
+
the file, and `--define RECIPIENT=<address> --define FLOOR=1000000` sets it.
|
|
72
|
+
|
|
73
|
+
```sauce chain=base,arbitrum define=RECIPIENT,FLOOR
|
|
74
|
+
// A helper takes what it needs as parameters.
|
|
75
|
+
function afterFee(amount: Uint256): Uint256 {
|
|
76
|
+
return amount - amount / 1000n;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
require(RECIPIENT != 0n, "set RECIPIENT");
|
|
80
|
+
const held = USDC.balanceOf(ctx.self());
|
|
81
|
+
require(held >= FLOOR, "below floor");
|
|
82
|
+
USDC.transfer(RECIPIENT, afterFee(held));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
A `const` at the top of a script is the script's own local: a helper cannot read it (pass it in),
|
|
86
|
+
a define of the same name does not reach it, and the `sauce` command refuses such a define rather
|
|
87
|
+
than ignore it. Declare `main` to share a module constant with helpers, or to return a value.
|
|
88
|
+
|
|
89
|
+
## The file's header
|
|
90
|
+
|
|
91
|
+
Every program starts with a comment that says how to run it, in this order:
|
|
92
|
+
|
|
93
|
+
1. what the program does, in one line;
|
|
94
|
+
2. the `sauce` command that runs it, with `--chain <chain>` and `--args` naming every `main`
|
|
95
|
+
parameter, in order: `--args <tokenIn> <tokenOut> <amountIn>`;
|
|
96
|
+
3. one line per parameter, `name: Type`, then what it means and its units, in smallest units
|
|
97
|
+
(`5000000000` is 5,000 USDC, which has 6 decimals), and that an array or a record is passed as
|
|
98
|
+
JSON;
|
|
99
|
+
4. one concrete run on a supported chain with real values: addresses taken from the registry
|
|
100
|
+
(`sauce globals --chain <chain> --tokens`), the developer's own inputs left as `<placeholders>`.
|
|
101
|
+
|
|
102
|
+
An intent file, which has no `main`, lists its defines and its `--intent-…` flags the same way.
|
|
103
|
+
|
|
104
|
+
```sauce chain=base
|
|
105
|
+
// Pays each of `recipients` `amount` of the chain's USDC, from the Pot.
|
|
106
|
+
//
|
|
107
|
+
// sauce run payout.sauce.ts --chain <chain> --config sauce.config.json --keystore <keystore> \
|
|
108
|
+
// --args <recipients> <amount>
|
|
109
|
+
//
|
|
110
|
+
// recipients: Address[] who is paid, a JSON array: '["<recipient>","<recipient>"]'
|
|
111
|
+
// amount: Uint256 what each is paid, in USDC's smallest units (6 decimals):
|
|
112
|
+
// 5000000 is 5 USDC
|
|
113
|
+
//
|
|
114
|
+
// On Base, 5 USDC to each of two recipients:
|
|
115
|
+
//
|
|
116
|
+
// sauce run payout.sauce.ts --chain base --config sauce.config.json --keystore <keystore> \
|
|
117
|
+
// --args '["<recipient>","<recipient>"]' 5000000
|
|
118
|
+
function main(recipients: Address[], amount: Uint256) {
|
|
119
|
+
for (const to of recipients) {
|
|
120
|
+
USDC.transfer(to, amount);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Runtime inputs and compile-time values
|
|
126
|
+
|
|
127
|
+
| Value | Write it as | Arrives |
|
|
128
|
+
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
129
|
+
| Anything the caller chooses per run: tokens, amounts, recipients, limits | a **`main(...)` parameter** | with the transaction (`--args`); one program serves every value |
|
|
130
|
+
| A choice made per compile: which venues exist on the chain, a fixed fee | a **module constant** beside `main`, which a **define** of its name replaces | folded into the bytecode; a different value is a different program |
|
|
131
|
+
| A value of a script, or of an intent file | an **undeclared name**, set by a define | folded into the bytecode |
|
|
132
|
+
| A value the chain supplies | a global (`sauce-globals`) | resolved when compiling for that chain |
|
|
133
|
+
|
|
134
|
+
`main`'s parameters are taken in declaration order, ABI-encoded by default, and appended to the
|
|
135
|
+
program's bytecode: that is the payload a cook runs. `--args` and `--args-json` of `sauce run`,
|
|
136
|
+
`simulate` and `tx` encode them (`sauce-cli`); `sauce-typescript` covers encoding them from
|
|
137
|
+
TypeScript. A program compiles for every chain the SDK knows; for the initial release its cook is
|
|
138
|
+
built and sent only on Ethereum, Base and Solana, and on every other chain (a preview chain) it is
|
|
139
|
+
compiled and simulated (`sauce-chains`).
|
|
140
|
+
|
|
141
|
+
## Compiling for a chain
|
|
142
|
+
|
|
143
|
+
Compiling a file for a chain lowers the names the chain supplies (`sauce-globals`), the token
|
|
144
|
+
syntax and the intents the file opens; everything else reaches the compiler as written. A program
|
|
145
|
+
for a chain is the language of [references/builtins.md](references/builtins.md), with nothing
|
|
146
|
+
removed:
|
|
147
|
+
|
|
148
|
+
- Annotations go wherever the language takes them: `function half(x: Uint256): Uint256`, and a
|
|
149
|
+
local's `let total: Uint256 = 0n;`. A parameter with no annotation is a `Uint256`, and a local
|
|
150
|
+
without one takes its type from its initializer.
|
|
151
|
+
- A record is an `interface` or an inline object type, `orders: Order[]` or
|
|
152
|
+
`orders: { amount: Uint256, to: Address }[]` (`;` between the fields works too, as a formatter
|
|
153
|
+
writes them); `main`'s arguments are encoded the same way for either.
|
|
154
|
+
- Trailing commas are fine, after `main`'s last parameter as anywhere else.
|
|
155
|
+
|
|
156
|
+
## Values
|
|
157
|
+
|
|
158
|
+
- Integers are 256-bit and checked: no floats (`1.5` is rejected), and a constant expression that
|
|
159
|
+
overflows or underflows (`0n - 1n`, `2n ** 256n - 1n`) is a compile error. Write the maximum as
|
|
160
|
+
`~0n`, and a negative (two's-complement) amount as **`-x`**, which never fails; `~x + 1n` reverts
|
|
161
|
+
when `x` is `0`.
|
|
162
|
+
- Amounts are in the token's smallest units; nothing scales decimals for you.
|
|
163
|
+
- Addresses are numbers: a `main` parameter, a global such as `USDC`, or a literal taken from the
|
|
164
|
+
registry, written with an `n` (`0x833589fcd6edb6e08f4c7c32d4f71b54bda02913n`); never an invented
|
|
165
|
+
one.
|
|
166
|
+
- `bytes`: `` hex`a9059cbb` ``, `"text"`, `.concat`, `.slice(a, b)`, `.length`, `b[i]`,
|
|
167
|
+
`x.toBytesBe(32n)`, `x.toBytesLe(8n)`, `abi.encode`/`abi.decode` (EVM). Bind a literal before
|
|
168
|
+
calling a method on it: ``const selector = hex`a9059cbb`; selector.concat(data)``. `hex` is the
|
|
169
|
+
only template form: every untagged template literal is rejected, with or without `${}`.
|
|
170
|
+
- Arrays and records: `[a, b]`, `new Array(n)`, `xs[i] = v`, `xs.length`, `{ amount: 1n }`.
|
|
171
|
+
Destructuring, `const [a, b] = …`, needs an initializer that produces a record (a multi-output
|
|
172
|
+
call, `abi.decode`); an array is indexed instead.
|
|
173
|
+
- `Account` parameters, with roles such as `Account<Writable>`, are `main`'s alone. On Solana they
|
|
174
|
+
are the transaction's accounts; on an EVM chain only a bare `Account` compiles, and it is an
|
|
175
|
+
address.
|
|
176
|
+
- A module-level `let` is scratch, reset on every run. Persistent state is `evm.sstore`/`evm.sload`
|
|
177
|
+
(or `svm.sstore`/`svm.sload`).
|
|
178
|
+
- **At module level, only scalar literals.** A `let` there starts as a number, address or boolean
|
|
179
|
+
literal; anything else (`[1n, 2n]`, `new Array(n)`, `-1n`, `1n << 160n`, a call) is refused with
|
|
180
|
+
"must be initialized with a literal". A `const` array there is a lookup table, read only at a
|
|
181
|
+
literal index (`FEES[0]`), never looped over. Declare arrays and computed values inside a function.
|
|
182
|
+
|
|
183
|
+
## Calling a contract
|
|
184
|
+
|
|
185
|
+
Call a contract by name, in this order of preference:
|
|
186
|
+
|
|
187
|
+
1. **A namespace**, for a contract the chain's registry records: `UniswapV3.Factory.getPool(...)`,
|
|
188
|
+
`AaveV3.Pool.supply(...)`, typed by the registry's ABI, its address the chain's. An interface, a
|
|
189
|
+
registry ABI with no address of its own, is called with the address it is at: a pool the
|
|
190
|
+
factory returned is `UniswapV3.Pool(pool)`, as in `UniswapV3.Pool(pool).slot0()`, and any
|
|
191
|
+
ERC-4626 vault `Erc4626.Vault(vault)`. A contract that has its own address takes `.at(address)`
|
|
192
|
+
to call another deployment of the same ABI: `AaveV3.Pool.at(address)`. The chain's file in
|
|
193
|
+
`sauce-chains`, or `sauce globals --chain <chain> --protocol <namespace>`, lists each
|
|
194
|
+
namespace's contracts, interfaces and methods.
|
|
195
|
+
2. **A registry ABI import**, where the chain has no namespace for it: each protocol's registry
|
|
196
|
+
page in `sauce-protocols` gives the import line, such as
|
|
197
|
+
`import VaultABI from "./protocols/erc4626/VaultABI.json"`, and the binding takes the address
|
|
198
|
+
with `.at`: `VaultABI.at(vault).convertToAssets(shares)`.
|
|
199
|
+
3. **The program's own ABI**, for a contract no registry knows, or a function its registry ABI
|
|
200
|
+
does not declare: a JSON ABI file beside the program, holding only the functions the program
|
|
201
|
+
calls, with the deployed contract's types from its verified source, imported by relative path
|
|
202
|
+
as the file's default export: `import IOracle from "./IOracle.json"`, then
|
|
203
|
+
`IOracle.at(pool).observe(...)`. The `sauce` command reads it from beside the file; through the
|
|
204
|
+
MCP server, pass it in `modules` with the program (`{ "IOracle.json": "<its JSON>" }`).
|
|
205
|
+
[examples/twap.sauce.ts](examples/twap.sauce.ts) finds a pool through `UniswapV3.Factory` and
|
|
206
|
+
reads its price history through [examples/IOracle.json](examples/IOracle.json), which declares
|
|
207
|
+
the one function the registry's pool ABI lacks, `observe`.
|
|
208
|
+
|
|
209
|
+
Never call through `evm.static` (or `evm.call`) with a hex selector where one of these is
|
|
210
|
+
possible: the typed call encodes the arguments, decodes the result and names its fields. Take only
|
|
211
|
+
what you need from a result: `const [sqrtPriceX96] = UniswapV3.Pool(pool).slot0();` and
|
|
212
|
+
`UniswapV3.Pool(pool).slot0().sqrtPriceX96` both read the first field alone.
|
|
213
|
+
|
|
214
|
+
```sauce chain=base,ethereum
|
|
215
|
+
function main(vault: Address, shares: Uint256): Uint256 {
|
|
216
|
+
// A contract the chain's registry records: its factory, by name.
|
|
217
|
+
const pool = UniswapV3.Factory.getPool(WETH, USDC, 500n);
|
|
218
|
+
require(pool != 0n, "no WETH/USDC 0.05% pool");
|
|
219
|
+
// Interfaces, called with the address they are at: the pool it returned, and a vault.
|
|
220
|
+
const [sqrtPriceX96] = UniswapV3.Pool(pool).slot0();
|
|
221
|
+
require(sqrtPriceX96 > 0n, "the pool is not initialized");
|
|
222
|
+
return Erc4626.Vault(vault).convertToAssets(shares);
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Functions
|
|
227
|
+
|
|
228
|
+
- **Call what exists directly.** Typed bindings, namespaces and library functions are called as
|
|
229
|
+
they are: `USDC.transfer(...)`, `UniswapV3.Factory.getPool(...)`, `uniswapV3(...)` from
|
|
230
|
+
`@sauce/router`. Do not wrap a single call in a helper, and do not hand-roll a raw selector with
|
|
231
|
+
`evm.static` and `abi.decode` where a typed binding or a namespace exists. Keep a helper only for
|
|
232
|
+
real logic used more than once.
|
|
233
|
+
- Helpers are top-level `function` declarations, annotated on the signature. They may call each
|
|
234
|
+
other and recurse; `main` is never called.
|
|
235
|
+
- **A helper that returns a value returns it on every path**: an `if` with a `return` and no
|
|
236
|
+
`else`, or a loop that may end without one, fails the compile with "does not return on every
|
|
237
|
+
path". End the helper with a `return`.
|
|
238
|
+
|
|
239
|
+
```sauce fails chain=base
|
|
240
|
+
function larger(a: Uint256, b: Uint256): Uint256 {
|
|
241
|
+
if (a > b) {
|
|
242
|
+
return a;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function main(a: Uint256, b: Uint256): Uint256 {
|
|
247
|
+
return larger(a, b);
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
- **Arrays and records are passed by reference**: a helper that writes `xs[i] = v` changes the
|
|
252
|
+
caller's array, so a helper can fill an array it is given. Numbers, bools and bytes are copies.
|
|
253
|
+
- **A comparison is a `bool`, but a function with no return annotation returns a number**, even
|
|
254
|
+
`return a > b` (1 or 0). `if`, `while` and `&&` take either; a `: bool` function cannot return the
|
|
255
|
+
number. Give a helper that answers yes or no a `: bool` return type:
|
|
256
|
+
|
|
257
|
+
```sauce chain=base,arbitrum
|
|
258
|
+
// Selling token0 (the lower address) pushes a pool's price down, so a higher price is better.
|
|
259
|
+
function isBetter(price: Uint256, than: Uint256, sellsToken0: bool): bool {
|
|
260
|
+
if (sellsToken0) {
|
|
261
|
+
return price > than;
|
|
262
|
+
}
|
|
263
|
+
return price < than;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Fills `best` in place: an array goes to a helper by reference.
|
|
267
|
+
function keepBest(best: Uint256[], price: Uint256, sellsToken0: bool): void {
|
|
268
|
+
if (best[0] == 0n || isBetter(price, best[0], sellsToken0)) {
|
|
269
|
+
best[0] = price;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function main(prices: Uint256[], tokenIn: Address, tokenOut: Address): Uint256 {
|
|
274
|
+
let best = new Array(1);
|
|
275
|
+
for (const price of prices) {
|
|
276
|
+
keepBest(best, price, tokenIn < tokenOut);
|
|
277
|
+
}
|
|
278
|
+
return best[0];
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Syntax that compiles, and what to write instead
|
|
283
|
+
|
|
284
|
+
Compiles: `let`/`const`, `if`/`else if`/`else`, `while`, C-style `for`, `for...of` over an array,
|
|
285
|
+
`break`/`continue`, `i++` and `+=` as statements, ternaries, `&&`/`||`/`!`, `**`, bit operators,
|
|
286
|
+
`/` and `%`, helper functions, `Math.mulDiv(a, b, c)`, `Math.sqrt(x)`.
|
|
287
|
+
The full list, with what each rejection says, is section 14 of
|
|
288
|
+
[references/builtins.md](references/builtins.md).
|
|
289
|
+
|
|
290
|
+
| Rejected | Write instead |
|
|
291
|
+
| ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
292
|
+
| `switch`, `for...in`, `class`, `enum`, `type` aliases, `await` | `if` chains, arrays, inline object types, plain functions |
|
|
293
|
+
| `try`/`catch`, `throw new Error(...)` | `require(cond, "reason")` or `throw "reason"`; for a failing external call, `.catch` (below) |
|
|
294
|
+
| arrow functions and nested functions, except the intent syntax `Chain(() => { ... })` and `.catch(() => { ... })` | top-level function declarations |
|
|
295
|
+
| template literals, comparing bytes with `==` | `"text"`, or bytes built with `.concat`; compare `crypto.keccak256` of each |
|
|
296
|
+
| `as` casts, default parameters, spread, object destructuring | explicit values and field access |
|
|
297
|
+
| `arr.push(x)`, `console.log`, `Math.min`/`max`/`abs`/`pow` | `new Array(n)` and an index; `if`; `**` |
|
|
298
|
+
|
|
299
|
+
```sauce fails
|
|
300
|
+
function main(x: Uint256): Uint256 {
|
|
301
|
+
switch (x) {
|
|
302
|
+
case 1n:
|
|
303
|
+
return 1n;
|
|
304
|
+
}
|
|
305
|
+
return 0n;
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Failure is atomic
|
|
310
|
+
|
|
311
|
+
`require(false)`, `require(cond, "reason")`, `throw "reason"`, a reverting call, and every guard
|
|
312
|
+
the package emits revert the **whole transaction**: for an intent, the whole fulfilment, including
|
|
313
|
+
the calls that ran before the program. Nothing half-happens, so put every safety check in the
|
|
314
|
+
program.
|
|
315
|
+
|
|
316
|
+
The one way to survive a failure is on an external EVM call: `.catch(() => { ... })` runs instead
|
|
317
|
+
when that call reverts, and the call's own effects are undone. The handler may assign locals of the
|
|
318
|
+
enclosing function.
|
|
319
|
+
|
|
320
|
+
```sauce chain=base
|
|
321
|
+
import { ISauceRouter } from "./artifacts/ISauceRouter.json";
|
|
322
|
+
|
|
323
|
+
function main(pool: Address, amount: Uint256, sqrtPriceLimitX96: Uint256) {
|
|
324
|
+
let filled = true;
|
|
325
|
+
ISauceRouter.at(ctx.self())
|
|
326
|
+
.swapV3(pool, WETH, USDC, amount, sqrtPriceLimitX96, ctx.self(), ctx.self())
|
|
327
|
+
.catch(() => {
|
|
328
|
+
filled = false;
|
|
329
|
+
});
|
|
330
|
+
require(filled, "the pool refused");
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
The value form, `const v = <call>.catch(() => { return <constant>; });`, gives the constant when
|
|
335
|
+
the call fails. It takes a call that returns one value: a bound method with one output, such as
|
|
336
|
+
a namespace contract's or an imported ABI's. A raw `evm.call`, `evm.static` or `evm.delegate`
|
|
337
|
+
returns bytes, which no constant can stand in for ("a `.catch()` fallback: expected a bytes value,
|
|
338
|
+
found a number"). For a raw read that may fail, test it with the statement form, then read again
|
|
339
|
+
only when it worked. A read changes nothing, so the second call is safe; never repeat a write
|
|
340
|
+
that way.
|
|
341
|
+
|
|
342
|
+
`.catch()` catches a call that reverts, not a call to an address with no code. That call succeeds
|
|
343
|
+
and returns nothing, and decoding nothing reverts the cook, `.catch()` or not. When an address may
|
|
344
|
+
have no code, check `ctx.codeSize(address) > 0n` first:
|
|
345
|
+
|
|
346
|
+
```sauce chain=base,arbitrum
|
|
347
|
+
// One word from a read that may fail, or 0: an address with no code, or a read that reverts.
|
|
348
|
+
function readWord(target: Address, query: bytes): Uint256 {
|
|
349
|
+
if (ctx.codeSize(target) == 0n) {
|
|
350
|
+
return 0n;
|
|
351
|
+
}
|
|
352
|
+
let readable = true;
|
|
353
|
+
evm.static(target, query).catch(() => {
|
|
354
|
+
readable = false;
|
|
355
|
+
});
|
|
356
|
+
if (!readable) {
|
|
357
|
+
return 0n;
|
|
358
|
+
}
|
|
359
|
+
return abi.decode(evm.static(target, query), ["Uint256"])[0];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function main(target: Address, query: bytes): Uint256 {
|
|
363
|
+
return readWord(target, query);
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## What a program costs
|
|
368
|
+
|
|
369
|
+
On an EVM chain, a cook's gas is the transaction's own, the Kitchen's and the Pot's, plus the
|
|
370
|
+
program's, which the engine interprets step by step. Measured on a local chain through the engine
|
|
371
|
+
and a Kitchen-made Pot:
|
|
372
|
+
|
|
373
|
+
| What | Gas, about |
|
|
374
|
+
| --------------------------------------------------- | -------------------------------------------- |
|
|
375
|
+
| A cook whose program does almost nothing | 43,000, the transaction's 21,000 included |
|
|
376
|
+
| One loop iteration that adds two numbers | 1,000 |
|
|
377
|
+
| Writing an array element, or reading one | 500, or 300, on top |
|
|
378
|
+
| A call to a contract the transaction already called | 2,000 on top, plus what that contract spends |
|
|
379
|
+
| `.catch()` on that call | 100 more |
|
|
380
|
+
| `crypto.keccak256(abi.encode(a, b))` | 2,000 |
|
|
381
|
+
|
|
382
|
+
The first call to a contract in a transaction costs 2,600 more than later ones, as on any EVM
|
|
383
|
+
chain. A loop is what adds up in the program itself: a hundred iterations of a little arithmetic
|
|
384
|
+
cost about 100,000 gas. Read a value once and keep it in a local rather than calling for it twice,
|
|
385
|
+
and bound each loop by its input. The real figure is the rehearsal's:
|
|
386
|
+
`sauce simulate` prints it, and `sauce run` and most signers set the gas limit from an estimate.
|
|
387
|
+
Leave headroom when the chain can move between the rehearsal and the send; a swap that crosses more
|
|
388
|
+
ticks spends more.
|
|
389
|
+
|
|
390
|
+
## Reading a compile error
|
|
391
|
+
|
|
392
|
+
Compile errors fail the command; there is no warning channel. `sauce compile` points at the file's
|
|
393
|
+
line and column, including on a line the package rewrote, and a `hint:` line names the flag or
|
|
394
|
+
define to add. `X is not a declared variable` usually means a missing define or `main` parameter.
|
|
395
|
+
`Unexpected token` is a syntax error at the line and column it names.
|
|
396
|
+
`a function argument: expected a number, found a bool` at a call usually means the called
|
|
397
|
+
function's parameter has no annotation, so it is a number: annotate it, `first: bool`. For any
|
|
398
|
+
other message, find it in [references/builtins.md](references/builtins.md). `a nested function
|
|
399
|
+
declaration is not supported` means a function declared inside another function or a block:
|
|
400
|
+
declare it at the top level. `X is called but never declared` means a function that is not in
|
|
401
|
+
scope, usually a typo.
|
|
402
|
+
|
|
403
|
+
## Example
|
|
404
|
+
|
|
405
|
+
[examples/saucescript.mts](examples/saucescript.mts) compiles a guarded program, asserts each
|
|
406
|
+
rejection above, and pins what compiling for a chain adds. Complete programs are listed in
|
|
407
|
+
`sauce-examples`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "function",
|
|
4
|
+
"name": "observe",
|
|
5
|
+
"stateMutability": "view",
|
|
6
|
+
"inputs": [{ "name": "secondsAgos", "type": "uint32[]" }],
|
|
7
|
+
"outputs": [
|
|
8
|
+
{ "name": "tickCumulatives", "type": "int56[]" },
|
|
9
|
+
{ "name": "secondsPerLiquidityCumulativeX128s", "type": "uint160[]" }
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
]
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// SauceScript's boundary, checked against the compiler the SDK ships: what compiles, what a
|
|
2
|
+
// define changes, what the compiler refuses, what differs per target, and what compiling for a
|
|
3
|
+
// chain adds.
|
|
4
|
+
//
|
|
5
|
+
// node saucescript.mts
|
|
6
|
+
import { stripVTControlCharacters } from "node:util";
|
|
7
|
+
|
|
8
|
+
import { routes } from "@eco-incorp/sauce";
|
|
9
|
+
import { compile, type CompileResult } from "@eco-incorp/sauce/compiler";
|
|
10
|
+
|
|
11
|
+
function check(condition: unknown, message: string): asserts condition {
|
|
12
|
+
if (!condition) throw new Error(`check failed: ${message}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function build(source: string, target: "evm" | "svm" = "evm", defines: [string, string][] = []) {
|
|
16
|
+
const bytes = new TextEncoder().encode(source);
|
|
17
|
+
return compile({
|
|
18
|
+
target,
|
|
19
|
+
entry: "main.ts",
|
|
20
|
+
resolve: (p) => (p === "main.ts" ? bytes : undefined),
|
|
21
|
+
defines,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function rejects(source: string, target: "evm" | "svm" = "evm"): string {
|
|
26
|
+
try {
|
|
27
|
+
build(source, target);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
// Diagnostics carry ANSI styling; strip it before matching.
|
|
30
|
+
return stripVTControlCharacters(String((error as Error).message));
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`expected the compiler to reject:\n${source}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// A guarded program: module const, a define-overridable floor, a loop, a helper, `require` and `throw`.
|
|
36
|
+
// Either failure reverts the WHOLE surrounding transaction; nothing before it survives.
|
|
37
|
+
const guarded = `
|
|
38
|
+
const FLOOR = 1n;
|
|
39
|
+
|
|
40
|
+
function sum(xs: Uint256[]): Uint256 {
|
|
41
|
+
let total = 0n;
|
|
42
|
+
for (const x of xs) {
|
|
43
|
+
total += x;
|
|
44
|
+
}
|
|
45
|
+
return total;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function main(amounts: Uint256[], deadline: Uint256): Uint256 {
|
|
49
|
+
if (ctx.timestamp() > deadline) {
|
|
50
|
+
throw "expired";
|
|
51
|
+
}
|
|
52
|
+
const total = sum(amounts);
|
|
53
|
+
require(total >= FLOOR);
|
|
54
|
+
return total;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const a: CompileResult = build(guarded);
|
|
59
|
+
const b = build(guarded, "evm", [["FLOOR", "1000000"]]);
|
|
60
|
+
check(a.entryEncoding === "abi-v1", "entry arguments default to ABI-v1");
|
|
61
|
+
// A define is folded into the bytecode: a different value is a different program (and hash).
|
|
62
|
+
check(Buffer.compare(a.bytecode, b.bytecode) !== 0, "a define changes the bytecode");
|
|
63
|
+
|
|
64
|
+
// Outside the subset. Each one is a compile error, never a silently different program.
|
|
65
|
+
check(
|
|
66
|
+
/unsupported construct/.test(
|
|
67
|
+
rejects("function main(x: Uint256): Uint256 { switch (x) { case 1n: return 1n; } return 0n; }"),
|
|
68
|
+
),
|
|
69
|
+
"switch",
|
|
70
|
+
);
|
|
71
|
+
check(
|
|
72
|
+
/unsupported construct/.test(
|
|
73
|
+
rejects("function main(): void { try { require(false); } catch (e) {} }"),
|
|
74
|
+
),
|
|
75
|
+
"try/catch",
|
|
76
|
+
);
|
|
77
|
+
check(
|
|
78
|
+
/unsupported construct/.test(
|
|
79
|
+
rejects('function main(x: Uint256): void { throw new Error("no"); }'),
|
|
80
|
+
),
|
|
81
|
+
"throw new Error",
|
|
82
|
+
);
|
|
83
|
+
check(
|
|
84
|
+
/not a context builtin/.test(rejects("function main(): Address { return ctx.caller(); }")),
|
|
85
|
+
"the caller is ctx.msgSender(), not ctx.caller()",
|
|
86
|
+
);
|
|
87
|
+
// A negative amount is `-x`, two's complement, on both targets; `~x + 1n` overflows at x = 0.
|
|
88
|
+
for (const target of ["evm", "svm"] as const)
|
|
89
|
+
build("function main(x: Uint256): Uint256 { return -x; }", target);
|
|
90
|
+
check(
|
|
91
|
+
/overflows 256 bits/.test(rejects("function main(): Uint256 { return ~0n + 1n; }")),
|
|
92
|
+
"~0n + 1n overflows",
|
|
93
|
+
);
|
|
94
|
+
check(
|
|
95
|
+
/not a valid 256-bit literal/.test(rejects("function main(): Uint256 { return 1.5; }")),
|
|
96
|
+
"no floats",
|
|
97
|
+
);
|
|
98
|
+
check(
|
|
99
|
+
/overflows 256 bits/.test(rejects("function main(): Uint256 { return 0n - 1n; }")),
|
|
100
|
+
"checked arithmetic",
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// Target differences: EVM-only context reads are refused on Solana with a reason.
|
|
104
|
+
check(
|
|
105
|
+
/not available on the svm target/.test(
|
|
106
|
+
rejects("function main(): Uint256 { return ctx.msgValue(); }", "svm"),
|
|
107
|
+
),
|
|
108
|
+
"svm msgValue",
|
|
109
|
+
);
|
|
110
|
+
const svm = build(
|
|
111
|
+
"function main(vault: Account<Writable>, amount: Uint256): Uint256 { return amount; }",
|
|
112
|
+
"svm",
|
|
113
|
+
);
|
|
114
|
+
check(svm.manifest?.accounts[0]?.kind === "slot", "SVM Account parameters become manifest slots");
|
|
115
|
+
|
|
116
|
+
// A file compiled for a chain (`sauce compile --chain`, `routes.compileSauceProgram`) gets the
|
|
117
|
+
// chain's names and the token syntax lowered, and otherwise reaches the compiler as written.
|
|
118
|
+
const forChain = (source: string) => {
|
|
119
|
+
try {
|
|
120
|
+
return routes.compileSauceProgram("base", source);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
return stripVTControlCharacters(String((error as Error).message));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const compiled = (source: string) => {
|
|
126
|
+
const result = forChain(source);
|
|
127
|
+
check(typeof result !== "string", `compiles for a chain:\n${source}\n${String(result)}`);
|
|
128
|
+
return result;
|
|
129
|
+
};
|
|
130
|
+
const typed = compiled(
|
|
131
|
+
"function half(x: Uint256): Uint256 { return x / 2n; }\nfunction main(to: Address, amount, items: { amount: Uint256, to: Address }[]) { USDC.transfer(to, half(amount)); require(items.length > 0n); }",
|
|
132
|
+
);
|
|
133
|
+
check(
|
|
134
|
+
typed.entryParams.map((p) => `${p.name}: ${p.type}`).join(", ") ===
|
|
135
|
+
"to: Address, amount: Uint256, items: { amount: Uint256, to: Address }[]",
|
|
136
|
+
"a parameter with no annotation is a Uint256",
|
|
137
|
+
);
|
|
138
|
+
compiled("function main(x: Uint256) { let y: Uint256 = x; require(y > 0n); }"); // an annotated local
|
|
139
|
+
const records = compiled(
|
|
140
|
+
"interface Order { amount: Uint256; to: Address; }\nfunction main(orders: Order[]) { for (const o of orders) { USDC.transfer(o.to, o.amount); } }",
|
|
141
|
+
);
|
|
142
|
+
check(
|
|
143
|
+
records.entryParams[0]?.type === "{ amount: Uint256, to: Address }[]",
|
|
144
|
+
"an interface parameter is encoded as the record it names",
|
|
145
|
+
);
|
|
146
|
+
compiled("function main(\n a: Uint256,\n b: Uint256,\n) { require(a > b); }"); // a trailing comma
|
|
147
|
+
// A script: its statements are the entry, beside its imports and helpers.
|
|
148
|
+
compiled(
|
|
149
|
+
'import { balanceOf as held } from "@sauce/token";\nfunction twice(x: Uint256): Uint256 { return x * 2n; }\nrequire(twice(held(USDC, ctx.self())) >= 0n);',
|
|
150
|
+
);
|
|
151
|
+
compiled("require(chainId == 8453n);");
|
|
152
|
+
// ...and its top-level consts are its own locals, which a helper cannot read.
|
|
153
|
+
check(
|
|
154
|
+
/`FEE` is not a declared variable/.test(
|
|
155
|
+
String(
|
|
156
|
+
forChain(
|
|
157
|
+
"const FEE = 3n;\nfunction f(x: Uint256): Uint256 { return x * FEE; }\nrequire(f(1n) == 3n);",
|
|
158
|
+
),
|
|
159
|
+
),
|
|
160
|
+
),
|
|
161
|
+
"a helper cannot read a script's const",
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
console.log(
|
|
165
|
+
`guarded program: ${a.bytecode.length} bytes (FLOOR=1) vs ${b.bytecode.length} (FLOOR=1e6)`,
|
|
166
|
+
);
|
|
167
|
+
console.log(`svm manifest: ${JSON.stringify(svm.manifest?.accounts)}`);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Reads what a Uniswap V3 pool's time-weighted average price is computed from: its tick cumulative
|
|
2
|
+
// `window` seconds ago and now, returned as abi.encode(then, now). The factory and the pool are
|
|
3
|
+
// namespaces; `observe`, which the registry's UniswapV3.Pool ABI does not declare, is called
|
|
4
|
+
// through the program's own ABI beside it, IOracle.json: that one function, with the pool's
|
|
5
|
+
// deployed types. The average tick over the window is (now - then) / window.
|
|
6
|
+
//
|
|
7
|
+
// sauce simulate twap.sauce.ts --chain <chain> --config sauce.config.json \
|
|
8
|
+
// --owner <address> --args <tokenA> <tokenB> <fee> <window>
|
|
9
|
+
//
|
|
10
|
+
// tokenA: Address one token of the pair
|
|
11
|
+
// tokenB: Address the other
|
|
12
|
+
// fee: Uint256 the pool's fee tier, in millionths: 500 is 0.05%, 3000 is 0.3%
|
|
13
|
+
// window: Uint256 how far back, in seconds: 1800 is 30 minutes
|
|
14
|
+
//
|
|
15
|
+
// On Base, the WETH/USDC 0.05% pool over 30 minutes:
|
|
16
|
+
//
|
|
17
|
+
// sauce simulate twap.sauce.ts --chain base --config sauce.config.json \
|
|
18
|
+
// --owner <address> --args 0x4200000000000000000000000000000000000006 \
|
|
19
|
+
// 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 500 1800
|
|
20
|
+
import IOracle from "./IOracle.json";
|
|
21
|
+
|
|
22
|
+
function main(tokenA: Address, tokenB: Address, fee: Uint256, window: Uint256): bytes {
|
|
23
|
+
const pool = UniswapV3.Factory.getPool(tokenA, tokenB, fee);
|
|
24
|
+
require(pool != 0n, "no pool for that pair and fee");
|
|
25
|
+
require(UniswapV3.Pool(pool).liquidity() > 0n, "the pool has no liquidity");
|
|
26
|
+
// Only what is needed: observe's first result, the tick cumulatives.
|
|
27
|
+
const [ticks] = IOracle.at(pool).observe([window, 0n]);
|
|
28
|
+
return abi.encode(ticks[0], ticks[1]);
|
|
29
|
+
}
|