@eco-incorp/sauce 0.99.4 → 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.
Files changed (1302) hide show
  1. package/README.md +105 -63
  2. package/actions/action-program.schema.json +1810 -0
  3. package/actions/dist/abis.d.ts +167 -0
  4. package/actions/dist/abis.d.ts.map +1 -0
  5. package/actions/dist/abis.js +215 -0
  6. package/actions/dist/compile.d.ts +15 -8
  7. package/actions/dist/compile.d.ts.map +1 -1
  8. package/actions/dist/compile.js +11 -33
  9. package/actions/dist/compose.d.ts +46 -0
  10. package/actions/dist/compose.d.ts.map +1 -0
  11. package/actions/dist/compose.js +118 -0
  12. package/actions/dist/emit.d.ts +0 -35
  13. package/actions/dist/emit.d.ts.map +1 -1
  14. package/actions/dist/emit.js +15 -46
  15. package/actions/dist/index.d.ts +11 -8
  16. package/actions/dist/index.d.ts.map +1 -1
  17. package/actions/dist/index.js +6 -4
  18. package/actions/dist/program.d.ts +23 -0
  19. package/actions/dist/program.d.ts.map +1 -0
  20. package/actions/dist/program.js +358 -0
  21. package/actions/dist/registry.d.ts +37 -0
  22. package/actions/dist/registry.d.ts.map +1 -0
  23. package/actions/dist/registry.js +36 -0
  24. package/actions/dist/schema.d.ts +6 -0
  25. package/actions/dist/schema.d.ts.map +1 -0
  26. package/actions/dist/schema.js +166 -0
  27. package/actions/dist/semantics.d.ts +18 -0
  28. package/actions/dist/semantics.d.ts.map +1 -0
  29. package/actions/dist/semantics.js +164 -0
  30. package/actions/dist/spec.d.ts +97 -0
  31. package/actions/dist/spec.d.ts.map +1 -0
  32. package/actions/dist/spec.js +323 -0
  33. package/actions/dist/split-swap.d.ts +35 -0
  34. package/actions/dist/split-swap.d.ts.map +1 -0
  35. package/actions/dist/split-swap.js +175 -0
  36. package/actions/dist/to-quote.d.ts +32 -56
  37. package/actions/dist/to-quote.d.ts.map +1 -1
  38. package/actions/dist/to-quote.js +134 -141
  39. package/actions/dist/to-sauce.d.ts +48 -32
  40. package/actions/dist/to-sauce.d.ts.map +1 -1
  41. package/actions/dist/to-sauce.js +691 -753
  42. package/actions/dist/types.d.ts +227 -335
  43. package/actions/dist/types.d.ts.map +1 -1
  44. package/actions/dist/types.js +12 -3
  45. package/dev-tools/README.md +9 -9
  46. package/dev-tools/artifacts/ISauceRouter.json +1 -1
  47. package/dev-tools/artifacts/Router.json +1 -1
  48. package/dev-tools/scripts/start-fork.sh +1 -1
  49. package/dev-tools/scripts/start-local.sh +5 -1
  50. package/dev-tools/src/svm-local.ts +23 -13
  51. package/docs/README.md +45 -34
  52. package/docs/api/README.md +37 -29
  53. package/docs/api/compiler.md +116 -55
  54. package/docs/api/coverage.md +99 -48
  55. package/docs/api/routes.md +51 -22
  56. package/docs/concepts/architecture.md +83 -116
  57. package/docs/concepts/saucescript.md +27 -23
  58. package/docs/examples/README.md +18 -10
  59. package/docs/examples/action-program.ts +75 -0
  60. package/docs/examples/cross-chain-cascade.sauce.ts +21 -0
  61. package/docs/examples/cross-chain-cascade.ts +43 -0
  62. package/docs/examples/cross-chain-intent.sauce.ts +23 -0
  63. package/docs/examples/cross-chain-intent.ts +49 -0
  64. package/docs/examples/first-intent.ts +7 -10
  65. package/docs/examples/protocol-approval.ts +3 -7
  66. package/docs/guides/actions.md +395 -0
  67. package/docs/guides/builders-and-actions.md +31 -37
  68. package/docs/guides/compiling.md +97 -98
  69. package/docs/guides/intents.md +242 -24
  70. package/docs/guides/nested-intents.md +165 -5
  71. package/docs/guides/protocols-and-tokens.md +15 -7
  72. package/docs/guides/quick-start.md +51 -22
  73. package/docs/guides/solana.md +38 -40
  74. package/docs/guides/verification.md +70 -31
  75. package/package.json +7 -2
  76. package/sdk/dist/artifacts/ISauceRouter.json +1 -1
  77. package/sdk/dist/artifacts/Router.json +1 -1
  78. package/sdk/dist/artifacts/V12Deployments.json +23 -22
  79. package/sdk/dist/artifacts/V12EngineGate.json +2 -2
  80. package/sdk/dist/artifacts/V12Kitchen.json +1 -1
  81. package/sdk/dist/artifacts/V12Pot.json +1 -1
  82. package/sdk/dist/artifacts/V12RuntimeBytecode.json +1 -1
  83. package/sdk/dist/artifacts/svm/engine-devnet.so +0 -0
  84. package/sdk/dist/artifacts/svm/engine-mainnet.so +0 -0
  85. package/sdk/dist/bytes.d.ts +10 -0
  86. package/sdk/dist/bytes.d.ts.map +1 -0
  87. package/sdk/dist/bytes.js +31 -0
  88. package/sdk/dist/bytes.js.map +1 -0
  89. package/sdk/dist/chains/canonical.d.ts +7 -1
  90. package/sdk/dist/chains/canonical.d.ts.map +1 -1
  91. package/sdk/dist/chains/canonical.js +6 -2
  92. package/sdk/dist/chains/canonical.js.map +1 -1
  93. package/sdk/dist/chains/index.d.ts +16 -2
  94. package/sdk/dist/chains/index.d.ts.map +1 -1
  95. package/sdk/dist/chains/index.js +51 -34
  96. package/sdk/dist/chains/index.js.map +1 -1
  97. package/sdk/dist/compact-arguments.d.ts +4 -1
  98. package/sdk/dist/compact-arguments.d.ts.map +1 -1
  99. package/sdk/dist/compact-arguments.js +25 -4
  100. package/sdk/dist/compact-arguments.js.map +1 -1
  101. package/sdk/dist/compiler.d.ts +13 -1
  102. package/sdk/dist/compiler.d.ts.map +1 -1
  103. package/sdk/dist/compiler.js +5 -6
  104. package/sdk/dist/compiler.js.map +1 -1
  105. package/sdk/dist/core/types.d.ts +18 -2
  106. package/sdk/dist/core/types.d.ts.map +1 -1
  107. package/sdk/dist/deployments/pot.d.ts +39 -0
  108. package/sdk/dist/deployments/pot.d.ts.map +1 -0
  109. package/sdk/dist/deployments/pot.js +48 -0
  110. package/sdk/dist/deployments/pot.js.map +1 -0
  111. package/sdk/dist/deployments/v12-addresses.d.ts +1 -4
  112. package/sdk/dist/deployments/v12-addresses.d.ts.map +1 -1
  113. package/sdk/dist/deployments/v12-addresses.js +7 -21
  114. package/sdk/dist/deployments/v12-addresses.js.map +1 -1
  115. package/sdk/dist/deposit/index.d.ts +5 -5
  116. package/sdk/dist/deposit/index.d.ts.map +1 -1
  117. package/sdk/dist/deposit/index.js +1 -1
  118. package/sdk/dist/deposit/index.js.map +1 -1
  119. package/sdk/dist/deposit/params.d.ts +3 -2
  120. package/sdk/dist/deposit/params.d.ts.map +1 -1
  121. package/sdk/dist/deposit/params.js +40 -3
  122. package/sdk/dist/deposit/params.js.map +1 -1
  123. package/sdk/dist/deposit/source.d.ts +0 -19
  124. package/sdk/dist/deposit/source.d.ts.map +1 -1
  125. package/sdk/dist/deposit/source.js +17 -34
  126. package/sdk/dist/deposit/source.js.map +1 -1
  127. package/sdk/dist/descriptors/accessors.d.ts +2 -2
  128. package/sdk/dist/descriptors/accessors.d.ts.map +1 -1
  129. package/sdk/dist/descriptors/accessors.js +15 -4
  130. package/sdk/dist/descriptors/accessors.js.map +1 -1
  131. package/sdk/dist/descriptors/call.d.ts +8 -13
  132. package/sdk/dist/descriptors/call.d.ts.map +1 -1
  133. package/sdk/dist/descriptors/call.js +7 -19
  134. package/sdk/dist/descriptors/call.js.map +1 -1
  135. package/sdk/dist/descriptors/derive.d.ts +1 -1
  136. package/sdk/dist/descriptors/derive.d.ts.map +1 -1
  137. package/sdk/dist/descriptors/derive.js +1 -1
  138. package/sdk/dist/descriptors/derive.js.map +1 -1
  139. package/sdk/dist/descriptors/index.d.ts +1 -1
  140. package/sdk/dist/descriptors/index.d.ts.map +1 -1
  141. package/sdk/dist/descriptors/index.js +1 -1
  142. package/sdk/dist/descriptors/index.js.map +1 -1
  143. package/sdk/dist/descriptors/links.d.ts +3 -12
  144. package/sdk/dist/descriptors/links.d.ts.map +1 -1
  145. package/sdk/dist/descriptors/links.js +2 -32
  146. package/sdk/dist/descriptors/links.js.map +1 -1
  147. package/sdk/dist/descriptors/query.d.ts +7 -3
  148. package/sdk/dist/descriptors/query.d.ts.map +1 -1
  149. package/sdk/dist/descriptors/query.js +9 -5
  150. package/sdk/dist/descriptors/query.js.map +1 -1
  151. package/sdk/dist/descriptors/registry.d.ts.map +1 -1
  152. package/sdk/dist/descriptors/registry.js +1 -0
  153. package/sdk/dist/descriptors/registry.js.map +1 -1
  154. package/sdk/dist/embedded/recipes.d.ts +3 -0
  155. package/sdk/dist/embedded/recipes.d.ts.map +1 -0
  156. package/sdk/dist/embedded/recipes.js +15 -0
  157. package/sdk/dist/embedded/recipes.js.map +1 -0
  158. package/sdk/dist/embedded/resolve.d.ts +27 -0
  159. package/sdk/dist/embedded/resolve.d.ts.map +1 -0
  160. package/sdk/dist/embedded/resolve.js +99 -0
  161. package/sdk/dist/embedded/resolve.js.map +1 -0
  162. package/sdk/dist/embedded/skills.generated.d.ts +3 -0
  163. package/sdk/dist/embedded/skills.generated.d.ts.map +1 -0
  164. package/sdk/dist/embedded/skills.generated.js +141 -0
  165. package/sdk/dist/embedded/skills.generated.js.map +1 -0
  166. package/sdk/dist/embedded/sources.generated.d.ts +7 -0
  167. package/sdk/dist/embedded/sources.generated.d.ts.map +1 -0
  168. package/sdk/dist/embedded/sources.generated.js +231 -0
  169. package/sdk/dist/embedded/sources.generated.js.map +1 -0
  170. package/sdk/dist/evm/execution-fee.d.ts +30 -0
  171. package/sdk/dist/evm/execution-fee.d.ts.map +1 -0
  172. package/sdk/dist/evm/execution-fee.js +33 -0
  173. package/sdk/dist/evm/execution-fee.js.map +1 -0
  174. package/sdk/dist/index.d.ts +7 -2
  175. package/sdk/dist/index.d.ts.map +1 -1
  176. package/sdk/dist/index.js +16 -10
  177. package/sdk/dist/index.js.map +1 -1
  178. package/sdk/dist/plugin/index.d.ts +1 -1
  179. package/sdk/dist/plugin/index.d.ts.map +1 -1
  180. package/sdk/dist/plugin/index.js +5 -22
  181. package/sdk/dist/plugin/index.js.map +1 -1
  182. package/sdk/dist/protocols/aave-v4/abis.d.ts +201 -0
  183. package/sdk/dist/protocols/aave-v4/abis.d.ts.map +1 -0
  184. package/sdk/dist/protocols/aave-v4/abis.js +139 -0
  185. package/sdk/dist/protocols/aave-v4/abis.js.map +1 -0
  186. package/sdk/dist/protocols/aave-v4/addresses.d.ts +3 -0
  187. package/sdk/dist/protocols/aave-v4/addresses.d.ts.map +1 -0
  188. package/sdk/dist/protocols/aave-v4/addresses.js +65 -0
  189. package/sdk/dist/protocols/aave-v4/addresses.js.map +1 -0
  190. package/sdk/dist/protocols/aave-v4/functions.d.ts +5 -0
  191. package/sdk/dist/protocols/aave-v4/functions.d.ts.map +1 -0
  192. package/sdk/dist/protocols/aave-v4/functions.js +37 -0
  193. package/sdk/dist/protocols/aave-v4/functions.js.map +1 -0
  194. package/sdk/dist/protocols/aave-v4/index.d.ts +5 -0
  195. package/sdk/dist/protocols/aave-v4/index.d.ts.map +1 -0
  196. package/sdk/dist/protocols/aave-v4/index.js +5 -0
  197. package/sdk/dist/protocols/aave-v4/index.js.map +1 -0
  198. package/sdk/dist/protocols/aave-v4/info.d.ts +3 -0
  199. package/sdk/dist/protocols/aave-v4/info.d.ts.map +1 -0
  200. package/sdk/dist/protocols/aave-v4/info.js +12 -0
  201. package/sdk/dist/protocols/aave-v4/info.js.map +1 -0
  202. package/sdk/dist/protocols/across/abis.d.ts +24 -12
  203. package/sdk/dist/protocols/across/abis.d.ts.map +1 -1
  204. package/sdk/dist/protocols/across/abis.js +16 -8
  205. package/sdk/dist/protocols/across/abis.js.map +1 -1
  206. package/sdk/dist/protocols/across/addresses.d.ts.map +1 -1
  207. package/sdk/dist/protocols/across/addresses.js +10 -0
  208. package/sdk/dist/protocols/across/addresses.js.map +1 -1
  209. package/sdk/dist/protocols/across/functions.d.ts +1 -1
  210. package/sdk/dist/protocols/across/functions.d.ts.map +1 -1
  211. package/sdk/dist/protocols/across/functions.js +2 -2
  212. package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts +112 -0
  213. package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts.map +1 -0
  214. package/sdk/dist/protocols/aerodrome-slipstream/abis.js +73 -0
  215. package/sdk/dist/protocols/aerodrome-slipstream/abis.js.map +1 -0
  216. package/sdk/dist/protocols/aerodrome-slipstream/addresses.d.ts +3 -0
  217. package/sdk/dist/protocols/aerodrome-slipstream/addresses.d.ts.map +1 -0
  218. package/sdk/dist/protocols/aerodrome-slipstream/addresses.js +39 -0
  219. package/sdk/dist/protocols/aerodrome-slipstream/addresses.js.map +1 -0
  220. package/sdk/dist/protocols/aerodrome-slipstream/functions.d.ts +2 -0
  221. package/sdk/dist/protocols/aerodrome-slipstream/functions.d.ts.map +1 -0
  222. package/sdk/dist/protocols/aerodrome-slipstream/functions.js +9 -0
  223. package/sdk/dist/protocols/aerodrome-slipstream/functions.js.map +1 -0
  224. package/sdk/dist/protocols/aerodrome-slipstream/index.d.ts +5 -0
  225. package/sdk/dist/protocols/aerodrome-slipstream/index.d.ts.map +1 -0
  226. package/sdk/dist/protocols/aerodrome-slipstream/index.js +5 -0
  227. package/sdk/dist/protocols/aerodrome-slipstream/index.js.map +1 -0
  228. package/sdk/dist/protocols/aerodrome-slipstream/info.d.ts +3 -0
  229. package/sdk/dist/protocols/aerodrome-slipstream/info.d.ts.map +1 -0
  230. package/sdk/dist/protocols/aerodrome-slipstream/info.js +12 -0
  231. package/sdk/dist/protocols/aerodrome-slipstream/info.js.map +1 -0
  232. package/sdk/dist/protocols/aevo/abis.d.ts +17 -2
  233. package/sdk/dist/protocols/aevo/abis.d.ts.map +1 -1
  234. package/sdk/dist/protocols/aevo/abis.js +10 -2
  235. package/sdk/dist/protocols/aevo/abis.js.map +1 -1
  236. package/sdk/dist/protocols/aevo/functions.d.ts +1 -1
  237. package/sdk/dist/protocols/aevo/functions.d.ts.map +1 -1
  238. package/sdk/dist/protocols/aevo/functions.js +2 -2
  239. package/sdk/dist/protocols/alchemix/abis.d.ts +1 -1
  240. package/sdk/dist/protocols/alchemix/abis.js +1 -1
  241. package/sdk/dist/protocols/alchemix/abis.js.map +1 -1
  242. package/sdk/dist/protocols/ambient/abis.d.ts +2 -2
  243. package/sdk/dist/protocols/ambient/abis.d.ts.map +1 -1
  244. package/sdk/dist/protocols/ambient/abis.js +3 -2
  245. package/sdk/dist/protocols/ambient/abis.js.map +1 -1
  246. package/sdk/dist/protocols/ambient/addresses.d.ts.map +1 -1
  247. package/sdk/dist/protocols/ambient/addresses.js +2 -1
  248. package/sdk/dist/protocols/ambient/addresses.js.map +1 -1
  249. package/sdk/dist/protocols/arrakis/abis.d.ts +4 -13
  250. package/sdk/dist/protocols/arrakis/abis.d.ts.map +1 -1
  251. package/sdk/dist/protocols/arrakis/abis.js +2 -11
  252. package/sdk/dist/protocols/arrakis/abis.js.map +1 -1
  253. package/sdk/dist/protocols/arrakis/functions.d.ts +1 -1
  254. package/sdk/dist/protocols/arrakis/functions.d.ts.map +1 -1
  255. package/sdk/dist/protocols/arrakis/functions.js +2 -1
  256. package/sdk/dist/protocols/arrakis/functions.js.map +1 -1
  257. package/sdk/dist/protocols/axelar/abis.d.ts +1 -1
  258. package/sdk/dist/protocols/axelar/abis.js +1 -1
  259. package/sdk/dist/protocols/balancer-v2/abis.d.ts +7 -7
  260. package/sdk/dist/protocols/balancer-v2/abis.js +7 -7
  261. package/sdk/dist/protocols/balancer-v2/abis.js.map +1 -1
  262. package/sdk/dist/protocols/cbeth/abis.d.ts +7 -1
  263. package/sdk/dist/protocols/cbeth/abis.d.ts.map +1 -1
  264. package/sdk/dist/protocols/cbeth/abis.js +6 -2
  265. package/sdk/dist/protocols/cbeth/abis.js.map +1 -1
  266. package/sdk/dist/protocols/cctp/abis.d.ts +1 -4
  267. package/sdk/dist/protocols/cctp/abis.d.ts.map +1 -1
  268. package/sdk/dist/protocols/cctp/abis.js +3 -1
  269. package/sdk/dist/protocols/cctp/abis.js.map +1 -1
  270. package/sdk/dist/protocols/cctp/addresses.d.ts.map +1 -1
  271. package/sdk/dist/protocols/cctp/addresses.js +3 -0
  272. package/sdk/dist/protocols/cctp/addresses.js.map +1 -1
  273. package/sdk/dist/protocols/chainlink/abis.d.ts +6 -6
  274. package/sdk/dist/protocols/chainlink/abis.js +6 -6
  275. package/sdk/dist/protocols/chainlink/abis.js.map +1 -1
  276. package/sdk/dist/protocols/chainlink/addresses.d.ts.map +1 -1
  277. package/sdk/dist/protocols/chainlink/addresses.js +10 -0
  278. package/sdk/dist/protocols/chainlink/addresses.js.map +1 -1
  279. package/sdk/dist/protocols/chainlink-ccip/abis.d.ts +1 -1
  280. package/sdk/dist/protocols/chainlink-ccip/abis.js +1 -1
  281. package/sdk/dist/protocols/chainlink-ccip/addresses.d.ts.map +1 -1
  282. package/sdk/dist/protocols/chainlink-ccip/addresses.js +9 -0
  283. package/sdk/dist/protocols/chainlink-ccip/addresses.js.map +1 -1
  284. package/sdk/dist/protocols/circle-gateway/abis.d.ts +114 -0
  285. package/sdk/dist/protocols/circle-gateway/abis.d.ts.map +1 -0
  286. package/sdk/dist/protocols/circle-gateway/abis.js +86 -0
  287. package/sdk/dist/protocols/circle-gateway/abis.js.map +1 -0
  288. package/sdk/dist/protocols/circle-gateway/addresses.d.ts +3 -0
  289. package/sdk/dist/protocols/circle-gateway/addresses.d.ts.map +1 -0
  290. package/sdk/dist/protocols/circle-gateway/addresses.js +37 -0
  291. package/sdk/dist/protocols/circle-gateway/addresses.js.map +1 -0
  292. package/sdk/dist/protocols/circle-gateway/functions.d.ts +4 -0
  293. package/sdk/dist/protocols/circle-gateway/functions.d.ts.map +1 -0
  294. package/sdk/dist/protocols/circle-gateway/functions.js +27 -0
  295. package/sdk/dist/protocols/circle-gateway/functions.js.map +1 -0
  296. package/sdk/dist/protocols/circle-gateway/index.d.ts +5 -0
  297. package/sdk/dist/protocols/circle-gateway/index.d.ts.map +1 -0
  298. package/sdk/dist/protocols/circle-gateway/index.js +5 -0
  299. package/sdk/dist/protocols/circle-gateway/index.js.map +1 -0
  300. package/sdk/dist/protocols/circle-gateway/info.d.ts +3 -0
  301. package/sdk/dist/protocols/circle-gateway/info.d.ts.map +1 -0
  302. package/sdk/dist/protocols/circle-gateway/info.js +12 -0
  303. package/sdk/dist/protocols/circle-gateway/info.js.map +1 -0
  304. package/sdk/dist/protocols/compound-v2/abis.d.ts +2 -2
  305. package/sdk/dist/protocols/compound-v2/abis.js +2 -2
  306. package/sdk/dist/protocols/compound-v2/abis.js.map +1 -1
  307. package/sdk/dist/protocols/connext/abis.d.ts +46 -6
  308. package/sdk/dist/protocols/connext/abis.d.ts.map +1 -1
  309. package/sdk/dist/protocols/connext/abis.js +27 -5
  310. package/sdk/dist/protocols/connext/abis.js.map +1 -1
  311. package/sdk/dist/protocols/connext/addresses.d.ts.map +1 -1
  312. package/sdk/dist/protocols/connext/addresses.js +1 -7
  313. package/sdk/dist/protocols/connext/addresses.js.map +1 -1
  314. package/sdk/dist/protocols/connext/functions.d.ts +1 -1
  315. package/sdk/dist/protocols/connext/functions.d.ts.map +1 -1
  316. package/sdk/dist/protocols/connext/functions.js +3 -2
  317. package/sdk/dist/protocols/connext/functions.js.map +1 -1
  318. package/sdk/dist/protocols/curve/abis.d.ts +119 -7
  319. package/sdk/dist/protocols/curve/abis.d.ts.map +1 -1
  320. package/sdk/dist/protocols/curve/abis.js +90 -7
  321. package/sdk/dist/protocols/curve/abis.js.map +1 -1
  322. package/sdk/dist/protocols/debridge/abis.d.ts +7 -7
  323. package/sdk/dist/protocols/debridge/abis.js +5 -5
  324. package/sdk/dist/protocols/debridge/abis.js.map +1 -1
  325. package/sdk/dist/protocols/debridge/addresses.d.ts.map +1 -1
  326. package/sdk/dist/protocols/debridge/addresses.js +11 -0
  327. package/sdk/dist/protocols/debridge/addresses.js.map +1 -1
  328. package/sdk/dist/protocols/eco-routes/abis.d.ts +463 -0
  329. package/sdk/dist/protocols/eco-routes/abis.d.ts.map +1 -0
  330. package/sdk/dist/protocols/eco-routes/abis.js +632 -0
  331. package/sdk/dist/protocols/eco-routes/abis.js.map +1 -0
  332. package/sdk/dist/protocols/eco-routes/addresses.d.ts +9 -0
  333. package/sdk/dist/protocols/eco-routes/addresses.d.ts.map +1 -0
  334. package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts +585 -0
  335. package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts.map +1 -0
  336. package/sdk/dist/protocols/eco-routes/addresses.generated.js +590 -0
  337. package/sdk/dist/protocols/eco-routes/addresses.generated.js.map +1 -0
  338. package/sdk/dist/protocols/eco-routes/addresses.js +21 -0
  339. package/sdk/dist/protocols/eco-routes/addresses.js.map +1 -0
  340. package/sdk/dist/protocols/eco-routes/functions.d.ts +12 -0
  341. package/sdk/dist/protocols/eco-routes/functions.d.ts.map +1 -0
  342. package/sdk/dist/protocols/eco-routes/functions.js +45 -0
  343. package/sdk/dist/protocols/eco-routes/functions.js.map +1 -0
  344. package/sdk/dist/protocols/eco-routes/index.d.ts +6 -0
  345. package/sdk/dist/protocols/eco-routes/index.d.ts.map +1 -0
  346. package/sdk/dist/protocols/eco-routes/index.js +6 -0
  347. package/sdk/dist/protocols/eco-routes/index.js.map +1 -0
  348. package/sdk/dist/protocols/eco-routes/info.d.ts +3 -0
  349. package/sdk/dist/protocols/eco-routes/info.d.ts.map +1 -0
  350. package/sdk/dist/protocols/eco-routes/info.js +12 -0
  351. package/sdk/dist/protocols/eco-routes/info.js.map +1 -0
  352. package/sdk/dist/protocols/eco-routes/lookup.d.ts +82 -0
  353. package/sdk/dist/protocols/eco-routes/lookup.d.ts.map +1 -0
  354. package/sdk/dist/protocols/eco-routes/lookup.js +148 -0
  355. package/sdk/dist/protocols/eco-routes/lookup.js.map +1 -0
  356. package/sdk/dist/protocols/eigenlayer/abis.d.ts +4 -4
  357. package/sdk/dist/protocols/eigenlayer/abis.d.ts.map +1 -1
  358. package/sdk/dist/protocols/eigenlayer/abis.js +5 -4
  359. package/sdk/dist/protocols/eigenlayer/abis.js.map +1 -1
  360. package/sdk/dist/protocols/ens/abis.d.ts +4 -4
  361. package/sdk/dist/protocols/ens/abis.js +4 -4
  362. package/sdk/dist/protocols/etherfi/abis.d.ts +1 -1
  363. package/sdk/dist/protocols/etherfi/abis.d.ts.map +1 -1
  364. package/sdk/dist/protocols/etherfi/abis.js +2 -1
  365. package/sdk/dist/protocols/etherfi/abis.js.map +1 -1
  366. package/sdk/dist/protocols/euler-v2/abis.d.ts +2 -2
  367. package/sdk/dist/protocols/euler-v2/abis.js +2 -2
  368. package/sdk/dist/protocols/euler-v2/abis.js.map +1 -1
  369. package/sdk/dist/protocols/fluid/abis.d.ts +47 -26
  370. package/sdk/dist/protocols/fluid/abis.d.ts.map +1 -1
  371. package/sdk/dist/protocols/fluid/abis.js +39 -18
  372. package/sdk/dist/protocols/fluid/abis.js.map +1 -1
  373. package/sdk/dist/protocols/fluid/functions.d.ts +4 -4
  374. package/sdk/dist/protocols/fluid/functions.d.ts.map +1 -1
  375. package/sdk/dist/protocols/fluid/functions.js +18 -16
  376. package/sdk/dist/protocols/fluid/functions.js.map +1 -1
  377. package/sdk/dist/protocols/gains-network/abis.d.ts +44 -35
  378. package/sdk/dist/protocols/gains-network/abis.d.ts.map +1 -1
  379. package/sdk/dist/protocols/gains-network/abis.js +26 -21
  380. package/sdk/dist/protocols/gains-network/abis.js.map +1 -1
  381. package/sdk/dist/protocols/gains-network/functions.d.ts +3 -3
  382. package/sdk/dist/protocols/gains-network/functions.d.ts.map +1 -1
  383. package/sdk/dist/protocols/gains-network/functions.js +6 -6
  384. package/sdk/dist/protocols/gamma/abis.d.ts +43 -0
  385. package/sdk/dist/protocols/gamma/abis.d.ts.map +1 -1
  386. package/sdk/dist/protocols/gamma/abis.js +30 -0
  387. package/sdk/dist/protocols/gamma/abis.js.map +1 -1
  388. package/sdk/dist/protocols/gamma/addresses.d.ts.map +1 -1
  389. package/sdk/dist/protocols/gamma/addresses.js +2 -7
  390. package/sdk/dist/protocols/gamma/addresses.js.map +1 -1
  391. package/sdk/dist/protocols/gamma/functions.d.ts +1 -0
  392. package/sdk/dist/protocols/gamma/functions.d.ts.map +1 -1
  393. package/sdk/dist/protocols/gamma/functions.js +9 -0
  394. package/sdk/dist/protocols/gamma/functions.js.map +1 -1
  395. package/sdk/dist/protocols/gelato/abis.d.ts +2 -2
  396. package/sdk/dist/protocols/gelato/abis.js +2 -2
  397. package/sdk/dist/protocols/gmx-v1/abis.d.ts +15 -3
  398. package/sdk/dist/protocols/gmx-v1/abis.d.ts.map +1 -1
  399. package/sdk/dist/protocols/gmx-v1/abis.js +5 -3
  400. package/sdk/dist/protocols/gmx-v1/abis.js.map +1 -1
  401. package/sdk/dist/protocols/gmx-v1/functions.d.ts +2 -2
  402. package/sdk/dist/protocols/gmx-v1/functions.d.ts.map +1 -1
  403. package/sdk/dist/protocols/gmx-v1/functions.js +2 -2
  404. package/sdk/dist/protocols/gmx-v2/abis.d.ts +11 -5
  405. package/sdk/dist/protocols/gmx-v2/abis.d.ts.map +1 -1
  406. package/sdk/dist/protocols/gmx-v2/abis.js +7 -4
  407. package/sdk/dist/protocols/gmx-v2/abis.js.map +1 -1
  408. package/sdk/dist/protocols/gmx-v2/addresses.d.ts.map +1 -1
  409. package/sdk/dist/protocols/gmx-v2/addresses.js +3 -1
  410. package/sdk/dist/protocols/gmx-v2/addresses.js.map +1 -1
  411. package/sdk/dist/protocols/gmx-v2/functions.d.ts +1 -1
  412. package/sdk/dist/protocols/gmx-v2/functions.d.ts.map +1 -1
  413. package/sdk/dist/protocols/gmx-v2/functions.js +4 -2
  414. package/sdk/dist/protocols/gmx-v2/functions.js.map +1 -1
  415. package/sdk/dist/protocols/harvest/abis.d.ts +8 -2
  416. package/sdk/dist/protocols/harvest/abis.d.ts.map +1 -1
  417. package/sdk/dist/protocols/harvest/abis.js +2 -2
  418. package/sdk/dist/protocols/harvest/abis.js.map +1 -1
  419. package/sdk/dist/protocols/hegic/abis.d.ts +5 -2
  420. package/sdk/dist/protocols/hegic/abis.d.ts.map +1 -1
  421. package/sdk/dist/protocols/hegic/abis.js +7 -2
  422. package/sdk/dist/protocols/hegic/abis.js.map +1 -1
  423. package/sdk/dist/protocols/hegic/addresses.d.ts.map +1 -1
  424. package/sdk/dist/protocols/hegic/addresses.js +1 -0
  425. package/sdk/dist/protocols/hegic/addresses.js.map +1 -1
  426. package/sdk/dist/protocols/hegic/functions.d.ts +1 -1
  427. package/sdk/dist/protocols/hegic/functions.d.ts.map +1 -1
  428. package/sdk/dist/protocols/hegic/functions.js +3 -3
  429. package/sdk/dist/protocols/hop/addresses.d.ts.map +1 -1
  430. package/sdk/dist/protocols/hop/addresses.js +5 -2
  431. package/sdk/dist/protocols/hop/addresses.js.map +1 -1
  432. package/sdk/dist/protocols/hyperlane/abis.d.ts +5 -5
  433. package/sdk/dist/protocols/hyperlane/abis.js +5 -5
  434. package/sdk/dist/protocols/hyperlane/abis.js.map +1 -1
  435. package/sdk/dist/protocols/hyperlane/addresses.d.ts.map +1 -1
  436. package/sdk/dist/protocols/hyperlane/addresses.js +9 -0
  437. package/sdk/dist/protocols/hyperlane/addresses.js.map +1 -1
  438. package/sdk/dist/protocols/index.d.ts +1 -0
  439. package/sdk/dist/protocols/index.d.ts.map +1 -1
  440. package/sdk/dist/protocols/index.js +13 -0
  441. package/sdk/dist/protocols/index.js.map +1 -1
  442. package/sdk/dist/protocols/kim/abis.d.ts +7 -20
  443. package/sdk/dist/protocols/kim/abis.d.ts.map +1 -1
  444. package/sdk/dist/protocols/kim/abis.js +6 -12
  445. package/sdk/dist/protocols/kim/abis.js.map +1 -1
  446. package/sdk/dist/protocols/kim/functions.d.ts +1 -1
  447. package/sdk/dist/protocols/kim/functions.d.ts.map +1 -1
  448. package/sdk/dist/protocols/kim/functions.js +3 -2
  449. package/sdk/dist/protocols/kim/functions.js.map +1 -1
  450. package/sdk/dist/protocols/kyberswap/abis.d.ts +41 -16
  451. package/sdk/dist/protocols/kyberswap/abis.d.ts.map +1 -1
  452. package/sdk/dist/protocols/kyberswap/abis.js +21 -8
  453. package/sdk/dist/protocols/kyberswap/abis.js.map +1 -1
  454. package/sdk/dist/protocols/kyberswap/addresses.d.ts.map +1 -1
  455. package/sdk/dist/protocols/kyberswap/addresses.js +12 -2
  456. package/sdk/dist/protocols/kyberswap/addresses.js.map +1 -1
  457. package/sdk/dist/protocols/kyberswap-aggregator/addresses.d.ts.map +1 -1
  458. package/sdk/dist/protocols/kyberswap-aggregator/addresses.js +12 -1
  459. package/sdk/dist/protocols/kyberswap-aggregator/addresses.js.map +1 -1
  460. package/sdk/dist/protocols/layerbank/abis.d.ts +81 -24
  461. package/sdk/dist/protocols/layerbank/abis.d.ts.map +1 -1
  462. package/sdk/dist/protocols/layerbank/abis.js +69 -17
  463. package/sdk/dist/protocols/layerbank/abis.js.map +1 -1
  464. package/sdk/dist/protocols/layerbank/addresses.d.ts.map +1 -1
  465. package/sdk/dist/protocols/layerbank/addresses.js +3 -1
  466. package/sdk/dist/protocols/layerbank/addresses.js.map +1 -1
  467. package/sdk/dist/protocols/layerbank/functions.d.ts +4 -4
  468. package/sdk/dist/protocols/layerbank/functions.d.ts.map +1 -1
  469. package/sdk/dist/protocols/layerbank/functions.js +18 -16
  470. package/sdk/dist/protocols/layerbank/functions.js.map +1 -1
  471. package/sdk/dist/protocols/layerzero/abis.d.ts +3 -3
  472. package/sdk/dist/protocols/layerzero/abis.js +3 -3
  473. package/sdk/dist/protocols/layerzero/addresses.d.ts.map +1 -1
  474. package/sdk/dist/protocols/layerzero/addresses.js +11 -1
  475. package/sdk/dist/protocols/layerzero/addresses.js.map +1 -1
  476. package/sdk/dist/protocols/level-finance/abis.d.ts +6 -0
  477. package/sdk/dist/protocols/level-finance/abis.d.ts.map +1 -1
  478. package/sdk/dist/protocols/level-finance/abis.js +2 -0
  479. package/sdk/dist/protocols/level-finance/abis.js.map +1 -1
  480. package/sdk/dist/protocols/level-finance/functions.d.ts +2 -2
  481. package/sdk/dist/protocols/level-finance/functions.d.ts.map +1 -1
  482. package/sdk/dist/protocols/level-finance/functions.js +4 -4
  483. package/sdk/dist/protocols/lifi/abis.d.ts +41 -4
  484. package/sdk/dist/protocols/lifi/abis.d.ts.map +1 -1
  485. package/sdk/dist/protocols/lifi/abis.js +24 -4
  486. package/sdk/dist/protocols/lifi/abis.js.map +1 -1
  487. package/sdk/dist/protocols/lifi/addresses.d.ts.map +1 -1
  488. package/sdk/dist/protocols/lifi/addresses.js +9 -0
  489. package/sdk/dist/protocols/lifi/addresses.js.map +1 -1
  490. package/sdk/dist/protocols/lifi/functions.d.ts +1 -1
  491. package/sdk/dist/protocols/lifi/functions.d.ts.map +1 -1
  492. package/sdk/dist/protocols/lifi/functions.js +5 -2
  493. package/sdk/dist/protocols/lifi/functions.js.map +1 -1
  494. package/sdk/dist/protocols/liquity-v1/abis.d.ts +6 -0
  495. package/sdk/dist/protocols/liquity-v1/abis.d.ts.map +1 -1
  496. package/sdk/dist/protocols/liquity-v1/abis.js +7 -1
  497. package/sdk/dist/protocols/liquity-v1/abis.js.map +1 -1
  498. package/sdk/dist/protocols/liquity-v1/functions.d.ts +1 -1
  499. package/sdk/dist/protocols/liquity-v1/functions.d.ts.map +1 -1
  500. package/sdk/dist/protocols/liquity-v1/functions.js +1 -1
  501. package/sdk/dist/protocols/mantle-meth/abis.d.ts +26 -25
  502. package/sdk/dist/protocols/mantle-meth/abis.d.ts.map +1 -1
  503. package/sdk/dist/protocols/mantle-meth/abis.js +22 -17
  504. package/sdk/dist/protocols/mantle-meth/abis.js.map +1 -1
  505. package/sdk/dist/protocols/mantle-meth/addresses.d.ts.map +1 -1
  506. package/sdk/dist/protocols/mantle-meth/addresses.js +3 -0
  507. package/sdk/dist/protocols/mantle-meth/addresses.js.map +1 -1
  508. package/sdk/dist/protocols/mantle-meth/functions.d.ts +1 -1
  509. package/sdk/dist/protocols/mantle-meth/functions.d.ts.map +1 -1
  510. package/sdk/dist/protocols/mantle-meth/functions.js +4 -4
  511. package/sdk/dist/protocols/maverick/abis.d.ts +9 -0
  512. package/sdk/dist/protocols/maverick/abis.d.ts.map +1 -1
  513. package/sdk/dist/protocols/maverick/abis.js +7 -1
  514. package/sdk/dist/protocols/maverick/abis.js.map +1 -1
  515. package/sdk/dist/protocols/morpho-blue/addresses.d.ts.map +1 -1
  516. package/sdk/dist/protocols/morpho-blue/addresses.js +10 -0
  517. package/sdk/dist/protocols/morpho-blue/addresses.js.map +1 -1
  518. package/sdk/dist/protocols/mux-protocol/abis.d.ts +87 -32
  519. package/sdk/dist/protocols/mux-protocol/abis.d.ts.map +1 -1
  520. package/sdk/dist/protocols/mux-protocol/abis.js +54 -21
  521. package/sdk/dist/protocols/mux-protocol/abis.js.map +1 -1
  522. package/sdk/dist/protocols/mux-protocol/functions.d.ts +2 -2
  523. package/sdk/dist/protocols/mux-protocol/functions.d.ts.map +1 -1
  524. package/sdk/dist/protocols/mux-protocol/functions.js +8 -8
  525. package/sdk/dist/protocols/olympus/abis.d.ts +5 -2
  526. package/sdk/dist/protocols/olympus/abis.d.ts.map +1 -1
  527. package/sdk/dist/protocols/olympus/abis.js +2 -2
  528. package/sdk/dist/protocols/olympus/abis.js.map +1 -1
  529. package/sdk/dist/protocols/oneinch/abis.d.ts +5 -5
  530. package/sdk/dist/protocols/oneinch/abis.d.ts.map +1 -1
  531. package/sdk/dist/protocols/oneinch/abis.js +5 -3
  532. package/sdk/dist/protocols/oneinch/abis.js.map +1 -1
  533. package/sdk/dist/protocols/oneinch/functions.d.ts +1 -1
  534. package/sdk/dist/protocols/oneinch/functions.d.ts.map +1 -1
  535. package/sdk/dist/protocols/oneinch/functions.js +2 -2
  536. package/sdk/dist/protocols/openocean/abis.d.ts +14 -1
  537. package/sdk/dist/protocols/openocean/abis.d.ts.map +1 -1
  538. package/sdk/dist/protocols/openocean/abis.js +11 -1
  539. package/sdk/dist/protocols/openocean/abis.js.map +1 -1
  540. package/sdk/dist/protocols/openocean/functions.d.ts +1 -1
  541. package/sdk/dist/protocols/openocean/functions.d.ts.map +1 -1
  542. package/sdk/dist/protocols/openocean/functions.js +1 -1
  543. package/sdk/dist/protocols/opyn/abis.d.ts +4 -1
  544. package/sdk/dist/protocols/opyn/abis.d.ts.map +1 -1
  545. package/sdk/dist/protocols/opyn/abis.js +1 -1
  546. package/sdk/dist/protocols/opyn/abis.js.map +1 -1
  547. package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts +6 -6
  548. package/sdk/dist/protocols/pancakeswap-v3/abis.js +6 -6
  549. package/sdk/dist/protocols/pancakeswap-v3/abis.js.map +1 -1
  550. package/sdk/dist/protocols/paraswap/abis.d.ts +1 -1
  551. package/sdk/dist/protocols/paraswap/abis.js +1 -1
  552. package/sdk/dist/protocols/pendle/abis.d.ts +288 -6
  553. package/sdk/dist/protocols/pendle/abis.d.ts.map +1 -1
  554. package/sdk/dist/protocols/pendle/abis.js +160 -6
  555. package/sdk/dist/protocols/pendle/abis.js.map +1 -1
  556. package/sdk/dist/protocols/permit2/abis.d.ts +1 -1
  557. package/sdk/dist/protocols/permit2/abis.js +1 -1
  558. package/sdk/dist/protocols/permit2/addresses.d.ts.map +1 -1
  559. package/sdk/dist/protocols/permit2/addresses.js +9 -0
  560. package/sdk/dist/protocols/permit2/addresses.js.map +1 -1
  561. package/sdk/dist/protocols/perpetual-protocol/abis.d.ts +46 -38
  562. package/sdk/dist/protocols/perpetual-protocol/abis.d.ts.map +1 -1
  563. package/sdk/dist/protocols/perpetual-protocol/abis.js +27 -14
  564. package/sdk/dist/protocols/perpetual-protocol/abis.js.map +1 -1
  565. package/sdk/dist/protocols/premia/abis.d.ts +18 -17
  566. package/sdk/dist/protocols/premia/abis.d.ts.map +1 -1
  567. package/sdk/dist/protocols/premia/abis.js +20 -10
  568. package/sdk/dist/protocols/premia/abis.js.map +1 -1
  569. package/sdk/dist/protocols/premia/addresses.d.ts.map +1 -1
  570. package/sdk/dist/protocols/premia/addresses.js +3 -8
  571. package/sdk/dist/protocols/premia/addresses.js.map +1 -1
  572. package/sdk/dist/protocols/premia/functions.d.ts +2 -2
  573. package/sdk/dist/protocols/premia/functions.d.ts.map +1 -1
  574. package/sdk/dist/protocols/premia/functions.js +8 -8
  575. package/sdk/dist/protocols/pyth/abis.d.ts +3 -3
  576. package/sdk/dist/protocols/pyth/abis.d.ts.map +1 -1
  577. package/sdk/dist/protocols/pyth/abis.js +6 -3
  578. package/sdk/dist/protocols/pyth/abis.js.map +1 -1
  579. package/sdk/dist/protocols/reflexer/abis.d.ts +8 -5
  580. package/sdk/dist/protocols/reflexer/abis.d.ts.map +1 -1
  581. package/sdk/dist/protocols/reflexer/abis.js +10 -6
  582. package/sdk/dist/protocols/reflexer/abis.js.map +1 -1
  583. package/sdk/dist/protocols/renzo/abis.d.ts +1 -1
  584. package/sdk/dist/protocols/renzo/abis.js +1 -1
  585. package/sdk/dist/protocols/renzo/abis.js.map +1 -1
  586. package/sdk/dist/protocols/sablier/abis.d.ts +2 -2
  587. package/sdk/dist/protocols/sablier/abis.js +2 -2
  588. package/sdk/dist/protocols/safe/addresses.d.ts.map +1 -1
  589. package/sdk/dist/protocols/safe/addresses.js +10 -0
  590. package/sdk/dist/protocols/safe/addresses.js.map +1 -1
  591. package/sdk/dist/protocols/seaport/abis.d.ts +65 -5
  592. package/sdk/dist/protocols/seaport/abis.d.ts.map +1 -1
  593. package/sdk/dist/protocols/seaport/abis.js +41 -5
  594. package/sdk/dist/protocols/seaport/abis.js.map +1 -1
  595. package/sdk/dist/protocols/seaport/addresses.d.ts.map +1 -1
  596. package/sdk/dist/protocols/seaport/addresses.js +10 -0
  597. package/sdk/dist/protocols/seaport/addresses.js.map +1 -1
  598. package/sdk/dist/protocols/seaport/functions.d.ts +1 -1
  599. package/sdk/dist/protocols/seaport/functions.d.ts.map +1 -1
  600. package/sdk/dist/protocols/seaport/functions.js +1 -0
  601. package/sdk/dist/protocols/seaport/functions.js.map +1 -1
  602. package/sdk/dist/protocols/silo/abis.d.ts +3 -0
  603. package/sdk/dist/protocols/silo/abis.d.ts.map +1 -1
  604. package/sdk/dist/protocols/silo/abis.js +4 -1
  605. package/sdk/dist/protocols/silo/abis.js.map +1 -1
  606. package/sdk/dist/protocols/silo/addresses.d.ts.map +1 -1
  607. package/sdk/dist/protocols/silo/addresses.js +2 -1
  608. package/sdk/dist/protocols/silo/addresses.js.map +1 -1
  609. package/sdk/dist/protocols/silo/functions.d.ts +1 -1
  610. package/sdk/dist/protocols/silo/functions.d.ts.map +1 -1
  611. package/sdk/dist/protocols/silo/functions.js +2 -1
  612. package/sdk/dist/protocols/silo/functions.js.map +1 -1
  613. package/sdk/dist/protocols/socket/abis.d.ts +1 -13
  614. package/sdk/dist/protocols/socket/abis.d.ts.map +1 -1
  615. package/sdk/dist/protocols/socket/abis.js +3 -11
  616. package/sdk/dist/protocols/socket/abis.js.map +1 -1
  617. package/sdk/dist/protocols/socket/functions.d.ts +1 -1
  618. package/sdk/dist/protocols/socket/functions.d.ts.map +1 -1
  619. package/sdk/dist/protocols/socket/functions.js +1 -1
  620. package/sdk/dist/protocols/spookyswap/addresses.d.ts.map +1 -1
  621. package/sdk/dist/protocols/spookyswap/addresses.js +2 -1
  622. package/sdk/dist/protocols/spookyswap/addresses.js.map +1 -1
  623. package/sdk/dist/protocols/squid/abis.d.ts +33 -21
  624. package/sdk/dist/protocols/squid/abis.d.ts.map +1 -1
  625. package/sdk/dist/protocols/squid/abis.js +19 -13
  626. package/sdk/dist/protocols/squid/abis.js.map +1 -1
  627. package/sdk/dist/protocols/squid/functions.d.ts +1 -1
  628. package/sdk/dist/protocols/squid/functions.d.ts.map +1 -1
  629. package/sdk/dist/protocols/squid/functions.js +2 -2
  630. package/sdk/dist/protocols/stargate/abis.d.ts +23 -3
  631. package/sdk/dist/protocols/stargate/abis.d.ts.map +1 -1
  632. package/sdk/dist/protocols/stargate/abis.js +19 -3
  633. package/sdk/dist/protocols/stargate/abis.js.map +1 -1
  634. package/sdk/dist/protocols/superfluid/abis.d.ts +2 -2
  635. package/sdk/dist/protocols/superfluid/abis.js +2 -2
  636. package/sdk/dist/protocols/superfluid/abis.js.map +1 -1
  637. package/sdk/dist/protocols/sushiswap-v2/addresses.d.ts.map +1 -1
  638. package/sdk/dist/protocols/sushiswap-v2/addresses.js +2 -1
  639. package/sdk/dist/protocols/sushiswap-v2/addresses.js.map +1 -1
  640. package/sdk/dist/protocols/swell/abis.d.ts +2 -8
  641. package/sdk/dist/protocols/swell/abis.d.ts.map +1 -1
  642. package/sdk/dist/protocols/swell/abis.js +4 -2
  643. package/sdk/dist/protocols/swell/abis.js.map +1 -1
  644. package/sdk/dist/protocols/swell/functions.d.ts +2 -2
  645. package/sdk/dist/protocols/swell/functions.d.ts.map +1 -1
  646. package/sdk/dist/protocols/swell/functions.js +4 -2
  647. package/sdk/dist/protocols/swell/functions.js.map +1 -1
  648. package/sdk/dist/protocols/synapse/addresses.d.ts.map +1 -1
  649. package/sdk/dist/protocols/synapse/addresses.js +2 -1
  650. package/sdk/dist/protocols/synapse/addresses.js.map +1 -1
  651. package/sdk/dist/protocols/synthetix-v3/abis.d.ts +40 -5
  652. package/sdk/dist/protocols/synthetix-v3/abis.d.ts.map +1 -1
  653. package/sdk/dist/protocols/synthetix-v3/abis.js +27 -5
  654. package/sdk/dist/protocols/synthetix-v3/abis.js.map +1 -1
  655. package/sdk/dist/protocols/synthetix-v3/addresses.d.ts.map +1 -1
  656. package/sdk/dist/protocols/synthetix-v3/addresses.js +2 -1
  657. package/sdk/dist/protocols/synthetix-v3/addresses.js.map +1 -1
  658. package/sdk/dist/protocols/synthra-v3/abis.d.ts +347 -0
  659. package/sdk/dist/protocols/synthra-v3/abis.d.ts.map +1 -0
  660. package/sdk/dist/protocols/synthra-v3/abis.js +242 -0
  661. package/sdk/dist/protocols/synthra-v3/abis.js.map +1 -0
  662. package/sdk/dist/protocols/synthra-v3/addresses.d.ts +3 -0
  663. package/sdk/dist/protocols/synthra-v3/addresses.d.ts.map +1 -0
  664. package/sdk/dist/protocols/synthra-v3/addresses.js +16 -0
  665. package/sdk/dist/protocols/synthra-v3/addresses.js.map +1 -0
  666. package/sdk/dist/protocols/synthra-v3/functions.d.ts +2 -0
  667. package/sdk/dist/protocols/synthra-v3/functions.d.ts.map +1 -0
  668. package/sdk/dist/protocols/synthra-v3/functions.js +9 -0
  669. package/sdk/dist/protocols/synthra-v3/functions.js.map +1 -0
  670. package/sdk/dist/protocols/synthra-v3/index.d.ts +5 -0
  671. package/sdk/dist/protocols/synthra-v3/index.d.ts.map +1 -0
  672. package/sdk/dist/protocols/synthra-v3/index.js +5 -0
  673. package/sdk/dist/protocols/synthra-v3/index.js.map +1 -0
  674. package/sdk/dist/protocols/synthra-v3/info.d.ts +3 -0
  675. package/sdk/dist/protocols/synthra-v3/info.d.ts.map +1 -0
  676. package/sdk/dist/protocols/synthra-v3/info.js +11 -0
  677. package/sdk/dist/protocols/synthra-v3/info.js.map +1 -0
  678. package/sdk/dist/protocols/thales/abis.d.ts +53 -24
  679. package/sdk/dist/protocols/thales/abis.d.ts.map +1 -1
  680. package/sdk/dist/protocols/thales/abis.js +27 -11
  681. package/sdk/dist/protocols/thales/abis.js.map +1 -1
  682. package/sdk/dist/protocols/thales/functions.d.ts +2 -2
  683. package/sdk/dist/protocols/thales/functions.d.ts.map +1 -1
  684. package/sdk/dist/protocols/thales/functions.js +5 -6
  685. package/sdk/dist/protocols/thales/functions.js.map +1 -1
  686. package/sdk/dist/protocols/thruster/abis.d.ts +1 -1
  687. package/sdk/dist/protocols/thruster/abis.js +1 -1
  688. package/sdk/dist/protocols/trader-joe/abis.d.ts +3 -3
  689. package/sdk/dist/protocols/trader-joe/abis.js +2 -2
  690. package/sdk/dist/protocols/trader-joe/abis.js.map +1 -1
  691. package/sdk/dist/protocols/uniswap-v2/addresses.d.ts.map +1 -1
  692. package/sdk/dist/protocols/uniswap-v2/addresses.js +10 -0
  693. package/sdk/dist/protocols/uniswap-v2/addresses.js.map +1 -1
  694. package/sdk/dist/protocols/uniswap-v3/abis.d.ts +127 -8
  695. package/sdk/dist/protocols/uniswap-v3/abis.d.ts.map +1 -1
  696. package/sdk/dist/protocols/uniswap-v3/abis.js +90 -8
  697. package/sdk/dist/protocols/uniswap-v3/abis.js.map +1 -1
  698. package/sdk/dist/protocols/uniswap-v3/addresses.d.ts.map +1 -1
  699. package/sdk/dist/protocols/uniswap-v3/addresses.js +14 -0
  700. package/sdk/dist/protocols/uniswap-v3/addresses.js.map +1 -1
  701. package/sdk/dist/protocols/uniswap-v4/abis.d.ts +27 -15
  702. package/sdk/dist/protocols/uniswap-v4/abis.d.ts.map +1 -1
  703. package/sdk/dist/protocols/uniswap-v4/abis.js +25 -15
  704. package/sdk/dist/protocols/uniswap-v4/abis.js.map +1 -1
  705. package/sdk/dist/protocols/uniswap-v4/addresses.d.ts.map +1 -1
  706. package/sdk/dist/protocols/uniswap-v4/addresses.js +11 -0
  707. package/sdk/dist/protocols/uniswap-v4/addresses.js.map +1 -1
  708. package/sdk/dist/protocols/unitflow-v3/abis.d.ts +104 -0
  709. package/sdk/dist/protocols/unitflow-v3/abis.d.ts.map +1 -0
  710. package/sdk/dist/protocols/unitflow-v3/abis.js +70 -0
  711. package/sdk/dist/protocols/unitflow-v3/abis.js.map +1 -0
  712. package/sdk/dist/protocols/unitflow-v3/addresses.d.ts +3 -0
  713. package/sdk/dist/protocols/unitflow-v3/addresses.d.ts.map +1 -0
  714. package/sdk/dist/protocols/unitflow-v3/addresses.js +19 -0
  715. package/sdk/dist/protocols/unitflow-v3/addresses.js.map +1 -0
  716. package/sdk/dist/protocols/unitflow-v3/functions.d.ts +2 -0
  717. package/sdk/dist/protocols/unitflow-v3/functions.d.ts.map +1 -0
  718. package/sdk/dist/protocols/unitflow-v3/functions.js +9 -0
  719. package/sdk/dist/protocols/unitflow-v3/functions.js.map +1 -0
  720. package/sdk/dist/protocols/unitflow-v3/index.d.ts +5 -0
  721. package/sdk/dist/protocols/unitflow-v3/index.d.ts.map +1 -0
  722. package/sdk/dist/protocols/unitflow-v3/index.js +5 -0
  723. package/sdk/dist/protocols/unitflow-v3/index.js.map +1 -0
  724. package/sdk/dist/protocols/unitflow-v3/info.d.ts +3 -0
  725. package/sdk/dist/protocols/unitflow-v3/info.d.ts.map +1 -0
  726. package/sdk/dist/protocols/unitflow-v3/info.js +12 -0
  727. package/sdk/dist/protocols/unitflow-v3/info.js.map +1 -0
  728. package/sdk/dist/protocols/velodrome/addresses.d.ts.map +1 -1
  729. package/sdk/dist/protocols/velodrome/addresses.js +3 -1
  730. package/sdk/dist/protocols/velodrome/addresses.js.map +1 -1
  731. package/sdk/dist/protocols/venus/abis.d.ts +62 -1
  732. package/sdk/dist/protocols/venus/abis.d.ts.map +1 -1
  733. package/sdk/dist/protocols/venus/abis.js +48 -1
  734. package/sdk/dist/protocols/venus/abis.js.map +1 -1
  735. package/sdk/dist/protocols/vertex/abis.d.ts +16 -9
  736. package/sdk/dist/protocols/vertex/abis.d.ts.map +1 -1
  737. package/sdk/dist/protocols/vertex/abis.js +13 -4
  738. package/sdk/dist/protocols/vertex/abis.js.map +1 -1
  739. package/sdk/dist/protocols/wormhole/abis.d.ts +2 -2
  740. package/sdk/dist/protocols/wormhole/abis.js +2 -2
  741. package/sdk/dist/protocols/wormhole/addresses.d.ts.map +1 -1
  742. package/sdk/dist/protocols/wormhole/addresses.js +9 -0
  743. package/sdk/dist/protocols/wormhole/addresses.js.map +1 -1
  744. package/sdk/dist/protocols/zerolend/addresses.d.ts.map +1 -1
  745. package/sdk/dist/protocols/zerolend/addresses.js +2 -1
  746. package/sdk/dist/protocols/zerolend/addresses.js.map +1 -1
  747. package/sdk/dist/protocols/zerox/addresses.d.ts.map +1 -1
  748. package/sdk/dist/protocols/zerox/addresses.js +2 -1
  749. package/sdk/dist/protocols/zerox/addresses.js.map +1 -1
  750. package/sdk/dist/protocols/zksync-bridge/abis.d.ts +1 -1
  751. package/sdk/dist/protocols/zksync-bridge/abis.js +1 -1
  752. package/sdk/dist/recipes/cctp-transfer.d.ts +17 -6
  753. package/sdk/dist/recipes/cctp-transfer.d.ts.map +1 -1
  754. package/sdk/dist/recipes/cctp-transfer.js +7 -20
  755. package/sdk/dist/recipes/cctp-transfer.js.map +1 -1
  756. package/sdk/dist/recipes/index.d.ts +5 -15
  757. package/sdk/dist/recipes/index.d.ts.map +1 -1
  758. package/sdk/dist/recipes/index.js +19 -36
  759. package/sdk/dist/recipes/index.js.map +1 -1
  760. package/sdk/dist/recipes/settle.sauce.ts +15 -2
  761. package/sdk/dist/routes/chain-exports.generated.d.ts +97 -0
  762. package/sdk/dist/routes/chain-exports.generated.d.ts.map +1 -0
  763. package/sdk/dist/routes/chain-exports.generated.js +91 -0
  764. package/sdk/dist/routes/chain-exports.generated.js.map +1 -0
  765. package/sdk/dist/routes/compile-types.d.ts +3 -0
  766. package/sdk/dist/routes/compile-types.d.ts.map +1 -1
  767. package/sdk/dist/routes/composed.d.ts +13 -0
  768. package/sdk/dist/routes/composed.d.ts.map +1 -0
  769. package/sdk/dist/routes/composed.js +94 -0
  770. package/sdk/dist/routes/composed.js.map +1 -0
  771. package/sdk/dist/routes/encode.d.ts +6 -6
  772. package/sdk/dist/routes/globals.d.ts +19 -4
  773. package/sdk/dist/routes/globals.d.ts.map +1 -1
  774. package/sdk/dist/routes/globals.js +51 -85
  775. package/sdk/dist/routes/globals.js.map +1 -1
  776. package/sdk/dist/routes/index.d.ts +15 -6
  777. package/sdk/dist/routes/index.d.ts.map +1 -1
  778. package/sdk/dist/routes/index.js +17 -5
  779. package/sdk/dist/routes/index.js.map +1 -1
  780. package/sdk/dist/routes/intent-dsl.d.ts +60 -19
  781. package/sdk/dist/routes/intent-dsl.d.ts.map +1 -1
  782. package/sdk/dist/routes/intent-dsl.js +175 -67
  783. package/sdk/dist/routes/intent-dsl.js.map +1 -1
  784. package/sdk/dist/routes/intent-pot.d.ts +49 -0
  785. package/sdk/dist/routes/intent-pot.d.ts.map +1 -0
  786. package/sdk/dist/routes/intent-pot.js +46 -0
  787. package/sdk/dist/routes/intent-pot.js.map +1 -0
  788. package/sdk/dist/routes/intent-sugar.d.ts +97 -0
  789. package/sdk/dist/routes/intent-sugar.d.ts.map +1 -0
  790. package/sdk/dist/routes/intent-sugar.js +615 -0
  791. package/sdk/dist/routes/intent-sugar.js.map +1 -0
  792. package/sdk/dist/routes/nest-dynamic.d.ts +146 -0
  793. package/sdk/dist/routes/nest-dynamic.d.ts.map +1 -0
  794. package/sdk/dist/routes/nest-dynamic.js +308 -0
  795. package/sdk/dist/routes/nest-dynamic.js.map +1 -0
  796. package/sdk/dist/routes/nest.d.ts +16 -5
  797. package/sdk/dist/routes/nest.d.ts.map +1 -1
  798. package/sdk/dist/routes/nest.js +29 -10
  799. package/sdk/dist/routes/nest.js.map +1 -1
  800. package/sdk/dist/routes/portal.d.ts +7 -272
  801. package/sdk/dist/routes/portal.d.ts.map +1 -1
  802. package/sdk/dist/routes/portal.js +13 -92
  803. package/sdk/dist/routes/portal.js.map +1 -1
  804. package/sdk/dist/routes/protocol-rewrite.d.ts.map +1 -1
  805. package/sdk/dist/routes/protocol-rewrite.js +2 -0
  806. package/sdk/dist/routes/protocol-rewrite.js.map +1 -1
  807. package/sdk/dist/routes/rs-compile.d.ts +26 -15
  808. package/sdk/dist/routes/rs-compile.d.ts.map +1 -1
  809. package/sdk/dist/routes/rs-compile.js +57 -169
  810. package/sdk/dist/routes/rs-compile.js.map +1 -1
  811. package/sdk/dist/routes/sauce-route.d.ts +26 -1
  812. package/sdk/dist/routes/sauce-route.d.ts.map +1 -1
  813. package/sdk/dist/routes/sauce-route.js +109 -6
  814. package/sdk/dist/routes/sauce-route.js.map +1 -1
  815. package/sdk/dist/routes/source-globals.generated.d.ts +435 -20
  816. package/sdk/dist/routes/source-globals.generated.d.ts.map +1 -1
  817. package/sdk/dist/routes/template.d.ts +184 -0
  818. package/sdk/dist/routes/template.d.ts.map +1 -0
  819. package/sdk/dist/routes/template.js +338 -0
  820. package/sdk/dist/routes/template.js.map +1 -0
  821. package/sdk/dist/routes/token-registry.d.ts.map +1 -1
  822. package/sdk/dist/routes/token-registry.js +35 -0
  823. package/sdk/dist/routes/token-registry.js.map +1 -1
  824. package/sdk/dist/routes/token-rewrite.d.ts +1 -1
  825. package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
  826. package/sdk/dist/skills/loader.d.ts +2 -7
  827. package/sdk/dist/skills/loader.d.ts.map +1 -1
  828. package/sdk/dist/skills/loader.js +14 -25
  829. package/sdk/dist/skills/loader.js.map +1 -1
  830. package/sdk/dist/std/token/token.evm.js +56 -15
  831. package/sdk/dist/std/token/token.svm.js +24 -3
  832. package/sdk/dist/svm/accessors.d.ts +3 -3
  833. package/sdk/dist/svm/accessors.js +3 -3
  834. package/sdk/dist/svm/client.d.ts +1 -0
  835. package/sdk/dist/svm/client.d.ts.map +1 -1
  836. package/sdk/dist/svm/client.js +6 -0
  837. package/sdk/dist/svm/client.js.map +1 -1
  838. package/sdk/dist/svm/clusters.d.ts +6 -2
  839. package/sdk/dist/svm/clusters.d.ts.map +1 -1
  840. package/sdk/dist/svm/clusters.js +0 -2
  841. package/sdk/dist/svm/clusters.js.map +1 -1
  842. package/sdk/dist/svm/engine-artifacts.d.ts +24 -13
  843. package/sdk/dist/svm/engine-artifacts.d.ts.map +1 -1
  844. package/sdk/dist/svm/engine-artifacts.js +31 -26
  845. package/sdk/dist/svm/engine-artifacts.js.map +1 -1
  846. package/sdk/dist/svm/engine-public.d.ts.map +1 -1
  847. package/sdk/dist/svm/engine-public.js +2 -1
  848. package/sdk/dist/svm/engine-public.js.map +1 -1
  849. package/sdk/dist/svm/index.d.ts +0 -1
  850. package/sdk/dist/svm/index.d.ts.map +1 -1
  851. package/sdk/dist/svm/index.js +3 -1
  852. package/sdk/dist/svm/index.js.map +1 -1
  853. package/sdk/dist/svm/intent.d.ts.map +1 -1
  854. package/sdk/dist/svm/intent.js +4 -3
  855. package/sdk/dist/svm/intent.js.map +1 -1
  856. package/sdk/dist/svm/loader.d.ts.map +1 -1
  857. package/sdk/dist/svm/loader.js +2 -3
  858. package/sdk/dist/svm/loader.js.map +1 -1
  859. package/sdk/dist/svm/recipes/index.d.ts +57 -4
  860. package/sdk/dist/svm/recipes/index.d.ts.map +1 -1
  861. package/sdk/dist/svm/recipes/index.js +7 -9
  862. package/sdk/dist/svm/recipes/index.js.map +1 -1
  863. package/sdk/dist/svm/venues/alphaq/index.d.ts.map +1 -1
  864. package/sdk/dist/svm/venues/alphaq/index.js +4 -2
  865. package/sdk/dist/svm/venues/alphaq/index.js.map +1 -1
  866. package/sdk/dist/svm/venues/binaryfi/index.d.ts.map +1 -1
  867. package/sdk/dist/svm/venues/binaryfi/index.js +2 -1
  868. package/sdk/dist/svm/venues/binaryfi/index.js.map +1 -1
  869. package/sdk/dist/svm/venues/fluxbeam/index.d.ts.map +1 -1
  870. package/sdk/dist/svm/venues/fluxbeam/index.js +2 -7
  871. package/sdk/dist/svm/venues/fluxbeam/index.js.map +1 -1
  872. package/sdk/dist/svm/venues/jupiter-lend-earn/index.d.ts.map +1 -1
  873. package/sdk/dist/svm/venues/jupiter-lend-earn/index.js +2 -1
  874. package/sdk/dist/svm/venues/jupiter-lend-earn/index.js.map +1 -1
  875. package/sdk/dist/svm/venues/kipseli/index.d.ts.map +1 -1
  876. package/sdk/dist/svm/venues/kipseli/index.js +31 -14
  877. package/sdk/dist/svm/venues/kipseli/index.js.map +1 -1
  878. package/sdk/dist/svm/venues/mercurial/index.d.ts.map +1 -1
  879. package/sdk/dist/svm/venues/mercurial/index.js +2 -7
  880. package/sdk/dist/svm/venues/mercurial/index.js.map +1 -1
  881. package/sdk/dist/svm/venues/meteora-damm-v1-stable/index.d.ts.map +1 -1
  882. package/sdk/dist/svm/venues/meteora-damm-v1-stable/index.js +3 -2
  883. package/sdk/dist/svm/venues/meteora-damm-v1-stable/index.js.map +1 -1
  884. package/sdk/dist/svm/venues/mswap/index.d.ts.map +1 -1
  885. package/sdk/dist/svm/venues/mswap/index.js +2 -2
  886. package/sdk/dist/svm/venues/mswap/index.js.map +1 -1
  887. package/sdk/dist/svm/venues/orca-legacy-token-swap/index.d.ts.map +1 -1
  888. package/sdk/dist/svm/venues/orca-legacy-token-swap/index.js +2 -7
  889. package/sdk/dist/svm/venues/orca-legacy-token-swap/index.js.map +1 -1
  890. package/sdk/dist/svm/venues/saber-stableswap/index.d.ts.map +1 -1
  891. package/sdk/dist/svm/venues/saber-stableswap/index.js +2 -7
  892. package/sdk/dist/svm/venues/saber-stableswap/index.js.map +1 -1
  893. package/sdk/dist/svm/venues/sanctum-infinity/index.js +2 -2
  894. package/sdk/dist/svm/venues/sanctum-infinity/index.js.map +1 -1
  895. package/sdk/dist/svm/venues/sanctum-stake-pool/index.d.ts.map +1 -1
  896. package/sdk/dist/svm/venues/sanctum-stake-pool/index.js +2 -8
  897. package/sdk/dist/svm/venues/sanctum-stake-pool/index.js.map +1 -1
  898. package/sdk/dist/svm/venues/spl-token-swap-forks/index.d.ts.map +1 -1
  899. package/sdk/dist/svm/venues/spl-token-swap-forks/index.js +2 -7
  900. package/sdk/dist/svm/venues/spl-token-swap-forks/index.js.map +1 -1
  901. package/sdk/dist/svm/venues/stabble-common.d.ts.map +1 -1
  902. package/sdk/dist/svm/venues/stabble-common.js +3 -8
  903. package/sdk/dist/svm/venues/stabble-common.js.map +1 -1
  904. package/sdk/dist/svm/verify.d.ts.map +1 -1
  905. package/sdk/dist/svm/verify.js +1 -4
  906. package/sdk/dist/svm/verify.js.map +1 -1
  907. package/sdk/dist/swap/index.d.ts +4 -4
  908. package/sdk/dist/swap/index.d.ts.map +1 -1
  909. package/sdk/dist/swap/index.js +4 -4
  910. package/sdk/dist/swap/index.js.map +1 -1
  911. package/sdk/dist/swap/source.d.ts +0 -7
  912. package/sdk/dist/swap/source.d.ts.map +1 -1
  913. package/sdk/dist/swap/source.js +3 -11
  914. package/sdk/dist/swap/source.js.map +1 -1
  915. package/sdk/dist/token/api.d.ts +8 -9
  916. package/sdk/dist/token/api.d.ts.map +1 -1
  917. package/sdk/dist/token/api.js +4 -5
  918. package/sdk/dist/token/api.js.map +1 -1
  919. package/sdk/dist/token/evm.d.ts +5 -2
  920. package/sdk/dist/token/evm.d.ts.map +1 -1
  921. package/sdk/dist/token/evm.js +24 -13
  922. package/sdk/dist/token/evm.js.map +1 -1
  923. package/sdk/dist/token/index.d.ts +4 -4
  924. package/sdk/dist/token/index.js +4 -4
  925. package/sdk/dist/token/safe.d.ts +17 -0
  926. package/sdk/dist/token/safe.d.ts.map +1 -0
  927. package/sdk/dist/token/safe.js +211 -0
  928. package/sdk/dist/token/safe.js.map +1 -0
  929. package/sdk/dist/token/source.d.ts +0 -4
  930. package/sdk/dist/token/source.d.ts.map +1 -1
  931. package/sdk/dist/token/source.js +7 -10
  932. package/sdk/dist/token/source.js.map +1 -1
  933. package/sdk/dist/verify/decode.d.ts +6 -6
  934. package/sdk/dist/verify/decode.js +7 -7
  935. package/sdk/dist/verify/decode.js.map +1 -1
  936. package/sdk/dist/verify/index.js +2 -2
  937. package/sdk/dist/verify/intent.js +2 -2
  938. package/sdk/dist/verify/vectors.d.ts +1 -1
  939. package/sdk/dist/verify/vectors.d.ts.map +1 -1
  940. package/sdk/dist/verify/vectors.js +2 -2
  941. package/sdk/dist/verify/vectors.js.map +1 -1
  942. package/sdk/dist/verify/wire.d.ts +21 -4
  943. package/sdk/dist/verify/wire.d.ts.map +1 -1
  944. package/sdk/dist/verify/wire.js +21 -4
  945. package/sdk/dist/verify/wire.js.map +1 -1
  946. package/sdk/dist/wasm-compiler.d.ts +31 -0
  947. package/sdk/dist/wasm-compiler.d.ts.map +1 -0
  948. package/sdk/dist/wasm-compiler.js +52 -0
  949. package/sdk/dist/wasm-compiler.js.map +1 -0
  950. package/sdk/src/protocols/aave-v4/AaveV4HubABI.json +67 -0
  951. package/sdk/src/protocols/aave-v4/AaveV4SpokeABI.json +215 -0
  952. package/sdk/src/protocols/aave-v4/abis.ts +139 -0
  953. package/sdk/src/protocols/aave-v4/addresses.ts +66 -0
  954. package/sdk/src/protocols/aave-v4/functions.ts +39 -0
  955. package/sdk/src/protocols/aave-v4/index.ts +4 -0
  956. package/sdk/src/protocols/aave-v4/info.ts +14 -0
  957. package/sdk/src/protocols/across/AcrossHubPoolABI.json +2 -2
  958. package/sdk/src/protocols/across/AcrossSpokePoolABI.json +27 -11
  959. package/sdk/src/protocols/across/abis.ts +16 -8
  960. package/sdk/src/protocols/across/addresses.ts +10 -0
  961. package/sdk/src/protocols/across/functions.ts +2 -2
  962. package/sdk/src/protocols/aerodrome-slipstream/AeroMetarouterABI.json +24 -0
  963. package/sdk/src/protocols/aerodrome-slipstream/SlipstreamCLFactoryABI.json +58 -0
  964. package/sdk/src/protocols/aerodrome-slipstream/SlipstreamPositionManagerABI.json +77 -0
  965. package/sdk/src/protocols/aerodrome-slipstream/abis.ts +74 -0
  966. package/sdk/src/protocols/aerodrome-slipstream/addresses.ts +40 -0
  967. package/sdk/src/protocols/aerodrome-slipstream/functions.ts +8 -0
  968. package/sdk/src/protocols/aerodrome-slipstream/index.ts +4 -0
  969. package/sdk/src/protocols/aerodrome-slipstream/info.ts +14 -0
  970. package/sdk/src/protocols/aevo/DepositContractABI.json +23 -2
  971. package/sdk/src/protocols/aevo/abis.ts +10 -2
  972. package/sdk/src/protocols/aevo/functions.ts +2 -2
  973. package/sdk/src/protocols/alchemix/AlchemistABI.json +1 -1
  974. package/sdk/src/protocols/alchemix/abis.ts +1 -1
  975. package/sdk/src/protocols/ambient/CrocSwapDexABI.json +2 -2
  976. package/sdk/src/protocols/ambient/abis.ts +3 -2
  977. package/sdk/src/protocols/ambient/addresses.ts +2 -1
  978. package/sdk/src/protocols/arrakis/ArrakisRouterABI.json +5 -1
  979. package/sdk/src/protocols/arrakis/ArrakisVaultABI.json +0 -16
  980. package/sdk/src/protocols/arrakis/abis.ts +2 -11
  981. package/sdk/src/protocols/arrakis/functions.ts +2 -1
  982. package/sdk/src/protocols/axelar/AxelarITSABI.json +1 -1
  983. package/sdk/src/protocols/axelar/abis.ts +1 -1
  984. package/sdk/src/protocols/balancer-v2/BalancerV2VaultABI.json +7 -7
  985. package/sdk/src/protocols/balancer-v2/abis.ts +7 -7
  986. package/sdk/src/protocols/cbeth/CbETHABI.json +10 -1
  987. package/sdk/src/protocols/cbeth/abis.ts +6 -2
  988. package/sdk/src/protocols/cctp/TokenMessengerABI.json +30 -9
  989. package/sdk/src/protocols/cctp/abis.ts +3 -1
  990. package/sdk/src/protocols/cctp/addresses.ts +3 -0
  991. package/sdk/src/protocols/chainlink/AggregatorV3ABI.json +3 -3
  992. package/sdk/src/protocols/chainlink/FeedRegistryABI.json +3 -3
  993. package/sdk/src/protocols/chainlink/abis.ts +6 -6
  994. package/sdk/src/protocols/chainlink/addresses.ts +10 -0
  995. package/sdk/src/protocols/chainlink-ccip/CCIPRouterABI.json +1 -1
  996. package/sdk/src/protocols/chainlink-ccip/abis.ts +1 -1
  997. package/sdk/src/protocols/chainlink-ccip/addresses.ts +9 -0
  998. package/sdk/src/protocols/circle-gateway/GatewayMinterABI.json +49 -0
  999. package/sdk/src/protocols/circle-gateway/GatewayWalletABI.json +111 -0
  1000. package/sdk/src/protocols/circle-gateway/abis.ts +86 -0
  1001. package/sdk/src/protocols/circle-gateway/addresses.ts +39 -0
  1002. package/sdk/src/protocols/circle-gateway/functions.ts +28 -0
  1003. package/sdk/src/protocols/circle-gateway/index.ts +4 -0
  1004. package/sdk/src/protocols/circle-gateway/info.ts +14 -0
  1005. package/sdk/src/protocols/compound-v2/CErc20ABI.json +2 -2
  1006. package/sdk/src/protocols/compound-v2/abis.ts +2 -2
  1007. package/sdk/src/protocols/connext/EverclearSpokeABI.json +60 -6
  1008. package/sdk/src/protocols/connext/abis.ts +27 -5
  1009. package/sdk/src/protocols/connext/addresses.ts +1 -7
  1010. package/sdk/src/protocols/connext/functions.ts +3 -2
  1011. package/sdk/src/protocols/curve/CurveRouterNGABI.json +37 -0
  1012. package/sdk/src/protocols/curve/CurveStableSwapABI.json +7 -7
  1013. package/sdk/src/protocols/curve/CurveThreePoolABI.json +117 -0
  1014. package/sdk/src/protocols/curve/abis.ts +91 -7
  1015. package/sdk/src/protocols/debridge/DlnDestinationABI.json +7 -7
  1016. package/sdk/src/protocols/debridge/DlnSourceABI.json +1 -1
  1017. package/sdk/src/protocols/debridge/abis.ts +5 -5
  1018. package/sdk/src/protocols/debridge/addresses.ts +11 -0
  1019. package/sdk/src/protocols/eco-routes/abis.ts +633 -0
  1020. package/sdk/src/protocols/eco-routes/addresses.generated.ts +589 -0
  1021. package/sdk/src/protocols/eco-routes/addresses.ts +27 -0
  1022. package/sdk/src/protocols/eco-routes/functions.ts +45 -0
  1023. package/sdk/src/protocols/eco-routes/index.ts +5 -0
  1024. package/sdk/src/protocols/eco-routes/info.ts +14 -0
  1025. package/sdk/src/protocols/eco-routes/lookup.ts +215 -0
  1026. package/sdk/src/protocols/eigenlayer/DelegationManagerABI.json +2 -2
  1027. package/sdk/src/protocols/eigenlayer/StrategyManagerABI.json +2 -2
  1028. package/sdk/src/protocols/eigenlayer/abis.ts +5 -4
  1029. package/sdk/src/protocols/ens/ENSRegistryABI.json +4 -4
  1030. package/sdk/src/protocols/ens/abis.ts +4 -4
  1031. package/sdk/src/protocols/etherfi/WeETHABI.json +1 -1
  1032. package/sdk/src/protocols/etherfi/abis.ts +2 -1
  1033. package/sdk/src/protocols/euler-v2/EVCABI.json +2 -2
  1034. package/sdk/src/protocols/euler-v2/abis.ts +2 -2
  1035. package/sdk/src/protocols/fluid/FluidLendingABI.json +20 -37
  1036. package/sdk/src/protocols/fluid/FluidVaultABI.json +41 -0
  1037. package/sdk/src/protocols/fluid/abis.ts +41 -18
  1038. package/sdk/src/protocols/fluid/functions.ts +18 -16
  1039. package/sdk/src/protocols/gains-network/DiamondABI.json +49 -37
  1040. package/sdk/src/protocols/gains-network/abis.ts +26 -21
  1041. package/sdk/src/protocols/gains-network/functions.ts +6 -6
  1042. package/sdk/src/protocols/gamma/UniProxyLegacyABI.json +62 -0
  1043. package/sdk/src/protocols/gamma/abis.ts +31 -0
  1044. package/sdk/src/protocols/gamma/addresses.ts +2 -7
  1045. package/sdk/src/protocols/gamma/functions.ts +10 -0
  1046. package/sdk/src/protocols/gelato/GelatoAutomateABI.json +2 -2
  1047. package/sdk/src/protocols/gelato/abis.ts +2 -2
  1048. package/sdk/src/protocols/gmx-v1/PositionRouterABI.json +21 -3
  1049. package/sdk/src/protocols/gmx-v1/abis.ts +5 -3
  1050. package/sdk/src/protocols/gmx-v1/functions.ts +2 -2
  1051. package/sdk/src/protocols/gmx-v2/ExchangeRouterABI.json +13 -5
  1052. package/sdk/src/protocols/gmx-v2/abis.ts +7 -4
  1053. package/sdk/src/protocols/gmx-v2/addresses.ts +3 -1
  1054. package/sdk/src/protocols/gmx-v2/functions.ts +4 -2
  1055. package/sdk/src/protocols/harvest/VaultABI.json +12 -2
  1056. package/sdk/src/protocols/harvest/abis.ts +2 -2
  1057. package/sdk/src/protocols/hegic/HegicABI.json +6 -2
  1058. package/sdk/src/protocols/hegic/abis.ts +7 -2
  1059. package/sdk/src/protocols/hegic/addresses.ts +1 -0
  1060. package/sdk/src/protocols/hegic/functions.ts +3 -3
  1061. package/sdk/src/protocols/hop/addresses.ts +5 -2
  1062. package/sdk/src/protocols/hyperlane/HyperlaneMailboxABI.json +5 -5
  1063. package/sdk/src/protocols/hyperlane/abis.ts +5 -5
  1064. package/sdk/src/protocols/hyperlane/addresses.ts +9 -0
  1065. package/sdk/src/protocols/index.ts +13 -0
  1066. package/sdk/src/protocols/kim/KimRouterABI.json +8 -27
  1067. package/sdk/src/protocols/kim/abis.ts +6 -12
  1068. package/sdk/src/protocols/kim/functions.ts +3 -2
  1069. package/sdk/src/protocols/kyberswap/KyberSwapElasticRouterABI.json +1 -1
  1070. package/sdk/src/protocols/kyberswap/KyberSwapMetaAggregationRouterABI.json +52 -18
  1071. package/sdk/src/protocols/kyberswap/abis.ts +21 -8
  1072. package/sdk/src/protocols/kyberswap/addresses.ts +12 -2
  1073. package/sdk/src/protocols/kyberswap-aggregator/addresses.ts +12 -1
  1074. package/sdk/src/protocols/layerbank/LTokenABI.json +19 -29
  1075. package/sdk/src/protocols/layerbank/LayerBankCoreABI.json +87 -2
  1076. package/sdk/src/protocols/layerbank/abis.ts +69 -17
  1077. package/sdk/src/protocols/layerbank/addresses.ts +3 -1
  1078. package/sdk/src/protocols/layerbank/functions.ts +18 -16
  1079. package/sdk/src/protocols/layerzero/LayerZeroEndpointV2ABI.json +3 -3
  1080. package/sdk/src/protocols/layerzero/abis.ts +3 -3
  1081. package/sdk/src/protocols/layerzero/addresses.ts +11 -1
  1082. package/sdk/src/protocols/level-finance/LiquidityPoolABI.json +8 -0
  1083. package/sdk/src/protocols/level-finance/abis.ts +2 -0
  1084. package/sdk/src/protocols/level-finance/functions.ts +4 -4
  1085. package/sdk/src/protocols/lifi/LiFiDiamondABI.json +54 -4
  1086. package/sdk/src/protocols/lifi/abis.ts +24 -4
  1087. package/sdk/src/protocols/lifi/addresses.ts +9 -0
  1088. package/sdk/src/protocols/lifi/functions.ts +5 -2
  1089. package/sdk/src/protocols/liquity-v1/BorrowerOperationsABI.json +8 -0
  1090. package/sdk/src/protocols/liquity-v1/abis.ts +7 -1
  1091. package/sdk/src/protocols/liquity-v1/functions.ts +1 -1
  1092. package/sdk/src/protocols/mantle-meth/METHABI.json +0 -46
  1093. package/sdk/src/protocols/mantle-meth/METHStakingABI.json +50 -0
  1094. package/sdk/src/protocols/mantle-meth/abis.ts +23 -17
  1095. package/sdk/src/protocols/mantle-meth/addresses.ts +3 -0
  1096. package/sdk/src/protocols/mantle-meth/functions.ts +4 -4
  1097. package/sdk/src/protocols/maverick/MaverickV2FactoryABI.json +8 -0
  1098. package/sdk/src/protocols/maverick/MaverickV2RouterABI.json +4 -0
  1099. package/sdk/src/protocols/maverick/abis.ts +7 -1
  1100. package/sdk/src/protocols/morpho-blue/addresses.ts +10 -0
  1101. package/sdk/src/protocols/mux-protocol/LiquidityPoolABI.json +45 -11
  1102. package/sdk/src/protocols/mux-protocol/OrderBookABI.json +59 -17
  1103. package/sdk/src/protocols/mux-protocol/abis.ts +55 -22
  1104. package/sdk/src/protocols/mux-protocol/functions.ts +8 -8
  1105. package/sdk/src/protocols/olympus/StakingABI.json +8 -3
  1106. package/sdk/src/protocols/olympus/abis.ts +2 -2
  1107. package/sdk/src/protocols/oneinch/AggregationRouterV6ABI.json +5 -5
  1108. package/sdk/src/protocols/oneinch/abis.ts +5 -3
  1109. package/sdk/src/protocols/oneinch/functions.ts +2 -2
  1110. package/sdk/src/protocols/openocean/OpenOceanExchangeV2ABI.json +19 -1
  1111. package/sdk/src/protocols/openocean/abis.ts +11 -1
  1112. package/sdk/src/protocols/openocean/functions.ts +1 -1
  1113. package/sdk/src/protocols/opyn/ControllerABI.json +6 -1
  1114. package/sdk/src/protocols/opyn/abis.ts +1 -1
  1115. package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3FactoryABI.json +1 -1
  1116. package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3NFPMABI.json +3 -3
  1117. package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3SmartRouterABI.json +2 -2
  1118. package/sdk/src/protocols/pancakeswap-v3/abis.ts +6 -6
  1119. package/sdk/src/protocols/paraswap/AugustusV5ABI.json +1 -1
  1120. package/sdk/src/protocols/paraswap/abis.ts +1 -1
  1121. package/sdk/src/protocols/pendle/PendleRouterABI.json +392 -6
  1122. package/sdk/src/protocols/pendle/abis.ts +160 -6
  1123. package/sdk/src/protocols/permit2/Permit2ABI.json +1 -1
  1124. package/sdk/src/protocols/permit2/abis.ts +1 -1
  1125. package/sdk/src/protocols/permit2/addresses.ts +9 -0
  1126. package/sdk/src/protocols/perpetual-protocol/ClearingHouseABI.json +61 -49
  1127. package/sdk/src/protocols/perpetual-protocol/abis.ts +27 -14
  1128. package/sdk/src/protocols/premia/DiamondABI.json +24 -24
  1129. package/sdk/src/protocols/premia/abis.ts +20 -10
  1130. package/sdk/src/protocols/premia/addresses.ts +3 -8
  1131. package/sdk/src/protocols/premia/functions.ts +8 -8
  1132. package/sdk/src/protocols/pyth/PythOracleABI.json +3 -3
  1133. package/sdk/src/protocols/pyth/abis.ts +6 -3
  1134. package/sdk/src/protocols/reflexer/ETHJoinABI.json +5 -1
  1135. package/sdk/src/protocols/reflexer/SAFEEngineABI.json +4 -4
  1136. package/sdk/src/protocols/reflexer/abis.ts +10 -6
  1137. package/sdk/src/protocols/renzo/RestakeManagerABI.json +1 -1
  1138. package/sdk/src/protocols/renzo/abis.ts +1 -1
  1139. package/sdk/src/protocols/sablier/LockupLinearABI.json +2 -2
  1140. package/sdk/src/protocols/sablier/abis.ts +2 -2
  1141. package/sdk/src/protocols/safe/addresses.ts +10 -0
  1142. package/sdk/src/protocols/seaport/SeaportABI.json +87 -5
  1143. package/sdk/src/protocols/seaport/abis.ts +41 -5
  1144. package/sdk/src/protocols/seaport/addresses.ts +10 -0
  1145. package/sdk/src/protocols/seaport/functions.ts +1 -0
  1146. package/sdk/src/protocols/silo/SiloABI.json +4 -0
  1147. package/sdk/src/protocols/silo/abis.ts +4 -1
  1148. package/sdk/src/protocols/silo/addresses.ts +2 -1
  1149. package/sdk/src/protocols/silo/functions.ts +2 -1
  1150. package/sdk/src/protocols/socket/SocketGatewayABI.json +1 -17
  1151. package/sdk/src/protocols/socket/abis.ts +3 -11
  1152. package/sdk/src/protocols/socket/functions.ts +1 -1
  1153. package/sdk/src/protocols/spookyswap/addresses.ts +2 -1
  1154. package/sdk/src/protocols/squid/SquidRouterABI.json +42 -26
  1155. package/sdk/src/protocols/squid/abis.ts +19 -13
  1156. package/sdk/src/protocols/squid/functions.ts +2 -2
  1157. package/sdk/src/protocols/stargate/StargatePoolABI.json +31 -3
  1158. package/sdk/src/protocols/stargate/abis.ts +19 -3
  1159. package/sdk/src/protocols/superfluid/CFAForwarderABI.json +2 -2
  1160. package/sdk/src/protocols/superfluid/abis.ts +2 -2
  1161. package/sdk/src/protocols/sushiswap-v2/addresses.ts +2 -1
  1162. package/sdk/src/protocols/swell/RswETHABI.json +1 -6
  1163. package/sdk/src/protocols/swell/SwETHABI.json +1 -6
  1164. package/sdk/src/protocols/swell/abis.ts +4 -2
  1165. package/sdk/src/protocols/swell/functions.ts +4 -2
  1166. package/sdk/src/protocols/synapse/addresses.ts +2 -1
  1167. package/sdk/src/protocols/synthetix-v3/PerpsMarketProxyABI.json +54 -5
  1168. package/sdk/src/protocols/synthetix-v3/abis.ts +27 -5
  1169. package/sdk/src/protocols/synthetix-v3/addresses.ts +2 -1
  1170. package/sdk/src/protocols/synthra-v3/SynthraV3FactoryABI.json +54 -0
  1171. package/sdk/src/protocols/synthra-v3/SynthraV3NonfungiblePositionManagerABI.json +212 -0
  1172. package/sdk/src/protocols/synthra-v3/SynthraV3QuoterV2ABI.json +55 -0
  1173. package/sdk/src/protocols/synthra-v3/SynthraV3SwapRouter02ABI.json +168 -0
  1174. package/sdk/src/protocols/synthra-v3/abis.ts +244 -0
  1175. package/sdk/src/protocols/synthra-v3/addresses.ts +17 -0
  1176. package/sdk/src/protocols/synthra-v3/functions.ts +8 -0
  1177. package/sdk/src/protocols/synthra-v3/index.ts +4 -0
  1178. package/sdk/src/protocols/synthra-v3/info.ts +13 -0
  1179. package/sdk/src/protocols/thales/PositionalMarketABI.json +16 -0
  1180. package/sdk/src/protocols/thales/SpeedMarketsAMMABI.json +57 -22
  1181. package/sdk/src/protocols/thales/ThalesAMMABI.json +4 -11
  1182. package/sdk/src/protocols/thales/abis.ts +28 -11
  1183. package/sdk/src/protocols/thales/functions.ts +5 -6
  1184. package/sdk/src/protocols/thruster/ThrusterV3SwapRouterABI.json +1 -1
  1185. package/sdk/src/protocols/thruster/abis.ts +1 -1
  1186. package/sdk/src/protocols/trader-joe/LBRouterABI.json +3 -3
  1187. package/sdk/src/protocols/trader-joe/abis.ts +2 -2
  1188. package/sdk/src/protocols/uniswap-v2/addresses.ts +10 -0
  1189. package/sdk/src/protocols/uniswap-v3/UniswapV3FactoryABI.json +2 -2
  1190. package/sdk/src/protocols/uniswap-v3/UniswapV3NonfungiblePositionManagerABI.json +3 -3
  1191. package/sdk/src/protocols/uniswap-v3/UniswapV3QuoterV2ABI.json +1 -1
  1192. package/sdk/src/protocols/uniswap-v3/UniswapV3SwapRouter02ABI.json +168 -0
  1193. package/sdk/src/protocols/uniswap-v3/UniswapV3SwapRouterABI.json +2 -2
  1194. package/sdk/src/protocols/uniswap-v3/abis.ts +91 -8
  1195. package/sdk/src/protocols/uniswap-v3/addresses.ts +14 -0
  1196. package/sdk/src/protocols/uniswap-v4/UniswapV4PoolManagerABI.json +15 -15
  1197. package/sdk/src/protocols/uniswap-v4/UniswapV4UniversalRouterABI.json +16 -0
  1198. package/sdk/src/protocols/uniswap-v4/abis.ts +25 -15
  1199. package/sdk/src/protocols/uniswap-v4/addresses.ts +11 -0
  1200. package/sdk/src/protocols/unitflow-v3/UnitFlowV3FactoryABI.json +46 -0
  1201. package/sdk/src/protocols/unitflow-v3/UnitFlowV3QuoterABI.json +37 -0
  1202. package/sdk/src/protocols/unitflow-v3/UnitFlowV3RouterABI.json +67 -0
  1203. package/sdk/src/protocols/unitflow-v3/abis.ts +71 -0
  1204. package/sdk/src/protocols/unitflow-v3/addresses.ts +20 -0
  1205. package/sdk/src/protocols/unitflow-v3/functions.ts +8 -0
  1206. package/sdk/src/protocols/unitflow-v3/index.ts +4 -0
  1207. package/sdk/src/protocols/unitflow-v3/info.ts +14 -0
  1208. package/sdk/src/protocols/velodrome/addresses.ts +3 -1
  1209. package/sdk/src/protocols/venus/VBNBABI.json +86 -0
  1210. package/sdk/src/protocols/venus/VTokenABI.json +1 -1
  1211. package/sdk/src/protocols/venus/abis.ts +49 -1
  1212. package/sdk/src/protocols/vertex/ClearinghouseABI.json +20 -10
  1213. package/sdk/src/protocols/vertex/EndpointABI.json +1 -1
  1214. package/sdk/src/protocols/vertex/abis.ts +13 -4
  1215. package/sdk/src/protocols/wormhole/WormholeTokenBridgeABI.json +2 -2
  1216. package/sdk/src/protocols/wormhole/abis.ts +2 -2
  1217. package/sdk/src/protocols/wormhole/addresses.ts +9 -0
  1218. package/sdk/src/protocols/zerolend/addresses.ts +2 -1
  1219. package/sdk/src/protocols/zerox/addresses.ts +2 -1
  1220. package/sdk/src/protocols/zksync-bridge/ZkSyncDiamondProxyABI.json +1 -1
  1221. package/sdk/src/protocols/zksync-bridge/abis.ts +1 -1
  1222. package/sdk/src/skills/aave-v4.md +91 -0
  1223. package/sdk/src/skills/across.md +28 -10
  1224. package/sdk/src/skills/aerodrome-slipstream.md +57 -0
  1225. package/sdk/src/skills/aerodrome.md +1 -0
  1226. package/sdk/src/skills/aevo.md +12 -4
  1227. package/sdk/src/skills/ambient.md +2 -2
  1228. package/sdk/src/skills/arrakis.md +3 -3
  1229. package/sdk/src/skills/cbeth.md +2 -2
  1230. package/sdk/src/skills/chainlink-ccip.md +3 -2
  1231. package/sdk/src/skills/chainlink.md +1 -1
  1232. package/sdk/src/skills/circle-gateway.md +98 -0
  1233. package/sdk/src/skills/compound-v2.md +2 -2
  1234. package/sdk/src/skills/connext.md +8 -7
  1235. package/sdk/src/skills/curve.md +17 -2
  1236. package/sdk/src/skills/debridge.md +3 -2
  1237. package/sdk/src/skills/eigenlayer.md +1 -1
  1238. package/sdk/src/skills/etherfi.md +1 -1
  1239. package/sdk/src/skills/fluid.md +46 -39
  1240. package/sdk/src/skills/gains-network.md +13 -21
  1241. package/sdk/src/skills/gamma.md +12 -6
  1242. package/sdk/src/skills/gmx-v1.md +4 -2
  1243. package/sdk/src/skills/gmx-v2.md +6 -2
  1244. package/sdk/src/skills/harvest.md +2 -2
  1245. package/sdk/src/skills/hegic.md +9 -8
  1246. package/sdk/src/skills/hop.md +8 -8
  1247. package/sdk/src/skills/hyperlane.md +4 -3
  1248. package/sdk/src/skills/index.md +84 -77
  1249. package/sdk/src/skills/kim.md +11 -14
  1250. package/sdk/src/skills/kyberswap-aggregator.md +5 -3
  1251. package/sdk/src/skills/kyberswap.md +6 -6
  1252. package/sdk/src/skills/layerbank.md +41 -35
  1253. package/sdk/src/skills/layerzero.md +3 -2
  1254. package/sdk/src/skills/level-finance.md +6 -4
  1255. package/sdk/src/skills/lido.md +5 -5
  1256. package/sdk/src/skills/lifi.md +41 -23
  1257. package/sdk/src/skills/liquity-v1.md +6 -2
  1258. package/sdk/src/skills/loader.ts +15 -25
  1259. package/sdk/src/skills/mantle-meth.md +13 -5
  1260. package/sdk/src/skills/maverick.md +3 -3
  1261. package/sdk/src/skills/morpho-blue.md +1 -1
  1262. package/sdk/src/skills/mux-protocol.md +21 -17
  1263. package/sdk/src/skills/oneinch.md +4 -3
  1264. package/sdk/src/skills/openocean.md +2 -2
  1265. package/sdk/src/skills/opyn.md +1 -1
  1266. package/sdk/src/skills/permit2.md +1 -1
  1267. package/sdk/src/skills/perpetual-protocol.md +2 -2
  1268. package/sdk/src/skills/premia.md +21 -21
  1269. package/sdk/src/skills/reflexer.md +1 -1
  1270. package/sdk/src/skills/renzo.md +1 -1
  1271. package/sdk/src/skills/safe.md +1 -1
  1272. package/sdk/src/skills/seaport.md +3 -2
  1273. package/sdk/src/skills/silo.md +4 -3
  1274. package/sdk/src/skills/socket.md +4 -5
  1275. package/sdk/src/skills/spookyswap.md +2 -2
  1276. package/sdk/src/skills/squid.md +18 -10
  1277. package/sdk/src/skills/stargate.md +1 -1
  1278. package/sdk/src/skills/sushiswap-v2.md +1 -1
  1279. package/sdk/src/skills/swell.md +6 -4
  1280. package/sdk/src/skills/synapse.md +1 -1
  1281. package/sdk/src/skills/synthetix-v3.md +1 -1
  1282. package/sdk/src/skills/synthra-v3.md +57 -0
  1283. package/sdk/src/skills/thales.md +12 -10
  1284. package/sdk/src/skills/trader-joe.md +1 -1
  1285. package/sdk/src/skills/uniswap-v2.md +2 -1
  1286. package/sdk/src/skills/uniswap-v3.md +14 -4
  1287. package/sdk/src/skills/uniswap-v4.md +3 -1
  1288. package/sdk/src/skills/unitflow-v3.md +62 -0
  1289. package/sdk/src/skills/velodrome.md +2 -2
  1290. package/sdk/src/skills/venus.md +10 -2
  1291. package/sdk/src/skills/vertex.md +1 -1
  1292. package/sdk/src/skills/wormhole.md +1 -1
  1293. package/sdk/src/skills/zerolend.md +1 -1
  1294. package/sdk/src/skills/zerox.md +1 -1
  1295. package/sdk/src/skills/zksync-bridge.md +1 -1
  1296. package/actions/dist/megas-swap.d.ts +0 -97
  1297. package/actions/dist/megas-swap.d.ts.map +0 -1
  1298. package/actions/dist/megas-swap.js +0 -286
  1299. package/sdk/dist/routes/globals.generated.d.ts +0 -94
  1300. package/sdk/dist/routes/globals.generated.d.ts.map +0 -1
  1301. package/sdk/dist/routes/globals.generated.js +0 -2
  1302. package/sdk/dist/routes/globals.generated.js.map +0 -1
