@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
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
14
|
* WHAT THIS IS. A source rewrite, run before the compiler ever sees the program — the same class of
|
|
15
|
-
* thing as `token-rewrite.ts`'s `Token(x)` -> `
|
|
16
|
-
* has no notion of a closure, a chain, or an intent, and does not need one.
|
|
17
|
-
* expression above has become ordinary statements it already supports.
|
|
15
|
+
* thing as `token-rewrite.ts`'s `Token(x).transfer(...)` -> `transfer(x, ...)`, and for the same
|
|
16
|
+
* reason: the compiler has no notion of a closure, a chain, or an intent, and does not need one.
|
|
17
|
+
* By the time it runs, the expression above has become ordinary statements it already supports.
|
|
18
18
|
*
|
|
19
19
|
* WHAT `amount` IS. It is a local of the ENCLOSING program, whose value exists only while that
|
|
20
20
|
* program runs. So the child intent cannot be encoded with it — it is encoded with a sentinel in its
|
|
@@ -22,26 +22,44 @@
|
|
|
22
22
|
* variable is one slot. This is the identical mechanism `nest-dynamic.ts` uses for a measured
|
|
23
23
|
* balance; a capture is just a value that arrives by a different route.
|
|
24
24
|
*
|
|
25
|
-
* WHAT IS LOWERED, AND
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
25
|
+
* WHAT IS LOWERED, AND HOW. A body whose every statement is a token `transfer`/`approve` becomes
|
|
26
|
+
* plain `route.calls` — which is what an eco-routes route IS, a list of calls — one per transfer and
|
|
27
|
+
* two per approve (a reset to zero first, for USDT). The Portal's Executor runs those, not a Sauce
|
|
28
|
+
* program, so they get the Executor's checks rather than SafeERC20's; see the lowering loop. Any
|
|
29
|
+
* other body (a loop, a balance read, arithmetic, `transferFrom`, an intent of its own) is compiled
|
|
30
|
+
* as a program for the destination and cooked on its Pot. An identifier that is neither a
|
|
31
|
+
* compile-time value nor an enclosing local is refused. Nothing here guesses: the failure mode this
|
|
32
|
+
* exists to avoid is a plausible-looking intent carrying a number nobody chose.
|
|
33
|
+
*
|
|
34
|
+
* HOW THE REWARD IS FUNDED. By default the program pays it into the intent's vault itself and then
|
|
35
|
+
* publishes: it asks the source Portal for `intentVaultAddress` over the very bytes it is about to
|
|
36
|
+
* publish, transfers each reward token there with `SafeERC20` semantics, sends the native amount,
|
|
37
|
+
* and calls `publish` — all in the one cook, so the vault cannot be wrong and no allowance is left
|
|
38
|
+
* on the Pot every intent on the chain shares. `intents.fundVia: "publishAndFund"` emits the
|
|
39
|
+
* approvals and `publishAndFund` instead. See `vaultFundingStatements` and `portal.ts`'s module doc.
|
|
40
|
+
*
|
|
41
|
+
* WHICH CHAIN A NAME MEANS. Two chains are in play, and each part of the expression belongs to one.
|
|
42
|
+
* The body and the delivery argument run on the destination, so `USDC` there is the destination's.
|
|
43
|
+
* The reward is escrowed by the enclosing program, on the chain it runs on, in a vault of that
|
|
44
|
+
* chain's Portal, so `USDC` in `.reward(...)` is that chain's. An intent opened inside a body is
|
|
45
|
+
* funded on the body's chain: its reward resolves there and its own body on its own destination —
|
|
46
|
+
* the same rule one level down, because the child compile re-enters this pass with `source` set to
|
|
47
|
+
* the chain it compiles for.
|
|
32
48
|
*
|
|
33
49
|
* WHERE THE ADDRESSES COME FROM. The Portal on each side, and the prover for the pair, are looked up
|
|
34
50
|
* in the SDK's eco-routes deployment registry (`protocols/eco-routes`). A caller supplies what has
|
|
35
51
|
* no correct default — deadlines, and a creator when the refund must not go to the executing Pot.
|
|
36
52
|
*/
|
|
37
|
-
import { parse } from "acorn";
|
|
38
53
|
import { encodeFunctionData } from "viem";
|
|
39
54
|
import { ERC20ABI } from "../protocols/erc20/abis.js";
|
|
40
|
-
import { safeApproveStatements } from "../token/safe.js";
|
|
41
|
-
import {
|
|
55
|
+
import { safeApproveStatements, safeTransferStatements } from "../token/safe.js";
|
|
56
|
+
import { walk } from "./ast-walk.js";
|
|
57
|
+
import { childProgram, enclosingLocals, literalValue, moduleScope, unreachedFunctions, } from "./intent-body.js";
|
|
42
58
|
import { denormalizeToEvm } from "./encode.js";
|
|
59
|
+
import { rewardAssetsConflict } from "./intent.js";
|
|
43
60
|
import { normalizeReward, normalizeRoute, toUniversalAddress } from "./normalize.js";
|
|
44
|
-
import { publishAndFundTx } from "./portal.js";
|
|
61
|
+
import { INTENT_FUND_VIA, intentVaultAddressCall, publishAndFundTx, publishTx, } from "./portal.js";
|
|
62
|
+
import { parseSauce } from "./parse.js";
|
|
45
63
|
import { emitTemplate, splitByPlaceholders } from "./template.js";
|
|
46
64
|
/**
|
|
47
65
|
* One sentinel per captured variable.
|
|
@@ -68,22 +86,16 @@ const fail = (message) => {
|
|
|
68
86
|
throw new SugarError(`intent sugar: ${message}`);
|
|
69
87
|
};
|
|
70
88
|
function literalOf(node) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return value;
|
|
75
|
-
if (typeof value === "number" && Number.isSafeInteger(value))
|
|
76
|
-
return BigInt(value);
|
|
77
|
-
if (typeof value === "boolean")
|
|
78
|
-
return value ? 1n : 0n;
|
|
79
|
-
}
|
|
89
|
+
const value = literalValue(node);
|
|
90
|
+
if (value !== undefined)
|
|
91
|
+
return value;
|
|
80
92
|
if (node.type === "UnaryExpression" && node.operator === "-") {
|
|
81
93
|
fail("a negative literal is not a valid address or amount");
|
|
82
94
|
}
|
|
83
95
|
return undefined;
|
|
84
96
|
}
|
|
85
97
|
function makeResolver(defines, outerLocals) {
|
|
86
|
-
return (node, what) => {
|
|
98
|
+
return (node, what, unknown) => {
|
|
87
99
|
const direct = literalOf(node);
|
|
88
100
|
if (direct !== undefined)
|
|
89
101
|
return { literal: direct };
|
|
@@ -94,6 +106,8 @@ function makeResolver(defines, outerLocals) {
|
|
|
94
106
|
return { literal: define };
|
|
95
107
|
if (outerLocals.has(name))
|
|
96
108
|
return { capture: name };
|
|
109
|
+
if (unknown !== undefined)
|
|
110
|
+
return fail(unknown(name));
|
|
97
111
|
return fail(`${what} refers to '${name}', which is neither a compile-time value nor a variable of the ` +
|
|
98
112
|
`enclosing program. Declare it with \`const ${name} = ...\` before the intent, or supply ` +
|
|
99
113
|
`it as a compile-time define.`);
|
|
@@ -104,12 +118,18 @@ function makeResolver(defines, outerLocals) {
|
|
|
104
118
|
}
|
|
105
119
|
/** Whether every statement is a plain token write, which lowers to direct `route.calls` entries and
|
|
106
120
|
* needs no program, no Pot and no Kitchen fee. Anything else — a swap, control flow, a nested
|
|
107
|
-
* intent — takes the
|
|
121
|
+
* intent, an argument that has to be computed (`half(amount)`, `amount - fee`) — takes the
|
|
122
|
+
* general path. */
|
|
108
123
|
function isDirectCallBody(body, defines) {
|
|
124
|
+
// The SHAPE of each argument, not its value: a literal or a name is resolved by the lowering
|
|
125
|
+
// itself, which reports a name it cannot resolve by name. Anything computed needs a program.
|
|
126
|
+
const shapeOnly = (node, what) => literalOf(node) !== undefined || node.type === "Identifier"
|
|
127
|
+
? { literal: 0n }
|
|
128
|
+
: fail(`${what} is computed`);
|
|
109
129
|
return (body.length > 0 &&
|
|
110
130
|
body.every((statement) => {
|
|
111
131
|
try {
|
|
112
|
-
lowerStatement(statement,
|
|
132
|
+
lowerStatement(statement, shapeOnly, defines);
|
|
113
133
|
return true;
|
|
114
134
|
}
|
|
115
135
|
catch {
|
|
@@ -117,7 +137,7 @@ function isDirectCallBody(body, defines) {
|
|
|
117
137
|
}
|
|
118
138
|
}));
|
|
119
139
|
}
|
|
120
|
-
/** `USDC.transfer(to, amount)` or `Token(addr).transfer(to, amount)` ->
|
|
140
|
+
/** `USDC.transfer(to, amount)` or `Token(addr).transfer(to, amount)` -> the token write it names. */
|
|
121
141
|
function lowerStatement(statement, resolve, defines) {
|
|
122
142
|
if (statement.type !== "ExpressionStatement") {
|
|
123
143
|
return fail(`a \`${statement.type}\` cannot become a route call. An intent's body is a list of calls, so ` +
|
|
@@ -151,7 +171,7 @@ function lowerStatement(statement, resolve, defines) {
|
|
|
151
171
|
const address = defines.get(name);
|
|
152
172
|
if (address === undefined) {
|
|
153
173
|
return fail(`'${name}' is not a token this chain registers. Use a registered symbol, or ` +
|
|
154
|
-
|
|
174
|
+
"`Token(address)` with a literal, a define or a top-level `const` of a literal.");
|
|
155
175
|
}
|
|
156
176
|
target = address;
|
|
157
177
|
}
|
|
@@ -176,59 +196,31 @@ function lowerStatement(statement, resolve, defines) {
|
|
|
176
196
|
}
|
|
177
197
|
return { target, method, args };
|
|
178
198
|
}
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
for (const statement of body) {
|
|
200
|
-
walk(statement, (node) => {
|
|
201
|
-
if (node.type !== "Identifier")
|
|
202
|
-
return;
|
|
203
|
-
const name = node.name;
|
|
204
|
-
if (declared.has(name) || defines.has(name))
|
|
205
|
-
return;
|
|
206
|
-
if (!outerLocals.has(name))
|
|
207
|
-
return;
|
|
208
|
-
if (!read.includes(name))
|
|
209
|
-
read.push(name);
|
|
210
|
-
});
|
|
199
|
+
/** How a message names a field of `list`. */
|
|
200
|
+
const fieldOf = (list, path) => list.part === "reward" ? `\`reward.${path}\`` : `the delivery's \`${path}\``;
|
|
201
|
+
/** A token address of `list`. It is encoded into the intent, so it must be known when the intent is
|
|
202
|
+
* built: a symbol, a literal, a define or a top-level `const` of a literal, never a value the
|
|
203
|
+
* program has only while it runs. */
|
|
204
|
+
function tokenOf(node, resolve, list) {
|
|
205
|
+
const chain = list.chain.slug;
|
|
206
|
+
const subject = `the ${list.part} token`;
|
|
207
|
+
const where = list.part === "delivery"
|
|
208
|
+
? `The delivery — the intent's second argument, \`{ tokens: [...] }\` — is what the solver ` +
|
|
209
|
+
`brings to ${chain}, so its symbols are ${chain}'s: fix it there, not in \`.reward(...)\`.`
|
|
210
|
+
: `The reward — \`.reward({ tokens: [...] })\` — is escrowed on ${chain}, where the program ` +
|
|
211
|
+
`opening the intent runs, so its symbols are ${chain}'s.`;
|
|
212
|
+
const fix = `Use a symbol ${chain} registers, or the token's ${chain} address as a literal, a define or a ` +
|
|
213
|
+
"top-level `const` of a literal.";
|
|
214
|
+
if (node.type !== "Identifier" && literalOf(node) === undefined) {
|
|
215
|
+
return fail(`${subject} is a ${node.type}, which is not known when the intent is built. ${where} ${fix}`);
|
|
211
216
|
}
|
|
212
|
-
|
|
217
|
+
const value = resolve(node, subject, (name) => `${subject} '${name}' is not a token ${chain} registers, nor a define. ${where} ${fix}`);
|
|
218
|
+
if ("literal" in value)
|
|
219
|
+
return value.literal;
|
|
220
|
+
return fail(`${subject} '${value.capture}' is a variable of the program, known only while it runs, and an ` +
|
|
221
|
+
`intent names its tokens when it is built. ${where} ${fix}`);
|
|
213
222
|
}
|
|
214
|
-
|
|
215
|
-
function stripMemberProperties(body) {
|
|
216
|
-
const properties = new Set();
|
|
217
|
-
for (const statement of body) {
|
|
218
|
-
walk(statement, (node) => {
|
|
219
|
-
if (node.type !== "MemberExpression")
|
|
220
|
-
return;
|
|
221
|
-
if (node.computed === true)
|
|
222
|
-
return;
|
|
223
|
-
const property = node.property;
|
|
224
|
-
if (property?.type === "Identifier") {
|
|
225
|
-
properties.add(property.name);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
return properties;
|
|
230
|
-
}
|
|
231
|
-
function lowerReward(node, resolve) {
|
|
223
|
+
function lowerReward(node, resolve, list) {
|
|
232
224
|
if (node.type !== "ObjectExpression") {
|
|
233
225
|
return fail("`.reward(...)` takes an object, e.g. `{ tokens: [{ token: USDC, amount }] }`");
|
|
234
226
|
}
|
|
@@ -239,11 +231,12 @@ function lowerReward(node, resolve) {
|
|
|
239
231
|
const name = key?.type === "Identifier" ? key.name : "";
|
|
240
232
|
const value = property.value;
|
|
241
233
|
if (name === "tokens") {
|
|
242
|
-
if (value.type !== "ArrayExpression")
|
|
243
|
-
return fail("
|
|
234
|
+
if (value.type !== "ArrayExpression") {
|
|
235
|
+
return fail(`${fieldOf(list, "tokens")} must be an array`);
|
|
236
|
+
}
|
|
244
237
|
tokens = (value.elements ?? []).map((element) => {
|
|
245
238
|
if (element === null || element.type !== "ObjectExpression") {
|
|
246
|
-
return fail(
|
|
239
|
+
return fail(`each entry of ${fieldOf(list, "tokens")} must be \`{ token, amount }\``);
|
|
247
240
|
}
|
|
248
241
|
let token;
|
|
249
242
|
let amount;
|
|
@@ -253,27 +246,26 @@ function lowerReward(node, resolve) {
|
|
|
253
246
|
// `{ token: USDC, amount }` -- shorthand's value IS the identifier.
|
|
254
247
|
const fieldValue = field.value;
|
|
255
248
|
if (fieldName === "token") {
|
|
256
|
-
|
|
257
|
-
if (!("literal" in resolved)) {
|
|
258
|
-
return fail("a reward token address must be known when the intent is built");
|
|
259
|
-
}
|
|
260
|
-
token = resolved.literal;
|
|
249
|
+
token = tokenOf(fieldValue, resolve, list);
|
|
261
250
|
}
|
|
262
251
|
else if (fieldName === "amount") {
|
|
263
|
-
amount = resolve(fieldValue, "
|
|
252
|
+
amount = resolve(fieldValue, fieldOf(list, "tokens[].amount"));
|
|
264
253
|
}
|
|
265
254
|
else {
|
|
266
|
-
return fail(
|
|
255
|
+
return fail(`${fieldOf(list, `tokens[].${fieldName}`)} is not a field of a token amount`);
|
|
267
256
|
}
|
|
268
257
|
}
|
|
269
258
|
if (token === undefined || amount === undefined) {
|
|
270
|
-
return fail(
|
|
259
|
+
return fail(`each entry of ${fieldOf(list, "tokens")} needs both \`token\` and \`amount\``);
|
|
271
260
|
}
|
|
272
261
|
return { token, amount };
|
|
273
262
|
});
|
|
274
263
|
}
|
|
275
264
|
else if (name === "nativeAmount") {
|
|
276
|
-
nativeAmount = resolve(value, "
|
|
265
|
+
nativeAmount = resolve(value, fieldOf(list, "nativeAmount"));
|
|
266
|
+
}
|
|
267
|
+
else if (list.part === "delivery") {
|
|
268
|
+
return fail(`\`${name}\` is not a field of the delivery, which takes only \`tokens\``);
|
|
277
269
|
}
|
|
278
270
|
else {
|
|
279
271
|
return fail(`\`reward.${name}\` is not settable here. Deadlines, creator and prover come from the ` +
|
|
@@ -281,17 +273,20 @@ function lowerReward(node, resolve) {
|
|
|
281
273
|
}
|
|
282
274
|
}
|
|
283
275
|
if (tokens.length === 0 && nativeAmount === undefined) {
|
|
284
|
-
return fail(
|
|
276
|
+
return fail(list.part === "reward"
|
|
277
|
+
? "`.reward(...)` must offer something — `tokens`, `nativeAmount`, or both"
|
|
278
|
+
: "the delivery names no token: list what the solver brings in `tokens`, or leave the " +
|
|
279
|
+
"intent's second argument out");
|
|
285
280
|
}
|
|
286
281
|
return { tokens, nativeAmount };
|
|
287
282
|
}
|
|
288
283
|
/** `{ tokens: [{ token, amount }] }` — what the solver delivers to run the intent. Same shape as a
|
|
289
284
|
* reward leg, and deliberately the same parser, since the fields mean the same things. */
|
|
290
|
-
function lowerDelivery(node, resolve) {
|
|
285
|
+
function lowerDelivery(node, resolve, list) {
|
|
291
286
|
if (node.type !== "ObjectExpression") {
|
|
292
287
|
return fail("an intent's second argument is `{ tokens: [{ token, amount }] }`");
|
|
293
288
|
}
|
|
294
|
-
const spec = lowerReward(node, resolve);
|
|
289
|
+
const spec = lowerReward(node, resolve, list);
|
|
295
290
|
if (spec.nativeAmount !== undefined) {
|
|
296
291
|
return fail("`nativeAmount` belongs to the reward, not to what the solver delivers");
|
|
297
292
|
}
|
|
@@ -361,7 +356,7 @@ function collectSites(program, context) {
|
|
|
361
356
|
// ---------------------------------------------------------------------------
|
|
362
357
|
const addressHex = (value) => `0x${value.toString(16).padStart(40, "0")}`;
|
|
363
358
|
/** Lowers every `Chain(() => { ... }).reward({ ... })` in `source`. Purely textual surgery driven by
|
|
364
|
-
*
|
|
359
|
+
* parser ranges, so everything else survives byte for byte. */
|
|
365
360
|
export function rewriteIntentSugar(source, context) {
|
|
366
361
|
// Every route compile comes through here, and most programs have no sugar, so skip the parse
|
|
367
362
|
// when a site is impossible. A site is a call whose callee's property is the identifier
|
|
@@ -372,17 +367,16 @@ export function rewriteIntentSugar(source, context) {
|
|
|
372
367
|
if (!source.includes("reward") && !source.includes("\\u")) {
|
|
373
368
|
return { source, rewrote: false, intents: [] };
|
|
374
369
|
}
|
|
375
|
-
const program =
|
|
376
|
-
ecmaVersion: "latest",
|
|
377
|
-
sourceType: "module",
|
|
378
|
-
});
|
|
370
|
+
const program = parseSauce(source);
|
|
379
371
|
const sites = collectSites(program, context);
|
|
380
372
|
if (sites.length === 0)
|
|
381
373
|
return { source, rewrote: false, intents: [] };
|
|
382
|
-
//
|
|
383
|
-
//
|
|
384
|
-
|
|
385
|
-
|
|
374
|
+
// The file's top level: the declarations a child program may carry, and the entry. See
|
|
375
|
+
// `intent-body.ts` for what each name an intent body reads means.
|
|
376
|
+
const scope = moduleScope(program);
|
|
377
|
+
// The file's functions some child program carries; those the enclosing program no longer reaches
|
|
378
|
+
// once its bodies are lowered move out of it below.
|
|
379
|
+
const carriedFunctions = new Set();
|
|
386
380
|
const intents = [];
|
|
387
381
|
const replacements = [];
|
|
388
382
|
sites.forEach((site, index) => {
|
|
@@ -412,10 +406,31 @@ export function rewriteIntentSugar(source, context) {
|
|
|
412
406
|
}
|
|
413
407
|
return captureSentinel(at);
|
|
414
408
|
};
|
|
415
|
-
//
|
|
416
|
-
// USDC
|
|
417
|
-
|
|
418
|
-
|
|
409
|
+
// TWO chains, so two resolvers. The body and the delivery argument run on the DESTINATION:
|
|
410
|
+
// `USDC` in the closure is the destination's USDC. The reward is escrowed by THIS program, on
|
|
411
|
+
// the chain it runs on, and approved to that chain's Portal a few statements below, so its
|
|
412
|
+
// `USDC` is the enclosing chain's. Crossing them names an address with no code where the call
|
|
413
|
+
// runs: a reward token from the destination fails SafeERC20's code check on the approval and
|
|
414
|
+
// reverts the whole fulfilment, and a body token from here is not a token over there.
|
|
415
|
+
//
|
|
416
|
+
// A top-level `const` of a literal is known when the file is compiled, so it is a value here
|
|
417
|
+
// exactly as a define is, and the same on both chains: what the file wrote. A define of the same
|
|
418
|
+
// name takes precedence, as the compiler gives a define over a module `const`, and a local of
|
|
419
|
+
// the opening function shadows it.
|
|
420
|
+
const opening = enclosingLocals(program, scope, site.start);
|
|
421
|
+
const fixed = [...scope.declarations].flatMap(([name, d]) => d.literal === undefined || opening.has(name) ? [] : [[name, d.literal]]);
|
|
422
|
+
const compileTime = (chain) => new Map([...fixed, ...context.definesFor(chain)]);
|
|
423
|
+
const defines = compileTime(site.chain);
|
|
424
|
+
// What the enclosing program can read where the intent opens: its locals there, and the
|
|
425
|
+
// file's module-level values. A reward, a delivery or a token-write argument naming one is
|
|
426
|
+
// spliced in at run time.
|
|
427
|
+
const readable = new Set([
|
|
428
|
+
...opening,
|
|
429
|
+
...scope.imports.keys(),
|
|
430
|
+
...[...scope.declarations].filter(([, d]) => d.kind === "variable").map(([name]) => name),
|
|
431
|
+
]);
|
|
432
|
+
const resolve = makeResolver(defines, readable);
|
|
433
|
+
const resolveFunding = makeResolver(compileTime(context.source), readable);
|
|
419
434
|
/**
|
|
420
435
|
* What the solver delivers to the destination Executor so this intent can run.
|
|
421
436
|
*
|
|
@@ -424,15 +439,19 @@ export function rewriteIntentSugar(source, context) {
|
|
|
424
439
|
* because there it is not a judgement call — a `transfer` of N moves N, so N is what has to
|
|
425
440
|
* arrive. A program's needs cannot be read off its source, so the general path asks.
|
|
426
441
|
*/
|
|
427
|
-
const explicitDelivery = site.delivery === undefined
|
|
442
|
+
const explicitDelivery = site.delivery === undefined
|
|
443
|
+
? undefined
|
|
444
|
+
: lowerDelivery(site.delivery, resolve, { part: "delivery", chain: site.chain });
|
|
428
445
|
// TWO SHAPES, chosen by what the closure actually contains.
|
|
429
446
|
//
|
|
430
447
|
// A body of nothing but token writes needs no program: each statement is already one route
|
|
431
448
|
// call, which is cheaper than a cook and needs neither a Pot nor a Kitchen fee. Anything else --
|
|
432
449
|
// a swap, a condition, a loop, an intent of its own -- is a program, compiled for the
|
|
433
450
|
// destination and run through its Pot. The second shape is strictly more general; the first is
|
|
434
|
-
// kept because it is free.
|
|
435
|
-
|
|
451
|
+
// kept because it is free. It is ERC-20 calldata, so only for an EVM destination: on Solana a
|
|
452
|
+
// symbol is a mint's key, and a token write there goes the program way, where the SVM compile
|
|
453
|
+
// refuses the token syntax by name.
|
|
454
|
+
const simple = site.chain.kind === "evm" && isDirectCallBody(site.body, defines);
|
|
436
455
|
// The Portal the child's route records. Resolved once, here, because it is also what the Pot's
|
|
437
456
|
// owner is derived from: a route recording one Portal is run by that Portal's Executor.
|
|
438
457
|
const destinationPortal = context.defaults.destinationPortal ?? context.portalOf(site.chain);
|
|
@@ -440,17 +459,20 @@ export function rewriteIntentSugar(source, context) {
|
|
|
440
459
|
const calls = [];
|
|
441
460
|
const captureWords = [];
|
|
442
461
|
if (!simple) {
|
|
443
|
-
|
|
444
|
-
|
|
462
|
+
// The body as a program of its own: the file's declarations it reaches, carried as written,
|
|
463
|
+
// and `main` taking what it captures (`intent-body.ts`).
|
|
464
|
+
//
|
|
445
465
|
// Captured values reach the program as ENTRY ARGUMENTS. They cannot be folded in: their
|
|
446
466
|
// values do not exist when it is compiled. Declared as `main`'s parameters, encoded
|
|
447
467
|
// compact-v1 at a declared width so the payload's length does not move with them, and spliced
|
|
448
|
-
// by the parent at a fixed offset -- which is the property `scalarWidth` exists for.
|
|
449
|
-
//
|
|
450
|
-
//
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
const
|
|
468
|
+
// by the parent at a fixed offset -- which is the property `scalarWidth` exists for. Left
|
|
469
|
+
// unannotated: the compiler reads an unannotated parameter as a number, which a spliced
|
|
470
|
+
// 32-byte word is.
|
|
471
|
+
const childModule = childProgram(source, program, scope, site, site.body, source.slice(site.bodyStart + 1, site.bodyEnd - 1), new Set(defines.keys()));
|
|
472
|
+
const captured = childModule.captures;
|
|
473
|
+
for (const name of childModule.carriedFunctions)
|
|
474
|
+
carriedFunctions.add(name);
|
|
475
|
+
const child = context.compileChild(site.chain, childModule.source, captured, destinationPortal);
|
|
454
476
|
captured.forEach((name, i) => {
|
|
455
477
|
captureWords.push({ name, sentinel: child.captureSentinels[i] });
|
|
456
478
|
});
|
|
@@ -468,24 +490,40 @@ export function rewriteIntentSugar(source, context) {
|
|
|
468
490
|
}
|
|
469
491
|
calls.push(child.call);
|
|
470
492
|
}
|
|
493
|
+
// Each call is encoded by viem against the ERC-20 ABI, so the selector and the word layout are
|
|
494
|
+
// the encoder's rather than this file's. A captured argument goes in as its sentinel, which is
|
|
495
|
+
// address-shaped and therefore legal in either position.
|
|
496
|
+
const tokenCall = (target, method, args) => ({
|
|
497
|
+
target: addressHex(target),
|
|
498
|
+
data: encodeFunctionData({
|
|
499
|
+
abi: ERC20ABI,
|
|
500
|
+
functionName: method,
|
|
501
|
+
args: [addressHex(sentinelFor(args[0])), sentinelFor(args[1])],
|
|
502
|
+
}),
|
|
503
|
+
value: 0n,
|
|
504
|
+
});
|
|
505
|
+
// These calls are not a Sauce program: the Portal's Executor runs each one raw and checks only
|
|
506
|
+
// that it did not revert and that the target has code. So they are NOT SafeERC20. What that
|
|
507
|
+
// costs, and what the lowering does about it:
|
|
508
|
+
// - A token that returns nothing (USDT) works as it is: nothing decodes the return.
|
|
509
|
+
// - USDT refuses to move a non-zero allowance to another non-zero value, and ONE Executor runs
|
|
510
|
+
// every intent on a chain, so an allowance an earlier intent left behind is a realistic
|
|
511
|
+
// state. Every approve is therefore preceded by `approve(spender, 0)` — `forceApprove`'s end
|
|
512
|
+
// state, unconditionally, because the Executor's allowance cannot be read when the intent is
|
|
513
|
+
// built. A literal zero amount needs no reset.
|
|
514
|
+
// - A token that returns `false` instead of reverting is NOT detected. A body that needs that
|
|
515
|
+
// check must take the program path, whose writes are `@sauce/token`'s SafeERC20 ones.
|
|
471
516
|
for (const statement of simple ? site.body : []) {
|
|
472
517
|
const lowered = lowerStatement(statement, resolve, defines);
|
|
473
518
|
// A `transfer` moves tokens the Executor must have been given; an `approve` moves nothing.
|
|
474
519
|
if (lowered.method === "transfer" && explicitDelivery === undefined) {
|
|
475
520
|
derivedDelivery.push({ token: lowered.target, amount: lowered.args[1] });
|
|
476
521
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
data: encodeFunctionData({
|
|
483
|
-
abi: ERC20ABI,
|
|
484
|
-
functionName: lowered.method,
|
|
485
|
-
args: [addressHex(sentinelFor(lowered.args[0])), sentinelFor(lowered.args[1])],
|
|
486
|
-
}),
|
|
487
|
-
value: 0n,
|
|
488
|
-
});
|
|
522
|
+
const amount = lowered.args[1];
|
|
523
|
+
if (lowered.method === "approve" && !("literal" in amount && amount.literal === 0n)) {
|
|
524
|
+
calls.push(tokenCall(lowered.target, "approve", [lowered.args[0], { literal: 0n }]));
|
|
525
|
+
}
|
|
526
|
+
calls.push(tokenCall(lowered.target, lowered.method, lowered.args));
|
|
489
527
|
}
|
|
490
528
|
// A capture the PROGRAM reads is a slot too: its sentinel sits in the argument tail of the cook
|
|
491
529
|
// calldata above, which the parent splices exactly as it splices a reward amount.
|
|
@@ -499,7 +537,18 @@ export function rewriteIntentSugar(source, context) {
|
|
|
499
537
|
if (!captures.includes(name))
|
|
500
538
|
captures.push(name);
|
|
501
539
|
}
|
|
502
|
-
|
|
540
|
+
// On the enclosing chain: see `resolveFunding` above.
|
|
541
|
+
const reward = lowerReward(site.reward, resolveFunding, {
|
|
542
|
+
part: "reward",
|
|
543
|
+
chain: context.source,
|
|
544
|
+
});
|
|
545
|
+
// A native amount known to be zero offers nothing; any other (a literal or a run-time value)
|
|
546
|
+
// is a native leg the source Portal would count against a leg of its native ERC-20.
|
|
547
|
+
const offersNative = reward.nativeAmount !== undefined &&
|
|
548
|
+
!("literal" in reward.nativeAmount && reward.nativeAmount.literal === 0n);
|
|
549
|
+
const conflict = rewardAssetsConflict(context.source.id, offersNative, reward.tokens.map((t) => addressHex(t.token)));
|
|
550
|
+
if (conflict !== undefined)
|
|
551
|
+
fail(conflict);
|
|
503
552
|
const { defaults } = context;
|
|
504
553
|
const rewardDeadline = defaults.rewardDeadline ?? requireDeadline(defaults);
|
|
505
554
|
const child = {
|
|
@@ -533,14 +582,21 @@ export function rewriteIntentSugar(source, context) {
|
|
|
533
582
|
}),
|
|
534
583
|
};
|
|
535
584
|
const sourcePortal = defaults.sourcePortal ?? context.portalOf(context.source);
|
|
536
|
-
const
|
|
537
|
-
|
|
585
|
+
const fundVia = requireFundVia(defaults);
|
|
586
|
+
// `publish` when the program pays the vault itself, `publishAndFund` when the Portal pulls the
|
|
587
|
+
// reward under an approval. Either way the intent is these bytes, cut at the same slots.
|
|
588
|
+
const tx = fundVia === "transfer"
|
|
589
|
+
? publishTx(child, { portal: sourcePortal })
|
|
590
|
+
: publishAndFundTx(child, defaults.allowPartial ?? false, { portal: sourcePortal });
|
|
591
|
+
// An intent every value of which is known now — defines and literals, no local of the program —
|
|
592
|
+
// has no slot to fill: its calldata is simply these bytes.
|
|
593
|
+
const template = placeholders.length === 0 ? undefined : splitByPlaceholders(tx.data, placeholders);
|
|
538
594
|
// Every sentinel must have become a slot. `splitByPlaceholders` guarantees that for the ones it
|
|
539
595
|
// was TOLD about; this catches the other direction — a sentinel written into the payload whose
|
|
540
596
|
// placeholder was never declared, which leaves it in the literal segments and ships an intent
|
|
541
597
|
// carrying `0x5acecab7…` where an amount belongs. That happened once, silently, which is why it
|
|
542
598
|
// is checked rather than reasoned about.
|
|
543
|
-
for (const segment of template.
|
|
599
|
+
for (const segment of template?.segments ?? [tx.data]) {
|
|
544
600
|
for (const tag of [CAPTURE_TAG, CHILD_CAPTURE_TAG]) {
|
|
545
601
|
if (segment.includes(tag)) {
|
|
546
602
|
throw new SugarError(`intent sugar: a capture sentinel (0x${tag}) survived into the encoded intent — some ` +
|
|
@@ -550,28 +606,50 @@ export function rewriteIntentSugar(source, context) {
|
|
|
550
606
|
}
|
|
551
607
|
}
|
|
552
608
|
const locals = Object.fromEntries(captures.map((name) => [name, name]));
|
|
553
|
-
const emitted =
|
|
609
|
+
const emitted = template === undefined
|
|
610
|
+
? {
|
|
611
|
+
statements: [`const ${prefix}data = hex\`${tx.data.slice(2)}\`;`],
|
|
612
|
+
dataVar: `${prefix}data`,
|
|
613
|
+
}
|
|
614
|
+
: emitTemplate(template, { prefix, locals });
|
|
554
615
|
const statements = [...emitted.statements];
|
|
555
|
-
// One approve per distinct reward token, so the Portal can pull the escrow from this Pot.
|
|
556
|
-
// Through `token/safe.ts`: the ERC-20 ABI's `bool` return is decoded even when discarded and a
|
|
557
|
-
// token like USDT returns nothing, so the call goes out raw and the SafeERC20 check judges the
|
|
558
|
-
// result. That helper also resets a standing allowance first -- which matters here more than
|
|
559
|
-
// anywhere, because one Pot publishes every intent on this chain and the previous one's
|
|
560
|
-
// leftover allowance is exactly what USDT refuses to overwrite.
|
|
561
616
|
const portalWord = {
|
|
562
617
|
literal: BigInt(denormalizeToEvm(toUniversalAddress(sourcePortal))),
|
|
563
618
|
};
|
|
564
|
-
const
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
619
|
+
const portalLiteral = `${portalWord.literal}n`;
|
|
620
|
+
if (fundVia === "transfer") {
|
|
621
|
+
statements.push(...vaultFundingStatements({
|
|
622
|
+
prefix,
|
|
623
|
+
child,
|
|
624
|
+
publishData: tx.data,
|
|
625
|
+
dataVar: emitted.dataVar,
|
|
626
|
+
sourcePortal,
|
|
627
|
+
reward,
|
|
628
|
+
}), `evm.call(${portalLiteral}, 0n, ${emitted.dataVar});`);
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
// One approve per distinct reward token, so the Portal can pull the escrow from this Pot.
|
|
632
|
+
// Through `token/safe.ts`: the ERC-20 ABI's `bool` return is decoded even when discarded and a
|
|
633
|
+
// token like USDT returns nothing, so the call goes out raw and the SafeERC20 check judges the
|
|
634
|
+
// result. That helper also resets a standing allowance first -- which matters here more than
|
|
635
|
+
// anywhere, because one Pot publishes every intent on this chain and the previous one's
|
|
636
|
+
// leftover allowance is exactly what USDT refuses to overwrite. A token listed twice is
|
|
637
|
+
// approved once, for the larger amount: `_fundToken` pulls each entry up to the vault's
|
|
638
|
+
// whole balance of that token, so the largest entry is the allowance it needs.
|
|
639
|
+
largestPerToken(`${prefix}a`, reward, statements).forEach(({ token, amount }, i) => {
|
|
640
|
+
statements.push(...safeApproveStatements(`${prefix}${i}`, `${token}n`, portalWord, amount));
|
|
641
|
+
});
|
|
642
|
+
// The native reward travels as the call's value: `_fundNative` pays the vault from
|
|
643
|
+
// `msg.value`, and `Refund.excessNative` returns what it did not need.
|
|
644
|
+
statements.push(`evm.call(${portalLiteral}, ${valueExpression(reward.nativeAmount)}, ${emitted.dataVar});`);
|
|
645
|
+
}
|
|
646
|
+
intents.push({
|
|
647
|
+
intent: child,
|
|
648
|
+
captures,
|
|
649
|
+
sentinels: placeholders.map(({ value, source }) => ({ sentinel: value, capture: source })),
|
|
650
|
+
destination: site.chain,
|
|
651
|
+
fundVia,
|
|
572
652
|
});
|
|
573
|
-
statements.push(`evm.call(${BigInt(denormalizeToEvm(toUniversalAddress(sourcePortal)))}n, 0n, ${emitted.dataVar});`);
|
|
574
|
-
intents.push({ intent: child, captures, destination: site.chain });
|
|
575
653
|
replacements.push({
|
|
576
654
|
start: site.start,
|
|
577
655
|
end: site.end,
|
|
@@ -584,7 +662,135 @@ export function rewriteIntentSugar(source, context) {
|
|
|
584
662
|
for (const replacement of [...replacements].sort((a, b) => b.start - a.start)) {
|
|
585
663
|
out = out.slice(0, replacement.start) + replacement.text + out.slice(replacement.end);
|
|
586
664
|
}
|
|
587
|
-
return { source: out, rewrote: true, intents };
|
|
665
|
+
return { source: withoutMovedFunctions(out, carriedFunctions), rewrote: true, intents };
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* `source` without the functions only an intent body used. Each moved into that body's program,
|
|
669
|
+
* which compiles it for the chain it runs on; left here it would be compiled for this chain too,
|
|
670
|
+
* where the program never calls it, and could fail a rewrite there for a token or protocol that
|
|
671
|
+
* chain does not have.
|
|
672
|
+
*/
|
|
673
|
+
function withoutMovedFunctions(source, carried) {
|
|
674
|
+
if (carried.size === 0)
|
|
675
|
+
return source;
|
|
676
|
+
const program = parseSauce(source);
|
|
677
|
+
const moved = unreachedFunctions(moduleScope(program), carried);
|
|
678
|
+
if (moved.size === 0)
|
|
679
|
+
return source;
|
|
680
|
+
let out = source;
|
|
681
|
+
const statements = [...(program.body ?? [])].reverse();
|
|
682
|
+
for (const statement of statements) {
|
|
683
|
+
const node = statement.type === "ExportNamedDeclaration"
|
|
684
|
+
? (statement.declaration ?? statement)
|
|
685
|
+
: statement;
|
|
686
|
+
const id = node.type === "FunctionDeclaration" ? node.id : undefined;
|
|
687
|
+
if (id === undefined || !moved.has(id.name))
|
|
688
|
+
continue;
|
|
689
|
+
const end = out[statement.end] === "\n" ? statement.end + 1 : statement.end;
|
|
690
|
+
out = out.slice(0, statement.start) + out.slice(end);
|
|
691
|
+
}
|
|
692
|
+
return out;
|
|
693
|
+
}
|
|
694
|
+
/** A native amount as the expression a call's value takes: its literal, or the enclosing local. */
|
|
695
|
+
function valueExpression(value) {
|
|
696
|
+
if (value === undefined)
|
|
697
|
+
return "0n";
|
|
698
|
+
return "literal" in value ? `${value.literal}n` : value.capture;
|
|
699
|
+
}
|
|
700
|
+
/** `defaults.fundVia`, defaulted and checked, refusing an option that belongs to the other mode. */
|
|
701
|
+
function requireFundVia(defaults) {
|
|
702
|
+
const fundVia = defaults.fundVia ?? "transfer";
|
|
703
|
+
if (!INTENT_FUND_VIA.includes(fundVia)) {
|
|
704
|
+
return fail(`\`intents.fundVia\` is '${String(fundVia)}', which is not ` +
|
|
705
|
+
`${INTENT_FUND_VIA.map((via) => `"${via}"`).join(" or ")}`);
|
|
706
|
+
}
|
|
707
|
+
if (fundVia === "transfer" && defaults.allowPartial === true) {
|
|
708
|
+
return fail('`intents.allowPartial` goes with `fundVia: "publishAndFund"`: funding by transfer pays the ' +
|
|
709
|
+
"whole reward into the vault, and `publish` takes no such flag");
|
|
710
|
+
}
|
|
711
|
+
return fundVia;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Each distinct reward token, in first-seen order, with the largest amount it is listed for: the
|
|
715
|
+
* balance `isIntentFunded` checks every entry of that token against, and so what a transfer into
|
|
716
|
+
* the vault — or an approval the Portal pulls under — must cover. A literal when every amount is
|
|
717
|
+
* known now; otherwise a local, computed by the statements this appends (named `<tag><i>m<k>`), the
|
|
718
|
+
* largest of the captured values and of the largest literal beside them.
|
|
719
|
+
*/
|
|
720
|
+
function largestPerToken(tag, reward, statements) {
|
|
721
|
+
const byToken = new Map();
|
|
722
|
+
for (const t of reward.tokens)
|
|
723
|
+
byToken.set(t.token, [...(byToken.get(t.token) ?? []), t.amount]);
|
|
724
|
+
return [...byToken].map(([token, amounts], i) => {
|
|
725
|
+
const largestLiteral = amounts.reduce((max, a) => ("literal" in a && (max === undefined || a.literal > max) ? a.literal : max), undefined);
|
|
726
|
+
const captured = [...new Set(amounts.flatMap((a) => ("capture" in a ? [a.capture] : [])))];
|
|
727
|
+
if (captured.length === 0)
|
|
728
|
+
return { token, amount: { literal: largestLiteral } };
|
|
729
|
+
const operands = [...captured, ...(largestLiteral === undefined ? [] : [`${largestLiteral}n`])];
|
|
730
|
+
let local = operands[0];
|
|
731
|
+
operands.slice(1).forEach((operand, k) => {
|
|
732
|
+
const next = `${tag}${i}m${k}`;
|
|
733
|
+
statements.push(`const ${next} = ${local} > ${operand} ? ${local} : ${operand};`);
|
|
734
|
+
local = next;
|
|
735
|
+
});
|
|
736
|
+
return { token, amount: { local } };
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* The statements that pay an intent's reward into its vault from the executing contract, before
|
|
741
|
+
* the `publish` that follows them:
|
|
742
|
+
*
|
|
743
|
+
* 1. the vault, read from the Portal in this same cook — `intentVaultAddress` over the very bytes
|
|
744
|
+
* about to be published, so the address cannot disagree with the intent the Portal records.
|
|
745
|
+
* Its arguments are `publish`'s exactly (`(uint64, bytes, Reward)` both), so the call is the
|
|
746
|
+
* rendered payload with the other selector in front, not a second copy of the intent;
|
|
747
|
+
* 2. one `transfer(vault, amount)` per distinct reward token, for the largest of its amounts (the
|
|
748
|
+
* balance `isIntentFunded` checks each entry against), with `SafeERC20` semantics
|
|
749
|
+
* (`token/safe.ts`): a token returning nothing works, `false` or no code reverts the cook. A
|
|
750
|
+
* captured amount of zero transfers nothing;
|
|
751
|
+
* 3. the native amount, sent to the vault.
|
|
752
|
+
*/
|
|
753
|
+
function vaultFundingStatements(funding) {
|
|
754
|
+
const { prefix, child, publishData, dataVar, sourcePortal, reward } = funding;
|
|
755
|
+
const query = intentVaultAddressCall(child, { portal: sourcePortal }).data;
|
|
756
|
+
// Held, not assumed: the selector swap below is only sound while both functions take the same
|
|
757
|
+
// arguments in the same encoding.
|
|
758
|
+
if (query.slice(10) !== publishData.slice(10)) {
|
|
759
|
+
throw new SugarError("intent sugar: intentVaultAddress and publish no longer encode the same arguments — " +
|
|
760
|
+
"the vault read would ask about a different intent than the one published. This is a bug " +
|
|
761
|
+
"in the lowering, not in the program.");
|
|
762
|
+
}
|
|
763
|
+
const portal = `${BigInt(denormalizeToEvm(toUniversalAddress(sourcePortal)))}n`;
|
|
764
|
+
const vault = `${prefix}vault`;
|
|
765
|
+
const statements = [
|
|
766
|
+
`const ${prefix}vsel = hex\`${query.slice(2, 10)}\`;`,
|
|
767
|
+
`const ${prefix}vq = ${prefix}vsel.concat(${dataVar}.slice(4n, ${dataVar}.length));`,
|
|
768
|
+
`const [${vault}] = abi.decode(evm.static(${portal}, ${prefix}vq), ["Address"]);`,
|
|
769
|
+
];
|
|
770
|
+
largestPerToken(`${prefix}f`, reward, statements).forEach(({ token, amount }, i) => {
|
|
771
|
+
// A token listed only for nothing needs nothing in the vault.
|
|
772
|
+
if ("literal" in amount && amount.literal === 0n)
|
|
773
|
+
return;
|
|
774
|
+
const transfer = safeTransferStatements(`${prefix}f${i}_`, `${token}n`, { local: vault }, amount);
|
|
775
|
+
if ("literal" in amount) {
|
|
776
|
+
statements.push(...transfer);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
// The calldata consts are hoisted out of the zero guard; the call AND its SafeERC20 check go
|
|
780
|
+
// inside it, since checking a call that never happened would read a stale result.
|
|
781
|
+
const firstCall = transfer.findIndex((line) => line.includes("evm.call("));
|
|
782
|
+
statements.push(...transfer.slice(0, firstCall));
|
|
783
|
+
statements.push(`if (${amount.local} > 0n) { ${transfer.slice(firstCall).join(" ")} }`);
|
|
784
|
+
});
|
|
785
|
+
const native = reward.nativeAmount;
|
|
786
|
+
if (native !== undefined && !("literal" in native && native.literal === 0n)) {
|
|
787
|
+
// Bound, not inline: a method call on a `hex` literal is outside the compiler's subset, and
|
|
788
|
+
// `evm.call` is the one way to send value.
|
|
789
|
+
statements.push(`const ${prefix}fnd = hex\`\`;`);
|
|
790
|
+
const send = `evm.call(${vault}, ${valueExpression(native)}, ${prefix}fnd);`;
|
|
791
|
+
statements.push("literal" in native ? send : `if (${native.capture} > 0n) { ${send} }`);
|
|
792
|
+
}
|
|
793
|
+
return statements;
|
|
588
794
|
}
|
|
589
795
|
/**
|
|
590
796
|
* The reward's creator — who may reclaim it once `rewardDeadline` passes.
|