@eco-incorp/sauce 0.99.3 → 0.99.5
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 +105 -63
- package/actions/action-program.schema.json +1810 -0
- package/actions/dist/abis.d.ts +167 -0
- package/actions/dist/abis.d.ts.map +1 -0
- package/actions/dist/abis.js +215 -0
- package/actions/dist/compile.d.ts +15 -8
- package/actions/dist/compile.d.ts.map +1 -1
- package/actions/dist/compile.js +11 -33
- package/actions/dist/compose.d.ts +46 -0
- package/actions/dist/compose.d.ts.map +1 -0
- package/actions/dist/compose.js +118 -0
- package/actions/dist/emit.d.ts +0 -35
- package/actions/dist/emit.d.ts.map +1 -1
- package/actions/dist/emit.js +15 -46
- package/actions/dist/index.d.ts +11 -8
- package/actions/dist/index.d.ts.map +1 -1
- package/actions/dist/index.js +6 -4
- package/actions/dist/program.d.ts +23 -0
- package/actions/dist/program.d.ts.map +1 -0
- package/actions/dist/program.js +358 -0
- package/actions/dist/registry.d.ts +37 -0
- package/actions/dist/registry.d.ts.map +1 -0
- package/actions/dist/registry.js +36 -0
- package/actions/dist/schema.d.ts +6 -0
- package/actions/dist/schema.d.ts.map +1 -0
- package/actions/dist/schema.js +166 -0
- package/actions/dist/semantics.d.ts +18 -0
- package/actions/dist/semantics.d.ts.map +1 -0
- package/actions/dist/semantics.js +164 -0
- package/actions/dist/spec.d.ts +97 -0
- package/actions/dist/spec.d.ts.map +1 -0
- package/actions/dist/spec.js +323 -0
- package/actions/dist/split-swap.d.ts +35 -0
- package/actions/dist/split-swap.d.ts.map +1 -0
- package/actions/dist/split-swap.js +175 -0
- package/actions/dist/to-quote.d.ts +32 -56
- package/actions/dist/to-quote.d.ts.map +1 -1
- package/actions/dist/to-quote.js +134 -141
- package/actions/dist/to-sauce.d.ts +48 -32
- package/actions/dist/to-sauce.d.ts.map +1 -1
- package/actions/dist/to-sauce.js +691 -753
- package/actions/dist/types.d.ts +227 -335
- package/actions/dist/types.d.ts.map +1 -1
- package/actions/dist/types.js +12 -3
- package/dev-tools/README.md +9 -9
- package/dev-tools/artifacts/ISauceRouter.json +1 -1
- package/dev-tools/artifacts/Router.json +1 -1
- package/dev-tools/scripts/start-fork.sh +1 -1
- package/dev-tools/scripts/start-local.sh +5 -1
- package/dev-tools/src/svm-local.ts +23 -13
- package/docs/README.md +45 -34
- package/docs/api/README.md +37 -29
- package/docs/api/compiler.md +116 -55
- package/docs/api/coverage.md +99 -48
- package/docs/api/routes.md +51 -22
- package/docs/concepts/architecture.md +83 -116
- package/docs/concepts/saucescript.md +27 -23
- package/docs/examples/README.md +18 -10
- package/docs/examples/action-program.ts +75 -0
- package/docs/examples/cross-chain-cascade.sauce.ts +21 -0
- package/docs/examples/cross-chain-cascade.ts +43 -0
- package/docs/examples/cross-chain-intent.sauce.ts +23 -0
- package/docs/examples/cross-chain-intent.ts +49 -0
- package/docs/examples/first-intent.ts +7 -10
- package/docs/examples/protocol-approval.ts +3 -7
- package/docs/guides/actions.md +395 -0
- package/docs/guides/builders-and-actions.md +31 -37
- package/docs/guides/compiling.md +97 -98
- package/docs/guides/intents.md +242 -24
- package/docs/guides/nested-intents.md +165 -5
- package/docs/guides/protocols-and-tokens.md +15 -7
- package/docs/guides/quick-start.md +51 -22
- package/docs/guides/solana.md +38 -39
- package/docs/guides/verification.md +70 -31
- package/package.json +7 -2
- package/sdk/dist/artifacts/ISauceRouter.json +1 -1
- package/sdk/dist/artifacts/Router.json +1 -1
- package/sdk/dist/artifacts/V12Deployments.json +23 -22
- package/sdk/dist/artifacts/V12EngineGate.json +2 -2
- package/sdk/dist/artifacts/V12Kitchen.json +1 -1
- package/sdk/dist/artifacts/V12Pot.json +1 -1
- package/sdk/dist/artifacts/V12RuntimeBytecode.json +1 -1
- package/sdk/dist/artifacts/svm/engine-devnet.so +0 -0
- package/sdk/dist/artifacts/svm/engine-mainnet.so +0 -0
- package/sdk/dist/artifacts/svm/engine-wire-devnet.json +6 -0
- package/sdk/dist/artifacts/svm/engine-wire-mainnet.json +6 -0
- package/sdk/dist/bytes.d.ts +10 -0
- package/sdk/dist/bytes.d.ts.map +1 -0
- package/sdk/dist/bytes.js +31 -0
- package/sdk/dist/bytes.js.map +1 -0
- package/sdk/dist/chains/canonical.d.ts +7 -1
- package/sdk/dist/chains/canonical.d.ts.map +1 -1
- package/sdk/dist/chains/canonical.js +6 -2
- package/sdk/dist/chains/canonical.js.map +1 -1
- package/sdk/dist/chains/index.d.ts +16 -2
- package/sdk/dist/chains/index.d.ts.map +1 -1
- package/sdk/dist/chains/index.js +51 -34
- package/sdk/dist/chains/index.js.map +1 -1
- package/sdk/dist/compact-arguments.d.ts +4 -1
- package/sdk/dist/compact-arguments.d.ts.map +1 -1
- package/sdk/dist/compact-arguments.js +25 -4
- package/sdk/dist/compact-arguments.js.map +1 -1
- package/sdk/dist/compiler.d.ts +13 -1
- package/sdk/dist/compiler.d.ts.map +1 -1
- package/sdk/dist/compiler.js +5 -6
- package/sdk/dist/compiler.js.map +1 -1
- package/sdk/dist/core/types.d.ts +18 -2
- package/sdk/dist/core/types.d.ts.map +1 -1
- package/sdk/dist/deployments/pot.d.ts +39 -0
- package/sdk/dist/deployments/pot.d.ts.map +1 -0
- package/sdk/dist/deployments/pot.js +48 -0
- package/sdk/dist/deployments/pot.js.map +1 -0
- package/sdk/dist/deployments/v12-addresses.d.ts +1 -4
- package/sdk/dist/deployments/v12-addresses.d.ts.map +1 -1
- package/sdk/dist/deployments/v12-addresses.js +7 -21
- package/sdk/dist/deployments/v12-addresses.js.map +1 -1
- package/sdk/dist/deposit/index.d.ts +5 -5
- 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 +3 -2
- package/sdk/dist/deposit/params.d.ts.map +1 -1
- package/sdk/dist/deposit/params.js +40 -3
- package/sdk/dist/deposit/params.js.map +1 -1
- package/sdk/dist/deposit/source.d.ts +0 -19
- package/sdk/dist/deposit/source.d.ts.map +1 -1
- package/sdk/dist/deposit/source.js +17 -34
- package/sdk/dist/deposit/source.js.map +1 -1
- package/sdk/dist/descriptors/accessors.d.ts +2 -2
- package/sdk/dist/descriptors/accessors.d.ts.map +1 -1
- package/sdk/dist/descriptors/accessors.js +15 -4
- package/sdk/dist/descriptors/accessors.js.map +1 -1
- package/sdk/dist/descriptors/call.d.ts +8 -13
- package/sdk/dist/descriptors/call.d.ts.map +1 -1
- package/sdk/dist/descriptors/call.js +7 -19
- package/sdk/dist/descriptors/call.js.map +1 -1
- package/sdk/dist/descriptors/derive.d.ts +1 -1
- package/sdk/dist/descriptors/derive.d.ts.map +1 -1
- package/sdk/dist/descriptors/derive.js +1 -1
- package/sdk/dist/descriptors/derive.js.map +1 -1
- package/sdk/dist/descriptors/index.d.ts +1 -1
- package/sdk/dist/descriptors/index.d.ts.map +1 -1
- package/sdk/dist/descriptors/index.js +1 -1
- package/sdk/dist/descriptors/index.js.map +1 -1
- package/sdk/dist/descriptors/links.d.ts +3 -12
- package/sdk/dist/descriptors/links.d.ts.map +1 -1
- package/sdk/dist/descriptors/links.js +2 -32
- package/sdk/dist/descriptors/links.js.map +1 -1
- package/sdk/dist/descriptors/query.d.ts +7 -3
- package/sdk/dist/descriptors/query.d.ts.map +1 -1
- package/sdk/dist/descriptors/query.js +9 -5
- package/sdk/dist/descriptors/query.js.map +1 -1
- package/sdk/dist/descriptors/registry.d.ts.map +1 -1
- package/sdk/dist/descriptors/registry.js +1 -0
- package/sdk/dist/descriptors/registry.js.map +1 -1
- package/sdk/dist/embedded/recipes.d.ts +3 -0
- package/sdk/dist/embedded/recipes.d.ts.map +1 -0
- package/sdk/dist/embedded/recipes.js +15 -0
- package/sdk/dist/embedded/recipes.js.map +1 -0
- package/sdk/dist/embedded/resolve.d.ts +27 -0
- package/sdk/dist/embedded/resolve.d.ts.map +1 -0
- package/sdk/dist/embedded/resolve.js +99 -0
- package/sdk/dist/embedded/resolve.js.map +1 -0
- package/sdk/dist/embedded/skills.generated.d.ts +3 -0
- package/sdk/dist/embedded/skills.generated.d.ts.map +1 -0
- package/sdk/dist/embedded/skills.generated.js +141 -0
- package/sdk/dist/embedded/skills.generated.js.map +1 -0
- package/sdk/dist/embedded/sources.generated.d.ts +7 -0
- package/sdk/dist/embedded/sources.generated.d.ts.map +1 -0
- package/sdk/dist/embedded/sources.generated.js +231 -0
- package/sdk/dist/embedded/sources.generated.js.map +1 -0
- package/sdk/dist/evm/execution-fee.d.ts +30 -0
- package/sdk/dist/evm/execution-fee.d.ts.map +1 -0
- package/sdk/dist/evm/execution-fee.js +33 -0
- package/sdk/dist/evm/execution-fee.js.map +1 -0
- package/sdk/dist/index.d.ts +7 -2
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +16 -10
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/plugin/index.d.ts +1 -1
- package/sdk/dist/plugin/index.d.ts.map +1 -1
- package/sdk/dist/plugin/index.js +5 -22
- package/sdk/dist/plugin/index.js.map +1 -1
- package/sdk/dist/protocols/aave-v4/abis.d.ts +201 -0
- package/sdk/dist/protocols/aave-v4/abis.d.ts.map +1 -0
- package/sdk/dist/protocols/aave-v4/abis.js +139 -0
- package/sdk/dist/protocols/aave-v4/abis.js.map +1 -0
- package/sdk/dist/protocols/aave-v4/addresses.d.ts +3 -0
- package/sdk/dist/protocols/aave-v4/addresses.d.ts.map +1 -0
- package/sdk/dist/protocols/aave-v4/addresses.js +65 -0
- package/sdk/dist/protocols/aave-v4/addresses.js.map +1 -0
- package/sdk/dist/protocols/aave-v4/functions.d.ts +5 -0
- package/sdk/dist/protocols/aave-v4/functions.d.ts.map +1 -0
- package/sdk/dist/protocols/aave-v4/functions.js +37 -0
- package/sdk/dist/protocols/aave-v4/functions.js.map +1 -0
- package/sdk/dist/protocols/aave-v4/index.d.ts +5 -0
- package/sdk/dist/protocols/aave-v4/index.d.ts.map +1 -0
- package/sdk/dist/protocols/aave-v4/index.js +5 -0
- package/sdk/dist/protocols/aave-v4/index.js.map +1 -0
- package/sdk/dist/protocols/aave-v4/info.d.ts +3 -0
- package/sdk/dist/protocols/aave-v4/info.d.ts.map +1 -0
- package/sdk/dist/protocols/aave-v4/info.js +12 -0
- package/sdk/dist/protocols/aave-v4/info.js.map +1 -0
- package/sdk/dist/protocols/across/abis.d.ts +24 -12
- package/sdk/dist/protocols/across/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/across/abis.js +16 -8
- package/sdk/dist/protocols/across/abis.js.map +1 -1
- package/sdk/dist/protocols/across/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/across/addresses.js +10 -0
- package/sdk/dist/protocols/across/addresses.js.map +1 -1
- package/sdk/dist/protocols/across/functions.d.ts +1 -1
- package/sdk/dist/protocols/across/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/across/functions.js +2 -2
- package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts +112 -0
- package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/abis.js +73 -0
- package/sdk/dist/protocols/aerodrome-slipstream/abis.js.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/addresses.d.ts +3 -0
- package/sdk/dist/protocols/aerodrome-slipstream/addresses.d.ts.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/addresses.js +39 -0
- package/sdk/dist/protocols/aerodrome-slipstream/addresses.js.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/functions.d.ts +2 -0
- package/sdk/dist/protocols/aerodrome-slipstream/functions.d.ts.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/functions.js +9 -0
- package/sdk/dist/protocols/aerodrome-slipstream/functions.js.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/index.d.ts +5 -0
- package/sdk/dist/protocols/aerodrome-slipstream/index.d.ts.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/index.js +5 -0
- package/sdk/dist/protocols/aerodrome-slipstream/index.js.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/info.d.ts +3 -0
- package/sdk/dist/protocols/aerodrome-slipstream/info.d.ts.map +1 -0
- package/sdk/dist/protocols/aerodrome-slipstream/info.js +12 -0
- package/sdk/dist/protocols/aerodrome-slipstream/info.js.map +1 -0
- package/sdk/dist/protocols/aevo/abis.d.ts +17 -2
- package/sdk/dist/protocols/aevo/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/aevo/abis.js +10 -2
- package/sdk/dist/protocols/aevo/abis.js.map +1 -1
- package/sdk/dist/protocols/aevo/functions.d.ts +1 -1
- package/sdk/dist/protocols/aevo/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/aevo/functions.js +2 -2
- package/sdk/dist/protocols/alchemix/abis.d.ts +1 -1
- package/sdk/dist/protocols/alchemix/abis.js +1 -1
- package/sdk/dist/protocols/alchemix/abis.js.map +1 -1
- package/sdk/dist/protocols/ambient/abis.d.ts +2 -2
- package/sdk/dist/protocols/ambient/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/ambient/abis.js +3 -2
- package/sdk/dist/protocols/ambient/abis.js.map +1 -1
- package/sdk/dist/protocols/ambient/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/ambient/addresses.js +2 -1
- package/sdk/dist/protocols/ambient/addresses.js.map +1 -1
- package/sdk/dist/protocols/arrakis/abis.d.ts +4 -13
- package/sdk/dist/protocols/arrakis/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/arrakis/abis.js +2 -11
- package/sdk/dist/protocols/arrakis/abis.js.map +1 -1
- package/sdk/dist/protocols/arrakis/functions.d.ts +1 -1
- package/sdk/dist/protocols/arrakis/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/arrakis/functions.js +2 -1
- package/sdk/dist/protocols/arrakis/functions.js.map +1 -1
- package/sdk/dist/protocols/axelar/abis.d.ts +1 -1
- package/sdk/dist/protocols/axelar/abis.js +1 -1
- package/sdk/dist/protocols/balancer-v2/abis.d.ts +7 -7
- package/sdk/dist/protocols/balancer-v2/abis.js +7 -7
- package/sdk/dist/protocols/balancer-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/cbeth/abis.d.ts +7 -1
- package/sdk/dist/protocols/cbeth/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/cbeth/abis.js +6 -2
- package/sdk/dist/protocols/cbeth/abis.js.map +1 -1
- package/sdk/dist/protocols/cctp/abis.d.ts +1 -4
- package/sdk/dist/protocols/cctp/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/cctp/abis.js +3 -1
- package/sdk/dist/protocols/cctp/abis.js.map +1 -1
- package/sdk/dist/protocols/cctp/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/cctp/addresses.js +3 -0
- package/sdk/dist/protocols/cctp/addresses.js.map +1 -1
- package/sdk/dist/protocols/chainlink/abis.d.ts +6 -6
- package/sdk/dist/protocols/chainlink/abis.js +6 -6
- package/sdk/dist/protocols/chainlink/abis.js.map +1 -1
- package/sdk/dist/protocols/chainlink/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/chainlink/addresses.js +10 -0
- package/sdk/dist/protocols/chainlink/addresses.js.map +1 -1
- package/sdk/dist/protocols/chainlink-ccip/abis.d.ts +1 -1
- package/sdk/dist/protocols/chainlink-ccip/abis.js +1 -1
- package/sdk/dist/protocols/chainlink-ccip/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/chainlink-ccip/addresses.js +9 -0
- package/sdk/dist/protocols/chainlink-ccip/addresses.js.map +1 -1
- package/sdk/dist/protocols/circle-gateway/abis.d.ts +114 -0
- package/sdk/dist/protocols/circle-gateway/abis.d.ts.map +1 -0
- package/sdk/dist/protocols/circle-gateway/abis.js +86 -0
- package/sdk/dist/protocols/circle-gateway/abis.js.map +1 -0
- package/sdk/dist/protocols/circle-gateway/addresses.d.ts +3 -0
- package/sdk/dist/protocols/circle-gateway/addresses.d.ts.map +1 -0
- package/sdk/dist/protocols/circle-gateway/addresses.js +37 -0
- package/sdk/dist/protocols/circle-gateway/addresses.js.map +1 -0
- package/sdk/dist/protocols/circle-gateway/functions.d.ts +4 -0
- package/sdk/dist/protocols/circle-gateway/functions.d.ts.map +1 -0
- package/sdk/dist/protocols/circle-gateway/functions.js +27 -0
- package/sdk/dist/protocols/circle-gateway/functions.js.map +1 -0
- package/sdk/dist/protocols/circle-gateway/index.d.ts +5 -0
- package/sdk/dist/protocols/circle-gateway/index.d.ts.map +1 -0
- package/sdk/dist/protocols/circle-gateway/index.js +5 -0
- package/sdk/dist/protocols/circle-gateway/index.js.map +1 -0
- package/sdk/dist/protocols/circle-gateway/info.d.ts +3 -0
- package/sdk/dist/protocols/circle-gateway/info.d.ts.map +1 -0
- package/sdk/dist/protocols/circle-gateway/info.js +12 -0
- package/sdk/dist/protocols/circle-gateway/info.js.map +1 -0
- package/sdk/dist/protocols/compound-v2/abis.d.ts +2 -2
- package/sdk/dist/protocols/compound-v2/abis.js +2 -2
- package/sdk/dist/protocols/compound-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/connext/abis.d.ts +46 -6
- package/sdk/dist/protocols/connext/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/connext/abis.js +27 -5
- package/sdk/dist/protocols/connext/abis.js.map +1 -1
- package/sdk/dist/protocols/connext/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/connext/addresses.js +1 -7
- package/sdk/dist/protocols/connext/addresses.js.map +1 -1
- package/sdk/dist/protocols/connext/functions.d.ts +1 -1
- package/sdk/dist/protocols/connext/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/connext/functions.js +3 -2
- package/sdk/dist/protocols/connext/functions.js.map +1 -1
- package/sdk/dist/protocols/curve/abis.d.ts +119 -7
- package/sdk/dist/protocols/curve/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/curve/abis.js +90 -7
- package/sdk/dist/protocols/curve/abis.js.map +1 -1
- package/sdk/dist/protocols/debridge/abis.d.ts +7 -7
- package/sdk/dist/protocols/debridge/abis.js +5 -5
- package/sdk/dist/protocols/debridge/abis.js.map +1 -1
- package/sdk/dist/protocols/debridge/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/debridge/addresses.js +11 -0
- package/sdk/dist/protocols/debridge/addresses.js.map +1 -1
- package/sdk/dist/protocols/eco-routes/abis.d.ts +463 -0
- package/sdk/dist/protocols/eco-routes/abis.d.ts.map +1 -0
- package/sdk/dist/protocols/eco-routes/abis.js +632 -0
- package/sdk/dist/protocols/eco-routes/abis.js.map +1 -0
- package/sdk/dist/protocols/eco-routes/addresses.d.ts +9 -0
- package/sdk/dist/protocols/eco-routes/addresses.d.ts.map +1 -0
- package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts +585 -0
- package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts.map +1 -0
- package/sdk/dist/protocols/eco-routes/addresses.generated.js +590 -0
- package/sdk/dist/protocols/eco-routes/addresses.generated.js.map +1 -0
- package/sdk/dist/protocols/eco-routes/addresses.js +21 -0
- package/sdk/dist/protocols/eco-routes/addresses.js.map +1 -0
- package/sdk/dist/protocols/eco-routes/functions.d.ts +12 -0
- package/sdk/dist/protocols/eco-routes/functions.d.ts.map +1 -0
- package/sdk/dist/protocols/eco-routes/functions.js +45 -0
- package/sdk/dist/protocols/eco-routes/functions.js.map +1 -0
- package/sdk/dist/protocols/eco-routes/index.d.ts +6 -0
- package/sdk/dist/protocols/eco-routes/index.d.ts.map +1 -0
- package/sdk/dist/protocols/eco-routes/index.js +6 -0
- package/sdk/dist/protocols/eco-routes/index.js.map +1 -0
- package/sdk/dist/protocols/eco-routes/info.d.ts +3 -0
- package/sdk/dist/protocols/eco-routes/info.d.ts.map +1 -0
- package/sdk/dist/protocols/eco-routes/info.js +12 -0
- package/sdk/dist/protocols/eco-routes/info.js.map +1 -0
- package/sdk/dist/protocols/eco-routes/lookup.d.ts +82 -0
- package/sdk/dist/protocols/eco-routes/lookup.d.ts.map +1 -0
- package/sdk/dist/protocols/eco-routes/lookup.js +148 -0
- package/sdk/dist/protocols/eco-routes/lookup.js.map +1 -0
- package/sdk/dist/protocols/eigenlayer/abis.d.ts +4 -4
- package/sdk/dist/protocols/eigenlayer/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/eigenlayer/abis.js +5 -4
- package/sdk/dist/protocols/eigenlayer/abis.js.map +1 -1
- package/sdk/dist/protocols/ens/abis.d.ts +4 -4
- package/sdk/dist/protocols/ens/abis.js +4 -4
- package/sdk/dist/protocols/etherfi/abis.d.ts +1 -1
- package/sdk/dist/protocols/etherfi/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/etherfi/abis.js +2 -1
- package/sdk/dist/protocols/etherfi/abis.js.map +1 -1
- package/sdk/dist/protocols/euler-v2/abis.d.ts +2 -2
- package/sdk/dist/protocols/euler-v2/abis.js +2 -2
- package/sdk/dist/protocols/euler-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/fluid/abis.d.ts +47 -26
- package/sdk/dist/protocols/fluid/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/fluid/abis.js +39 -18
- package/sdk/dist/protocols/fluid/abis.js.map +1 -1
- package/sdk/dist/protocols/fluid/functions.d.ts +4 -4
- package/sdk/dist/protocols/fluid/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/fluid/functions.js +18 -16
- package/sdk/dist/protocols/fluid/functions.js.map +1 -1
- package/sdk/dist/protocols/gains-network/abis.d.ts +44 -35
- package/sdk/dist/protocols/gains-network/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/gains-network/abis.js +26 -21
- package/sdk/dist/protocols/gains-network/abis.js.map +1 -1
- package/sdk/dist/protocols/gains-network/functions.d.ts +3 -3
- package/sdk/dist/protocols/gains-network/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/gains-network/functions.js +6 -6
- package/sdk/dist/protocols/gamma/abis.d.ts +43 -0
- package/sdk/dist/protocols/gamma/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/gamma/abis.js +30 -0
- package/sdk/dist/protocols/gamma/abis.js.map +1 -1
- package/sdk/dist/protocols/gamma/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/gamma/addresses.js +2 -7
- package/sdk/dist/protocols/gamma/addresses.js.map +1 -1
- package/sdk/dist/protocols/gamma/functions.d.ts +1 -0
- package/sdk/dist/protocols/gamma/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/gamma/functions.js +9 -0
- package/sdk/dist/protocols/gamma/functions.js.map +1 -1
- package/sdk/dist/protocols/gelato/abis.d.ts +2 -2
- package/sdk/dist/protocols/gelato/abis.js +2 -2
- package/sdk/dist/protocols/gmx-v1/abis.d.ts +15 -3
- package/sdk/dist/protocols/gmx-v1/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/gmx-v1/abis.js +5 -3
- package/sdk/dist/protocols/gmx-v1/abis.js.map +1 -1
- package/sdk/dist/protocols/gmx-v1/functions.d.ts +2 -2
- package/sdk/dist/protocols/gmx-v1/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/gmx-v1/functions.js +2 -2
- package/sdk/dist/protocols/gmx-v2/abis.d.ts +11 -5
- package/sdk/dist/protocols/gmx-v2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/gmx-v2/abis.js +7 -4
- package/sdk/dist/protocols/gmx-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/gmx-v2/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/gmx-v2/addresses.js +3 -1
- package/sdk/dist/protocols/gmx-v2/addresses.js.map +1 -1
- package/sdk/dist/protocols/gmx-v2/functions.d.ts +1 -1
- package/sdk/dist/protocols/gmx-v2/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/gmx-v2/functions.js +4 -2
- package/sdk/dist/protocols/gmx-v2/functions.js.map +1 -1
- package/sdk/dist/protocols/harvest/abis.d.ts +8 -2
- package/sdk/dist/protocols/harvest/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/harvest/abis.js +2 -2
- package/sdk/dist/protocols/harvest/abis.js.map +1 -1
- package/sdk/dist/protocols/hegic/abis.d.ts +5 -2
- package/sdk/dist/protocols/hegic/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/hegic/abis.js +7 -2
- package/sdk/dist/protocols/hegic/abis.js.map +1 -1
- package/sdk/dist/protocols/hegic/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/hegic/addresses.js +1 -0
- package/sdk/dist/protocols/hegic/addresses.js.map +1 -1
- package/sdk/dist/protocols/hegic/functions.d.ts +1 -1
- package/sdk/dist/protocols/hegic/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/hegic/functions.js +3 -3
- package/sdk/dist/protocols/hop/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/hop/addresses.js +5 -2
- package/sdk/dist/protocols/hop/addresses.js.map +1 -1
- package/sdk/dist/protocols/hyperlane/abis.d.ts +5 -5
- package/sdk/dist/protocols/hyperlane/abis.js +5 -5
- package/sdk/dist/protocols/hyperlane/abis.js.map +1 -1
- package/sdk/dist/protocols/hyperlane/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/hyperlane/addresses.js +9 -0
- package/sdk/dist/protocols/hyperlane/addresses.js.map +1 -1
- package/sdk/dist/protocols/index.d.ts +1 -0
- package/sdk/dist/protocols/index.d.ts.map +1 -1
- package/sdk/dist/protocols/index.js +13 -0
- package/sdk/dist/protocols/index.js.map +1 -1
- package/sdk/dist/protocols/kim/abis.d.ts +7 -20
- package/sdk/dist/protocols/kim/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/kim/abis.js +6 -12
- package/sdk/dist/protocols/kim/abis.js.map +1 -1
- package/sdk/dist/protocols/kim/functions.d.ts +1 -1
- package/sdk/dist/protocols/kim/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/kim/functions.js +3 -2
- package/sdk/dist/protocols/kim/functions.js.map +1 -1
- package/sdk/dist/protocols/kyberswap/abis.d.ts +41 -16
- package/sdk/dist/protocols/kyberswap/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/kyberswap/abis.js +21 -8
- package/sdk/dist/protocols/kyberswap/abis.js.map +1 -1
- package/sdk/dist/protocols/kyberswap/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/kyberswap/addresses.js +12 -2
- package/sdk/dist/protocols/kyberswap/addresses.js.map +1 -1
- package/sdk/dist/protocols/kyberswap-aggregator/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/kyberswap-aggregator/addresses.js +12 -1
- package/sdk/dist/protocols/kyberswap-aggregator/addresses.js.map +1 -1
- package/sdk/dist/protocols/layerbank/abis.d.ts +81 -24
- package/sdk/dist/protocols/layerbank/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/layerbank/abis.js +69 -17
- package/sdk/dist/protocols/layerbank/abis.js.map +1 -1
- package/sdk/dist/protocols/layerbank/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/layerbank/addresses.js +3 -1
- package/sdk/dist/protocols/layerbank/addresses.js.map +1 -1
- package/sdk/dist/protocols/layerbank/functions.d.ts +4 -4
- package/sdk/dist/protocols/layerbank/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/layerbank/functions.js +18 -16
- package/sdk/dist/protocols/layerbank/functions.js.map +1 -1
- package/sdk/dist/protocols/layerzero/abis.d.ts +3 -3
- package/sdk/dist/protocols/layerzero/abis.js +3 -3
- package/sdk/dist/protocols/layerzero/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/layerzero/addresses.js +11 -1
- package/sdk/dist/protocols/layerzero/addresses.js.map +1 -1
- package/sdk/dist/protocols/level-finance/abis.d.ts +6 -0
- package/sdk/dist/protocols/level-finance/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/level-finance/abis.js +2 -0
- package/sdk/dist/protocols/level-finance/abis.js.map +1 -1
- package/sdk/dist/protocols/level-finance/functions.d.ts +2 -2
- package/sdk/dist/protocols/level-finance/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/level-finance/functions.js +4 -4
- package/sdk/dist/protocols/lifi/abis.d.ts +41 -4
- package/sdk/dist/protocols/lifi/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/lifi/abis.js +24 -4
- package/sdk/dist/protocols/lifi/abis.js.map +1 -1
- package/sdk/dist/protocols/lifi/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/lifi/addresses.js +9 -0
- package/sdk/dist/protocols/lifi/addresses.js.map +1 -1
- package/sdk/dist/protocols/lifi/functions.d.ts +1 -1
- package/sdk/dist/protocols/lifi/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/lifi/functions.js +5 -2
- package/sdk/dist/protocols/lifi/functions.js.map +1 -1
- package/sdk/dist/protocols/liquity-v1/abis.d.ts +6 -0
- package/sdk/dist/protocols/liquity-v1/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/liquity-v1/abis.js +7 -1
- package/sdk/dist/protocols/liquity-v1/abis.js.map +1 -1
- package/sdk/dist/protocols/liquity-v1/functions.d.ts +1 -1
- package/sdk/dist/protocols/liquity-v1/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/liquity-v1/functions.js +1 -1
- package/sdk/dist/protocols/mantle-meth/abis.d.ts +26 -25
- package/sdk/dist/protocols/mantle-meth/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/mantle-meth/abis.js +22 -17
- package/sdk/dist/protocols/mantle-meth/abis.js.map +1 -1
- package/sdk/dist/protocols/mantle-meth/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/mantle-meth/addresses.js +3 -0
- package/sdk/dist/protocols/mantle-meth/addresses.js.map +1 -1
- package/sdk/dist/protocols/mantle-meth/functions.d.ts +1 -1
- package/sdk/dist/protocols/mantle-meth/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/mantle-meth/functions.js +4 -4
- package/sdk/dist/protocols/maverick/abis.d.ts +9 -0
- package/sdk/dist/protocols/maverick/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/maverick/abis.js +7 -1
- package/sdk/dist/protocols/maverick/abis.js.map +1 -1
- package/sdk/dist/protocols/morpho-blue/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/morpho-blue/addresses.js +10 -0
- package/sdk/dist/protocols/morpho-blue/addresses.js.map +1 -1
- package/sdk/dist/protocols/mux-protocol/abis.d.ts +87 -32
- package/sdk/dist/protocols/mux-protocol/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/mux-protocol/abis.js +54 -21
- package/sdk/dist/protocols/mux-protocol/abis.js.map +1 -1
- package/sdk/dist/protocols/mux-protocol/functions.d.ts +2 -2
- package/sdk/dist/protocols/mux-protocol/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/mux-protocol/functions.js +8 -8
- package/sdk/dist/protocols/olympus/abis.d.ts +5 -2
- package/sdk/dist/protocols/olympus/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/olympus/abis.js +2 -2
- package/sdk/dist/protocols/olympus/abis.js.map +1 -1
- package/sdk/dist/protocols/oneinch/abis.d.ts +5 -5
- package/sdk/dist/protocols/oneinch/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/oneinch/abis.js +5 -3
- package/sdk/dist/protocols/oneinch/abis.js.map +1 -1
- package/sdk/dist/protocols/oneinch/functions.d.ts +1 -1
- package/sdk/dist/protocols/oneinch/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/oneinch/functions.js +2 -2
- package/sdk/dist/protocols/openocean/abis.d.ts +14 -1
- package/sdk/dist/protocols/openocean/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/openocean/abis.js +11 -1
- package/sdk/dist/protocols/openocean/abis.js.map +1 -1
- package/sdk/dist/protocols/openocean/functions.d.ts +1 -1
- package/sdk/dist/protocols/openocean/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/openocean/functions.js +1 -1
- package/sdk/dist/protocols/opyn/abis.d.ts +4 -1
- package/sdk/dist/protocols/opyn/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/opyn/abis.js +1 -1
- package/sdk/dist/protocols/opyn/abis.js.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts +6 -6
- package/sdk/dist/protocols/pancakeswap-v3/abis.js +6 -6
- package/sdk/dist/protocols/pancakeswap-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/paraswap/abis.d.ts +1 -1
- package/sdk/dist/protocols/paraswap/abis.js +1 -1
- package/sdk/dist/protocols/pendle/abis.d.ts +288 -6
- package/sdk/dist/protocols/pendle/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/pendle/abis.js +160 -6
- package/sdk/dist/protocols/pendle/abis.js.map +1 -1
- package/sdk/dist/protocols/permit2/abis.d.ts +1 -1
- package/sdk/dist/protocols/permit2/abis.js +1 -1
- package/sdk/dist/protocols/permit2/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/permit2/addresses.js +9 -0
- package/sdk/dist/protocols/permit2/addresses.js.map +1 -1
- package/sdk/dist/protocols/perpetual-protocol/abis.d.ts +46 -38
- package/sdk/dist/protocols/perpetual-protocol/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/perpetual-protocol/abis.js +27 -14
- package/sdk/dist/protocols/perpetual-protocol/abis.js.map +1 -1
- package/sdk/dist/protocols/premia/abis.d.ts +18 -17
- package/sdk/dist/protocols/premia/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/premia/abis.js +20 -10
- package/sdk/dist/protocols/premia/abis.js.map +1 -1
- package/sdk/dist/protocols/premia/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/premia/addresses.js +3 -8
- package/sdk/dist/protocols/premia/addresses.js.map +1 -1
- package/sdk/dist/protocols/premia/functions.d.ts +2 -2
- package/sdk/dist/protocols/premia/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/premia/functions.js +8 -8
- package/sdk/dist/protocols/pyth/abis.d.ts +3 -3
- package/sdk/dist/protocols/pyth/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/pyth/abis.js +6 -3
- package/sdk/dist/protocols/pyth/abis.js.map +1 -1
- package/sdk/dist/protocols/reflexer/abis.d.ts +8 -5
- package/sdk/dist/protocols/reflexer/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/reflexer/abis.js +10 -6
- package/sdk/dist/protocols/reflexer/abis.js.map +1 -1
- package/sdk/dist/protocols/renzo/abis.d.ts +1 -1
- package/sdk/dist/protocols/renzo/abis.js +1 -1
- package/sdk/dist/protocols/renzo/abis.js.map +1 -1
- package/sdk/dist/protocols/sablier/abis.d.ts +2 -2
- package/sdk/dist/protocols/sablier/abis.js +2 -2
- package/sdk/dist/protocols/safe/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/safe/addresses.js +10 -0
- package/sdk/dist/protocols/safe/addresses.js.map +1 -1
- package/sdk/dist/protocols/seaport/abis.d.ts +65 -5
- package/sdk/dist/protocols/seaport/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/seaport/abis.js +41 -5
- package/sdk/dist/protocols/seaport/abis.js.map +1 -1
- package/sdk/dist/protocols/seaport/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/seaport/addresses.js +10 -0
- package/sdk/dist/protocols/seaport/addresses.js.map +1 -1
- package/sdk/dist/protocols/seaport/functions.d.ts +1 -1
- package/sdk/dist/protocols/seaport/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/seaport/functions.js +1 -0
- package/sdk/dist/protocols/seaport/functions.js.map +1 -1
- package/sdk/dist/protocols/silo/abis.d.ts +3 -0
- package/sdk/dist/protocols/silo/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/silo/abis.js +4 -1
- package/sdk/dist/protocols/silo/abis.js.map +1 -1
- package/sdk/dist/protocols/silo/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/silo/addresses.js +2 -1
- package/sdk/dist/protocols/silo/addresses.js.map +1 -1
- package/sdk/dist/protocols/silo/functions.d.ts +1 -1
- package/sdk/dist/protocols/silo/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/silo/functions.js +2 -1
- package/sdk/dist/protocols/silo/functions.js.map +1 -1
- package/sdk/dist/protocols/socket/abis.d.ts +1 -13
- package/sdk/dist/protocols/socket/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/socket/abis.js +3 -11
- package/sdk/dist/protocols/socket/abis.js.map +1 -1
- package/sdk/dist/protocols/socket/functions.d.ts +1 -1
- package/sdk/dist/protocols/socket/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/socket/functions.js +1 -1
- package/sdk/dist/protocols/spookyswap/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/spookyswap/addresses.js +2 -1
- package/sdk/dist/protocols/spookyswap/addresses.js.map +1 -1
- package/sdk/dist/protocols/squid/abis.d.ts +33 -21
- package/sdk/dist/protocols/squid/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/squid/abis.js +19 -13
- package/sdk/dist/protocols/squid/abis.js.map +1 -1
- package/sdk/dist/protocols/squid/functions.d.ts +1 -1
- package/sdk/dist/protocols/squid/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/squid/functions.js +2 -2
- package/sdk/dist/protocols/stargate/abis.d.ts +23 -3
- package/sdk/dist/protocols/stargate/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/stargate/abis.js +19 -3
- package/sdk/dist/protocols/stargate/abis.js.map +1 -1
- package/sdk/dist/protocols/superfluid/abis.d.ts +2 -2
- package/sdk/dist/protocols/superfluid/abis.js +2 -2
- package/sdk/dist/protocols/superfluid/abis.js.map +1 -1
- package/sdk/dist/protocols/sushiswap-v2/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/sushiswap-v2/addresses.js +2 -1
- package/sdk/dist/protocols/sushiswap-v2/addresses.js.map +1 -1
- package/sdk/dist/protocols/swell/abis.d.ts +2 -8
- package/sdk/dist/protocols/swell/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/swell/abis.js +4 -2
- package/sdk/dist/protocols/swell/abis.js.map +1 -1
- package/sdk/dist/protocols/swell/functions.d.ts +2 -2
- package/sdk/dist/protocols/swell/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/swell/functions.js +4 -2
- package/sdk/dist/protocols/swell/functions.js.map +1 -1
- package/sdk/dist/protocols/synapse/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/synapse/addresses.js +2 -1
- package/sdk/dist/protocols/synapse/addresses.js.map +1 -1
- package/sdk/dist/protocols/synthetix-v3/abis.d.ts +40 -5
- package/sdk/dist/protocols/synthetix-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/synthetix-v3/abis.js +27 -5
- package/sdk/dist/protocols/synthetix-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/synthetix-v3/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/synthetix-v3/addresses.js +2 -1
- package/sdk/dist/protocols/synthetix-v3/addresses.js.map +1 -1
- package/sdk/dist/protocols/synthra-v3/abis.d.ts +347 -0
- package/sdk/dist/protocols/synthra-v3/abis.d.ts.map +1 -0
- package/sdk/dist/protocols/synthra-v3/abis.js +242 -0
- package/sdk/dist/protocols/synthra-v3/abis.js.map +1 -0
- package/sdk/dist/protocols/synthra-v3/addresses.d.ts +3 -0
- package/sdk/dist/protocols/synthra-v3/addresses.d.ts.map +1 -0
- package/sdk/dist/protocols/synthra-v3/addresses.js +16 -0
- package/sdk/dist/protocols/synthra-v3/addresses.js.map +1 -0
- package/sdk/dist/protocols/synthra-v3/functions.d.ts +2 -0
- package/sdk/dist/protocols/synthra-v3/functions.d.ts.map +1 -0
- package/sdk/dist/protocols/synthra-v3/functions.js +9 -0
- package/sdk/dist/protocols/synthra-v3/functions.js.map +1 -0
- package/sdk/dist/protocols/synthra-v3/index.d.ts +5 -0
- package/sdk/dist/protocols/synthra-v3/index.d.ts.map +1 -0
- package/sdk/dist/protocols/synthra-v3/index.js +5 -0
- package/sdk/dist/protocols/synthra-v3/index.js.map +1 -0
- package/sdk/dist/protocols/synthra-v3/info.d.ts +3 -0
- package/sdk/dist/protocols/synthra-v3/info.d.ts.map +1 -0
- package/sdk/dist/protocols/synthra-v3/info.js +11 -0
- package/sdk/dist/protocols/synthra-v3/info.js.map +1 -0
- package/sdk/dist/protocols/thales/abis.d.ts +53 -24
- package/sdk/dist/protocols/thales/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/thales/abis.js +27 -11
- package/sdk/dist/protocols/thales/abis.js.map +1 -1
- package/sdk/dist/protocols/thales/functions.d.ts +2 -2
- package/sdk/dist/protocols/thales/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/thales/functions.js +5 -6
- package/sdk/dist/protocols/thales/functions.js.map +1 -1
- package/sdk/dist/protocols/thruster/abis.d.ts +1 -1
- package/sdk/dist/protocols/thruster/abis.js +1 -1
- package/sdk/dist/protocols/trader-joe/abis.d.ts +3 -3
- package/sdk/dist/protocols/trader-joe/abis.js +2 -2
- package/sdk/dist/protocols/trader-joe/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v2/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v2/addresses.js +10 -0
- package/sdk/dist/protocols/uniswap-v2/addresses.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/abis.d.ts +127 -8
- package/sdk/dist/protocols/uniswap-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/abis.js +90 -8
- package/sdk/dist/protocols/uniswap-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/addresses.js +14 -0
- package/sdk/dist/protocols/uniswap-v3/addresses.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/abis.d.ts +27 -15
- package/sdk/dist/protocols/uniswap-v4/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/abis.js +25 -15
- 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 +11 -0
- package/sdk/dist/protocols/uniswap-v4/addresses.js.map +1 -1
- package/sdk/dist/protocols/unitflow-v3/abis.d.ts +104 -0
- package/sdk/dist/protocols/unitflow-v3/abis.d.ts.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/abis.js +70 -0
- package/sdk/dist/protocols/unitflow-v3/abis.js.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/addresses.d.ts +3 -0
- package/sdk/dist/protocols/unitflow-v3/addresses.d.ts.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/addresses.js +19 -0
- package/sdk/dist/protocols/unitflow-v3/addresses.js.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/functions.d.ts +2 -0
- package/sdk/dist/protocols/unitflow-v3/functions.d.ts.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/functions.js +9 -0
- package/sdk/dist/protocols/unitflow-v3/functions.js.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/index.d.ts +5 -0
- package/sdk/dist/protocols/unitflow-v3/index.d.ts.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/index.js +5 -0
- package/sdk/dist/protocols/unitflow-v3/index.js.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/info.d.ts +3 -0
- package/sdk/dist/protocols/unitflow-v3/info.d.ts.map +1 -0
- package/sdk/dist/protocols/unitflow-v3/info.js +12 -0
- package/sdk/dist/protocols/unitflow-v3/info.js.map +1 -0
- package/sdk/dist/protocols/velodrome/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/velodrome/addresses.js +3 -1
- package/sdk/dist/protocols/velodrome/addresses.js.map +1 -1
- package/sdk/dist/protocols/venus/abis.d.ts +62 -1
- package/sdk/dist/protocols/venus/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/venus/abis.js +48 -1
- package/sdk/dist/protocols/venus/abis.js.map +1 -1
- package/sdk/dist/protocols/vertex/abis.d.ts +16 -9
- package/sdk/dist/protocols/vertex/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/vertex/abis.js +13 -4
- package/sdk/dist/protocols/vertex/abis.js.map +1 -1
- package/sdk/dist/protocols/wormhole/abis.d.ts +2 -2
- package/sdk/dist/protocols/wormhole/abis.js +2 -2
- package/sdk/dist/protocols/wormhole/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/wormhole/addresses.js +9 -0
- package/sdk/dist/protocols/wormhole/addresses.js.map +1 -1
- package/sdk/dist/protocols/zerolend/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/zerolend/addresses.js +2 -1
- package/sdk/dist/protocols/zerolend/addresses.js.map +1 -1
- package/sdk/dist/protocols/zerox/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/zerox/addresses.js +2 -1
- package/sdk/dist/protocols/zerox/addresses.js.map +1 -1
- package/sdk/dist/protocols/zksync-bridge/abis.d.ts +1 -1
- package/sdk/dist/protocols/zksync-bridge/abis.js +1 -1
- package/sdk/dist/recipes/cctp-transfer.d.ts +17 -6
- package/sdk/dist/recipes/cctp-transfer.d.ts.map +1 -1
- package/sdk/dist/recipes/cctp-transfer.js +7 -20
- package/sdk/dist/recipes/cctp-transfer.js.map +1 -1
- package/sdk/dist/recipes/index.d.ts +5 -15
- package/sdk/dist/recipes/index.d.ts.map +1 -1
- package/sdk/dist/recipes/index.js +19 -36
- package/sdk/dist/recipes/index.js.map +1 -1
- package/sdk/dist/recipes/settle.sauce.ts +15 -2
- package/sdk/dist/routes/chain-exports.generated.d.ts +97 -0
- package/sdk/dist/routes/chain-exports.generated.d.ts.map +1 -0
- package/sdk/dist/routes/chain-exports.generated.js +91 -0
- package/sdk/dist/routes/chain-exports.generated.js.map +1 -0
- package/sdk/dist/routes/compile-types.d.ts +3 -0
- package/sdk/dist/routes/compile-types.d.ts.map +1 -1
- package/sdk/dist/routes/composed.d.ts +13 -0
- package/sdk/dist/routes/composed.d.ts.map +1 -0
- package/sdk/dist/routes/composed.js +94 -0
- package/sdk/dist/routes/composed.js.map +1 -0
- package/sdk/dist/routes/encode.d.ts +6 -6
- package/sdk/dist/routes/globals.d.ts +19 -4
- package/sdk/dist/routes/globals.d.ts.map +1 -1
- package/sdk/dist/routes/globals.js +51 -85
- package/sdk/dist/routes/globals.js.map +1 -1
- package/sdk/dist/routes/index.d.ts +15 -6
- package/sdk/dist/routes/index.d.ts.map +1 -1
- package/sdk/dist/routes/index.js +17 -5
- package/sdk/dist/routes/index.js.map +1 -1
- package/sdk/dist/routes/intent-dsl.d.ts +60 -19
- package/sdk/dist/routes/intent-dsl.d.ts.map +1 -1
- package/sdk/dist/routes/intent-dsl.js +175 -67
- package/sdk/dist/routes/intent-dsl.js.map +1 -1
- package/sdk/dist/routes/intent-pot.d.ts +49 -0
- package/sdk/dist/routes/intent-pot.d.ts.map +1 -0
- package/sdk/dist/routes/intent-pot.js +46 -0
- package/sdk/dist/routes/intent-pot.js.map +1 -0
- package/sdk/dist/routes/intent-sugar.d.ts +97 -0
- package/sdk/dist/routes/intent-sugar.d.ts.map +1 -0
- package/sdk/dist/routes/intent-sugar.js +615 -0
- package/sdk/dist/routes/intent-sugar.js.map +1 -0
- package/sdk/dist/routes/nest-dynamic.d.ts +146 -0
- package/sdk/dist/routes/nest-dynamic.d.ts.map +1 -0
- package/sdk/dist/routes/nest-dynamic.js +308 -0
- package/sdk/dist/routes/nest-dynamic.js.map +1 -0
- package/sdk/dist/routes/nest.d.ts +16 -5
- package/sdk/dist/routes/nest.d.ts.map +1 -1
- package/sdk/dist/routes/nest.js +29 -10
- package/sdk/dist/routes/nest.js.map +1 -1
- package/sdk/dist/routes/portal.d.ts +7 -272
- package/sdk/dist/routes/portal.d.ts.map +1 -1
- package/sdk/dist/routes/portal.js +13 -92
- package/sdk/dist/routes/portal.js.map +1 -1
- package/sdk/dist/routes/protocol-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/protocol-rewrite.js +2 -0
- package/sdk/dist/routes/protocol-rewrite.js.map +1 -1
- package/sdk/dist/routes/rs-compile.d.ts +26 -15
- package/sdk/dist/routes/rs-compile.d.ts.map +1 -1
- package/sdk/dist/routes/rs-compile.js +57 -169
- package/sdk/dist/routes/rs-compile.js.map +1 -1
- package/sdk/dist/routes/sauce-route.d.ts +26 -1
- package/sdk/dist/routes/sauce-route.d.ts.map +1 -1
- package/sdk/dist/routes/sauce-route.js +109 -6
- package/sdk/dist/routes/sauce-route.js.map +1 -1
- package/sdk/dist/routes/source-globals.generated.d.ts +435 -20
- package/sdk/dist/routes/source-globals.generated.d.ts.map +1 -1
- package/sdk/dist/routes/template.d.ts +184 -0
- package/sdk/dist/routes/template.d.ts.map +1 -0
- package/sdk/dist/routes/template.js +338 -0
- package/sdk/dist/routes/template.js.map +1 -0
- package/sdk/dist/routes/token-registry.d.ts.map +1 -1
- package/sdk/dist/routes/token-registry.js +35 -0
- package/sdk/dist/routes/token-registry.js.map +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
- package/sdk/dist/skills/loader.d.ts +2 -7
- package/sdk/dist/skills/loader.d.ts.map +1 -1
- package/sdk/dist/skills/loader.js +14 -25
- package/sdk/dist/skills/loader.js.map +1 -1
- package/sdk/dist/std/token/token.evm.js +56 -15
- package/sdk/dist/std/token/token.svm.js +24 -3
- package/sdk/dist/svm/accessors.d.ts +3 -3
- package/sdk/dist/svm/accessors.js +3 -3
- package/sdk/dist/svm/client.d.ts +1 -0
- package/sdk/dist/svm/client.d.ts.map +1 -1
- package/sdk/dist/svm/client.js +6 -0
- package/sdk/dist/svm/client.js.map +1 -1
- package/sdk/dist/svm/clusters.d.ts +6 -2
- package/sdk/dist/svm/clusters.d.ts.map +1 -1
- package/sdk/dist/svm/clusters.js +0 -2
- package/sdk/dist/svm/clusters.js.map +1 -1
- package/sdk/dist/svm/engine-artifacts.d.ts +24 -13
- package/sdk/dist/svm/engine-artifacts.d.ts.map +1 -1
- package/sdk/dist/svm/engine-artifacts.js +31 -26
- package/sdk/dist/svm/engine-artifacts.js.map +1 -1
- package/sdk/dist/svm/engine-public.d.ts.map +1 -1
- package/sdk/dist/svm/engine-public.js +2 -1
- package/sdk/dist/svm/engine-public.js.map +1 -1
- package/sdk/dist/svm/index.d.ts +0 -1
- package/sdk/dist/svm/index.d.ts.map +1 -1
- package/sdk/dist/svm/index.js +3 -1
- package/sdk/dist/svm/index.js.map +1 -1
- package/sdk/dist/svm/intent.d.ts.map +1 -1
- package/sdk/dist/svm/intent.js +4 -3
- package/sdk/dist/svm/intent.js.map +1 -1
- package/sdk/dist/svm/loader.d.ts.map +1 -1
- package/sdk/dist/svm/loader.js +2 -3
- package/sdk/dist/svm/loader.js.map +1 -1
- package/sdk/dist/svm/recipes/index.d.ts +57 -4
- package/sdk/dist/svm/recipes/index.d.ts.map +1 -1
- package/sdk/dist/svm/recipes/index.js +7 -9
- package/sdk/dist/svm/recipes/index.js.map +1 -1
- package/sdk/dist/svm/venues/alphaq/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/alphaq/index.js +4 -2
- package/sdk/dist/svm/venues/alphaq/index.js.map +1 -1
- package/sdk/dist/svm/venues/binaryfi/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/binaryfi/index.js +2 -1
- package/sdk/dist/svm/venues/binaryfi/index.js.map +1 -1
- package/sdk/dist/svm/venues/fluxbeam/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/fluxbeam/index.js +2 -7
- package/sdk/dist/svm/venues/fluxbeam/index.js.map +1 -1
- package/sdk/dist/svm/venues/jupiter-lend-earn/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/jupiter-lend-earn/index.js +2 -1
- package/sdk/dist/svm/venues/jupiter-lend-earn/index.js.map +1 -1
- package/sdk/dist/svm/venues/kipseli/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/kipseli/index.js +31 -14
- package/sdk/dist/svm/venues/kipseli/index.js.map +1 -1
- package/sdk/dist/svm/venues/mercurial/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/mercurial/index.js +2 -7
- package/sdk/dist/svm/venues/mercurial/index.js.map +1 -1
- package/sdk/dist/svm/venues/meteora-damm-v1-stable/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/meteora-damm-v1-stable/index.js +3 -2
- package/sdk/dist/svm/venues/meteora-damm-v1-stable/index.js.map +1 -1
- package/sdk/dist/svm/venues/mswap/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/mswap/index.js +2 -2
- package/sdk/dist/svm/venues/mswap/index.js.map +1 -1
- package/sdk/dist/svm/venues/orca-legacy-token-swap/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/orca-legacy-token-swap/index.js +2 -7
- package/sdk/dist/svm/venues/orca-legacy-token-swap/index.js.map +1 -1
- package/sdk/dist/svm/venues/saber-stableswap/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/saber-stableswap/index.js +2 -7
- package/sdk/dist/svm/venues/saber-stableswap/index.js.map +1 -1
- package/sdk/dist/svm/venues/sanctum-infinity/index.js +2 -2
- package/sdk/dist/svm/venues/sanctum-infinity/index.js.map +1 -1
- package/sdk/dist/svm/venues/sanctum-stake-pool/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/sanctum-stake-pool/index.js +2 -8
- package/sdk/dist/svm/venues/sanctum-stake-pool/index.js.map +1 -1
- package/sdk/dist/svm/venues/spl-token-swap-forks/index.d.ts.map +1 -1
- package/sdk/dist/svm/venues/spl-token-swap-forks/index.js +2 -7
- package/sdk/dist/svm/venues/spl-token-swap-forks/index.js.map +1 -1
- package/sdk/dist/svm/venues/stabble-common.d.ts.map +1 -1
- package/sdk/dist/svm/venues/stabble-common.js +3 -8
- package/sdk/dist/svm/venues/stabble-common.js.map +1 -1
- package/sdk/dist/svm/verify.d.ts.map +1 -1
- package/sdk/dist/svm/verify.js +1 -4
- package/sdk/dist/svm/verify.js.map +1 -1
- package/sdk/dist/swap/index.d.ts +4 -4
- package/sdk/dist/swap/index.d.ts.map +1 -1
- package/sdk/dist/swap/index.js +4 -4
- package/sdk/dist/swap/index.js.map +1 -1
- package/sdk/dist/swap/source.d.ts +0 -7
- package/sdk/dist/swap/source.d.ts.map +1 -1
- package/sdk/dist/swap/source.js +3 -11
- package/sdk/dist/swap/source.js.map +1 -1
- package/sdk/dist/token/api.d.ts +8 -9
- package/sdk/dist/token/api.d.ts.map +1 -1
- package/sdk/dist/token/api.js +4 -5
- package/sdk/dist/token/api.js.map +1 -1
- package/sdk/dist/token/evm.d.ts +5 -2
- package/sdk/dist/token/evm.d.ts.map +1 -1
- package/sdk/dist/token/evm.js +24 -13
- package/sdk/dist/token/evm.js.map +1 -1
- package/sdk/dist/token/index.d.ts +4 -4
- package/sdk/dist/token/index.js +4 -4
- package/sdk/dist/token/safe.d.ts +17 -0
- package/sdk/dist/token/safe.d.ts.map +1 -0
- package/sdk/dist/token/safe.js +211 -0
- package/sdk/dist/token/safe.js.map +1 -0
- package/sdk/dist/token/source.d.ts +0 -4
- package/sdk/dist/token/source.d.ts.map +1 -1
- package/sdk/dist/token/source.js +7 -10
- package/sdk/dist/token/source.js.map +1 -1
- package/sdk/dist/verify/decode.d.ts +6 -6
- package/sdk/dist/verify/decode.js +7 -7
- package/sdk/dist/verify/decode.js.map +1 -1
- package/sdk/dist/verify/index.js +2 -2
- package/sdk/dist/verify/intent.js +2 -2
- package/sdk/dist/verify/vectors.d.ts +1 -1
- package/sdk/dist/verify/vectors.d.ts.map +1 -1
- package/sdk/dist/verify/vectors.js +2 -2
- package/sdk/dist/verify/vectors.js.map +1 -1
- package/sdk/dist/verify/wire.d.ts +21 -4
- package/sdk/dist/verify/wire.d.ts.map +1 -1
- package/sdk/dist/verify/wire.js +21 -4
- package/sdk/dist/verify/wire.js.map +1 -1
- package/sdk/dist/wasm-compiler.d.ts +31 -0
- package/sdk/dist/wasm-compiler.d.ts.map +1 -0
- package/sdk/dist/wasm-compiler.js +52 -0
- package/sdk/dist/wasm-compiler.js.map +1 -0
- package/sdk/src/protocols/aave-v4/AaveV4HubABI.json +67 -0
- package/sdk/src/protocols/aave-v4/AaveV4SpokeABI.json +215 -0
- package/sdk/src/protocols/aave-v4/abis.ts +139 -0
- package/sdk/src/protocols/aave-v4/addresses.ts +66 -0
- package/sdk/src/protocols/aave-v4/functions.ts +39 -0
- package/sdk/src/protocols/aave-v4/index.ts +4 -0
- package/sdk/src/protocols/aave-v4/info.ts +14 -0
- package/sdk/src/protocols/across/AcrossHubPoolABI.json +2 -2
- package/sdk/src/protocols/across/AcrossSpokePoolABI.json +27 -11
- package/sdk/src/protocols/across/abis.ts +16 -8
- package/sdk/src/protocols/across/addresses.ts +10 -0
- package/sdk/src/protocols/across/functions.ts +2 -2
- package/sdk/src/protocols/aerodrome-slipstream/AeroMetarouterABI.json +24 -0
- package/sdk/src/protocols/aerodrome-slipstream/SlipstreamCLFactoryABI.json +58 -0
- package/sdk/src/protocols/aerodrome-slipstream/SlipstreamPositionManagerABI.json +77 -0
- package/sdk/src/protocols/aerodrome-slipstream/abis.ts +74 -0
- package/sdk/src/protocols/aerodrome-slipstream/addresses.ts +40 -0
- package/sdk/src/protocols/aerodrome-slipstream/functions.ts +8 -0
- package/sdk/src/protocols/aerodrome-slipstream/index.ts +4 -0
- package/sdk/src/protocols/aerodrome-slipstream/info.ts +14 -0
- package/sdk/src/protocols/aevo/DepositContractABI.json +23 -2
- package/sdk/src/protocols/aevo/abis.ts +10 -2
- package/sdk/src/protocols/aevo/functions.ts +2 -2
- package/sdk/src/protocols/alchemix/AlchemistABI.json +1 -1
- package/sdk/src/protocols/alchemix/abis.ts +1 -1
- package/sdk/src/protocols/ambient/CrocSwapDexABI.json +2 -2
- package/sdk/src/protocols/ambient/abis.ts +3 -2
- package/sdk/src/protocols/ambient/addresses.ts +2 -1
- package/sdk/src/protocols/arrakis/ArrakisRouterABI.json +5 -1
- package/sdk/src/protocols/arrakis/ArrakisVaultABI.json +0 -16
- package/sdk/src/protocols/arrakis/abis.ts +2 -11
- package/sdk/src/protocols/arrakis/functions.ts +2 -1
- package/sdk/src/protocols/axelar/AxelarITSABI.json +1 -1
- package/sdk/src/protocols/axelar/abis.ts +1 -1
- package/sdk/src/protocols/balancer-v2/BalancerV2VaultABI.json +7 -7
- package/sdk/src/protocols/balancer-v2/abis.ts +7 -7
- package/sdk/src/protocols/cbeth/CbETHABI.json +10 -1
- package/sdk/src/protocols/cbeth/abis.ts +6 -2
- package/sdk/src/protocols/cctp/TokenMessengerABI.json +30 -9
- package/sdk/src/protocols/cctp/abis.ts +3 -1
- package/sdk/src/protocols/cctp/addresses.ts +3 -0
- package/sdk/src/protocols/chainlink/AggregatorV3ABI.json +3 -3
- package/sdk/src/protocols/chainlink/FeedRegistryABI.json +3 -3
- package/sdk/src/protocols/chainlink/abis.ts +6 -6
- package/sdk/src/protocols/chainlink/addresses.ts +10 -0
- package/sdk/src/protocols/chainlink-ccip/CCIPRouterABI.json +1 -1
- package/sdk/src/protocols/chainlink-ccip/abis.ts +1 -1
- package/sdk/src/protocols/chainlink-ccip/addresses.ts +9 -0
- package/sdk/src/protocols/circle-gateway/GatewayMinterABI.json +49 -0
- package/sdk/src/protocols/circle-gateway/GatewayWalletABI.json +111 -0
- package/sdk/src/protocols/circle-gateway/abis.ts +86 -0
- package/sdk/src/protocols/circle-gateway/addresses.ts +39 -0
- package/sdk/src/protocols/circle-gateway/functions.ts +28 -0
- package/sdk/src/protocols/circle-gateway/index.ts +4 -0
- package/sdk/src/protocols/circle-gateway/info.ts +14 -0
- package/sdk/src/protocols/compound-v2/CErc20ABI.json +2 -2
- package/sdk/src/protocols/compound-v2/abis.ts +2 -2
- package/sdk/src/protocols/connext/EverclearSpokeABI.json +60 -6
- package/sdk/src/protocols/connext/abis.ts +27 -5
- package/sdk/src/protocols/connext/addresses.ts +1 -7
- package/sdk/src/protocols/connext/functions.ts +3 -2
- package/sdk/src/protocols/curve/CurveRouterNGABI.json +37 -0
- package/sdk/src/protocols/curve/CurveStableSwapABI.json +7 -7
- package/sdk/src/protocols/curve/CurveThreePoolABI.json +117 -0
- package/sdk/src/protocols/curve/abis.ts +91 -7
- package/sdk/src/protocols/debridge/DlnDestinationABI.json +7 -7
- package/sdk/src/protocols/debridge/DlnSourceABI.json +1 -1
- package/sdk/src/protocols/debridge/abis.ts +5 -5
- package/sdk/src/protocols/debridge/addresses.ts +11 -0
- package/sdk/src/protocols/eco-routes/abis.ts +633 -0
- package/sdk/src/protocols/eco-routes/addresses.generated.ts +589 -0
- package/sdk/src/protocols/eco-routes/addresses.ts +27 -0
- package/sdk/src/protocols/eco-routes/functions.ts +45 -0
- package/sdk/src/protocols/eco-routes/index.ts +5 -0
- package/sdk/src/protocols/eco-routes/info.ts +14 -0
- package/sdk/src/protocols/eco-routes/lookup.ts +215 -0
- package/sdk/src/protocols/eigenlayer/DelegationManagerABI.json +2 -2
- package/sdk/src/protocols/eigenlayer/StrategyManagerABI.json +2 -2
- package/sdk/src/protocols/eigenlayer/abis.ts +5 -4
- package/sdk/src/protocols/ens/ENSRegistryABI.json +4 -4
- package/sdk/src/protocols/ens/abis.ts +4 -4
- package/sdk/src/protocols/etherfi/WeETHABI.json +1 -1
- package/sdk/src/protocols/etherfi/abis.ts +2 -1
- package/sdk/src/protocols/euler-v2/EVCABI.json +2 -2
- package/sdk/src/protocols/euler-v2/abis.ts +2 -2
- package/sdk/src/protocols/fluid/FluidLendingABI.json +20 -37
- package/sdk/src/protocols/fluid/FluidVaultABI.json +41 -0
- package/sdk/src/protocols/fluid/abis.ts +41 -18
- package/sdk/src/protocols/fluid/functions.ts +18 -16
- package/sdk/src/protocols/gains-network/DiamondABI.json +49 -37
- package/sdk/src/protocols/gains-network/abis.ts +26 -21
- package/sdk/src/protocols/gains-network/functions.ts +6 -6
- package/sdk/src/protocols/gamma/UniProxyLegacyABI.json +62 -0
- package/sdk/src/protocols/gamma/abis.ts +31 -0
- package/sdk/src/protocols/gamma/addresses.ts +2 -7
- package/sdk/src/protocols/gamma/functions.ts +10 -0
- package/sdk/src/protocols/gelato/GelatoAutomateABI.json +2 -2
- package/sdk/src/protocols/gelato/abis.ts +2 -2
- package/sdk/src/protocols/gmx-v1/PositionRouterABI.json +21 -3
- package/sdk/src/protocols/gmx-v1/abis.ts +5 -3
- package/sdk/src/protocols/gmx-v1/functions.ts +2 -2
- package/sdk/src/protocols/gmx-v2/ExchangeRouterABI.json +13 -5
- package/sdk/src/protocols/gmx-v2/abis.ts +7 -4
- package/sdk/src/protocols/gmx-v2/addresses.ts +3 -1
- package/sdk/src/protocols/gmx-v2/functions.ts +4 -2
- package/sdk/src/protocols/harvest/VaultABI.json +12 -2
- package/sdk/src/protocols/harvest/abis.ts +2 -2
- package/sdk/src/protocols/hegic/HegicABI.json +6 -2
- package/sdk/src/protocols/hegic/abis.ts +7 -2
- package/sdk/src/protocols/hegic/addresses.ts +1 -0
- package/sdk/src/protocols/hegic/functions.ts +3 -3
- package/sdk/src/protocols/hop/addresses.ts +5 -2
- package/sdk/src/protocols/hyperlane/HyperlaneMailboxABI.json +5 -5
- package/sdk/src/protocols/hyperlane/abis.ts +5 -5
- package/sdk/src/protocols/hyperlane/addresses.ts +9 -0
- package/sdk/src/protocols/index.ts +13 -0
- package/sdk/src/protocols/kim/KimRouterABI.json +8 -27
- package/sdk/src/protocols/kim/abis.ts +6 -12
- package/sdk/src/protocols/kim/functions.ts +3 -2
- package/sdk/src/protocols/kyberswap/KyberSwapElasticRouterABI.json +1 -1
- package/sdk/src/protocols/kyberswap/KyberSwapMetaAggregationRouterABI.json +52 -18
- package/sdk/src/protocols/kyberswap/abis.ts +21 -8
- package/sdk/src/protocols/kyberswap/addresses.ts +12 -2
- package/sdk/src/protocols/kyberswap-aggregator/addresses.ts +12 -1
- package/sdk/src/protocols/layerbank/LTokenABI.json +19 -29
- package/sdk/src/protocols/layerbank/LayerBankCoreABI.json +87 -2
- package/sdk/src/protocols/layerbank/abis.ts +69 -17
- package/sdk/src/protocols/layerbank/addresses.ts +3 -1
- package/sdk/src/protocols/layerbank/functions.ts +18 -16
- package/sdk/src/protocols/layerzero/LayerZeroEndpointV2ABI.json +3 -3
- package/sdk/src/protocols/layerzero/abis.ts +3 -3
- package/sdk/src/protocols/layerzero/addresses.ts +11 -1
- package/sdk/src/protocols/level-finance/LiquidityPoolABI.json +8 -0
- package/sdk/src/protocols/level-finance/abis.ts +2 -0
- package/sdk/src/protocols/level-finance/functions.ts +4 -4
- package/sdk/src/protocols/lifi/LiFiDiamondABI.json +54 -4
- package/sdk/src/protocols/lifi/abis.ts +24 -4
- package/sdk/src/protocols/lifi/addresses.ts +9 -0
- package/sdk/src/protocols/lifi/functions.ts +5 -2
- package/sdk/src/protocols/liquity-v1/BorrowerOperationsABI.json +8 -0
- package/sdk/src/protocols/liquity-v1/abis.ts +7 -1
- package/sdk/src/protocols/liquity-v1/functions.ts +1 -1
- package/sdk/src/protocols/mantle-meth/METHABI.json +0 -46
- package/sdk/src/protocols/mantle-meth/METHStakingABI.json +50 -0
- package/sdk/src/protocols/mantle-meth/abis.ts +23 -17
- package/sdk/src/protocols/mantle-meth/addresses.ts +3 -0
- package/sdk/src/protocols/mantle-meth/functions.ts +4 -4
- package/sdk/src/protocols/maverick/MaverickV2FactoryABI.json +8 -0
- package/sdk/src/protocols/maverick/MaverickV2RouterABI.json +4 -0
- package/sdk/src/protocols/maverick/abis.ts +7 -1
- package/sdk/src/protocols/morpho-blue/addresses.ts +10 -0
- package/sdk/src/protocols/mux-protocol/LiquidityPoolABI.json +45 -11
- package/sdk/src/protocols/mux-protocol/OrderBookABI.json +59 -17
- package/sdk/src/protocols/mux-protocol/abis.ts +55 -22
- package/sdk/src/protocols/mux-protocol/functions.ts +8 -8
- package/sdk/src/protocols/olympus/StakingABI.json +8 -3
- package/sdk/src/protocols/olympus/abis.ts +2 -2
- package/sdk/src/protocols/oneinch/AggregationRouterV6ABI.json +5 -5
- package/sdk/src/protocols/oneinch/abis.ts +5 -3
- package/sdk/src/protocols/oneinch/functions.ts +2 -2
- package/sdk/src/protocols/openocean/OpenOceanExchangeV2ABI.json +19 -1
- package/sdk/src/protocols/openocean/abis.ts +11 -1
- package/sdk/src/protocols/openocean/functions.ts +1 -1
- package/sdk/src/protocols/opyn/ControllerABI.json +6 -1
- package/sdk/src/protocols/opyn/abis.ts +1 -1
- package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3FactoryABI.json +1 -1
- package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3NFPMABI.json +3 -3
- package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3SmartRouterABI.json +2 -2
- package/sdk/src/protocols/pancakeswap-v3/abis.ts +6 -6
- package/sdk/src/protocols/paraswap/AugustusV5ABI.json +1 -1
- package/sdk/src/protocols/paraswap/abis.ts +1 -1
- package/sdk/src/protocols/pendle/PendleRouterABI.json +392 -6
- package/sdk/src/protocols/pendle/abis.ts +160 -6
- package/sdk/src/protocols/permit2/Permit2ABI.json +1 -1
- package/sdk/src/protocols/permit2/abis.ts +1 -1
- package/sdk/src/protocols/permit2/addresses.ts +9 -0
- package/sdk/src/protocols/perpetual-protocol/ClearingHouseABI.json +61 -49
- package/sdk/src/protocols/perpetual-protocol/abis.ts +27 -14
- package/sdk/src/protocols/premia/DiamondABI.json +24 -24
- package/sdk/src/protocols/premia/abis.ts +20 -10
- package/sdk/src/protocols/premia/addresses.ts +3 -8
- package/sdk/src/protocols/premia/functions.ts +8 -8
- package/sdk/src/protocols/pyth/PythOracleABI.json +3 -3
- package/sdk/src/protocols/pyth/abis.ts +6 -3
- package/sdk/src/protocols/reflexer/ETHJoinABI.json +5 -1
- package/sdk/src/protocols/reflexer/SAFEEngineABI.json +4 -4
- package/sdk/src/protocols/reflexer/abis.ts +10 -6
- package/sdk/src/protocols/renzo/RestakeManagerABI.json +1 -1
- package/sdk/src/protocols/renzo/abis.ts +1 -1
- package/sdk/src/protocols/sablier/LockupLinearABI.json +2 -2
- package/sdk/src/protocols/sablier/abis.ts +2 -2
- package/sdk/src/protocols/safe/addresses.ts +10 -0
- package/sdk/src/protocols/seaport/SeaportABI.json +87 -5
- package/sdk/src/protocols/seaport/abis.ts +41 -5
- package/sdk/src/protocols/seaport/addresses.ts +10 -0
- package/sdk/src/protocols/seaport/functions.ts +1 -0
- package/sdk/src/protocols/silo/SiloABI.json +4 -0
- package/sdk/src/protocols/silo/abis.ts +4 -1
- package/sdk/src/protocols/silo/addresses.ts +2 -1
- package/sdk/src/protocols/silo/functions.ts +2 -1
- package/sdk/src/protocols/socket/SocketGatewayABI.json +1 -17
- package/sdk/src/protocols/socket/abis.ts +3 -11
- package/sdk/src/protocols/socket/functions.ts +1 -1
- package/sdk/src/protocols/spookyswap/addresses.ts +2 -1
- package/sdk/src/protocols/squid/SquidRouterABI.json +42 -26
- package/sdk/src/protocols/squid/abis.ts +19 -13
- package/sdk/src/protocols/squid/functions.ts +2 -2
- package/sdk/src/protocols/stargate/StargatePoolABI.json +31 -3
- package/sdk/src/protocols/stargate/abis.ts +19 -3
- package/sdk/src/protocols/superfluid/CFAForwarderABI.json +2 -2
- package/sdk/src/protocols/superfluid/abis.ts +2 -2
- package/sdk/src/protocols/sushiswap-v2/addresses.ts +2 -1
- package/sdk/src/protocols/swell/RswETHABI.json +1 -6
- package/sdk/src/protocols/swell/SwETHABI.json +1 -6
- package/sdk/src/protocols/swell/abis.ts +4 -2
- package/sdk/src/protocols/swell/functions.ts +4 -2
- package/sdk/src/protocols/synapse/addresses.ts +2 -1
- package/sdk/src/protocols/synthetix-v3/PerpsMarketProxyABI.json +54 -5
- package/sdk/src/protocols/synthetix-v3/abis.ts +27 -5
- package/sdk/src/protocols/synthetix-v3/addresses.ts +2 -1
- package/sdk/src/protocols/synthra-v3/SynthraV3FactoryABI.json +54 -0
- package/sdk/src/protocols/synthra-v3/SynthraV3NonfungiblePositionManagerABI.json +212 -0
- package/sdk/src/protocols/synthra-v3/SynthraV3QuoterV2ABI.json +55 -0
- package/sdk/src/protocols/synthra-v3/SynthraV3SwapRouter02ABI.json +168 -0
- package/sdk/src/protocols/synthra-v3/abis.ts +244 -0
- package/sdk/src/protocols/synthra-v3/addresses.ts +17 -0
- package/sdk/src/protocols/synthra-v3/functions.ts +8 -0
- package/sdk/src/protocols/synthra-v3/index.ts +4 -0
- package/sdk/src/protocols/synthra-v3/info.ts +13 -0
- package/sdk/src/protocols/thales/PositionalMarketABI.json +16 -0
- package/sdk/src/protocols/thales/SpeedMarketsAMMABI.json +57 -22
- package/sdk/src/protocols/thales/ThalesAMMABI.json +4 -11
- package/sdk/src/protocols/thales/abis.ts +28 -11
- package/sdk/src/protocols/thales/functions.ts +5 -6
- package/sdk/src/protocols/thruster/ThrusterV3SwapRouterABI.json +1 -1
- package/sdk/src/protocols/thruster/abis.ts +1 -1
- package/sdk/src/protocols/trader-joe/LBRouterABI.json +3 -3
- package/sdk/src/protocols/trader-joe/abis.ts +2 -2
- package/sdk/src/protocols/uniswap-v2/addresses.ts +10 -0
- package/sdk/src/protocols/uniswap-v3/UniswapV3FactoryABI.json +2 -2
- package/sdk/src/protocols/uniswap-v3/UniswapV3NonfungiblePositionManagerABI.json +3 -3
- package/sdk/src/protocols/uniswap-v3/UniswapV3QuoterV2ABI.json +1 -1
- package/sdk/src/protocols/uniswap-v3/UniswapV3SwapRouter02ABI.json +168 -0
- package/sdk/src/protocols/uniswap-v3/UniswapV3SwapRouterABI.json +2 -2
- package/sdk/src/protocols/uniswap-v3/abis.ts +91 -8
- package/sdk/src/protocols/uniswap-v3/addresses.ts +14 -0
- package/sdk/src/protocols/uniswap-v4/UniswapV4PoolManagerABI.json +15 -15
- package/sdk/src/protocols/uniswap-v4/UniswapV4UniversalRouterABI.json +16 -0
- package/sdk/src/protocols/uniswap-v4/abis.ts +25 -15
- package/sdk/src/protocols/uniswap-v4/addresses.ts +11 -0
- package/sdk/src/protocols/unitflow-v3/UnitFlowV3FactoryABI.json +46 -0
- package/sdk/src/protocols/unitflow-v3/UnitFlowV3QuoterABI.json +37 -0
- package/sdk/src/protocols/unitflow-v3/UnitFlowV3RouterABI.json +67 -0
- package/sdk/src/protocols/unitflow-v3/abis.ts +71 -0
- package/sdk/src/protocols/unitflow-v3/addresses.ts +20 -0
- package/sdk/src/protocols/unitflow-v3/functions.ts +8 -0
- package/sdk/src/protocols/unitflow-v3/index.ts +4 -0
- package/sdk/src/protocols/unitflow-v3/info.ts +14 -0
- package/sdk/src/protocols/velodrome/addresses.ts +3 -1
- package/sdk/src/protocols/venus/VBNBABI.json +86 -0
- package/sdk/src/protocols/venus/VTokenABI.json +1 -1
- package/sdk/src/protocols/venus/abis.ts +49 -1
- package/sdk/src/protocols/vertex/ClearinghouseABI.json +20 -10
- package/sdk/src/protocols/vertex/EndpointABI.json +1 -1
- package/sdk/src/protocols/vertex/abis.ts +13 -4
- package/sdk/src/protocols/wormhole/WormholeTokenBridgeABI.json +2 -2
- package/sdk/src/protocols/wormhole/abis.ts +2 -2
- package/sdk/src/protocols/wormhole/addresses.ts +9 -0
- package/sdk/src/protocols/zerolend/addresses.ts +2 -1
- package/sdk/src/protocols/zerox/addresses.ts +2 -1
- package/sdk/src/protocols/zksync-bridge/ZkSyncDiamondProxyABI.json +1 -1
- package/sdk/src/protocols/zksync-bridge/abis.ts +1 -1
- package/sdk/src/skills/aave-v4.md +91 -0
- package/sdk/src/skills/across.md +28 -10
- package/sdk/src/skills/aerodrome-slipstream.md +57 -0
- package/sdk/src/skills/aerodrome.md +1 -0
- package/sdk/src/skills/aevo.md +12 -4
- package/sdk/src/skills/ambient.md +2 -2
- package/sdk/src/skills/arrakis.md +3 -3
- package/sdk/src/skills/cbeth.md +2 -2
- package/sdk/src/skills/chainlink-ccip.md +3 -2
- package/sdk/src/skills/chainlink.md +1 -1
- package/sdk/src/skills/circle-gateway.md +98 -0
- package/sdk/src/skills/compound-v2.md +2 -2
- package/sdk/src/skills/connext.md +8 -7
- package/sdk/src/skills/curve.md +17 -2
- package/sdk/src/skills/debridge.md +3 -2
- package/sdk/src/skills/eigenlayer.md +1 -1
- package/sdk/src/skills/etherfi.md +1 -1
- package/sdk/src/skills/fluid.md +46 -39
- package/sdk/src/skills/gains-network.md +13 -21
- package/sdk/src/skills/gamma.md +12 -6
- package/sdk/src/skills/gmx-v1.md +4 -2
- package/sdk/src/skills/gmx-v2.md +6 -2
- package/sdk/src/skills/harvest.md +2 -2
- package/sdk/src/skills/hegic.md +9 -8
- package/sdk/src/skills/hop.md +8 -8
- package/sdk/src/skills/hyperlane.md +4 -3
- package/sdk/src/skills/index.md +84 -77
- package/sdk/src/skills/kim.md +11 -14
- package/sdk/src/skills/kyberswap-aggregator.md +5 -3
- package/sdk/src/skills/kyberswap.md +6 -6
- package/sdk/src/skills/layerbank.md +41 -35
- package/sdk/src/skills/layerzero.md +3 -2
- package/sdk/src/skills/level-finance.md +6 -4
- package/sdk/src/skills/lido.md +5 -5
- package/sdk/src/skills/lifi.md +41 -23
- package/sdk/src/skills/liquity-v1.md +6 -2
- package/sdk/src/skills/loader.ts +15 -25
- package/sdk/src/skills/mantle-meth.md +13 -5
- package/sdk/src/skills/maverick.md +3 -3
- package/sdk/src/skills/morpho-blue.md +1 -1
- package/sdk/src/skills/mux-protocol.md +21 -17
- package/sdk/src/skills/oneinch.md +4 -3
- package/sdk/src/skills/openocean.md +2 -2
- package/sdk/src/skills/opyn.md +1 -1
- package/sdk/src/skills/permit2.md +1 -1
- package/sdk/src/skills/perpetual-protocol.md +2 -2
- package/sdk/src/skills/premia.md +21 -21
- package/sdk/src/skills/reflexer.md +1 -1
- package/sdk/src/skills/renzo.md +1 -1
- package/sdk/src/skills/safe.md +1 -1
- package/sdk/src/skills/seaport.md +3 -2
- package/sdk/src/skills/silo.md +4 -3
- package/sdk/src/skills/socket.md +4 -5
- package/sdk/src/skills/spookyswap.md +2 -2
- package/sdk/src/skills/squid.md +18 -10
- package/sdk/src/skills/stargate.md +1 -1
- package/sdk/src/skills/sushiswap-v2.md +1 -1
- package/sdk/src/skills/swell.md +6 -4
- package/sdk/src/skills/synapse.md +1 -1
- package/sdk/src/skills/synthetix-v3.md +1 -1
- package/sdk/src/skills/synthra-v3.md +57 -0
- package/sdk/src/skills/thales.md +12 -10
- package/sdk/src/skills/trader-joe.md +1 -1
- package/sdk/src/skills/uniswap-v2.md +2 -1
- package/sdk/src/skills/uniswap-v3.md +14 -4
- package/sdk/src/skills/uniswap-v4.md +3 -1
- package/sdk/src/skills/unitflow-v3.md +62 -0
- package/sdk/src/skills/velodrome.md +2 -2
- package/sdk/src/skills/venus.md +10 -2
- package/sdk/src/skills/vertex.md +1 -1
- package/sdk/src/skills/wormhole.md +1 -1
- package/sdk/src/skills/zerolend.md +1 -1
- package/sdk/src/skills/zerox.md +1 -1
- package/sdk/src/skills/zksync-bridge.md +1 -1
- package/actions/dist/megas-swap.d.ts +0 -97
- package/actions/dist/megas-swap.d.ts.map +0 -1
- package/actions/dist/megas-swap.js +0 -286
- package/sdk/dist/routes/globals.generated.d.ts +0 -94
- package/sdk/dist/routes/globals.generated.d.ts.map +0 -1
- package/sdk/dist/routes/globals.generated.js +0 -2
- package/sdk/dist/routes/globals.generated.js.map +0 -1
package/actions/dist/to-sauce.js
CHANGED
|
@@ -1,197 +1,332 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Action programs -> SauceScript, compiled by the published Rust/wasm compiler.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Every protocol call is an ABI binding, `IBinding.at(target).method(args)`, the same shape an SDK
|
|
5
|
+
* route body lowers to: the compiler derives the selector and the argument encoding from the ABI,
|
|
6
|
+
* so this module computes neither. The ABIs come from the SDK's protocol registry wherever it has
|
|
7
|
+
* the exact function, and `abis.ts` records, per method, why not where it does not. Struct
|
|
8
|
+
* arguments are object literals keyed by the ABI's component names, which the compiler orders.
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
* selector and the same ABI-encoded arguments; `emit.ts`'s `encodeArgs` reproduces the retired
|
|
11
|
-
* builder's `abiEncode(tuple(args))` for every arity. What changed is the shape of the intermediate
|
|
12
|
-
* representation, and two things that were latent bugs in it:
|
|
10
|
+
* Two kinds of call stay raw `evm.call`, each for a stated reason:
|
|
13
11
|
*
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
12
|
+
* - an ERC-20 `approve`/`transfer` (`erc20Write`), through the SDK's `token/safe` lowering:
|
|
13
|
+
* a binding would decode the ABI's `bool` output, and a token that returns nothing (USDT)
|
|
14
|
+
* would then revert a write that succeeded — the raw call is checked the way OpenZeppelin's
|
|
15
|
+
* `SafeERC20` checks it instead;
|
|
16
|
+
* - a call carrying native value (`valueCall`), because a binding cannot attach value.
|
|
17
|
+
*
|
|
18
|
+
* A binding method's output is declared, and so decoded, only when an action reads it — see
|
|
19
|
+
* `abis.ts`.
|
|
20
|
+
*
|
|
21
|
+
* AMOUNTS AND OUTPUTS. An action's amount is its `amount`, the local an earlier action saved under
|
|
22
|
+
* its `amountRef`, or the previous action's output. Its output is what it delivered to the Pot
|
|
23
|
+
* (`ctx.self()`) for a swap, a wrap or a stake and for an Aave withdrawal — the venue's return value
|
|
24
|
+
* where that is the amount, a balance delta around the call where it is not — the value read for a
|
|
25
|
+
* source action, and otherwise its own amount, passed through. An action whose output a later
|
|
26
|
+
* action spends delivers to the Pot whatever its `recipient` says.
|
|
19
27
|
*/
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
28
|
+
import { bindBytes, bindConst, encodeArgs, fn, hexToBytes, indent, newEmitter, slotVar, } from "./emit.js";
|
|
29
|
+
import { contractsFor, methodSelector, } from "./abis.js";
|
|
30
|
+
import { safeApproveStatements, safeTransferStatements } from "./registry.js";
|
|
31
|
+
import { consumesPrevious } from "./semantics.js";
|
|
32
|
+
import { ACTION_SPECS } from "./spec.js";
|
|
23
33
|
/** V4 ActionConstants.CONTRACT_BALANCE — signals the router to use its own token balance. */
|
|
24
|
-
const V4_CONTRACT_BALANCE =
|
|
25
|
-
/**
|
|
26
|
-
|
|
34
|
+
const V4_CONTRACT_BALANCE = 1n << 255n;
|
|
35
|
+
/**
|
|
36
|
+
* V4 ActionConstants.OPEN_DELTA — a TAKE of this amount takes everything owed. It is ZERO: the
|
|
37
|
+
* all-ones word this used to be overflows the router's `uint128` cast and reverts every swap.
|
|
38
|
+
*/
|
|
39
|
+
const V4_OPEN_DELTA = 0n;
|
|
40
|
+
/** type(int256).max — Balancer's "no limit" for an asset the Vault may take. */
|
|
41
|
+
const MAX_INT256 = (1n << 255n) - 1n;
|
|
42
|
+
/** Aave V3's variable interest-rate mode, the only one it offers. */
|
|
43
|
+
const AAVE_VARIABLE_RATE = 2n;
|
|
44
|
+
/** CCTP V2's `minFinalityThreshold` for a standard (finalized) transfer. */
|
|
45
|
+
const CCTP_FINALIZED = 2000;
|
|
27
46
|
const ZERO = "0n";
|
|
28
47
|
const SELF = "ctx.self()";
|
|
29
|
-
|
|
30
|
-
/** An address, pool id or any other 256-bit field, as the literal the emitted source carries. */
|
|
48
|
+
/** An integer field, as the decimal literal the emitted source carries. */
|
|
31
49
|
function word(value) {
|
|
32
|
-
return
|
|
50
|
+
return `${BigInt(value).toString()}n`;
|
|
51
|
+
}
|
|
52
|
+
/** An address as a hex literal, so the emitted source reads like the addresses it was built from. */
|
|
53
|
+
function addr(value) {
|
|
54
|
+
return `0x${BigInt(value).toString(16).padStart(40, "0")}n`;
|
|
55
|
+
}
|
|
56
|
+
/** A recipient field: an address, or the Pot for `"self"`. */
|
|
57
|
+
function recipient(value) {
|
|
58
|
+
return value === "self" ? SELF : addr(value);
|
|
59
|
+
}
|
|
60
|
+
/** A bytes32 field (a pool id). */
|
|
61
|
+
function b32(value) {
|
|
62
|
+
return `0x${BigInt(value).toString(16).padStart(64, "0")}n`;
|
|
63
|
+
}
|
|
64
|
+
/** A recipient on another chain, as the 32-byte word bridges take: an address is left-padded. */
|
|
65
|
+
function remote(value) {
|
|
66
|
+
return b32(value);
|
|
33
67
|
}
|
|
34
68
|
function flag(value) {
|
|
35
|
-
return value ? "
|
|
69
|
+
return value ? "true" : "false";
|
|
70
|
+
}
|
|
71
|
+
/** An object literal. A binding orders its fields by the ABI; `abi.encode` takes them as written. */
|
|
72
|
+
function record(fields) {
|
|
73
|
+
return `{ ${Object.entries(fields)
|
|
74
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
75
|
+
.join(", ")} }`;
|
|
76
|
+
}
|
|
77
|
+
function list(elements) {
|
|
78
|
+
return `[${elements.join(", ")}]`;
|
|
79
|
+
}
|
|
80
|
+
/** Collects one action's statements and the bindings they name. */
|
|
81
|
+
class Lowering {
|
|
82
|
+
emit;
|
|
83
|
+
stmts = [];
|
|
84
|
+
used = new Set();
|
|
85
|
+
constructor(emit) {
|
|
86
|
+
this.emit = emit;
|
|
87
|
+
}
|
|
88
|
+
/** `IBinding.at(target).method(args)` — the expression, not yet a statement. */
|
|
89
|
+
call(binding, target, method, args) {
|
|
90
|
+
this.used.add(binding);
|
|
91
|
+
return `${binding}.at(${target}).${method}(${args.join(", ")})`;
|
|
92
|
+
}
|
|
93
|
+
/** A call whose value nothing reads. */
|
|
94
|
+
exec(binding, target, method, args) {
|
|
95
|
+
this.stmts.push(`${this.call(binding, target, method, args)};`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* An ERC-20 `approve(spender, amount)` or `transfer(to, amount)` through the SDK's `token/safe`,
|
|
99
|
+
* with OpenZeppelin `SafeERC20` semantics: the call is raw, so nothing is decoded on the way out,
|
|
100
|
+
* and then its returndata must be empty (from a contract) or decode as an ABI word equal to 1.
|
|
101
|
+
* `approve` first resets a non-zero allowance, which USDT requires. A token that refuses the
|
|
102
|
+
* write reverts the program.
|
|
103
|
+
*/
|
|
104
|
+
erc20Write(fn, token, first, amount) {
|
|
105
|
+
const prefix = this.emit.name("e");
|
|
106
|
+
const statements = fn === "approve"
|
|
107
|
+
? safeApproveStatements(prefix, token, this.wordArg(first), this.wordArg(amount))
|
|
108
|
+
: safeTransferStatements(prefix, token, this.wordArg(first), this.wordArg(amount));
|
|
109
|
+
this.stmts.push(...statements);
|
|
110
|
+
}
|
|
111
|
+
/** A word `token/safe` can splice: a literal, or a local (an expression is bound to one). */
|
|
112
|
+
wordArg(expr) {
|
|
113
|
+
const literal = /^(0x[0-9a-f]+|[0-9]+)n$/.exec(expr);
|
|
114
|
+
if (literal)
|
|
115
|
+
return { literal: BigInt(literal[1]) };
|
|
116
|
+
if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(expr))
|
|
117
|
+
return { local: expr };
|
|
118
|
+
return { local: this.bind("w", expr) };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A payable call carrying native `value`. Raw, because a binding call cannot attach value — the
|
|
122
|
+
* selector is still the binding's own fragment's, and the arguments are `abi.encode`d in one
|
|
123
|
+
* tuple (see `emit.ts#encodeArgs` for why the wrap is load-bearing).
|
|
124
|
+
*/
|
|
125
|
+
valueCall(binding, target, value, method, args) {
|
|
126
|
+
const sel = this.bytes("sel", hexToBytes(methodSelector(binding, method)));
|
|
127
|
+
const data = args.length === 0 ? sel : `${sel}.concat(${encodeArgs(args)})`;
|
|
128
|
+
this.stmts.push(`evm.call(${target}, ${value}, ${data});`);
|
|
129
|
+
}
|
|
130
|
+
/** Bind `expr` to a fresh `const` and yield its name. */
|
|
131
|
+
bind(prefix, expr) {
|
|
132
|
+
const bound = bindConst(this.emit, prefix, expr);
|
|
133
|
+
this.stmts.push(...bound.stmts);
|
|
134
|
+
return bound.expr;
|
|
135
|
+
}
|
|
136
|
+
/** Bind a byte literal. A method call's receiver must be an identifier, so bytes are bound. */
|
|
137
|
+
bytes(prefix, value) {
|
|
138
|
+
const bound = bindBytes(this.emit, prefix, value);
|
|
139
|
+
this.stmts.push(...bound.stmts);
|
|
140
|
+
return bound.expr;
|
|
141
|
+
}
|
|
142
|
+
/** The Pot's balance of `token`, as a bound local. */
|
|
143
|
+
selfBalance(token) {
|
|
144
|
+
return this.bind("bal", this.call("IErc20", token, "balanceOf", [SELF]));
|
|
145
|
+
}
|
|
146
|
+
/** The Pot's native balance, as a bound local. */
|
|
147
|
+
nativeBalance() {
|
|
148
|
+
return this.bind("nat", "ctx.selfBalance()");
|
|
149
|
+
}
|
|
150
|
+
result(output) {
|
|
151
|
+
return { stmts: this.stmts, output, bindings: [...this.used] };
|
|
152
|
+
}
|
|
36
153
|
}
|
|
37
|
-
|
|
38
|
-
|
|
154
|
+
/** A call whose declared output is the action's output when `needsOutput`. */
|
|
155
|
+
function captured(l, needsOutput, call, passThrough) {
|
|
156
|
+
if (!needsOutput) {
|
|
157
|
+
l.stmts.push(`${call};`);
|
|
158
|
+
return l.result(passThrough);
|
|
159
|
+
}
|
|
160
|
+
return l.result(l.bind("amt", call));
|
|
39
161
|
}
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
// Amount resolution
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
162
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
163
|
+
* Runs `run` between two readings of `measure` — the Pot's balance of the token it receives — and
|
|
164
|
+
* returns the DELTA as the output, for a venue whose return is not the amount received (an array,
|
|
165
|
+
* a signed pair, `bytes`, shares, or nothing). The call must deliver to the Pot for the delta to
|
|
166
|
+
* mean anything, which every caller arranges whenever `needsOutput` is set.
|
|
48
167
|
*/
|
|
49
|
-
function
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
168
|
+
function balanceDelta(l, needsOutput, measure, run, passThrough) {
|
|
169
|
+
if (!needsOutput) {
|
|
170
|
+
run();
|
|
171
|
+
return l.result(passThrough);
|
|
172
|
+
}
|
|
173
|
+
const pre = measure();
|
|
174
|
+
run();
|
|
175
|
+
const post = measure();
|
|
176
|
+
return l.result(l.bind("delta", `${post} - ${pre}`));
|
|
57
177
|
}
|
|
58
|
-
/**
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
return a.amountIn ?? a.amount ?? a.stETHAmount ?? a.wstETHAmount ?? a.steps?.[0]?.amount;
|
|
178
|
+
/** The local a runtime argument arrives in. Prefixed like `slotVar`, for the same reasons. */
|
|
179
|
+
function argumentVar(name) {
|
|
180
|
+
return `a_${name}`;
|
|
62
181
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// ---------------------------------------------------------------------------
|
|
66
|
-
/** The SauceScript source for `actions`. Empty for an empty list. */
|
|
67
|
-
export function actionsToSauceSource(actions) {
|
|
68
|
-
if (actions.length === 0)
|
|
69
|
-
return "";
|
|
182
|
+
/** Lowers a validated action list into `main`'s body. */
|
|
183
|
+
export function lowerActions(actions) {
|
|
70
184
|
const emit = newEmitter();
|
|
71
185
|
const body = [];
|
|
186
|
+
const bindings = new Set();
|
|
187
|
+
const parameters = [];
|
|
72
188
|
const declared = new Set();
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
getExplicitAmount(nextAction) === undefined &&
|
|
81
|
-
nextAction.amountRef === undefined);
|
|
82
|
-
const result = buildAction(emit, action, amountIn, needsStore);
|
|
189
|
+
let previous;
|
|
190
|
+
actions.forEach((action, i) => {
|
|
191
|
+
if (action.type === "argument")
|
|
192
|
+
parameters.push(action.name);
|
|
193
|
+
const next = actions[i + 1];
|
|
194
|
+
const needsOutput = action.saveOutputAs !== undefined || (next !== undefined && consumesPrevious(next));
|
|
195
|
+
const result = lowerAction(emit, action, amountOf(action, previous), needsOutput);
|
|
83
196
|
body.push(...result.stmts);
|
|
84
|
-
|
|
197
|
+
for (const b of result.bindings)
|
|
198
|
+
bindings.add(b);
|
|
199
|
+
if (needsOutput) {
|
|
85
200
|
const slot = action.saveOutputAs === undefined ? `t_out${i}` : slotVar(action.saveOutputAs);
|
|
86
201
|
body.push(declared.has(slot) ? `${slot} = ${result.output};` : `let ${slot} = ${result.output};`);
|
|
87
202
|
declared.add(slot);
|
|
88
|
-
|
|
203
|
+
previous = slot;
|
|
89
204
|
}
|
|
90
|
-
}
|
|
91
|
-
return
|
|
205
|
+
});
|
|
206
|
+
return { body, contracts: contractsFor(bindings), parameters };
|
|
207
|
+
}
|
|
208
|
+
/** The amount an action spends: its `amount`, the output it references, or the previous output. */
|
|
209
|
+
function amountOf(action, previous) {
|
|
210
|
+
if (!ACTION_SPECS[action.type].spends)
|
|
211
|
+
return ZERO;
|
|
212
|
+
const { amount, amountRef } = action;
|
|
213
|
+
if (amount !== undefined)
|
|
214
|
+
return word(amount);
|
|
215
|
+
if (amountRef !== undefined)
|
|
216
|
+
return slotVar(amountRef);
|
|
217
|
+
if (previous !== undefined)
|
|
218
|
+
return previous;
|
|
219
|
+
throw new Error(`${action.type} has no amount — the program was not validated`);
|
|
92
220
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
221
|
+
/** `main` for a standalone compile: typed parameters and the `void` return the compiler requires. */
|
|
222
|
+
export function renderProgram(lowered) {
|
|
223
|
+
const params = lowered.parameters.map((name) => `${argumentVar(name)}: Uint256`);
|
|
224
|
+
return `${fn("main", params, "void", lowered.body)}\n`;
|
|
96
225
|
}
|
|
97
|
-
|
|
98
|
-
|
|
226
|
+
/**
|
|
227
|
+
* `main` for an SDK route body: no annotations, because the route compiler's rewrite passes parse
|
|
228
|
+
* plain JavaScript and add the `void` themselves. A route body is compiled with no arguments, so a
|
|
229
|
+
* program with `argument` actions cannot be one.
|
|
230
|
+
*/
|
|
231
|
+
export function renderRouteBody(lowered) {
|
|
232
|
+
if (lowered.parameters.length > 0) {
|
|
233
|
+
throw new Error(`an intent route takes no runtime arguments, but this program declares ` +
|
|
234
|
+
`${lowered.parameters.map((p) => `'${p}'`).join(", ")}. Read the amount on-chain instead ` +
|
|
235
|
+
`(a \`balanceOf\` action), or compile it standalone with \`compileProgram\`.`);
|
|
236
|
+
}
|
|
237
|
+
return `function main() {\n${indent(lowered.body)}\n}\n`;
|
|
99
238
|
}
|
|
100
239
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* BREAKING: this took a `Saucer` and a `Saucer` amount and returned builder nodes. It now takes an
|
|
104
|
-
* [`Emitter`] (from `newEmitter()`) and a SauceScript amount EXPRESSION, and returns source
|
|
105
|
-
* fragments. `needsOutput` is the old `outputChained` under its real name: it both selects the
|
|
106
|
-
* recipient (`ctx.self()` when the output is consumed here, the action's own `recipient` otherwise)
|
|
107
|
-
* and decides whether a call's `uint256` return value is captured.
|
|
240
|
+
* The statements for one action, spending the SauceScript expression `amount`. `needsOutput` both
|
|
241
|
+
* routes the output to the Pot (instead of the action's own `recipient`) and captures it.
|
|
108
242
|
*/
|
|
109
|
-
export function
|
|
243
|
+
export function lowerAction(emit, action, amount, needsOutput) {
|
|
244
|
+
const l = new Lowering(emit);
|
|
110
245
|
switch (action.type) {
|
|
111
246
|
case "uniswapV3ExactInput":
|
|
112
|
-
return uniswapV3ExactInput(
|
|
247
|
+
return uniswapV3ExactInput(l, action, amount, needsOutput);
|
|
113
248
|
case "uniswapV3ExactInputMultiHop":
|
|
114
|
-
return uniswapV3ExactInputMultiHop(
|
|
249
|
+
return uniswapV3ExactInputMultiHop(l, action, amount, needsOutput);
|
|
115
250
|
case "uniswapV4ExactInput":
|
|
116
|
-
return uniswapV4ExactInput(
|
|
251
|
+
return uniswapV4ExactInput(l, action, amount, needsOutput);
|
|
117
252
|
case "uniswapV4ExactInputMultiHop":
|
|
118
|
-
return uniswapV4ExactInputMultiHop(
|
|
253
|
+
return uniswapV4ExactInputMultiHop(l, action, amount, needsOutput);
|
|
119
254
|
case "curveSwap":
|
|
120
|
-
return curveSwap(
|
|
255
|
+
return curveSwap(l, action, amount, needsOutput);
|
|
256
|
+
case "curveRouterNGSwap":
|
|
257
|
+
return curveRouterNGSwap(l, action, amount, needsOutput);
|
|
121
258
|
case "balancerV2Swap":
|
|
122
|
-
return balancerV2Swap(
|
|
259
|
+
return balancerV2Swap(l, action, amount, needsOutput);
|
|
123
260
|
case "balancerV2BatchSwap":
|
|
124
|
-
return balancerV2BatchSwap(
|
|
261
|
+
return balancerV2BatchSwap(l, action, amount, needsOutput);
|
|
125
262
|
case "balancerV3Swap":
|
|
126
|
-
return balancerV3Swap(
|
|
263
|
+
return balancerV3Swap(l, action, amount, needsOutput);
|
|
127
264
|
case "uniswapV2Swap":
|
|
128
|
-
return uniswapV2Swap(
|
|
129
|
-
case "curveRouterNGSwap":
|
|
130
|
-
return curveRouterNGSwap(emit, action, amountIn, needsOutput);
|
|
265
|
+
return uniswapV2Swap(l, action, amount, needsOutput);
|
|
131
266
|
case "ambientSwap":
|
|
132
|
-
return ambientSwap(
|
|
267
|
+
return ambientSwap(l, action, amount, needsOutput);
|
|
133
268
|
case "dodoSwap":
|
|
134
|
-
return dodoSwap(
|
|
269
|
+
return dodoSwap(l, action, amount, needsOutput);
|
|
135
270
|
case "maverickSwap":
|
|
136
|
-
return maverickSwap(
|
|
271
|
+
return maverickSwap(l, action, amount, needsOutput);
|
|
137
272
|
case "maverickMultiHopSwap":
|
|
138
|
-
return maverickMultiHopSwap(
|
|
273
|
+
return maverickMultiHopSwap(l, action, amount, needsOutput);
|
|
139
274
|
case "carbonSwap":
|
|
140
|
-
return carbonSwap(
|
|
275
|
+
return carbonSwap(l, action, amount, needsOutput);
|
|
141
276
|
case "fraxswapSwap":
|
|
142
|
-
return fraxswapSwap(
|
|
143
|
-
case "clipperSwap":
|
|
144
|
-
return clipperSwap(emit, action, amountIn, needsOutput);
|
|
145
|
-
case "integralSwap":
|
|
146
|
-
return integralSwap(emit, action, amountIn, needsOutput);
|
|
277
|
+
return fraxswapSwap(l, action, amount, needsOutput);
|
|
147
278
|
case "fluidDexT1Swap":
|
|
148
|
-
return fluidDexT1Swap(
|
|
149
|
-
case "
|
|
150
|
-
return
|
|
151
|
-
case "
|
|
152
|
-
return
|
|
153
|
-
case "
|
|
154
|
-
return
|
|
279
|
+
return fluidDexT1Swap(l, action, amount, needsOutput);
|
|
280
|
+
case "acrossBridge":
|
|
281
|
+
return acrossBridge(l, action, amount);
|
|
282
|
+
case "stargateBridge":
|
|
283
|
+
return stargateBridge(l, action, amount);
|
|
284
|
+
case "cctpBridge":
|
|
285
|
+
return cctpBridge(l, action, amount);
|
|
286
|
+
case "hyperlaneBridge":
|
|
287
|
+
return hyperlaneBridge(l, action, amount);
|
|
155
288
|
case "wrapETH":
|
|
156
|
-
return wrapETH(
|
|
289
|
+
return wrapETH(l, action, amount);
|
|
157
290
|
case "unwrapETH":
|
|
158
|
-
return unwrapETH(
|
|
291
|
+
return unwrapETH(l, action, amount);
|
|
159
292
|
case "wrapStETH":
|
|
160
|
-
return wrapStETH(
|
|
293
|
+
return wrapStETH(l, action, amount, needsOutput);
|
|
161
294
|
case "unwrapStETH":
|
|
162
|
-
return unwrapStETH(
|
|
295
|
+
return unwrapStETH(l, action, amount, needsOutput);
|
|
163
296
|
case "lidoStake":
|
|
164
|
-
return lidoStake(
|
|
297
|
+
return lidoStake(l, action, amount, needsOutput);
|
|
165
298
|
case "lidoUnstake":
|
|
166
|
-
return lidoUnstake(
|
|
299
|
+
return lidoUnstake(l, action, amount);
|
|
167
300
|
case "rocketPoolStake":
|
|
168
|
-
return rocketPoolStake(
|
|
301
|
+
return rocketPoolStake(l, action, amount, needsOutput);
|
|
169
302
|
case "rocketPoolUnstake":
|
|
170
|
-
return rocketPoolUnstake(
|
|
171
|
-
case "coinbaseStake":
|
|
172
|
-
return coinbaseStake(emit, action, amountIn);
|
|
303
|
+
return rocketPoolUnstake(l, action, amount, needsOutput);
|
|
173
304
|
case "etherFiStake":
|
|
174
|
-
return etherFiStake(
|
|
305
|
+
return etherFiStake(l, action, amount, needsOutput);
|
|
175
306
|
case "aaveV3Supply":
|
|
176
|
-
return aaveV3Supply(
|
|
307
|
+
return aaveV3Supply(l, action, amount);
|
|
177
308
|
case "aaveV3Withdraw":
|
|
178
|
-
return aaveV3Withdraw(
|
|
309
|
+
return aaveV3Withdraw(l, action, amount, needsOutput);
|
|
179
310
|
case "aaveV3Borrow":
|
|
180
|
-
return aaveV3Borrow(
|
|
311
|
+
return aaveV3Borrow(l, action, amount);
|
|
181
312
|
case "aaveV3Repay":
|
|
182
|
-
return aaveV3Repay(
|
|
313
|
+
return aaveV3Repay(l, action, amount);
|
|
183
314
|
case "compoundV3Supply":
|
|
184
|
-
return compoundV3Supply(
|
|
315
|
+
return compoundV3Supply(l, action, amount);
|
|
185
316
|
case "compoundV3Withdraw":
|
|
186
|
-
return compoundV3Withdraw(
|
|
187
|
-
case "
|
|
188
|
-
return
|
|
189
|
-
case "
|
|
190
|
-
return
|
|
191
|
-
case "
|
|
192
|
-
return
|
|
193
|
-
case "
|
|
194
|
-
return
|
|
317
|
+
return compoundV3Withdraw(l, action, amount);
|
|
318
|
+
case "transfer":
|
|
319
|
+
return transfer(l, action, amount);
|
|
320
|
+
case "approve":
|
|
321
|
+
return approve(l, action, amount);
|
|
322
|
+
case "permit2Approve":
|
|
323
|
+
return permit2Approve(l, action, amount);
|
|
324
|
+
case "balanceOf":
|
|
325
|
+
return balanceOf(l, action);
|
|
326
|
+
case "nativeBalance":
|
|
327
|
+
return l.result(l.nativeBalance());
|
|
328
|
+
case "argument":
|
|
329
|
+
return argument(l, action);
|
|
195
330
|
default: {
|
|
196
331
|
const _ = action;
|
|
197
332
|
throw new Error(`Unknown action type: ${_.type}`);
|
|
@@ -199,713 +334,516 @@ export function buildAction(emit, action, amountIn, needsOutput) {
|
|
|
199
334
|
}
|
|
200
335
|
}
|
|
201
336
|
// ---------------------------------------------------------------------------
|
|
202
|
-
//
|
|
337
|
+
// Swap actions
|
|
203
338
|
// ---------------------------------------------------------------------------
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return
|
|
339
|
+
function uniswapV3ExactInput(l, action, amountIn, needsOutput) {
|
|
340
|
+
const params = record({
|
|
341
|
+
tokenIn: addr(action.tokenIn),
|
|
342
|
+
tokenOut: addr(action.tokenOut),
|
|
343
|
+
fee: word(action.fee),
|
|
344
|
+
recipient: needsOutput ? SELF : recipient(action.recipient),
|
|
345
|
+
amountIn,
|
|
346
|
+
amountOutMinimum: word(action.amountOutMin),
|
|
347
|
+
sqrtPriceLimitX96: word(action.sqrtPriceLimitX96 ?? "0"),
|
|
348
|
+
});
|
|
349
|
+
const call = l.call("ISwapRouter02", addr(action.router), "exactInputSingle", [params]);
|
|
350
|
+
return captured(l, needsOutput, call, amountIn);
|
|
351
|
+
}
|
|
352
|
+
function uniswapV3ExactInputMultiHop(l, action, amountIn, needsOutput) {
|
|
353
|
+
const path = l.bytes("path", hexToBytes(action.path));
|
|
354
|
+
const params = record({
|
|
355
|
+
path,
|
|
356
|
+
recipient: needsOutput ? SELF : recipient(action.recipient),
|
|
357
|
+
amountIn,
|
|
358
|
+
amountOutMinimum: word(action.amountOutMin),
|
|
359
|
+
});
|
|
360
|
+
const call = l.call("ISwapRouter02", addr(action.router), "exactInput", [params]);
|
|
361
|
+
return captured(l, needsOutput, call, amountIn);
|
|
216
362
|
}
|
|
217
363
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
364
|
+
* Uniswap V4 through the Universal Router's `V4_SWAP` command (0x10): the input token is
|
|
365
|
+
* transferred to the router, which swaps (`SWAP_EXACT_IN_SINGLE` 0x06 / `SWAP_EXACT_IN` 0x07),
|
|
366
|
+
* settles from its own balance (`SETTLE` 0x0b, `payerIsUser = false`, `CONTRACT_BALANCE`) and takes
|
|
367
|
+
* everything owed to the recipient (`TAKE` 0x0e, `OPEN_DELTA`).
|
|
220
368
|
*
|
|
221
|
-
* The
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
369
|
+
* The router input is encoded in the program — `abi.encode(actions, params[])` inside the
|
|
370
|
+
* `bytes[]` of `execute` — so the amount is a runtime value, and the TAKE recipient can be
|
|
371
|
+
* `ctx.self()` when the output is chained, like every other swap. The swap parameters are ONE
|
|
372
|
+
* ABI-encoded struct, head offset included, which is what the V4 router's calldata decoder reads;
|
|
373
|
+
* the multi-hop struct has no `maxHopSlippage` field. Both were checked against the deployed
|
|
374
|
+
* mainnet Universal Router (`v4.mainnet.test.ts`), where the flattened encoding this replaced reverts.
|
|
227
375
|
*/
|
|
228
|
-
function
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
const
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
const path = bindBytes(emit, "path", hexToBytes(action.path));
|
|
266
|
-
const cd = calldata(emit, "exactInput((bytes,address,uint256,uint256))", [
|
|
267
|
-
tuple([path.expr, recipient, amountIn, word(action.amountOutMin)]),
|
|
268
|
-
]);
|
|
269
|
-
return capturedCall(emit, needsOutput, word(action.router), ZERO, { stmts: [...path.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
|
|
270
|
-
}
|
|
271
|
-
function uniswapV4ExactInput(emit, action, amountIn, needsOutput) {
|
|
272
|
-
const currencyIn = action.zeroForOne ? action.poolKey.currency0 : action.poolKey.currency1;
|
|
273
|
-
const currencyOut = action.zeroForOne ? action.poolKey.currency1 : action.poolKey.currency0;
|
|
274
|
-
// Transfer input token to the router so it can settle without Permit2
|
|
275
|
-
const transferCd = calldata(emit, "transfer(address,uint256)", [word(action.router), amountIn]);
|
|
276
|
-
// ExactInputSingleParams: { PoolKey poolKey, bool zeroForOne, uint128 amountIn, uint128 amountOutMinimum, bytes hookData }
|
|
277
|
-
const poolKeyAbi = {
|
|
278
|
-
type: "tuple",
|
|
279
|
-
components: [
|
|
280
|
-
{ type: "address", name: "currency0" },
|
|
281
|
-
{ type: "address", name: "currency1" },
|
|
282
|
-
{ type: "uint24", name: "fee" },
|
|
283
|
-
{ type: "int24", name: "tickSpacing" },
|
|
284
|
-
{ type: "address", name: "hooks" },
|
|
285
|
-
],
|
|
286
|
-
};
|
|
287
|
-
const swapParams = encodeAbiParameters([poolKeyAbi, { type: "bool" }, { type: "uint128" }, { type: "uint128" }, { type: "bytes" }], [
|
|
288
|
-
{
|
|
289
|
-
currency0: action.poolKey.currency0,
|
|
290
|
-
currency1: action.poolKey.currency1,
|
|
291
|
-
fee: action.poolKey.fee,
|
|
292
|
-
tickSpacing: action.poolKey.tickSpacing,
|
|
293
|
-
hooks: action.poolKey.hooks,
|
|
294
|
-
},
|
|
295
|
-
action.zeroForOne,
|
|
296
|
-
BigInt(action.amountIn ?? "0"),
|
|
297
|
-
BigInt(action.amountOutMin),
|
|
298
|
-
"0x",
|
|
299
|
-
]);
|
|
300
|
-
// SETTLE (0x0b) with payerIsUser=false + CONTRACT_BALANCE (0) — router uses its own balance
|
|
301
|
-
const settleParams = encodeAbiParameters([{ type: "address" }, { type: "uint256" }, { type: "bool" }], [currencyIn, V4_CONTRACT_BALANCE, false]);
|
|
302
|
-
// TAKE (0x0e) — sends output to specified recipient, OPEN_DELTA = take all owed
|
|
303
|
-
const takeParams = encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "uint256" }], [currencyOut, action.recipient, V4_OPEN_DELTA]);
|
|
304
|
-
const executeCalldata = v4ExecuteCalldata("0x060b0e", [swapParams, settleParams, takeParams]);
|
|
305
|
-
const sel = bindBytes(emit, "sel", selector("execute(bytes,bytes[])"));
|
|
306
|
-
const blob = bindBytes(emit, "v4", hexToBytes(executeCalldata));
|
|
307
|
-
const swap = [
|
|
308
|
-
...transferCd.stmts,
|
|
309
|
-
`${evmCall(word(currencyIn), ZERO, transferCd.expr)};`,
|
|
310
|
-
...sel.stmts,
|
|
311
|
-
...blob.stmts,
|
|
312
|
-
`${evmCall(word(action.router), ZERO, concatCalldata(sel.expr, [blob.expr]))};`,
|
|
313
|
-
];
|
|
314
|
-
// V4's take recipient is baked into a STATICALLY encoded blob, so unlike every other builder this
|
|
315
|
-
// one cannot redirect the output to ctx.self() when capturing. The delta is therefore measured on
|
|
316
|
-
// the recipient the caller named — which is the true realized output either way, and is only
|
|
317
|
-
// chainable when that recipient is the executing contract.
|
|
318
|
-
return balanceDeltaResult(emit, needsOutput, word(currencyOut), swap, amountIn);
|
|
319
|
-
}
|
|
320
|
-
function uniswapV4ExactInputMultiHop(emit, action, amountIn, needsOutput) {
|
|
376
|
+
function v4Execute(l, router, currencyIn, currencyOut, amountIn, swapAction, swapParams, to) {
|
|
377
|
+
l.erc20Write("transfer", addr(currencyIn), addr(router), amountIn);
|
|
378
|
+
const settle = l.bind("settle", encodeArgs([addr(currencyIn), word(V4_CONTRACT_BALANCE), flag(false)]));
|
|
379
|
+
const take = l.bind("take", encodeArgs([addr(currencyOut), to, word(V4_OPEN_DELTA)]));
|
|
380
|
+
const actions = l.bytes("v4actions", Uint8Array.of(swapAction, 0x0b, 0x0e));
|
|
381
|
+
const input = l.bind("v4input", encodeArgs([actions, list([swapParams, settle, take])]));
|
|
382
|
+
const commands = l.bytes("v4cmd", Uint8Array.of(0x10));
|
|
383
|
+
l.exec("IUniversalRouter", addr(router), "execute", [commands, list([input])]);
|
|
384
|
+
}
|
|
385
|
+
function uniswapV4ExactInput(l, action, amountIn, needsOutput) {
|
|
386
|
+
const { poolKey } = action;
|
|
387
|
+
const currencyIn = action.zeroForOne ? poolKey.currency0 : poolKey.currency1;
|
|
388
|
+
const currencyOut = action.zeroForOne ? poolKey.currency1 : poolKey.currency0;
|
|
389
|
+
const to = needsOutput ? SELF : recipient(action.recipient);
|
|
390
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(addr(currencyOut)), () => {
|
|
391
|
+
const hookData = l.bytes("hook", new Uint8Array());
|
|
392
|
+
// ExactInputSingleParams { PoolKey poolKey; bool zeroForOne; uint128 amountIn;
|
|
393
|
+
// uint128 amountOutMinimum; bytes hookData; }
|
|
394
|
+
const params = l.bind("v4swap", encodeArgs([
|
|
395
|
+
record({
|
|
396
|
+
poolKey: record({
|
|
397
|
+
currency0: addr(poolKey.currency0),
|
|
398
|
+
currency1: addr(poolKey.currency1),
|
|
399
|
+
fee: word(poolKey.fee),
|
|
400
|
+
tickSpacing: word(poolKey.tickSpacing),
|
|
401
|
+
hooks: addr(poolKey.hooks),
|
|
402
|
+
}),
|
|
403
|
+
zeroForOne: flag(action.zeroForOne),
|
|
404
|
+
amountIn,
|
|
405
|
+
amountOutMinimum: word(action.amountOutMin),
|
|
406
|
+
hookData,
|
|
407
|
+
}),
|
|
408
|
+
]));
|
|
409
|
+
v4Execute(l, action.router, currencyIn, currencyOut, amountIn, 0x06, params, to);
|
|
410
|
+
}, amountIn);
|
|
411
|
+
}
|
|
412
|
+
function uniswapV4ExactInputMultiHop(l, action, amountIn, needsOutput) {
|
|
321
413
|
const currencyOut = action.path[action.path.length - 1].intermediateCurrency;
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
action.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
]);
|
|
353
|
-
const settleParams = encodeAbiParameters([{ type: "address" }, { type: "uint256" }, { type: "bool" }], [action.currencyIn, V4_CONTRACT_BALANCE, false]);
|
|
354
|
-
const takeParams = encodeAbiParameters([{ type: "address" }, { type: "address" }, { type: "uint256" }], [currencyOut, action.recipient, V4_OPEN_DELTA]);
|
|
355
|
-
const executeCalldata = v4ExecuteCalldata("0x070b0e", [swapParams, settleParams, takeParams]);
|
|
356
|
-
const sel = bindBytes(emit, "sel", selector("execute(bytes,bytes[])"));
|
|
357
|
-
const blob = bindBytes(emit, "v4", hexToBytes(executeCalldata));
|
|
358
|
-
const swap = [
|
|
359
|
-
...transferCd.stmts,
|
|
360
|
-
`${evmCall(word(action.currencyIn), ZERO, transferCd.expr)};`,
|
|
361
|
-
...sel.stmts,
|
|
362
|
-
...blob.stmts,
|
|
363
|
-
`${evmCall(word(action.router), ZERO, concatCalldata(sel.expr, [blob.expr]))};`,
|
|
364
|
-
];
|
|
365
|
-
// V4's take recipient is baked into a STATICALLY encoded blob, so unlike every other builder this
|
|
366
|
-
// one cannot redirect the output to ctx.self() when capturing. The delta is therefore measured on
|
|
367
|
-
// the recipient the caller named — which is the true realized output either way, and is only
|
|
368
|
-
// chainable when that recipient is the executing contract.
|
|
369
|
-
return balanceDeltaResult(emit, needsOutput, word(currencyOut), swap, amountIn);
|
|
370
|
-
}
|
|
371
|
-
/** `abi.encode(bytes("0x10"), [abi.encode(actions, params)])` — the V4 router's two-level input. */
|
|
372
|
-
function v4ExecuteCalldata(actions, params) {
|
|
373
|
-
const v4Input = encodeAbiParameters([{ type: "bytes" }, { type: "bytes[]" }], [actions, params]);
|
|
374
|
-
return encodeAbiParameters([{ type: "bytes" }, { type: "bytes[]" }], ["0x10", [v4Input]]);
|
|
375
|
-
}
|
|
376
|
-
function curveSwap(emit, action, amountIn, needsOutput) {
|
|
377
|
-
// Older Curve pools (e.g. 3pool at 0xbEbc44...) expose only the 4-arg `exchange` which returns
|
|
378
|
-
// VOID and sends the output to msg.sender. We snapshot the pre-swap `tokenOut` balance, call the
|
|
379
|
-
// 4-arg exchange (Sauce is msg.sender — output lands here), then compute `post - pre` to recover
|
|
380
|
-
// this swap's output without sweeping any pre-existing dust from earlier actions.
|
|
381
|
-
const tokenOut = word(action.tokenOut);
|
|
382
|
-
const pre = selfBalance(emit, tokenOut);
|
|
383
|
-
const exchangeCd = calldata(emit, "exchange(int128,int128,uint256,uint256)", [
|
|
414
|
+
const to = needsOutput ? SELF : recipient(action.recipient);
|
|
415
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(addr(currencyOut)), () => {
|
|
416
|
+
const hookData = l.bytes("hook", new Uint8Array());
|
|
417
|
+
// ExactInputParams { Currency currencyIn; PathKey[] path; uint128 amountIn;
|
|
418
|
+
// uint128 amountOutMinimum; }
|
|
419
|
+
const path = list(action.path.map((hop) => record({
|
|
420
|
+
intermediateCurrency: addr(hop.intermediateCurrency),
|
|
421
|
+
fee: word(hop.fee),
|
|
422
|
+
tickSpacing: word(hop.tickSpacing),
|
|
423
|
+
hooks: addr(hop.hooks),
|
|
424
|
+
hookData,
|
|
425
|
+
})));
|
|
426
|
+
const params = l.bind("v4swap", encodeArgs([
|
|
427
|
+
record({
|
|
428
|
+
currencyIn: addr(action.currencyIn),
|
|
429
|
+
path,
|
|
430
|
+
amountIn,
|
|
431
|
+
amountOutMinimum: word(action.amountOutMin),
|
|
432
|
+
}),
|
|
433
|
+
]));
|
|
434
|
+
v4Execute(l, action.router, action.currencyIn, currencyOut, amountIn, 0x07, params, to);
|
|
435
|
+
}, amountIn);
|
|
436
|
+
}
|
|
437
|
+
function curveSwap(l, action, amountIn, needsOutput) {
|
|
438
|
+
// 3pool-era pools (e.g. 0xbEbc44…) expose only the 4-argument `exchange`, which returns nothing
|
|
439
|
+
// and pays msg.sender — the executing account. The output is the `tokenOut` balance delta around
|
|
440
|
+
// the call, which excludes whatever an earlier action left behind.
|
|
441
|
+
const tokenOut = addr(action.tokenOut);
|
|
442
|
+
const pre = l.selfBalance(tokenOut);
|
|
443
|
+
l.exec("ICurvePool", addr(action.pool), "exchange", [
|
|
384
444
|
word(action.i),
|
|
385
445
|
word(action.j),
|
|
386
446
|
amountIn,
|
|
387
447
|
word(action.amountOutMin),
|
|
388
448
|
]);
|
|
389
|
-
const post = selfBalance(
|
|
390
|
-
const delta =
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
`${evmCall(word(action.pool), ZERO, exchangeCd.expr)};`,
|
|
395
|
-
...post.stmts,
|
|
396
|
-
...delta.stmts,
|
|
397
|
-
];
|
|
398
|
-
if (needsOutput)
|
|
399
|
-
return { stmts: captureAndSwap, output: delta.expr };
|
|
400
|
-
// Non-chained: forward the delta to the recipient.
|
|
401
|
-
const transferCd = calldata(emit, "transfer(address,uint256)", [
|
|
402
|
-
word(action.recipient),
|
|
403
|
-
delta.expr,
|
|
404
|
-
]);
|
|
405
|
-
return {
|
|
406
|
-
stmts: [...captureAndSwap, ...transferCd.stmts, `${evmCall(tokenOut, ZERO, transferCd.expr)};`],
|
|
407
|
-
output: delta.expr,
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
function balancerV2Swap(emit, action, amountIn, needsOutput) {
|
|
411
|
-
const recipient = needsOutput ? SELF : word(action.recipient);
|
|
412
|
-
const userData = bindBytes(emit, "ud", new Uint8Array(0));
|
|
413
|
-
const singleSwap = tuple([
|
|
414
|
-
word(action.poolId), // bytes32 — must be static, not dynamic bytes
|
|
415
|
-
ZERO, // kind = GIVEN_IN
|
|
416
|
-
word(action.tokenIn),
|
|
417
|
-
word(action.tokenOut),
|
|
418
|
-
amountIn,
|
|
419
|
-
userData.expr,
|
|
420
|
-
]);
|
|
421
|
-
const funds = tuple([
|
|
422
|
-
SELF, // sender — must equal msg.sender (Sauce) for vault auth
|
|
423
|
-
ZERO,
|
|
424
|
-
recipient, // recipient — Sauce when chaining, caller otherwise
|
|
425
|
-
ZERO,
|
|
426
|
-
]);
|
|
427
|
-
const cd = calldata(emit, "swap((bytes32,uint8,address,address,uint256,bytes),(address,bool,address,bool),uint256,uint256)", [singleSwap, funds, word(action.amountOutMin), word(action.deadline)]);
|
|
428
|
-
return capturedCall(emit, needsOutput, word(action.vault), ZERO, { stmts: [...userData.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
|
|
429
|
-
}
|
|
430
|
-
function balancerV2BatchSwap(emit, action, amountIn, needsOutput) {
|
|
431
|
-
// `getExplicitAmount` reads `steps[0].amount`, which a batch swap always has, so `amountRef`
|
|
432
|
-
// could never win the `resolveAmountIn` precedence — it was accepted and silently ignored. The
|
|
433
|
-
// step amounts are baked into the pre-encoded blob below, so a runtime amount genuinely cannot
|
|
434
|
-
// reach this venue: say so rather than encode a different trade than the caller asked for.
|
|
435
|
-
if (action.amountRef !== undefined) {
|
|
436
|
-
throw new Error("balancerV2BatchSwap: `amountRef` cannot be applied — the per-step amounts are ABI-encoded " +
|
|
437
|
-
"into the batchSwap calldata at build time, so a chained runtime amount has nowhere to go. " +
|
|
438
|
-
"Set `steps[].amount` explicitly.");
|
|
449
|
+
const post = l.selfBalance(tokenOut);
|
|
450
|
+
const delta = l.bind("delta", `${post} - ${pre}`);
|
|
451
|
+
// Not chained, and not asked to keep it: forward the delta to the recipient.
|
|
452
|
+
if (!needsOutput && action.recipient !== "self") {
|
|
453
|
+
l.erc20Write("transfer", tokenOut, recipient(action.recipient), delta);
|
|
439
454
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
-
const
|
|
445
|
-
poolId:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
{ type: "uint256", name: "assetOutIndex" },
|
|
464
|
-
{ type: "uint256", name: "amount" },
|
|
465
|
-
{ type: "bytes", name: "userData" },
|
|
466
|
-
],
|
|
467
|
-
},
|
|
468
|
-
{ type: "address[]" },
|
|
469
|
-
{
|
|
470
|
-
type: "tuple",
|
|
471
|
-
components: [
|
|
472
|
-
{ type: "address", name: "sender" },
|
|
473
|
-
{ type: "bool", name: "fromInternalBalance" },
|
|
474
|
-
{ type: "address", name: "recipient" },
|
|
475
|
-
{ type: "bool", name: "toInternalBalance" },
|
|
476
|
-
],
|
|
477
|
-
},
|
|
478
|
-
{ type: "int256[]" },
|
|
479
|
-
{ type: "uint256" },
|
|
480
|
-
], [
|
|
481
|
-
0,
|
|
482
|
-
stepsData,
|
|
483
|
-
assetsData,
|
|
484
|
-
{
|
|
485
|
-
sender: SENDER_PLACEHOLDER,
|
|
486
|
-
fromInternalBalance: false,
|
|
487
|
-
recipient: RECIPIENT_PLACEHOLDER,
|
|
488
|
-
toInternalBalance: false,
|
|
489
|
-
},
|
|
490
|
-
limitsData,
|
|
491
|
-
BigInt(action.deadline),
|
|
455
|
+
return l.result(delta);
|
|
456
|
+
}
|
|
457
|
+
function balancerV2Swap(l, action, amountIn, needsOutput) {
|
|
458
|
+
const userData = l.bytes("ud", new Uint8Array());
|
|
459
|
+
const singleSwap = record({
|
|
460
|
+
poolId: b32(action.poolId),
|
|
461
|
+
kind: ZERO, // GIVEN_IN
|
|
462
|
+
assetIn: addr(action.tokenIn),
|
|
463
|
+
assetOut: addr(action.tokenOut),
|
|
464
|
+
amount: amountIn,
|
|
465
|
+
userData,
|
|
466
|
+
});
|
|
467
|
+
const funds = record({
|
|
468
|
+
sender: SELF, // must be msg.sender for the Vault to pull from it
|
|
469
|
+
fromInternalBalance: flag(false),
|
|
470
|
+
recipient: needsOutput ? SELF : recipient(action.recipient),
|
|
471
|
+
toInternalBalance: flag(false),
|
|
472
|
+
});
|
|
473
|
+
const call = l.call("IBalancerV2Vault", addr(action.vault), "swap", [
|
|
474
|
+
singleSwap,
|
|
475
|
+
funds,
|
|
476
|
+
word(action.amountOutMin),
|
|
477
|
+
word(action.deadline),
|
|
492
478
|
]);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
parts.push(bound.expr);
|
|
516
|
-
};
|
|
517
|
-
if (senderOffset < recipientOffset) {
|
|
518
|
-
chunk(0, senderOffset);
|
|
519
|
-
parts.push(encodeArgs([SELF]));
|
|
520
|
-
chunk(senderOffset + 32, recipientOffset);
|
|
521
|
-
parts.push(encodeArgs([recipientExpr]));
|
|
522
|
-
chunk(recipientOffset + 32, encodedBytes.length);
|
|
523
|
-
}
|
|
524
|
-
else {
|
|
525
|
-
chunk(0, recipientOffset);
|
|
526
|
-
parts.push(encodeArgs([recipientExpr]));
|
|
527
|
-
chunk(recipientOffset + 32, senderOffset);
|
|
528
|
-
parts.push(encodeArgs([SELF]));
|
|
529
|
-
chunk(senderOffset + 32, encodedBytes.length);
|
|
530
|
-
}
|
|
531
|
-
stmts.push(`${evmCall(word(action.vault), ZERO, concatCalldata(sel.expr, parts))};`);
|
|
532
|
-
// `batchSwap` returns `int256[] assetDeltas` — an array, so there is no uint256 to decode, and
|
|
533
|
-
// the entry that matters is signed and negative for the asset received. `recipientExpr` is
|
|
534
|
-
// already ctx.self() whenever we are capturing, so the self delta on the last step's output asset
|
|
535
|
-
// is the realized amount without any sign handling.
|
|
479
|
+
return captured(l, needsOutput, call, amountIn);
|
|
480
|
+
}
|
|
481
|
+
function balancerV2BatchSwap(l, action, amountIn, needsOutput) {
|
|
482
|
+
const userData = l.bytes("ud", new Uint8Array());
|
|
483
|
+
const steps = list(action.steps.map((step) => record({
|
|
484
|
+
poolId: b32(step.poolId),
|
|
485
|
+
assetInIndex: word(step.assetInIndex),
|
|
486
|
+
assetOutIndex: word(step.assetOutIndex),
|
|
487
|
+
amount: word(step.amount),
|
|
488
|
+
userData,
|
|
489
|
+
})));
|
|
490
|
+
// The Vault may take any amount of every asset but the last, and must pay at least
|
|
491
|
+
// `amountOutMin` of the last (a negative limit is an amount the Vault pays out).
|
|
492
|
+
const limits = list(action.assets.map((_, i) => i === action.assets.length - 1 ? `-${word(action.amountOutMin)}` : word(MAX_INT256)));
|
|
493
|
+
const funds = record({
|
|
494
|
+
sender: SELF,
|
|
495
|
+
fromInternalBalance: flag(false),
|
|
496
|
+
recipient: needsOutput ? SELF : recipient(action.recipient),
|
|
497
|
+
toInternalBalance: flag(false),
|
|
498
|
+
});
|
|
499
|
+
// `batchSwap` returns `int256[] assetDeltas`, signed and negative for what was received; the
|
|
500
|
+
// realized output is the executing account's delta on the last step's output asset instead.
|
|
536
501
|
const lastStep = action.steps[action.steps.length - 1];
|
|
537
502
|
const assetOut = action.assets[Number(lastStep.assetOutIndex)];
|
|
538
|
-
return
|
|
503
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(addr(assetOut)), () => l.exec("IBalancerV2Vault", addr(action.vault), "batchSwap", [
|
|
504
|
+
ZERO, // GIVEN_IN
|
|
505
|
+
steps,
|
|
506
|
+
list(action.assets.map(addr)),
|
|
507
|
+
funds,
|
|
508
|
+
limits,
|
|
509
|
+
word(action.deadline),
|
|
510
|
+
]), amountIn);
|
|
539
511
|
}
|
|
540
|
-
|
|
541
|
-
//
|
|
542
|
-
//
|
|
543
|
-
|
|
544
|
-
const recipient = needsOutput ? SELF : word(action.recipient);
|
|
545
|
-
const cd = calldata(emit, "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)", [
|
|
512
|
+
function uniswapV2Swap(l, action, amountIn, needsOutput) {
|
|
513
|
+
// `swapExactTokensForTokens` returns `uint256[] amounts`; the output is the balance delta on the
|
|
514
|
+
// last path token instead, which is what actually arrived.
|
|
515
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(addr(action.path[action.path.length - 1])), () => l.exec("IUniswapV2Router", addr(action.router), "swapExactTokensForTokens", [
|
|
546
516
|
amountIn,
|
|
547
517
|
word(action.amountOutMin),
|
|
548
|
-
|
|
549
|
-
recipient,
|
|
518
|
+
list(action.path.map(addr)),
|
|
519
|
+
needsOutput ? SELF : recipient(action.recipient),
|
|
550
520
|
word(action.deadline),
|
|
551
|
-
]);
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
// swapExactTokensForTokens returns `uint256[] memory amounts` — decoding the first 32 bytes as a
|
|
556
|
-
// uint256 yields the ABI offset (0x20), not the output amount. Snapshot the tokenOut balance
|
|
557
|
-
// pre/post instead.
|
|
558
|
-
const tokenOut = word(action.path[action.path.length - 1]);
|
|
559
|
-
const pre = selfBalance(emit, tokenOut);
|
|
560
|
-
const post = selfBalance(emit, tokenOut);
|
|
561
|
-
const delta = bindConst(emit, "delta", `${post.expr} - ${pre.expr}`);
|
|
562
|
-
return {
|
|
563
|
-
stmts: [...pre.stmts, ...swap, ...post.stmts, ...delta.stmts],
|
|
564
|
-
output: delta.expr,
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
function curveRouterNGSwap(emit, action, amountIn, needsOutput) {
|
|
568
|
-
const recipient = needsOutput ? SELF : word(action.recipient);
|
|
569
|
-
// Pad route to 11 entries
|
|
521
|
+
]), amountIn);
|
|
522
|
+
}
|
|
523
|
+
function curveRouterNGSwap(l, action, amountIn, needsOutput) {
|
|
524
|
+
const zero = "0x0000000000000000000000000000000000000000";
|
|
570
525
|
const route = [...action.route];
|
|
571
526
|
while (route.length < 11)
|
|
572
|
-
route.push(
|
|
573
|
-
|
|
574
|
-
const swapParams = [...action.swapParams];
|
|
527
|
+
route.push(zero);
|
|
528
|
+
const swapParams = action.swapParams.map((row) => [...row]);
|
|
575
529
|
while (swapParams.length < 5)
|
|
576
530
|
swapParams.push([0, 0, 0, 0, 0]);
|
|
577
|
-
// Pad pools to 5
|
|
578
531
|
const pools = [...action.pools];
|
|
579
532
|
while (pools.length < 5)
|
|
580
|
-
pools.push(
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
533
|
+
pools.push(zero);
|
|
534
|
+
const call = l.call("ICurveRouterNG", addr(action.router), "exchange", [
|
|
535
|
+
list(route.map(addr)),
|
|
536
|
+
list(swapParams.map((row) => list(row.map(word)))),
|
|
584
537
|
amountIn,
|
|
585
538
|
word(action.amountOutMin),
|
|
586
|
-
|
|
587
|
-
recipient,
|
|
539
|
+
list(pools.map(addr)),
|
|
540
|
+
needsOutput ? SELF : recipient(action.recipient),
|
|
588
541
|
]);
|
|
589
|
-
return
|
|
590
|
-
}
|
|
591
|
-
function balancerV3Swap(
|
|
592
|
-
//
|
|
593
|
-
const userData =
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
542
|
+
return captured(l, needsOutput, call, amountIn);
|
|
543
|
+
}
|
|
544
|
+
function balancerV3Swap(l, action, amountIn, needsOutput) {
|
|
545
|
+
// The V3 Router pays msg.sender — the executing account — and takes no recipient.
|
|
546
|
+
const userData = l.bytes("ud", new Uint8Array());
|
|
547
|
+
const call = l.call("IBalancerV3Router", addr(action.router), "swapSingleTokenExactIn", [
|
|
548
|
+
addr(action.pool),
|
|
549
|
+
addr(action.tokenIn),
|
|
550
|
+
addr(action.tokenOut),
|
|
598
551
|
amountIn,
|
|
599
552
|
word(action.amountOutMin),
|
|
600
553
|
word(action.deadline),
|
|
601
554
|
flag(action.wethIsEth),
|
|
602
|
-
userData
|
|
555
|
+
userData,
|
|
603
556
|
]);
|
|
604
|
-
return
|
|
605
|
-
}
|
|
606
|
-
function ambientSwap(
|
|
607
|
-
// abi.encode(base, quote, poolIdx, isBuy,
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
//
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const cd = calldata(emit, sig, [
|
|
635
|
-
word(action.fromToken),
|
|
636
|
-
word(action.toToken),
|
|
557
|
+
return captured(l, needsOutput, call, amountIn);
|
|
558
|
+
}
|
|
559
|
+
function ambientSwap(l, action, amountIn, needsOutput) {
|
|
560
|
+
// `userCmd(1, cmd)` is the swap callpath: cmd = abi.encode(base, quote, poolIdx, isBuy,
|
|
561
|
+
// inBaseQty, qty, tip, limitPrice, minOut, reserveFlags). It returns `bytes`, and settles to
|
|
562
|
+
// msg.sender, so the output is the delta on the received side: the quote token when buying
|
|
563
|
+
// (paying base), the base token otherwise.
|
|
564
|
+
const tokenOut = addr(action.isBuy ? action.quote : action.base);
|
|
565
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(tokenOut), () => {
|
|
566
|
+
const cmd = l.bind("cmd", encodeArgs([
|
|
567
|
+
addr(action.base),
|
|
568
|
+
addr(action.quote),
|
|
569
|
+
word(action.poolIdx),
|
|
570
|
+
flag(action.isBuy),
|
|
571
|
+
flag(action.inBaseQty),
|
|
572
|
+
amountIn,
|
|
573
|
+
word(action.tip),
|
|
574
|
+
word(action.limitPrice),
|
|
575
|
+
word(action.amountOutMin),
|
|
576
|
+
word(action.reserveFlags),
|
|
577
|
+
]));
|
|
578
|
+
l.exec("ICrocSwapDex", addr(action.dex), "userCmd", ["1n", cmd]);
|
|
579
|
+
}, amountIn);
|
|
580
|
+
}
|
|
581
|
+
function dodoSwap(l, action, amountIn, needsOutput) {
|
|
582
|
+
// The proxy pays msg.sender and returns the amount it paid. `version: "v1"` routes legacy
|
|
583
|
+
// Classical pairs through `dodoSwapV1`; allowances go to DODOApprove, not to the proxy.
|
|
584
|
+
const args = [
|
|
585
|
+
addr(action.fromToken),
|
|
586
|
+
addr(action.toToken),
|
|
637
587
|
amountIn,
|
|
638
588
|
word(action.amountOutMin),
|
|
639
|
-
|
|
589
|
+
list(action.pairs.map(addr)),
|
|
640
590
|
word(action.directions),
|
|
641
|
-
|
|
591
|
+
flag(false), // isIncentive
|
|
642
592
|
word(action.deadline),
|
|
643
|
-
]
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
593
|
+
];
|
|
594
|
+
const call = action.version === "v1"
|
|
595
|
+
? l.call("IDodoProxy", addr(action.proxy), "dodoSwapV1", args)
|
|
596
|
+
: l.call("IDodoProxy", addr(action.proxy), "dodoSwapV2TokenToToken", args);
|
|
597
|
+
return captured(l, needsOutput, call, amountIn);
|
|
598
|
+
}
|
|
599
|
+
function maverickSwap(l, action, amountIn, needsOutput) {
|
|
600
|
+
const call = l.call("IMaverickV2Router", addr(action.router), "exactInputSingle", [
|
|
601
|
+
needsOutput ? SELF : recipient(action.recipient),
|
|
602
|
+
addr(action.pool),
|
|
651
603
|
flag(action.tokenAIn),
|
|
652
604
|
amountIn,
|
|
653
605
|
word(action.amountOutMin),
|
|
654
606
|
]);
|
|
655
|
-
return
|
|
656
|
-
}
|
|
657
|
-
function maverickMultiHopSwap(
|
|
658
|
-
const
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
path.expr,
|
|
607
|
+
return captured(l, needsOutput, call, amountIn);
|
|
608
|
+
}
|
|
609
|
+
function maverickMultiHopSwap(l, action, amountIn, needsOutput) {
|
|
610
|
+
const path = l.bytes("path", hexToBytes(action.path));
|
|
611
|
+
const call = l.call("IMaverickV2Router", addr(action.router), "exactInputMultiHop", [
|
|
612
|
+
needsOutput ? SELF : recipient(action.recipient),
|
|
613
|
+
path,
|
|
663
614
|
amountIn,
|
|
664
615
|
word(action.amountOutMin),
|
|
665
616
|
]);
|
|
666
|
-
return
|
|
667
|
-
}
|
|
668
|
-
function carbonSwap(
|
|
669
|
-
// Carbon
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
617
|
+
return captured(l, needsOutput, call, amountIn);
|
|
618
|
+
}
|
|
619
|
+
function carbonSwap(l, action, amountIn, needsOutput) {
|
|
620
|
+
// Carbon pays msg.sender, and its per-strategy amounts are the trade: the action's own amount is
|
|
621
|
+
// not an argument here.
|
|
622
|
+
const tradeActions = list(action.tradeActions.map((ta) => record({ strategyId: word(ta.strategyId), amount: word(ta.amount) })));
|
|
623
|
+
const call = l.call("ICarbonController", addr(action.controller), "tradeBySourceAmount", [
|
|
624
|
+
addr(action.sourceToken),
|
|
625
|
+
addr(action.targetToken),
|
|
626
|
+
tradeActions,
|
|
675
627
|
word(action.deadline),
|
|
676
628
|
word(action.amountOutMin),
|
|
677
629
|
]);
|
|
678
|
-
return
|
|
630
|
+
return captured(l, needsOutput, call, amountIn);
|
|
679
631
|
}
|
|
680
|
-
function fraxswapSwap(
|
|
681
|
-
|
|
682
|
-
|
|
632
|
+
function fraxswapSwap(l, action, amountIn, needsOutput) {
|
|
633
|
+
// Fraxswap's router is UniswapV2-compatible for this function: same selector, same `uint256[]`
|
|
634
|
+
// return, so the output is a balance delta for the same reason.
|
|
635
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(addr(action.path[action.path.length - 1])), () => l.exec("IUniswapV2Router", addr(action.router), "swapExactTokensForTokens", [
|
|
683
636
|
amountIn,
|
|
684
637
|
word(action.amountOutMin),
|
|
685
|
-
|
|
686
|
-
recipient,
|
|
638
|
+
list(action.path.map(addr)),
|
|
639
|
+
needsOutput ? SELF : recipient(action.recipient),
|
|
687
640
|
word(action.deadline),
|
|
688
|
-
]);
|
|
689
|
-
// `swapExactTokensForTokens` returns `uint256[] memory amounts` — the SAME selector uniswapV2Swap
|
|
690
|
-
// uses, where decoding the first 32 bytes yields the ABI offset (0x20), not the output amount.
|
|
691
|
-
// This builder captured it anyway, so a chained fraxswap output was the constant 32.
|
|
692
|
-
const swap = [...cd.stmts, `${evmCall(word(action.router), ZERO, cd.expr)};`];
|
|
693
|
-
const tokenOut = word(action.path[action.path.length - 1]);
|
|
694
|
-
return balanceDeltaResult(emit, needsOutput, tokenOut, swap, amountIn);
|
|
695
|
-
}
|
|
696
|
-
function clipperSwap(emit, action, amountIn, needsOutput) {
|
|
697
|
-
// Clipper uses pre-transferred tokens, so the amount is implicit.
|
|
698
|
-
const recipient = needsOutput ? SELF : word(action.recipient);
|
|
699
|
-
const aux = bindBytes(emit, "aux", hexToBytes(action.auxiliaryData));
|
|
700
|
-
const cd = calldata(emit, "sellTokenForToken(address,address,address,uint256,bytes)", [
|
|
701
|
-
word(action.inputToken),
|
|
702
|
-
word(action.outputToken),
|
|
703
|
-
recipient,
|
|
704
|
-
word(action.amountOutMin),
|
|
705
|
-
aux.expr,
|
|
706
|
-
]);
|
|
707
|
-
return capturedCall(emit, needsOutput, word(action.exchange), ZERO, { stmts: [...aux.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
|
|
708
|
-
}
|
|
709
|
-
function integralSwap(emit, action, amountIn, needsOutput) {
|
|
710
|
-
// `sell` returns `uint256 orderId`, and Integral executes orders LATER — there is no output in
|
|
711
|
-
// this transaction to capture, so any number returned here would be a lie. Previously the order
|
|
712
|
-
// id was captured and chained as an amount.
|
|
713
|
-
if (needsOutput) {
|
|
714
|
-
throw new Error("integralSwap: Integral is a delayed-order venue — `sell` returns an orderId and the swap " +
|
|
715
|
-
"executes in a later transaction, so this action has no output amount to chain from. " +
|
|
716
|
-
"Give the next action an explicit amount or an amountRef to a different action.");
|
|
717
|
-
}
|
|
718
|
-
const recipient = word(action.recipient);
|
|
719
|
-
const params = tuple([
|
|
720
|
-
word(action.tokenIn),
|
|
721
|
-
word(action.tokenOut),
|
|
722
|
-
amountIn,
|
|
723
|
-
word(action.amountOutMin),
|
|
724
|
-
flag(action.wrapUnwrap),
|
|
725
|
-
recipient,
|
|
726
|
-
word(action.gasLimit),
|
|
727
|
-
word(action.submitDeadline),
|
|
728
|
-
]);
|
|
729
|
-
const cd = calldata(emit, "sell((address,address,uint256,uint256,bool,address,uint256,uint32))", [
|
|
730
|
-
params,
|
|
731
|
-
]);
|
|
732
|
-
return voidCall(word(action.delay), ZERO, cd, amountIn);
|
|
641
|
+
]), amountIn);
|
|
733
642
|
}
|
|
734
|
-
function fluidDexT1Swap(
|
|
735
|
-
const
|
|
736
|
-
const cd = calldata(emit, "swapIn(bool,uint256,uint256,address)", [
|
|
643
|
+
function fluidDexT1Swap(l, action, amountIn, needsOutput) {
|
|
644
|
+
const call = l.call("IFluidDexT1", addr(action.pool), "swapIn", [
|
|
737
645
|
flag(action.swap0to1),
|
|
738
646
|
amountIn,
|
|
739
647
|
word(action.amountOutMin),
|
|
740
|
-
recipient,
|
|
741
|
-
]);
|
|
742
|
-
return capturedCall(emit, needsOutput, word(action.pool), ZERO, cd, amountIn);
|
|
743
|
-
}
|
|
744
|
-
function fluidDexLiteSwap(emit, action, amountIn, needsOutput) {
|
|
745
|
-
// DexKey is a tuple: (token0, token1, salt)
|
|
746
|
-
const dexKey = tuple([word(action.token0), word(action.token1), word(action.salt)]);
|
|
747
|
-
const cd = calldata(emit, "swapSingle((address,address,bytes32),bool,int256,uint256,address)", [
|
|
748
|
-
dexKey,
|
|
749
|
-
flag(action.swap0To1),
|
|
750
|
-
amountIn, // positive = exact input
|
|
751
|
-
word(action.amountOutMin),
|
|
752
|
-
needsOutput ? SELF : word(action.recipient),
|
|
648
|
+
needsOutput ? SELF : recipient(action.recipient),
|
|
753
649
|
]);
|
|
754
|
-
|
|
755
|
-
// neither reliably the output nor reliably positive. The self delta on the received token needs
|
|
756
|
-
// no sign handling.
|
|
757
|
-
const swap = [...cd.stmts, `${evmCall(word(action.dex), ZERO, cd.expr)};`];
|
|
758
|
-
const tokenOut = word(action.swap0To1 ? action.token1 : action.token0);
|
|
759
|
-
return balanceDeltaResult(emit, needsOutput, tokenOut, swap, amountIn);
|
|
650
|
+
return captured(l, needsOutput, call, amountIn);
|
|
760
651
|
}
|
|
761
652
|
// ---------------------------------------------------------------------------
|
|
762
|
-
//
|
|
653
|
+
// Bridges — the amount passes through
|
|
763
654
|
// ---------------------------------------------------------------------------
|
|
764
|
-
function
|
|
765
|
-
|
|
766
|
-
|
|
655
|
+
function acrossBridge(l, action, amount) {
|
|
656
|
+
// The Pot deposits, so an expired deposit is refunded to it. The relayer keeps the difference
|
|
657
|
+
// between the input and output amounts; a fee above the amount reverts the subtraction.
|
|
658
|
+
const message = l.bytes("msg", hexToBytes(action.message));
|
|
659
|
+
const fee = BigInt(action.relayerFee);
|
|
660
|
+
const outputAmount = fee === 0n ? amount : l.bind("out", `${amount} - ${word(fee)}`);
|
|
661
|
+
l.exec("IAcrossSpokePool", addr(action.spokePool), "depositV3", [
|
|
662
|
+
SELF, // depositor
|
|
663
|
+
addr(action.recipient),
|
|
664
|
+
addr(action.token), // inputToken
|
|
665
|
+
addr(action.token), // outputToken: the same token on the destination
|
|
666
|
+
amount,
|
|
667
|
+
outputAmount,
|
|
668
|
+
word(action.destChainId),
|
|
669
|
+
ZERO, // exclusiveRelayer: none
|
|
670
|
+
word(action.quoteTimestamp),
|
|
671
|
+
word(action.fillDeadline),
|
|
672
|
+
word(action.exclusivityDeadline),
|
|
673
|
+
message,
|
|
674
|
+
]);
|
|
675
|
+
return l.result(amount);
|
|
676
|
+
}
|
|
677
|
+
function stargateBridge(l, action, amount) {
|
|
678
|
+
// Taxi mode (an empty `oftCmd`): the pool quotes the LayerZero fee for exactly this send, and the
|
|
679
|
+
// send pays it from the Pot, which also receives any refund.
|
|
680
|
+
const empty = l.bytes("empty", new Uint8Array());
|
|
681
|
+
const sendParam = record({
|
|
682
|
+
dstEid: word(action.dstEid),
|
|
683
|
+
to: remote(action.recipient),
|
|
684
|
+
amountLD: amount,
|
|
685
|
+
minAmountLD: word(action.amountOutMin),
|
|
686
|
+
extraOptions: empty,
|
|
687
|
+
composeMsg: empty,
|
|
688
|
+
oftCmd: empty,
|
|
689
|
+
});
|
|
690
|
+
const pool = addr(action.pool);
|
|
691
|
+
const quoted = l.bind("lz", l.call("IStargatePool", pool, "quoteSend", [sendParam, "false"]));
|
|
692
|
+
const nativeFee = l.bind("lzfee", `${quoted}.nativeFee`);
|
|
693
|
+
l.valueCall("IStargatePool", pool, nativeFee, "send", [
|
|
694
|
+
sendParam,
|
|
695
|
+
record({ nativeFee, lzTokenFee: ZERO }),
|
|
696
|
+
SELF,
|
|
697
|
+
]);
|
|
698
|
+
return l.result(amount);
|
|
767
699
|
}
|
|
768
|
-
function
|
|
769
|
-
|
|
770
|
-
|
|
700
|
+
function cctpBridge(l, action, amount) {
|
|
701
|
+
l.exec("ICctpTokenMessenger", addr(action.tokenMessenger), "depositForBurn", [
|
|
702
|
+
amount,
|
|
703
|
+
word(action.destinationDomain),
|
|
704
|
+
remote(action.recipient),
|
|
705
|
+
addr(action.token),
|
|
706
|
+
ZERO, // destinationCaller: anyone may relay the mint
|
|
707
|
+
word(action.maxFee ?? "0"),
|
|
708
|
+
word(action.minFinalityThreshold ?? CCTP_FINALIZED),
|
|
709
|
+
]);
|
|
710
|
+
return l.result(amount);
|
|
711
|
+
}
|
|
712
|
+
function hyperlaneBridge(l, action, amount) {
|
|
713
|
+
const router = addr(action.router);
|
|
714
|
+
const domain = word(action.destinationDomain);
|
|
715
|
+
const gas = l.bind("igp", l.call("IWarpRoute", router, "quoteGasPayment", [domain]));
|
|
716
|
+
l.valueCall("IWarpRoute", router, gas, "transferRemote", [
|
|
717
|
+
domain,
|
|
718
|
+
remote(action.recipient),
|
|
719
|
+
amount,
|
|
720
|
+
]);
|
|
721
|
+
return l.result(amount);
|
|
771
722
|
}
|
|
772
723
|
// ---------------------------------------------------------------------------
|
|
773
|
-
//
|
|
724
|
+
// Wrapping
|
|
774
725
|
// ---------------------------------------------------------------------------
|
|
775
|
-
function wrapETH(
|
|
776
|
-
|
|
726
|
+
function wrapETH(l, action, amount) {
|
|
727
|
+
l.valueCall("IWeth9", addr(action.weth), amount, "deposit", []);
|
|
728
|
+
return l.result(amount);
|
|
777
729
|
}
|
|
778
|
-
function unwrapETH(
|
|
779
|
-
|
|
730
|
+
function unwrapETH(l, action, amount) {
|
|
731
|
+
l.exec("IWeth9", addr(action.weth), "withdraw", [amount]);
|
|
732
|
+
return l.result(amount);
|
|
780
733
|
}
|
|
781
|
-
function wrapStETH(
|
|
782
|
-
|
|
734
|
+
function wrapStETH(l, action, amount, needsOutput) {
|
|
735
|
+
// `wrap` returns the wstETH it minted.
|
|
736
|
+
const call = l.call("IWstEth", addr(action.wstETH), "wrap", [amount]);
|
|
737
|
+
return captured(l, needsOutput, call, amount);
|
|
783
738
|
}
|
|
784
|
-
function unwrapStETH(
|
|
785
|
-
|
|
739
|
+
function unwrapStETH(l, action, amount, needsOutput) {
|
|
740
|
+
// `unwrap` returns the stETH it released — never more than the Pot's balance grew by, so a later
|
|
741
|
+
// action can always spend it.
|
|
742
|
+
const call = l.call("IWstEth", addr(action.wstETH), "unwrap", [amount]);
|
|
743
|
+
return captured(l, needsOutput, call, amount);
|
|
786
744
|
}
|
|
787
745
|
// ---------------------------------------------------------------------------
|
|
788
|
-
//
|
|
746
|
+
// Staking
|
|
789
747
|
// ---------------------------------------------------------------------------
|
|
790
|
-
function lidoStake(
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
748
|
+
function lidoStake(l, action, amount, needsOutput) {
|
|
749
|
+
// `submit` returns shares, not stETH, and a stETH balance can round a wei below the ETH staked;
|
|
750
|
+
// the output is the stETH balance delta.
|
|
751
|
+
const stETH = addr(action.stETH);
|
|
752
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(stETH), () => l.valueCall("ILido", stETH, amount, "submit", [
|
|
753
|
+
addr(action.referral ?? "0x0000000000000000000000000000000000000000"),
|
|
754
|
+
]), amount);
|
|
755
|
+
}
|
|
756
|
+
function lidoUnstake(l, action, amount) {
|
|
757
|
+
l.exec("ILidoWithdrawalQueue", addr(action.withdrawalQueue), "requestWithdrawals", [
|
|
758
|
+
list([amount]),
|
|
759
|
+
recipient(action.owner),
|
|
798
760
|
]);
|
|
799
|
-
return
|
|
800
|
-
}
|
|
801
|
-
function rocketPoolStake(emit, action, amountIn) {
|
|
802
|
-
return voidCall(word(action.depositPool), amountIn, calldata(emit, "deposit()", []), amountIn);
|
|
761
|
+
return l.result(amount);
|
|
803
762
|
}
|
|
804
|
-
function
|
|
805
|
-
return
|
|
763
|
+
function rocketPoolStake(l, action, amount, needsOutput) {
|
|
764
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(addr(action.rETH)), () => l.valueCall("IRocketDepositPool", addr(action.depositPool), amount, "deposit", []), amount);
|
|
806
765
|
}
|
|
807
|
-
function
|
|
808
|
-
return
|
|
766
|
+
function rocketPoolUnstake(l, action, amount, needsOutput) {
|
|
767
|
+
return balanceDelta(l, needsOutput, () => l.nativeBalance(), () => l.exec("IRocketTokenReth", addr(action.rETH), "burn", [amount]), amount);
|
|
809
768
|
}
|
|
810
|
-
function etherFiStake(
|
|
811
|
-
|
|
769
|
+
function etherFiStake(l, action, amount, needsOutput) {
|
|
770
|
+
// `deposit` returns eETH shares; the output is the eETH balance delta.
|
|
771
|
+
return balanceDelta(l, needsOutput, () => l.selfBalance(addr(action.eETH)), () => l.valueCall("IEtherFiLiquidityPool", addr(action.liquidityPool), amount, "deposit", []), amount);
|
|
812
772
|
}
|
|
813
773
|
// ---------------------------------------------------------------------------
|
|
814
|
-
// Lending
|
|
774
|
+
// Lending
|
|
815
775
|
// ---------------------------------------------------------------------------
|
|
816
|
-
function aaveV3Supply(
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
word(action.referralCode),
|
|
776
|
+
function aaveV3Supply(l, action, amount) {
|
|
777
|
+
l.exec("IAaveV3Pool", addr(action.pool), "supply", [
|
|
778
|
+
addr(action.token),
|
|
779
|
+
amount,
|
|
780
|
+
recipient(action.onBehalfOf),
|
|
781
|
+
word(action.referralCode ?? 0),
|
|
822
782
|
]);
|
|
823
|
-
return
|
|
824
|
-
}
|
|
825
|
-
function aaveV3Withdraw(
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
783
|
+
return l.result(amount);
|
|
784
|
+
}
|
|
785
|
+
function aaveV3Withdraw(l, action, amount, needsOutput) {
|
|
786
|
+
// `withdraw` returns the amount withdrawn, which is less than a `type(uint256).max` request.
|
|
787
|
+
const call = l.call("IAaveV3Pool", addr(action.pool), "withdraw", [
|
|
788
|
+
addr(action.token),
|
|
789
|
+
amount,
|
|
790
|
+
recipient(action.recipient),
|
|
830
791
|
]);
|
|
831
|
-
return
|
|
832
|
-
}
|
|
833
|
-
function aaveV3Borrow(
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
word(
|
|
838
|
-
word(action.referralCode),
|
|
839
|
-
|
|
792
|
+
return captured(l, needsOutput, call, amount);
|
|
793
|
+
}
|
|
794
|
+
function aaveV3Borrow(l, action, amount) {
|
|
795
|
+
l.exec("IAaveV3Pool", addr(action.pool), "borrow", [
|
|
796
|
+
addr(action.token),
|
|
797
|
+
amount,
|
|
798
|
+
word(AAVE_VARIABLE_RATE),
|
|
799
|
+
word(action.referralCode ?? 0),
|
|
800
|
+
recipient(action.onBehalfOf),
|
|
840
801
|
]);
|
|
841
|
-
return
|
|
842
|
-
}
|
|
843
|
-
function aaveV3Repay(
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
word(
|
|
848
|
-
|
|
802
|
+
return l.result(amount);
|
|
803
|
+
}
|
|
804
|
+
function aaveV3Repay(l, action, amount) {
|
|
805
|
+
l.exec("IAaveV3Pool", addr(action.pool), "repay", [
|
|
806
|
+
addr(action.token),
|
|
807
|
+
amount,
|
|
808
|
+
word(AAVE_VARIABLE_RATE),
|
|
809
|
+
recipient(action.onBehalfOf),
|
|
849
810
|
]);
|
|
850
|
-
return
|
|
811
|
+
return l.result(amount);
|
|
851
812
|
}
|
|
852
|
-
function compoundV3Supply(
|
|
853
|
-
|
|
854
|
-
return
|
|
813
|
+
function compoundV3Supply(l, action, amount) {
|
|
814
|
+
l.exec("ICometMarket", addr(action.comet), "supply", [addr(action.token), amount]);
|
|
815
|
+
return l.result(amount);
|
|
855
816
|
}
|
|
856
|
-
function compoundV3Withdraw(
|
|
857
|
-
|
|
858
|
-
return
|
|
817
|
+
function compoundV3Withdraw(l, action, amount) {
|
|
818
|
+
l.exec("ICometMarket", addr(action.comet), "withdraw", [addr(action.token), amount]);
|
|
819
|
+
return l.result(amount);
|
|
859
820
|
}
|
|
860
821
|
// ---------------------------------------------------------------------------
|
|
861
|
-
//
|
|
822
|
+
// Tokens — the amount passes through, and nothing is decoded (`Lowering.erc20Write`)
|
|
862
823
|
// ---------------------------------------------------------------------------
|
|
863
|
-
function
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
word(action.
|
|
877
|
-
message.expr,
|
|
824
|
+
function transfer(l, action, amount) {
|
|
825
|
+
l.erc20Write("transfer", addr(action.token), recipient(action.recipient), amount);
|
|
826
|
+
return l.result(amount);
|
|
827
|
+
}
|
|
828
|
+
function approve(l, action, amount) {
|
|
829
|
+
l.erc20Write("approve", addr(action.token), addr(action.spender), amount);
|
|
830
|
+
return l.result(amount);
|
|
831
|
+
}
|
|
832
|
+
function permit2Approve(l, action, amount) {
|
|
833
|
+
l.exec("IPermit2", addr(action.permit2), "approve", [
|
|
834
|
+
addr(action.token),
|
|
835
|
+
addr(action.spender),
|
|
836
|
+
amount,
|
|
837
|
+
word(action.expiration),
|
|
878
838
|
]);
|
|
879
|
-
return
|
|
839
|
+
return l.result(amount);
|
|
880
840
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
word(action.dstPoolId),
|
|
887
|
-
MSG_SENDER,
|
|
888
|
-
amountIn,
|
|
889
|
-
word(action.amountOutMin),
|
|
890
|
-
tuple([MSG_SENDER, MSG_SENDER, payload.expr]),
|
|
891
|
-
]);
|
|
892
|
-
return voidCall(word(action.router), word(action.lzFee), { stmts: [...payload.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
|
|
893
|
-
}
|
|
894
|
-
function cctpBridge(emit, action, amountIn) {
|
|
895
|
-
const cd = calldata(emit, "depositForBurn(uint256,uint32,bytes32,address)", [
|
|
896
|
-
amountIn,
|
|
897
|
-
word(action.destDomain),
|
|
898
|
-
word(action.mintRecipient),
|
|
899
|
-
word(action.token),
|
|
900
|
-
]);
|
|
901
|
-
return voidCall(word(action.tokenMessenger), ZERO, cd, amountIn);
|
|
841
|
+
// ---------------------------------------------------------------------------
|
|
842
|
+
// Sources — produce a value
|
|
843
|
+
// ---------------------------------------------------------------------------
|
|
844
|
+
function balanceOf(l, action) {
|
|
845
|
+
return l.result(l.selfBalance(addr(action.token)));
|
|
902
846
|
}
|
|
903
|
-
function
|
|
904
|
-
|
|
905
|
-
const cd = calldata(emit, "dispatch(uint32,bytes32,bytes)", [
|
|
906
|
-
word(action.destinationDomain),
|
|
907
|
-
word(action.token),
|
|
908
|
-
body.expr,
|
|
909
|
-
]);
|
|
910
|
-
return voidCall(word(action.router), word(action.gasPayment), { stmts: [...body.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
|
|
847
|
+
function argument(l, action) {
|
|
848
|
+
return l.result(argumentVar(action.name));
|
|
911
849
|
}
|