@@ -1,197 +1,332 @@
1
1
  /**
2
- * Routing actions -> a SauceScript program, compiled by the published Rust/wasm compiler.
2
+ * Action programs -> SauceScript, compiled by the published Rust/wasm compiler.
3
3
  *
4
- * This used to compose builder nodes (`s.int`, `s.externalCall`, `chain.join`) against the in-repo
5
- * TypeScript compiler's `Saucer`. That compiler is retired and the Rust one's only surface is
6
- * `compile()` over source text, so every action now emits SauceScript STATEMENTS instead — the
7
- * idiom `sdk/src/deposit/templates.ts` and `sdk/src/token/svm.ts` already use.
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
- * WHAT DID NOT CHANGE: the calldata. Every action still targets the same address with the same
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
- * - the per-build scratch-slot counters (`curveScratchCounter`, `v2ScratchCounter`) were
15
- * module-level and leaked across builds; they are the [`Emitter`]'s now, so a program's names
16
- * depend only on that program;
17
- * - a call whose `uint256` return value is consumed binds it to a local. The builder returned an
18
- * expression that re-issued the call on each use, which is one on-chain call per use.
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 { arrayLiteral, bindBytes, bindConst, calldata, concatCalldata, decodeUint256, encodeArgs, formatBigint, fn, hexToBytes, newEmitter, selector, slotVar, tupleLiteral as tuple, } from "./emit.js";
21
- import { compileEvm } from "./compile.js";
22
- import { encodeAbiParameters } from "viem";
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 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000");
25
- /** V4 ActionConstants.OPEN_DELTA — signals "take all owed" in a TAKE action. */
26
- const V4_OPEN_DELTA = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
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
- const MSG_SENDER = "ctx.msgSender()";
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 formatBigint(BigInt(value));
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 ? "1n" : "0n";
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
- function evmCall(target, value, data) {
38
- return `evm.call(${target}, ${value}, ${data})`;
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
- * Resolve the amount for an action:
45
- * 1. Explicit amount string (highest priority)
46
- * 2. amountRef — the local a previous action saved its output to
47
- * 3. lastOutputSlot — implicit chain from the previous action
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 resolveAmountIn(explicitAmount, amountRef, lastOutputSlot) {
50
- if (explicitAmount !== undefined)
51
- return word(explicitAmount);
52
- if (amountRef !== undefined)
53
- return slotVar(amountRef);
54
- if (lastOutputSlot !== undefined)
55
- return lastOutputSlot;
56
- throw new Error("No amount specified: provide an explicit amount, amountRef, or chain from a previous action");
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
- /** Extract the explicit amount field from any action type. */
59
- function getExplicitAmount(action) {
60
- const a = action;
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
- // Dispatcher
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 lastOutputSlot;
74
- for (let i = 0; i < actions.length; i++) {
75
- const action = actions[i];
76
- const amountIn = resolveAmountIn(getExplicitAmount(action), action.amountRef, lastOutputSlot);
77
- const nextAction = actions[i + 1];
78
- const needsStore = action.saveOutputAs !== undefined ||
79
- (nextAction !== undefined &&
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
- if (needsStore) {
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
- lastOutputSlot = slot;
203
+ previous = slot;
89
204
  }
90
- }
91
- return `${fn("main", [], "void", body)}\n`;
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
- export function actionsToSauce(actions) {
94
- const source = actionsToSauceSource(actions);
95
- return source === "" ? new Uint8Array() : compileEvm(source);
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
- export function actionToSauce(action) {
98
- return actionsToSauce([action]);
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
- * Emit the statements for one action.
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 buildAction(emit, action, amountIn, needsOutput) {
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(emit, action, amountIn, needsOutput);
247
+ return uniswapV3ExactInput(l, action, amount, needsOutput);
113
248
  case "uniswapV3ExactInputMultiHop":
114
- return uniswapV3ExactInputMultiHop(emit, action, amountIn, needsOutput);
249
+ return uniswapV3ExactInputMultiHop(l, action, amount, needsOutput);
115
250
  case "uniswapV4ExactInput":
116
- return uniswapV4ExactInput(emit, action, amountIn, needsOutput);
251
+ return uniswapV4ExactInput(l, action, amount, needsOutput);
117
252
  case "uniswapV4ExactInputMultiHop":
118
- return uniswapV4ExactInputMultiHop(emit, action, amountIn, needsOutput);
253
+ return uniswapV4ExactInputMultiHop(l, action, amount, needsOutput);
119
254
  case "curveSwap":
120
- return curveSwap(emit, action, amountIn, needsOutput);
255
+ return curveSwap(l, action, amount, needsOutput);
256
+ case "curveRouterNGSwap":
257
+ return curveRouterNGSwap(l, action, amount, needsOutput);
121
258
  case "balancerV2Swap":
122
- return balancerV2Swap(emit, action, amountIn, needsOutput);
259
+ return balancerV2Swap(l, action, amount, needsOutput);
123
260
  case "balancerV2BatchSwap":
124
- return balancerV2BatchSwap(emit, action, amountIn, needsOutput);
261
+ return balancerV2BatchSwap(l, action, amount, needsOutput);
125
262
  case "balancerV3Swap":
126
- return balancerV3Swap(emit, action, amountIn, needsOutput);
263
+ return balancerV3Swap(l, action, amount, needsOutput);
127
264
  case "uniswapV2Swap":
128
- return uniswapV2Swap(emit, action, amountIn, needsOutput);
129
- case "curveRouterNGSwap":
130
- return curveRouterNGSwap(emit, action, amountIn, needsOutput);
265
+ return uniswapV2Swap(l, action, amount, needsOutput);
131
266
  case "ambientSwap":
132
- return ambientSwap(emit, action, amountIn, needsOutput);
267
+ return ambientSwap(l, action, amount, needsOutput);
133
268
  case "dodoSwap":
134
- return dodoSwap(emit, action, amountIn, needsOutput);
269
+ return dodoSwap(l, action, amount, needsOutput);
135
270
  case "maverickSwap":
136
- return maverickSwap(emit, action, amountIn, needsOutput);
271
+ return maverickSwap(l, action, amount, needsOutput);
137
272
  case "maverickMultiHopSwap":
138
- return maverickMultiHopSwap(emit, action, amountIn, needsOutput);
273
+ return maverickMultiHopSwap(l, action, amount, needsOutput);
139
274
  case "carbonSwap":
140
- return carbonSwap(emit, action, amountIn, needsOutput);
275
+ return carbonSwap(l, action, amount, needsOutput);
141
276
  case "fraxswapSwap":
142
- return fraxswapSwap(emit, action, amountIn, needsOutput);
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(emit, action, amountIn, needsOutput);
149
- case "fluidDexLiteSwap":
150
- return fluidDexLiteSwap(emit, action, amountIn, needsOutput);
151
- case "transfer":
152
- return transfer(emit, action, amountIn);
153
- case "approve":
154
- return approve(emit, action, amountIn);
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(emit, action, amountIn);
289
+ return wrapETH(l, action, amount);
157
290
  case "unwrapETH":
158
- return unwrapETH(emit, action, amountIn);
291
+ return unwrapETH(l, action, amount);
159
292
  case "wrapStETH":
160
- return wrapStETH(emit, action, amountIn);
293
+ return wrapStETH(l, action, amount, needsOutput);
161
294
  case "unwrapStETH":
162
- return unwrapStETH(emit, action, amountIn);
295
+ return unwrapStETH(l, action, amount, needsOutput);
163
296
  case "lidoStake":
164
- return lidoStake(emit, action, amountIn);
297
+ return lidoStake(l, action, amount, needsOutput);
165
298
  case "lidoUnstake":
166
- return lidoUnstake(emit, action, amountIn);
299
+ return lidoUnstake(l, action, amount);
167
300
  case "rocketPoolStake":
168
- return rocketPoolStake(emit, action, amountIn);
301
+ return rocketPoolStake(l, action, amount, needsOutput);
169
302
  case "rocketPoolUnstake":
170
- return rocketPoolUnstake(emit, action, amountIn);
171
- case "coinbaseStake":
172
- return coinbaseStake(emit, action, amountIn);
303
+ return rocketPoolUnstake(l, action, amount, needsOutput);
173
304
  case "etherFiStake":
174
- return etherFiStake(emit, action, amountIn);
305
+ return etherFiStake(l, action, amount, needsOutput);
175
306
  case "aaveV3Supply":
176
- return aaveV3Supply(emit, action, amountIn);
307
+ return aaveV3Supply(l, action, amount);
177
308
  case "aaveV3Withdraw":
178
- return aaveV3Withdraw(emit, action, amountIn, needsOutput);
309
+ return aaveV3Withdraw(l, action, amount, needsOutput);
179
310
  case "aaveV3Borrow":
180
- return aaveV3Borrow(emit, action, amountIn);
311
+ return aaveV3Borrow(l, action, amount);
181
312
  case "aaveV3Repay":
182
- return aaveV3Repay(emit, action, amountIn);
313
+ return aaveV3Repay(l, action, amount);
183
314
  case "compoundV3Supply":
184
- return compoundV3Supply(emit, action, amountIn);
315
+ return compoundV3Supply(l, action, amount);
185
316
  case "compoundV3Withdraw":
186
- return compoundV3Withdraw(emit, action, amountIn);
187
- case "acrossBridge":
188
- return acrossBridge(emit, action, amountIn);
189
- case "stargateBridge":
190
- return stargateBridge(emit, action, amountIn);
191
- case "cctpBridge":
192
- return cctpBridge(emit, action, amountIn);
193
- case "hyperlaneBridge":
194
- return hyperlaneBridge(emit, action, amountIn);
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
- // Call shapes
337
+ // Swap actions
203
338
  // ---------------------------------------------------------------------------
204
- /** A call whose `uint256` return value is the action's output when `needsOutput`. */
205
- function capturedCall(emit, needsOutput, target, value, cd, passThrough) {
206
- const call = evmCall(target, value, cd.expr);
207
- if (!needsOutput)
208
- return { stmts: [...cd.stmts, `${call};`], output: passThrough };
209
- const decoded = decodeUint256(emit, call);
210
- const bound = bindConst(emit, "amt", decoded.expr);
211
- return { stmts: [...cd.stmts, ...decoded.stmts, ...bound.stmts], output: bound.expr };
212
- }
213
- /** A call with no usable return value — the input amount passes through. */
214
- function voidCall(target, value, cd, passThrough) {
215
- return { stmts: [...cd.stmts, `${evmCall(target, value, cd.expr)};`], output: passThrough };
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
- * Runs `stmts` between a pre/post `balanceOf(ctx.self())` snapshot of `token` and returns the
219
- * DELTA as the output.
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 shape for any venue whose call has no usable `uint256` return — an array, a struct, an order
222
- * id, or `bytes`. `capturedCall` decodes the first 32 bytes of the return, which for those is an
223
- * ABI offset or an unrelated value, not an amount. Seven builders got that wrong; this is the one
224
- * correct pattern, written once.
225
- *
226
- * The caller must have routed the output to `ctx.self()` for the delta to mean anything.
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 balanceDeltaResult(emit, needsOutput, token, stmts, passThrough) {
229
- if (!needsOutput)
230
- return { stmts: [...stmts], output: passThrough };
231
- const pre = selfBalance(emit, token);
232
- const post = selfBalance(emit, token);
233
- const delta = bindConst(emit, "delta", `${post.expr} - ${pre.expr}`);
234
- return {
235
- stmts: [...pre.stmts, ...stmts, ...post.stmts, ...delta.stmts],
236
- output: delta.expr,
237
- };
238
- }
239
- /** `balanceOf(ctx.self())` on `token`, as a bound `uint256` local. */
240
- function selfBalance(emit, token) {
241
- const cd = calldata(emit, "balanceOf(address)", [SELF]);
242
- const decoded = decodeUint256(emit, evmCall(token, ZERO, cd.expr));
243
- const bound = bindConst(emit, "bal", decoded.expr);
244
- return { stmts: [...cd.stmts, ...decoded.stmts, ...bound.stmts], expr: bound.expr };
245
- }
246
- // ---------------------------------------------------------------------------
247
- // Swap actions — capture uint256 output
248
- // ---------------------------------------------------------------------------
249
- function uniswapV3ExactInput(emit, action, amountIn, needsOutput) {
250
- const recipient = needsOutput ? SELF : word(action.recipient);
251
- const params = [
252
- word(action.tokenIn),
253
- word(action.tokenOut),
254
- word(action.fee),
255
- recipient,
256
- amountIn,
257
- word(action.amountOutMin ?? "0"),
258
- word(action.sqrtPriceLimitX96 ?? "0"),
259
- ];
260
- const cd = calldata(emit, "exactInputSingle((address,address,uint24,address,uint256,uint256,uint160))", [tuple(params)]);
261
- return capturedCall(emit, needsOutput, word(action.router), ZERO, cd, amountIn);
262
- }
263
- function uniswapV3ExactInputMultiHop(emit, action, amountIn, needsOutput) {
264
- const recipient = needsOutput ? SELF : word(action.recipient);
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 transferCd = calldata(emit, "transfer(address,uint256)", [word(action.router), amountIn]);
323
- // ExactInputParams: { Currency currencyIn, PathKey[] path, uint256[] maxHopSlippage, uint128 amountIn, uint128 amountOutMinimum }
324
- const pathKeyAbi = {
325
- type: "tuple[]",
326
- components: [
327
- { type: "address", name: "intermediateCurrency" },
328
- { type: "uint24", name: "fee" },
329
- { type: "int24", name: "tickSpacing" },
330
- { type: "address", name: "hooks" },
331
- { type: "bytes", name: "hookData" },
332
- ],
333
- };
334
- const swapParams = encodeAbiParameters([
335
- { type: "address" },
336
- pathKeyAbi,
337
- { type: "uint256[]" },
338
- { type: "uint128" },
339
- { type: "uint128" },
340
- ], [
341
- action.currencyIn,
342
- action.path.map((step) => ({
343
- intermediateCurrency: step.intermediateCurrency,
344
- fee: step.fee,
345
- tickSpacing: step.tickSpacing,
346
- hooks: step.hooks,
347
- hookData: "0x",
348
- })),
349
- [], // maxHopSlippage — empty array means no per-hop slippage limits
350
- BigInt(action.amountIn ?? "0"),
351
- BigInt(action.amountOutMin),
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(emit, tokenOut);
390
- const delta = bindConst(emit, "delta", `${post.expr} - ${pre.expr}`);
391
- const captureAndSwap = [
392
- ...pre.stmts,
393
- ...exchangeCd.stmts,
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
- const recipientExpr = needsOutput ? SELF : word(action.recipient);
441
- // Pre-encode the complex calldata with viem, then splice in the runtime values for funds.sender
442
- // (ctx.self()) and funds.recipient.
443
- const MAX_INT256 = BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819967");
444
- const stepsData = action.steps.map((step) => ({
445
- poolId: step.poolId,
446
- assetInIndex: BigInt(step.assetInIndex),
447
- assetOutIndex: BigInt(step.assetOutIndex),
448
- amount: BigInt(step.amount),
449
- userData: "0x",
450
- }));
451
- const assetsData = action.assets.map((a) => a);
452
- const limitsData = action.assets.map((_, i) => i === action.assets.length - 1 ? -BigInt(action.amountOutMin) : MAX_INT256);
453
- // Placeholder addresses stand in for the two runtime values.
454
- const SENDER_PLACEHOLDER = "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
455
- const RECIPIENT_PLACEHOLDER = "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
456
- const encoded = encodeAbiParameters([
457
- { type: "uint8" },
458
- {
459
- type: "tuple[]",
460
- components: [
461
- { type: "bytes32", name: "poolId" },
462
- { type: "uint256", name: "assetInIndex" },
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
- const encodedBytes = hexToBytes(encoded);
494
- const senderPad = hexToBytes("0x000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
495
- const recipientPad = hexToBytes("0x000000000000000000000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
496
- let senderOffset = -1;
497
- let recipientOffset = -1;
498
- for (let i = 0; i <= encodedBytes.length - 32; i++) {
499
- if (senderOffset === -1 && encodedBytes.slice(i, i + 32).every((b, j) => b === senderPad[j])) {
500
- senderOffset = i;
501
- }
502
- if (recipientOffset === -1 &&
503
- encodedBytes.slice(i, i + 32).every((b, j) => b === recipientPad[j])) {
504
- recipientOffset = i;
505
- }
506
- }
507
- const sel = bindBytes(emit, "sel", selector("batchSwap(uint8,(bytes32,uint256,uint256,uint256,bytes)[],address[],(address,bool,address,bool),int256[],uint256)"));
508
- // Build: selector + pre_sender + ctx.self() + between + recipient + post_recipient. Each pre-
509
- // encoded run is a bound `hex` const, because a method call's receiver must be an identifier.
510
- const stmts = [...sel.stmts];
511
- const parts = [];
512
- const chunk = (from, to) => {
513
- const bound = bindBytes(emit, "bs", encodedBytes.slice(from, to));
514
- stmts.push(...bound.stmts);
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 balanceDeltaResult(emit, needsOutput, word(assetOut), stmts, amountIn);
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
- // New AMM swap actions
542
- // ---------------------------------------------------------------------------
543
- function uniswapV2Swap(emit, action, amountIn, needsOutput) {
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
- arrayLiteral(action.path.map(word)),
549
- recipient,
518
+ list(action.path.map(addr)),
519
+ needsOutput ? SELF : recipient(action.recipient),
550
520
  word(action.deadline),
551
- ]);
552
- const swap = [...cd.stmts, `${evmCall(word(action.router), ZERO, cd.expr)};`];
553
- if (!needsOutput)
554
- return { stmts: swap, output: amountIn };
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("0x0000000000000000000000000000000000000000");
573
- // Pad swapParams to 5x5
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("0x0000000000000000000000000000000000000000");
581
- const cd = calldata(emit, "exchange(address[11],uint256[5][5],uint256,uint256,address[5],address)", [
582
- tuple(route.map(word)),
583
- tuple(swapParams.map((row) => tuple(row.map(word)))),
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
- tuple(pools.map(word)),
587
- recipient,
539
+ list(pools.map(addr)),
540
+ needsOutput ? SELF : recipient(action.recipient),
588
541
  ]);
589
- return capturedCall(emit, needsOutput, word(action.router), ZERO, cd, amountIn);
590
- }
591
- function balancerV3Swap(emit, action, amountIn, needsOutput) {
592
- // BalancerV3 Router sends output to msg.sender; no recipient parameter in the function
593
- const userData = bindBytes(emit, "ud", new Uint8Array(0));
594
- const cd = calldata(emit, "swapSingleTokenExactIn(address,address,address,uint256,uint256,uint256,bool,bytes)", [
595
- word(action.pool),
596
- word(action.tokenIn),
597
- word(action.tokenOut),
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.expr,
555
+ userData,
603
556
  ]);
604
- return capturedCall(emit, needsOutput, word(action.router), ZERO, { stmts: [...userData.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
605
- }
606
- function ambientSwap(emit, action, amountIn, needsOutput) {
607
- // abi.encode(base, quote, poolIdx, isBuy, inBaseQty, qty, tip, limitPrice, minOut, settleFlags)
608
- const cmd = bindConst(emit, "cmd", encodeArgs([
609
- word(action.base),
610
- word(action.quote),
611
- word(action.poolIdx),
612
- flag(action.isBuy),
613
- flag(action.inBaseQty),
614
- amountIn,
615
- word(action.tip),
616
- word(action.limitPrice),
617
- word(action.minOut),
618
- word(action.reserveFlags),
619
- ]));
620
- const cd = calldata(emit, "userCmd(uint16,bytes)", ["1n", cmd.expr]);
621
- // `userCmd` returns `bytes`, so there is no uint256 to decode. Ambient settles to msg.sender —
622
- // ctx.self() here — so the self delta on the received side IS the output. `isBuy` is "paying
623
- // base, receiving quote" (AMM_SWAP_INTERFACES.md), so the received token is the quote when
624
- // buying and the base otherwise.
625
- const swap = [...cmd.stmts, ...cd.stmts, `${evmCall(word(action.dex), ZERO, cd.expr)};`];
626
- const tokenOut = word(action.isBuy ? action.quote : action.base);
627
- return balanceDeltaResult(emit, needsOutput, tokenOut, swap, amountIn);
628
- }
629
- function dodoSwap(emit, action, amountIn, needsOutput) {
630
- // The DODO proxy sends output to msg.sender; we return the proxy's own return value.
631
- const sig = action.version === "v1"
632
- ? "dodoSwapV1(address,address,uint256,uint256,address[],uint256,bool,uint256)"
633
- : "dodoSwapV2TokenToToken(address,address,uint256,uint256,address[],uint256,bool,uint256)";
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
- arrayLiteral(action.dodoPairs.map(word)),
589
+ list(action.pairs.map(addr)),
640
590
  word(action.directions),
641
- ZERO, // isIncentive = false
591
+ flag(false), // isIncentive
642
592
  word(action.deadline),
643
- ]);
644
- return capturedCall(emit, needsOutput, word(action.proxy), ZERO, cd, amountIn);
645
- }
646
- function maverickSwap(emit, action, amountIn, needsOutput) {
647
- const recipient = needsOutput ? SELF : word(action.recipient);
648
- const cd = calldata(emit, "exactInputSingle(address,address,bool,uint256,uint256)", [
649
- recipient,
650
- word(action.pool),
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 capturedCall(emit, needsOutput, word(action.router), ZERO, cd, amountIn);
656
- }
657
- function maverickMultiHopSwap(emit, action, amountIn, needsOutput) {
658
- const recipient = needsOutput ? SELF : word(action.recipient);
659
- const path = bindBytes(emit, "path", hexToBytes(action.path));
660
- const cd = calldata(emit, "exactInputMultiHop(address,bytes,uint256,uint256)", [
661
- recipient,
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 capturedCall(emit, needsOutput, word(action.router), ZERO, { stmts: [...path.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
667
- }
668
- function carbonSwap(emit, action, amountIn, needsOutput) {
669
- // Carbon doesn't support a recipient override.
670
- const tradeActions = action.tradeActions.map((ta) => tuple([word(ta.strategyId), word(ta.amount)]));
671
- const cd = calldata(emit, "tradeBySourceAmount(address,address,(uint256,uint128)[],uint256,uint128)", [
672
- word(action.sourceToken),
673
- word(action.targetToken),
674
- arrayLiteral(tradeActions),
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 capturedCall(emit, needsOutput, word(action.controller), ZERO, cd, amountIn);
630
+ return captured(l, needsOutput, call, amountIn);
679
631
  }
680
- function fraxswapSwap(emit, action, amountIn, needsOutput) {
681
- const recipient = needsOutput ? SELF : word(action.recipient);
682
- const cd = calldata(emit, "swapExactTokensForTokens(uint256,uint256,address[],address,uint256)", [
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
- arrayLiteral(action.path.map(word)),
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(emit, action, amountIn, needsOutput) {
735
- const recipient = needsOutput ? SELF : word(action.recipient);
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
- // `swapSingle` returns `(int256 amount0, int256 amount1)` — a signed pair, so the first word is
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
- // Transfer & approve — void output (pass-through amount)
653
+ // Bridges — the amount passes through
763
654
  // ---------------------------------------------------------------------------
764
- function transfer(emit, action, amountIn) {
765
- const cd = calldata(emit, "transfer(address,uint256)", [word(action.to), amountIn]);
766
- return voidCall(word(action.token), ZERO, cd, amountIn);
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 approve(emit, action, amountIn) {
769
- const cd = calldata(emit, "approve(address,uint256)", [word(action.spender), amountIn]);
770
- return voidCall(word(action.token), ZERO, cd, amountIn);
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
- // Wrap / Unwrap — void output (pass-through amount)
724
+ // Wrapping
774
725
  // ---------------------------------------------------------------------------
775
- function wrapETH(emit, action, amountIn) {
776
- return voidCall(word(action.weth), amountIn, calldata(emit, "deposit()", []), amountIn);
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(emit, action, amountIn) {
779
- return voidCall(word(action.weth), ZERO, calldata(emit, "withdraw(uint256)", [amountIn]), amountIn);
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(emit, action, amountIn) {
782
- return voidCall(word(action.wstETH), ZERO, calldata(emit, "wrap(uint256)", [amountIn]), amountIn);
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(emit, action, amountIn) {
785
- return voidCall(word(action.wstETH), ZERO, calldata(emit, "unwrap(uint256)", [amountIn]), amountIn);
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
- // Liquid staking — void output (pass-through amount)
746
+ // Staking
789
747
  // ---------------------------------------------------------------------------
790
- function lidoStake(emit, action, amountIn) {
791
- const cd = calldata(emit, "submit(address)", [word(action.referral)]);
792
- return voidCall(word(action.stETH), amountIn, cd, amountIn);
793
- }
794
- function lidoUnstake(emit, action, amountIn) {
795
- const cd = calldata(emit, "requestWithdrawals(uint256[],address)", [
796
- arrayLiteral([amountIn]),
797
- MSG_SENDER,
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 voidCall(word(action.withdrawalQueue), ZERO, cd, amountIn);
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 rocketPoolUnstake(emit, action, amountIn) {
805
- return voidCall(word(action.rETH), ZERO, calldata(emit, "burn(uint256)", [amountIn]), amountIn);
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 coinbaseStake(emit, action, amountIn) {
808
- return voidCall(word(action.cbETH), amountIn, calldata(emit, "deposit()", []), amountIn);
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(emit, action, amountIn) {
811
- return voidCall(word(action.liquidityPool), amountIn, calldata(emit, "deposit()", []), amountIn);
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 / Borrowing — void output (pass-through amount)
774
+ // Lending
815
775
  // ---------------------------------------------------------------------------
816
- function aaveV3Supply(emit, action, amountIn) {
817
- const cd = calldata(emit, "supply(address,uint256,address,uint16)", [
818
- word(action.token),
819
- amountIn,
820
- word(action.onBehalfOf),
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 voidCall(word(action.pool), ZERO, cd, amountIn);
824
- }
825
- function aaveV3Withdraw(emit, action, amountIn, needsOutput) {
826
- const cd = calldata(emit, "withdraw(address,uint256,address)", [
827
- word(action.token),
828
- amountIn,
829
- word(action.to),
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 capturedCall(emit, needsOutput, word(action.pool), ZERO, cd, amountIn);
832
- }
833
- function aaveV3Borrow(emit, action, amountIn) {
834
- const cd = calldata(emit, "borrow(address,uint256,uint256,uint16,address)", [
835
- word(action.token),
836
- amountIn,
837
- word(action.interestRateMode),
838
- word(action.referralCode),
839
- word(action.onBehalfOf),
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 voidCall(word(action.pool), ZERO, cd, amountIn);
842
- }
843
- function aaveV3Repay(emit, action, amountIn) {
844
- const cd = calldata(emit, "repay(address,uint256,uint256,address)", [
845
- word(action.token),
846
- amountIn,
847
- word(action.interestRateMode),
848
- word(action.onBehalfOf),
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 voidCall(word(action.pool), ZERO, cd, amountIn);
811
+ return l.result(amount);
851
812
  }
852
- function compoundV3Supply(emit, action, amountIn) {
853
- const cd = calldata(emit, "supply(address,uint256)", [word(action.token), amountIn]);
854
- return voidCall(word(action.comet), ZERO, cd, amountIn);
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(emit, action, amountIn) {
857
- const cd = calldata(emit, "withdraw(address,uint256)", [word(action.token), amountIn]);
858
- return voidCall(word(action.comet), ZERO, cd, amountIn);
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
- // Bridge actions — void output (pass-through amount)
822
+ // Tokens — the amount passes through, and nothing is decoded (`Lowering.erc20Write`)
862
823
  // ---------------------------------------------------------------------------
863
- function acrossBridge(emit, action, amountIn) {
864
- const message = bindBytes(emit, "msg", hexToBytes(action.message));
865
- const cd = calldata(emit, "depositV3(address,address,address,address,uint256,uint256,uint256,address,uint32,uint32,uint32,bytes)", [
866
- MSG_SENDER, // depositor
867
- MSG_SENDER, // recipient
868
- word(action.token), // inputToken
869
- word(action.token), // outputToken (same for simple bridge)
870
- amountIn, // inputAmount
871
- amountIn, // outputAmount
872
- word(action.destChainId), // destinationChainId
873
- ZERO, // exclusiveRelayer (none)
874
- word(action.quoteTimestamp),
875
- word(action.fillDeadline),
876
- word(action.exclusivityDeadline),
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 voidCall(word(action.spokePool), ZERO, { stmts: [...message.stmts, ...cd.stmts], expr: cd.expr }, amountIn);
839
+ return l.result(amount);
880
840
  }
881
- function stargateBridge(emit, action, amountIn) {
882
- const payload = bindBytes(emit, "pl", new Uint8Array(0));
883
- const cd = calldata(emit, "swap(uint16,uint256,uint256,address,uint256,uint256,(address,address,bytes))", [
884
- word(action.destChainId),
885
- word(action.srcPoolId),
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 hyperlaneBridge(emit, action, amountIn) {
904
- const body = bindBytes(emit, "body", new Uint8Array(0));
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
  }