@layerzerolabs/protocol-starknet-v2 0.0.34

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 (504) hide show
  1. package/.turbo/turbo-build.log +186 -0
  2. package/.turbo/turbo-lint.log +71 -0
  3. package/.turbo/turbo-test.log +937 -0
  4. package/README.md +41 -0
  5. package/Scarb.lock +211 -0
  6. package/Scarb.toml +2 -0
  7. package/dist/4XD3ZRZ4.cjs +301 -0
  8. package/dist/4XD3ZRZ4.cjs.map +1 -0
  9. package/dist/4Z5IPBC3.js +299 -0
  10. package/dist/4Z5IPBC3.js.map +1 -0
  11. package/dist/5NEZDLVQ.cjs +474 -0
  12. package/dist/5NEZDLVQ.cjs.map +1 -0
  13. package/dist/6JYCOKDE.js +472 -0
  14. package/dist/6JYCOKDE.js.map +1 -0
  15. package/dist/7C4PFMIZ.cjs +1288 -0
  16. package/dist/7C4PFMIZ.cjs.map +1 -0
  17. package/dist/7ZSGGZUE.js +1229 -0
  18. package/dist/7ZSGGZUE.js.map +1 -0
  19. package/dist/ARHOGUYH.cjs +2136 -0
  20. package/dist/ARHOGUYH.cjs.map +1 -0
  21. package/dist/CRCRIUFX.js +1264 -0
  22. package/dist/CRCRIUFX.js.map +1 -0
  23. package/dist/DB7CQSED.cjs +430 -0
  24. package/dist/DB7CQSED.cjs.map +1 -0
  25. package/dist/DFXLWHYP.cjs +1266 -0
  26. package/dist/DFXLWHYP.cjs.map +1 -0
  27. package/dist/EOLZCMCK.js +988 -0
  28. package/dist/EOLZCMCK.js.map +1 -0
  29. package/dist/FFDPTOWG.cjs +331 -0
  30. package/dist/FFDPTOWG.cjs.map +1 -0
  31. package/dist/FOJGEAIO.js +2134 -0
  32. package/dist/FOJGEAIO.js.map +1 -0
  33. package/dist/IWIUMVGB.js +629 -0
  34. package/dist/IWIUMVGB.js.map +1 -0
  35. package/dist/MUEN6AWV.cjs +697 -0
  36. package/dist/MUEN6AWV.cjs.map +1 -0
  37. package/dist/ORE6VBZ4.cjs +990 -0
  38. package/dist/ORE6VBZ4.cjs.map +1 -0
  39. package/dist/OUFKWPZ7.js +732 -0
  40. package/dist/OUFKWPZ7.js.map +1 -0
  41. package/dist/T2QTYQXJ.js +1229 -0
  42. package/dist/T2QTYQXJ.js.map +1 -0
  43. package/dist/UPJTM7BR.cjs +631 -0
  44. package/dist/UPJTM7BR.cjs.map +1 -0
  45. package/dist/VNVNX2P3.cjs +1231 -0
  46. package/dist/VNVNX2P3.cjs.map +1 -0
  47. package/dist/VUOMXK5T.js +6 -0
  48. package/dist/VUOMXK5T.js.map +1 -0
  49. package/dist/WISWRTDG.js +1286 -0
  50. package/dist/WISWRTDG.js.map +1 -0
  51. package/dist/WU5L7YIQ.cjs +1231 -0
  52. package/dist/WU5L7YIQ.cjs.map +1 -0
  53. package/dist/X3B5JDMZ.js +695 -0
  54. package/dist/X3B5JDMZ.js.map +1 -0
  55. package/dist/XYNBDBBV.cjs +297 -0
  56. package/dist/XYNBDBBV.cjs.map +1 -0
  57. package/dist/Y5JFPCYJ.cjs +734 -0
  58. package/dist/Y5JFPCYJ.cjs.map +1 -0
  59. package/dist/YEHL7IYO.js +295 -0
  60. package/dist/YEHL7IYO.js.map +1 -0
  61. package/dist/YJF4D23A.cjs +8 -0
  62. package/dist/YJF4D23A.cjs.map +1 -0
  63. package/dist/YTS44OEA.js +428 -0
  64. package/dist/YTS44OEA.js.map +1 -0
  65. package/dist/Z2NIUZMW.js +329 -0
  66. package/dist/Z2NIUZMW.js.map +1 -0
  67. package/dist/abis/blocked-message-lib.cjs +13 -0
  68. package/dist/abis/blocked-message-lib.cjs.map +1 -0
  69. package/dist/abis/blocked-message-lib.d.ts +338 -0
  70. package/dist/abis/blocked-message-lib.d.ts.map +1 -0
  71. package/dist/abis/blocked-message-lib.js +4 -0
  72. package/dist/abis/blocked-message-lib.js.map +1 -0
  73. package/dist/abis/dvn-fee-lib.cjs +13 -0
  74. package/dist/abis/dvn-fee-lib.cjs.map +1 -0
  75. package/dist/abis/dvn-fee-lib.d.ts +214 -0
  76. package/dist/abis/dvn-fee-lib.d.ts.map +1 -0
  77. package/dist/abis/dvn-fee-lib.js +4 -0
  78. package/dist/abis/dvn-fee-lib.js.map +1 -0
  79. package/dist/abis/dvn.cjs +13 -0
  80. package/dist/abis/dvn.cjs.map +1 -0
  81. package/dist/abis/dvn.d.ts +952 -0
  82. package/dist/abis/dvn.d.ts.map +1 -0
  83. package/dist/abis/dvn.js +4 -0
  84. package/dist/abis/dvn.js.map +1 -0
  85. package/dist/abis/endpoint-v2.cjs +13 -0
  86. package/dist/abis/endpoint-v2.cjs.map +1 -0
  87. package/dist/abis/endpoint-v2.d.ts +1580 -0
  88. package/dist/abis/endpoint-v2.d.ts.map +1 -0
  89. package/dist/abis/endpoint-v2.js +4 -0
  90. package/dist/abis/endpoint-v2.js.map +1 -0
  91. package/dist/abis/executor-fee-lib.cjs +13 -0
  92. package/dist/abis/executor-fee-lib.cjs.map +1 -0
  93. package/dist/abis/executor-fee-lib.d.ts +217 -0
  94. package/dist/abis/executor-fee-lib.d.ts.map +1 -0
  95. package/dist/abis/executor-fee-lib.js +4 -0
  96. package/dist/abis/executor-fee-lib.js.map +1 -0
  97. package/dist/abis/executor.cjs +13 -0
  98. package/dist/abis/executor.cjs.map +1 -0
  99. package/dist/abis/executor.d.ts +914 -0
  100. package/dist/abis/executor.d.ts.map +1 -0
  101. package/dist/abis/executor.js +4 -0
  102. package/dist/abis/executor.js.map +1 -0
  103. package/dist/abis/o-app.cjs +13 -0
  104. package/dist/abis/o-app.cjs.map +1 -0
  105. package/dist/abis/o-app.d.ts +311 -0
  106. package/dist/abis/o-app.d.ts.map +1 -0
  107. package/dist/abis/o-app.js +4 -0
  108. package/dist/abis/o-app.js.map +1 -0
  109. package/dist/abis/oft-adapter.cjs +13 -0
  110. package/dist/abis/oft-adapter.cjs.map +1 -0
  111. package/dist/abis/oft-adapter.d.ts +722 -0
  112. package/dist/abis/oft-adapter.d.ts.map +1 -0
  113. package/dist/abis/oft-adapter.js +4 -0
  114. package/dist/abis/oft-adapter.js.map +1 -0
  115. package/dist/abis/oft.cjs +13 -0
  116. package/dist/abis/oft.cjs.map +1 -0
  117. package/dist/abis/oft.d.ts +922 -0
  118. package/dist/abis/oft.d.ts.map +1 -0
  119. package/dist/abis/oft.js +4 -0
  120. package/dist/abis/oft.js.map +1 -0
  121. package/dist/abis/omni-counter.cjs +13 -0
  122. package/dist/abis/omni-counter.cjs.map +1 -0
  123. package/dist/abis/omni-counter.d.ts +459 -0
  124. package/dist/abis/omni-counter.d.ts.map +1 -0
  125. package/dist/abis/omni-counter.js +4 -0
  126. package/dist/abis/omni-counter.js.map +1 -0
  127. package/dist/abis/price-feed.cjs +13 -0
  128. package/dist/abis/price-feed.cjs.map +1 -0
  129. package/dist/abis/price-feed.d.ts +505 -0
  130. package/dist/abis/price-feed.d.ts.map +1 -0
  131. package/dist/abis/price-feed.js +4 -0
  132. package/dist/abis/price-feed.js.map +1 -0
  133. package/dist/abis/simple-message-lib.cjs +13 -0
  134. package/dist/abis/simple-message-lib.cjs.map +1 -0
  135. package/dist/abis/simple-message-lib.d.ts +535 -0
  136. package/dist/abis/simple-message-lib.d.ts.map +1 -0
  137. package/dist/abis/simple-message-lib.js +4 -0
  138. package/dist/abis/simple-message-lib.js.map +1 -0
  139. package/dist/abis/treasury.cjs +13 -0
  140. package/dist/abis/treasury.cjs.map +1 -0
  141. package/dist/abis/treasury.d.ts +240 -0
  142. package/dist/abis/treasury.d.ts.map +1 -0
  143. package/dist/abis/treasury.js +4 -0
  144. package/dist/abis/treasury.js.map +1 -0
  145. package/dist/abis/ultra-light-node.cjs +13 -0
  146. package/dist/abis/ultra-light-node.cjs.map +1 -0
  147. package/dist/abis/ultra-light-node.d.ts +900 -0
  148. package/dist/abis/ultra-light-node.d.ts.map +1 -0
  149. package/dist/abis/ultra-light-node.js +4 -0
  150. package/dist/abis/ultra-light-node.js.map +1 -0
  151. package/dist/index.cjs +78 -0
  152. package/dist/index.cjs.map +1 -0
  153. package/dist/index.d.ts +15 -0
  154. package/dist/index.d.ts.map +1 -0
  155. package/dist/index.js +17 -0
  156. package/dist/index.js.map +1 -0
  157. package/dist/scripts/build-abi.cjs +28 -0
  158. package/dist/scripts/build-abi.cjs.map +1 -0
  159. package/dist/scripts/build-abi.d.ts +2 -0
  160. package/dist/scripts/build-abi.d.ts.map +1 -0
  161. package/dist/scripts/build-abi.js +26 -0
  162. package/dist/scripts/build-abi.js.map +1 -0
  163. package/layerzero/README.md +244 -0
  164. package/layerzero/Scarb.lock +203 -0
  165. package/layerzero/Scarb.toml +30 -0
  166. package/layerzero/snfoundry.toml +11 -0
  167. package/layerzero/src/common/constants.cairo +26 -0
  168. package/layerzero/src/common/conversions.cairo +16 -0
  169. package/layerzero/src/common/guid.cairo +20 -0
  170. package/layerzero/src/common/packet_v1_codec.cairo +307 -0
  171. package/layerzero/src/common/structs/messaging.cairo +40 -0
  172. package/layerzero/src/common/structs/packet.cairo +31 -0
  173. package/layerzero/src/endpoint/constants.cairo +14 -0
  174. package/layerzero/src/endpoint/endpoint.cairo +688 -0
  175. package/layerzero/src/endpoint/errors.cairo +108 -0
  176. package/layerzero/src/endpoint/events.cairo +124 -0
  177. package/layerzero/src/endpoint/interfaces/endpoint.cairo +286 -0
  178. package/layerzero/src/endpoint/interfaces/layerzero_composer.cairo +62 -0
  179. package/layerzero/src/endpoint/interfaces/layerzero_receiver.cairo +63 -0
  180. package/layerzero/src/endpoint/message_lib_manager/errors.cairo +95 -0
  181. package/layerzero/src/endpoint/message_lib_manager/events.cairo +90 -0
  182. package/layerzero/src/endpoint/message_lib_manager/interface.cairo +449 -0
  183. package/layerzero/src/endpoint/message_lib_manager/message_lib_manager.cairo +720 -0
  184. package/layerzero/src/endpoint/message_lib_manager/structs.cairo +33 -0
  185. package/layerzero/src/endpoint/messaging_channel/errors.cairo +37 -0
  186. package/layerzero/src/endpoint/messaging_channel/events.cairo +58 -0
  187. package/layerzero/src/endpoint/messaging_channel/interface.cairo +171 -0
  188. package/layerzero/src/endpoint/messaging_channel/messaging_channel.cairo +453 -0
  189. package/layerzero/src/endpoint/messaging_composer/errors.cairo +46 -0
  190. package/layerzero/src/endpoint/messaging_composer/events.cairo +67 -0
  191. package/layerzero/src/endpoint/messaging_composer/interface.cairo +132 -0
  192. package/layerzero/src/endpoint/messaging_composer/messaging_composer.cairo +223 -0
  193. package/layerzero/src/lib.cairo +189 -0
  194. package/layerzero/src/message_lib/blocked_message_lib.cairo +114 -0
  195. package/layerzero/src/message_lib/interface.cairo +63 -0
  196. package/layerzero/src/message_lib/sml/errors.cairo +23 -0
  197. package/layerzero/src/message_lib/sml/events.cairo +32 -0
  198. package/layerzero/src/message_lib/sml/simple_message_lib.cairo +312 -0
  199. package/layerzero/src/message_lib/structs.cairo +22 -0
  200. package/layerzero/src/message_lib/uln/errors.cairo +128 -0
  201. package/layerzero/src/message_lib/uln/events.cairo +97 -0
  202. package/layerzero/src/message_lib/uln/interface.cairo +83 -0
  203. package/layerzero/src/message_lib/uln/options.cairo +64 -0
  204. package/layerzero/src/message_lib/uln/structs/executor_config.cairo +35 -0
  205. package/layerzero/src/message_lib/uln/structs/payment_info.cairo +7 -0
  206. package/layerzero/src/message_lib/uln/structs/uln_config.cairo +155 -0
  207. package/layerzero/src/message_lib/uln/structs/uln_config_storage_node.cairo +91 -0
  208. package/layerzero/src/message_lib/uln/structs/verification.cairo +7 -0
  209. package/layerzero/src/message_lib/uln/ultra_light_node.cairo +965 -0
  210. package/layerzero/src/oapps/common/oapp_options_type_3/errors.cairo +22 -0
  211. package/layerzero/src/oapps/common/oapp_options_type_3/events.cairo +6 -0
  212. package/layerzero/src/oapps/common/oapp_options_type_3/interface.cairo +34 -0
  213. package/layerzero/src/oapps/common/oapp_options_type_3/oapp_options_type_3.cairo +120 -0
  214. package/layerzero/src/oapps/common/oapp_options_type_3/structs.cairo +6 -0
  215. package/layerzero/src/oapps/counter/constants.cairo +3 -0
  216. package/layerzero/src/oapps/counter/counter.cairo +170 -0
  217. package/layerzero/src/oapps/counter/interface.cairo +27 -0
  218. package/layerzero/src/oapps/counter/structs.cairo +20 -0
  219. package/layerzero/src/oapps/message_inspector/interface.cairo +21 -0
  220. package/layerzero/src/oapps/oapp/errors.cairo +72 -0
  221. package/layerzero/src/oapps/oapp/events.cairo +9 -0
  222. package/layerzero/src/oapps/oapp/interface.cairo +67 -0
  223. package/layerzero/src/oapps/oapp/oapp.cairo +70 -0
  224. package/layerzero/src/oapps/oapp/oapp_core.cairo +448 -0
  225. package/layerzero/src/oapps/oft/errors.cairo +42 -0
  226. package/layerzero/src/oapps/oft/events.cairo +33 -0
  227. package/layerzero/src/oapps/oft/interface.cairo +87 -0
  228. package/layerzero/src/oapps/oft/oft.cairo +188 -0
  229. package/layerzero/src/oapps/oft/oft_adapter.cairo +175 -0
  230. package/layerzero/src/oapps/oft/oft_compose_msg_codec.cairo +128 -0
  231. package/layerzero/src/oapps/oft/oft_core.cairo +542 -0
  232. package/layerzero/src/oapps/oft/oft_msg_codec.cairo +131 -0
  233. package/layerzero/src/oapps/oft/structs.cairo +72 -0
  234. package/layerzero/src/treasury/errors.cairo +22 -0
  235. package/layerzero/src/treasury/events.cairo +5 -0
  236. package/layerzero/src/treasury/interfaces/layerzero_treasury.cairo +54 -0
  237. package/layerzero/src/treasury/interfaces/lz_token_fee_lib.cairo +45 -0
  238. package/layerzero/src/treasury/interfaces/treasury_admin.cairo +39 -0
  239. package/layerzero/src/treasury/treasury.cairo +140 -0
  240. package/layerzero/src/workers/access_control.cairo +11 -0
  241. package/layerzero/src/workers/base/base.cairo +238 -0
  242. package/layerzero/src/workers/base/errors.cairo +24 -0
  243. package/layerzero/src/workers/base/events.cairo +43 -0
  244. package/layerzero/src/workers/base/interface.cairo +93 -0
  245. package/layerzero/src/workers/base/structs.cairo +10 -0
  246. package/layerzero/src/workers/common.cairo +59 -0
  247. package/layerzero/src/workers/dvn/constants.cairo +11 -0
  248. package/layerzero/src/workers/dvn/dvn.cairo +338 -0
  249. package/layerzero/src/workers/dvn/errors.cairo +80 -0
  250. package/layerzero/src/workers/dvn/events.cairo +30 -0
  251. package/layerzero/src/workers/dvn/fee_lib/dvn_fee_lib.cairo +152 -0
  252. package/layerzero/src/workers/dvn/fee_lib/interface.cairo +45 -0
  253. package/layerzero/src/workers/dvn/interface.cairo +131 -0
  254. package/layerzero/src/workers/dvn/options.cairo +125 -0
  255. package/layerzero/src/workers/dvn/structs.cairo +51 -0
  256. package/layerzero/src/workers/executor/errors.cairo +159 -0
  257. package/layerzero/src/workers/executor/events.cairo +32 -0
  258. package/layerzero/src/workers/executor/executor.cairo +392 -0
  259. package/layerzero/src/workers/executor/fee_lib/executor_fee_lib.cairo +160 -0
  260. package/layerzero/src/workers/executor/fee_lib/interface.cairo +87 -0
  261. package/layerzero/src/workers/executor/interface.cairo +131 -0
  262. package/layerzero/src/workers/executor/options.cairo +244 -0
  263. package/layerzero/src/workers/executor/structs.cairo +119 -0
  264. package/layerzero/src/workers/interface.cairo +32 -0
  265. package/layerzero/src/workers/price_feed/constants.cairo +7 -0
  266. package/layerzero/src/workers/price_feed/errors.cairo +28 -0
  267. package/layerzero/src/workers/price_feed/events.cairo +13 -0
  268. package/layerzero/src/workers/price_feed/interface.cairo +264 -0
  269. package/layerzero/src/workers/price_feed/price_feed.cairo +392 -0
  270. package/layerzero/src/workers/price_feed/structs.cairo +74 -0
  271. package/layerzero/tests/common/test_constants.cairo +21 -0
  272. package/layerzero/tests/common/test_guid.cairo +232 -0
  273. package/layerzero/tests/common/test_packet_v1_codec.cairo +372 -0
  274. package/layerzero/tests/common/utils.cairo +23 -0
  275. package/layerzero/tests/e2e/oft_utils.cairo +121 -0
  276. package/layerzero/tests/e2e/test_counter_with_sml.cairo +194 -0
  277. package/layerzero/tests/e2e/test_counter_with_uln.cairo +352 -0
  278. package/layerzero/tests/e2e/test_dvn.cairo +406 -0
  279. package/layerzero/tests/e2e/test_lz_token.cairo +354 -0
  280. package/layerzero/tests/e2e/test_oft_compose_with_uln.cairo +364 -0
  281. package/layerzero/tests/e2e/test_oft_with_sml.cairo +240 -0
  282. package/layerzero/tests/e2e/test_oft_with_uln.cairo +299 -0
  283. package/layerzero/tests/e2e/utils.cairo +490 -0
  284. package/layerzero/tests/endpoint/message_lib_manager/test_message_lib_manager.cairo +2051 -0
  285. package/layerzero/tests/endpoint/message_lib_manager/utils.cairo +45 -0
  286. package/layerzero/tests/endpoint/messaging_channel/test_messaging_channel.cairo +621 -0
  287. package/layerzero/tests/endpoint/messaging_channel/utils.cairo +96 -0
  288. package/layerzero/tests/endpoint/messaging_composer/test_messaging_composer.cairo +456 -0
  289. package/layerzero/tests/endpoint/messaging_composer/utils.cairo +75 -0
  290. package/layerzero/tests/endpoint/test_endpoint_commit.cairo +763 -0
  291. package/layerzero/tests/endpoint/test_endpoint_lzreceive.cairo +1253 -0
  292. package/layerzero/tests/endpoint/test_endpoint_quote.cairo +71 -0
  293. package/layerzero/tests/endpoint/test_endpoint_send.cairo +1327 -0
  294. package/layerzero/tests/endpoint/utils.cairo +129 -0
  295. package/layerzero/tests/fuzzable/blockchain_config.cairo +89 -0
  296. package/layerzero/tests/fuzzable/bytes32.cairo +16 -0
  297. package/layerzero/tests/fuzzable/contract_address.cairo +67 -0
  298. package/layerzero/tests/fuzzable/dst_config.cairo +37 -0
  299. package/layerzero/tests/fuzzable/eid.cairo +23 -0
  300. package/layerzero/tests/fuzzable/eth_address.cairo +17 -0
  301. package/layerzero/tests/fuzzable/expiry.cairo +27 -0
  302. package/layerzero/tests/fuzzable/felt_array.cairo +38 -0
  303. package/layerzero/tests/fuzzable/inbound_params.cairo +21 -0
  304. package/layerzero/tests/fuzzable/keys.cairo +16 -0
  305. package/layerzero/tests/fuzzable/model_type.cairo +27 -0
  306. package/layerzero/tests/fuzzable/origin.cairo +21 -0
  307. package/layerzero/tests/fuzzable/price.cairo +32 -0
  308. package/layerzero/tests/fuzzable/role_admin.cairo +29 -0
  309. package/layerzero/tests/fuzzable/small_byte_array.cairo +61 -0
  310. package/layerzero/tests/lib.cairo +177 -0
  311. package/layerzero/tests/message_lib/sml/test_simple_message_lib.cairo +224 -0
  312. package/layerzero/tests/message_lib/uln/test_uln_admin.cairo +2150 -0
  313. package/layerzero/tests/message_lib/uln/test_uln_config.cairo +527 -0
  314. package/layerzero/tests/message_lib/uln/test_uln_config_storage_node.cairo +69 -0
  315. package/layerzero/tests/message_lib/uln/test_uln_executor_config.cairo +173 -0
  316. package/layerzero/tests/message_lib/uln/test_uln_options.cairo +329 -0
  317. package/layerzero/tests/message_lib/uln/test_uln_quote.cairo +1038 -0
  318. package/layerzero/tests/message_lib/uln/test_uln_receive.cairo +715 -0
  319. package/layerzero/tests/message_lib/uln/test_uln_send.cairo +1155 -0
  320. package/layerzero/tests/message_lib/uln/utils.cairo +59 -0
  321. package/layerzero/tests/mocks/composer_target.cairo +76 -0
  322. package/layerzero/tests/mocks/endpoint.cairo +199 -0
  323. package/layerzero/tests/mocks/erc20/erc20.cairo +50 -0
  324. package/layerzero/tests/mocks/erc20/interface.cairo +8 -0
  325. package/layerzero/tests/mocks/message_inspector/message_inspector.cairo +17 -0
  326. package/layerzero/tests/mocks/message_lib_manager.cairo +98 -0
  327. package/layerzero/tests/mocks/messaging_channel/interface.cairo +23 -0
  328. package/layerzero/tests/mocks/messaging_channel/messaging_channel.cairo +138 -0
  329. package/layerzero/tests/mocks/messaging_composer.cairo +171 -0
  330. package/layerzero/tests/mocks/oapp_core/interface.cairo +53 -0
  331. package/layerzero/tests/mocks/oapp_core/oapp_core.cairo +142 -0
  332. package/layerzero/tests/mocks/oapp_options_type3.cairo +42 -0
  333. package/layerzero/tests/mocks/oft_core/interface.cairo +28 -0
  334. package/layerzero/tests/mocks/oft_core/oft_core.cairo +242 -0
  335. package/layerzero/tests/mocks/receiver.cairo +54 -0
  336. package/layerzero/tests/mocks/treasury/lz_token_fee_lib.cairo +57 -0
  337. package/layerzero/tests/mocks/treasury/treasury.cairo +74 -0
  338. package/layerzero/tests/mocks/uln_config/interface.cairo +12 -0
  339. package/layerzero/tests/mocks/uln_config/uln_config.cairo +35 -0
  340. package/layerzero/tests/mocks/workers/base.cairo +80 -0
  341. package/layerzero/tests/mocks/workers/dvn.cairo +115 -0
  342. package/layerzero/tests/mocks/workers/executor/decode/decode.cairo +97 -0
  343. package/layerzero/tests/mocks/workers/executor/decode/interface.cairo +59 -0
  344. package/layerzero/tests/mocks/workers/executor/executor.cairo +176 -0
  345. package/layerzero/tests/oapps/common/test_oapp_options_type_3.cairo +279 -0
  346. package/layerzero/tests/oapps/oft/test_oft_adapter.cairo +441 -0
  347. package/layerzero/tests/oapps/oft/test_oft_compose_msg_codec.cairo +139 -0
  348. package/layerzero/tests/oapps/oft/test_oft_core.cairo +751 -0
  349. package/layerzero/tests/oapps/oft/test_oft_msg_codec.cairo +268 -0
  350. package/layerzero/tests/oapps/test_counter.cairo +470 -0
  351. package/layerzero/tests/oapps/test_oapp_core.cairo +750 -0
  352. package/layerzero/tests/treasury/test_lz_token_fee_lib.cairo +63 -0
  353. package/layerzero/tests/treasury/test_treasury.cairo +458 -0
  354. package/layerzero/tests/treasury/utils.cairo +8 -0
  355. package/layerzero/tests/utils.cairo +48 -0
  356. package/layerzero/tests/workers/base/test_worker_base.cairo +1097 -0
  357. package/layerzero/tests/workers/base/utils.cairo +76 -0
  358. package/layerzero/tests/workers/dvn/fee_lib/test_dvn_fee_lib.cairo +361 -0
  359. package/layerzero/tests/workers/dvn/test_dvn.cairo +1101 -0
  360. package/layerzero/tests/workers/dvn/test_dvn_options.cairo +312 -0
  361. package/layerzero/tests/workers/dvn/utils.cairo +236 -0
  362. package/layerzero/tests/workers/executor/fee_lib/test_executor_fee_lib.cairo +223 -0
  363. package/layerzero/tests/workers/executor/test_decode.cairo +612 -0
  364. package/layerzero/tests/workers/executor/test_executor.cairo +1472 -0
  365. package/layerzero/tests/workers/executor/utils.cairo +296 -0
  366. package/layerzero/tests/workers/price_feed/test_price_feed.cairo +879 -0
  367. package/layerzero/tests/workers/price_feed/utils.cairo +37 -0
  368. package/libs/enumerable_set/Scarb.lock +24 -0
  369. package/libs/enumerable_set/Scarb.toml +17 -0
  370. package/libs/enumerable_set/src/enumerable_set.cairo +118 -0
  371. package/libs/enumerable_set/src/lib.cairo +4 -0
  372. package/libs/enumerable_set/tests/lib.cairo +5 -0
  373. package/libs/enumerable_set/tests/mocks/mock_enumerable_set.cairo +61 -0
  374. package/libs/enumerable_set/tests/test_enumerable_set.cairo +379 -0
  375. package/libs/lz_utils/Scarb.lock +24 -0
  376. package/libs/lz_utils/Scarb.toml +17 -0
  377. package/libs/lz_utils/src/bytes.cairo +33 -0
  378. package/libs/lz_utils/src/error.cairo +12 -0
  379. package/libs/lz_utils/src/keccak.cairo +28 -0
  380. package/libs/lz_utils/src/lib.cairo +3 -0
  381. package/libs/multisig/Scarb.lock +172 -0
  382. package/libs/multisig/Scarb.toml +23 -0
  383. package/libs/multisig/src/errors.cairo +84 -0
  384. package/libs/multisig/src/events.cairo +13 -0
  385. package/libs/multisig/src/interface.cairo +73 -0
  386. package/libs/multisig/src/lib.cairo +7 -0
  387. package/libs/multisig/src/multisig.cairo +241 -0
  388. package/libs/multisig/tests/lib.cairo +4 -0
  389. package/libs/multisig/tests/mocks/mock_multisig.cairo +57 -0
  390. package/libs/multisig/tests/test_multisig.cairo +452 -0
  391. package/package.json +41 -0
  392. package/src/scripts/build-abi.ts +51 -0
  393. package/target/CACHEDIR.TAG +3 -0
  394. package/target/dev/.fingerprint/alexandria_bytes-5ea6u5t70d7qi/alexandria_bytes +1 -0
  395. package/target/dev/.fingerprint/alexandria_data_structures-0aue3g6q80gs0/alexandria_data_structures +1 -0
  396. package/target/dev/.fingerprint/alexandria_math-h2fi7jdq4isuu/alexandria_math +1 -0
  397. package/target/dev/.fingerprint/core-lq3u730l5p1ag/core +1 -0
  398. package/target/dev/.fingerprint/core-vf7fc6rvic5vi/core +1 -0
  399. package/target/dev/.fingerprint/enumerable_set-eaerkg8njl85o/enumerable_set +1 -0
  400. package/target/dev/.fingerprint/enumerable_set-r54oje7t06ku8/enumerable_set +1 -0
  401. package/target/dev/.fingerprint/layerzero-oqgdqsaddpi2k/layerzero +1 -0
  402. package/target/dev/.fingerprint/lz_utils-kfkkeueiqg0pa/lz_utils +1 -0
  403. package/target/dev/.fingerprint/lz_utils-u4v1os6e7gkng/lz_utils +1 -0
  404. package/target/dev/.fingerprint/multisig-0fjetugejecge/multisig +1 -0
  405. package/target/dev/.fingerprint/multisig-6j5kqs436hm54/multisig +1 -0
  406. package/target/dev/.fingerprint/openzeppelin-ei1id1hu088lo/openzeppelin +1 -0
  407. package/target/dev/.fingerprint/openzeppelin-j9d5nd1qhfnu6/openzeppelin +1 -0
  408. package/target/dev/.fingerprint/openzeppelin_access-3oa41aikpaek0/openzeppelin_access +1 -0
  409. package/target/dev/.fingerprint/openzeppelin_access-p5h849v8so76q/openzeppelin_access +1 -0
  410. package/target/dev/.fingerprint/openzeppelin_account-4qhv5fks84g9u/openzeppelin_account +1 -0
  411. package/target/dev/.fingerprint/openzeppelin_account-hgbm8ln9ah7rm/openzeppelin_account +1 -0
  412. package/target/dev/.fingerprint/openzeppelin_finance-n70q9al0cps8i/openzeppelin_finance +1 -0
  413. package/target/dev/.fingerprint/openzeppelin_finance-nnd4f8703t3ak/openzeppelin_finance +1 -0
  414. package/target/dev/.fingerprint/openzeppelin_governance-3gnk21ubp5lis/openzeppelin_governance +1 -0
  415. package/target/dev/.fingerprint/openzeppelin_governance-rj1bfont4fij4/openzeppelin_governance +1 -0
  416. package/target/dev/.fingerprint/openzeppelin_introspection-3fja9hd1gvbcq/openzeppelin_introspection +1 -0
  417. package/target/dev/.fingerprint/openzeppelin_introspection-jc3nf5525eet6/openzeppelin_introspection +1 -0
  418. package/target/dev/.fingerprint/openzeppelin_merkle_tree-4en77ogr2r2l2/openzeppelin_merkle_tree +1 -0
  419. package/target/dev/.fingerprint/openzeppelin_merkle_tree-4t190frqs4db8/openzeppelin_merkle_tree +1 -0
  420. package/target/dev/.fingerprint/openzeppelin_presets-aqb0f6p9c0bp6/openzeppelin_presets +1 -0
  421. package/target/dev/.fingerprint/openzeppelin_presets-nseg8korhin8e/openzeppelin_presets +1 -0
  422. package/target/dev/.fingerprint/openzeppelin_security-g7p73ji1ih1qg/openzeppelin_security +1 -0
  423. package/target/dev/.fingerprint/openzeppelin_security-qp5328v80452u/openzeppelin_security +1 -0
  424. package/target/dev/.fingerprint/openzeppelin_token-jjf7tl9rphc6k/openzeppelin_token +1 -0
  425. package/target/dev/.fingerprint/openzeppelin_token-r6s43vlpj6rqk/openzeppelin_token +1 -0
  426. package/target/dev/.fingerprint/openzeppelin_upgrades-0dpbnre7engca/openzeppelin_upgrades +1 -0
  427. package/target/dev/.fingerprint/openzeppelin_upgrades-2sqgvbuv9s800/openzeppelin_upgrades +1 -0
  428. package/target/dev/.fingerprint/openzeppelin_utils-mj395ivff1ffo/openzeppelin_utils +1 -0
  429. package/target/dev/.fingerprint/openzeppelin_utils-oh1hse8sjumgm/openzeppelin_utils +1 -0
  430. package/target/dev/.fingerprint/starkware_utils-1qnnjnq0pf9u0/starkware_utils +1 -0
  431. package/target/dev/.fingerprint/starkware_utils-mh8e3te65lju4/starkware_utils +1 -0
  432. package/target/dev/enumerable_set.sierra.json +1 -0
  433. package/target/dev/incremental/alexandria_bytes-5ea6u5t70d7qi.bin +0 -0
  434. package/target/dev/incremental/alexandria_data_structures-0aue3g6q80gs0.bin +0 -0
  435. package/target/dev/incremental/alexandria_math-h2fi7jdq4isuu.bin +0 -0
  436. package/target/dev/incremental/core-lq3u730l5p1ag.bin +0 -0
  437. package/target/dev/incremental/core-vf7fc6rvic5vi.bin +0 -0
  438. package/target/dev/incremental/enumerable_set-eaerkg8njl85o.bin +0 -0
  439. package/target/dev/incremental/enumerable_set-r54oje7t06ku8.bin +0 -0
  440. package/target/dev/incremental/layerzero-oqgdqsaddpi2k.bin +0 -0
  441. package/target/dev/incremental/lz_utils-kfkkeueiqg0pa.bin +0 -0
  442. package/target/dev/incremental/lz_utils-u4v1os6e7gkng.bin +0 -0
  443. package/target/dev/incremental/multisig-0fjetugejecge.bin +0 -0
  444. package/target/dev/incremental/multisig-6j5kqs436hm54.bin +0 -0
  445. package/target/dev/incremental/openzeppelin-ei1id1hu088lo.bin +0 -0
  446. package/target/dev/incremental/openzeppelin-j9d5nd1qhfnu6.bin +0 -0
  447. package/target/dev/incremental/openzeppelin_access-3oa41aikpaek0.bin +0 -0
  448. package/target/dev/incremental/openzeppelin_access-p5h849v8so76q.bin +0 -0
  449. package/target/dev/incremental/openzeppelin_account-4qhv5fks84g9u.bin +0 -0
  450. package/target/dev/incremental/openzeppelin_account-hgbm8ln9ah7rm.bin +0 -0
  451. package/target/dev/incremental/openzeppelin_finance-n70q9al0cps8i.bin +0 -0
  452. package/target/dev/incremental/openzeppelin_finance-nnd4f8703t3ak.bin +0 -0
  453. package/target/dev/incremental/openzeppelin_governance-3gnk21ubp5lis.bin +0 -0
  454. package/target/dev/incremental/openzeppelin_governance-rj1bfont4fij4.bin +0 -0
  455. package/target/dev/incremental/openzeppelin_introspection-3fja9hd1gvbcq.bin +0 -0
  456. package/target/dev/incremental/openzeppelin_introspection-jc3nf5525eet6.bin +0 -0
  457. package/target/dev/incremental/openzeppelin_merkle_tree-4en77ogr2r2l2.bin +0 -0
  458. package/target/dev/incremental/openzeppelin_merkle_tree-4t190frqs4db8.bin +0 -0
  459. package/target/dev/incremental/openzeppelin_presets-aqb0f6p9c0bp6.bin +0 -0
  460. package/target/dev/incremental/openzeppelin_presets-nseg8korhin8e.bin +0 -0
  461. package/target/dev/incremental/openzeppelin_security-g7p73ji1ih1qg.bin +0 -0
  462. package/target/dev/incremental/openzeppelin_security-qp5328v80452u.bin +0 -0
  463. package/target/dev/incremental/openzeppelin_token-jjf7tl9rphc6k.bin +0 -0
  464. package/target/dev/incremental/openzeppelin_token-r6s43vlpj6rqk.bin +0 -0
  465. package/target/dev/incremental/openzeppelin_upgrades-0dpbnre7engca.bin +0 -0
  466. package/target/dev/incremental/openzeppelin_upgrades-2sqgvbuv9s800.bin +0 -0
  467. package/target/dev/incremental/openzeppelin_utils-mj395ivff1ffo.bin +0 -0
  468. package/target/dev/incremental/openzeppelin_utils-oh1hse8sjumgm.bin +0 -0
  469. package/target/dev/incremental/starkware_utils-1qnnjnq0pf9u0.bin +0 -0
  470. package/target/dev/incremental/starkware_utils-mh8e3te65lju4.bin +0 -0
  471. package/target/dev/layerzero.starknet_artifacts.json +1 -0
  472. package/target/dev/layerzero_BlockedMessageLib.compiled_contract_class.json +1 -0
  473. package/target/dev/layerzero_BlockedMessageLib.contract_class.json +1 -0
  474. package/target/dev/layerzero_Dvn.compiled_contract_class.json +1 -0
  475. package/target/dev/layerzero_Dvn.contract_class.json +1 -0
  476. package/target/dev/layerzero_DvnFeeLib.compiled_contract_class.json +1 -0
  477. package/target/dev/layerzero_DvnFeeLib.contract_class.json +1 -0
  478. package/target/dev/layerzero_Endpoint.compiled_contract_class.json +1 -0
  479. package/target/dev/layerzero_Endpoint.contract_class.json +1 -0
  480. package/target/dev/layerzero_Executor.compiled_contract_class.json +1 -0
  481. package/target/dev/layerzero_Executor.contract_class.json +1 -0
  482. package/target/dev/layerzero_ExecutorFeeLib.compiled_contract_class.json +1 -0
  483. package/target/dev/layerzero_ExecutorFeeLib.contract_class.json +1 -0
  484. package/target/dev/layerzero_OApp.compiled_contract_class.json +1 -0
  485. package/target/dev/layerzero_OApp.contract_class.json +1 -0
  486. package/target/dev/layerzero_OFT.compiled_contract_class.json +1 -0
  487. package/target/dev/layerzero_OFT.contract_class.json +1 -0
  488. package/target/dev/layerzero_OFTAdapter.compiled_contract_class.json +1 -0
  489. package/target/dev/layerzero_OFTAdapter.contract_class.json +1 -0
  490. package/target/dev/layerzero_OmniCounter.compiled_contract_class.json +1 -0
  491. package/target/dev/layerzero_OmniCounter.contract_class.json +1 -0
  492. package/target/dev/layerzero_PriceFeed.compiled_contract_class.json +1 -0
  493. package/target/dev/layerzero_PriceFeed.contract_class.json +1 -0
  494. package/target/dev/layerzero_SimpleMessageLib.compiled_contract_class.json +1 -0
  495. package/target/dev/layerzero_SimpleMessageLib.contract_class.json +1 -0
  496. package/target/dev/layerzero_Treasury.compiled_contract_class.json +1 -0
  497. package/target/dev/layerzero_Treasury.contract_class.json +1 -0
  498. package/target/dev/layerzero_UltraLightNode.compiled_contract_class.json +1 -0
  499. package/target/dev/layerzero_UltraLightNode.contract_class.json +1 -0
  500. package/target/dev/lz_utils.sierra.json +1 -0
  501. package/target/dev/multisig.sierra.json +1 -0
  502. package/tools/update_contracts.sh +19 -0
  503. package/tsconfig.json +20 -0
  504. package/tsup.config.ts +7 -0
@@ -0,0 +1,131 @@
1
+ //! Executor interface
2
+
3
+ use starknet::{ClassHash, ContractAddress};
4
+ use crate::Origin;
5
+ use crate::workers::executor::structs::{
6
+ ComposeParams, DstConfig, ExecuteParams, NativeDropParams, SetDstConfigParams,
7
+ };
8
+
9
+ /// Interface for the executor contract
10
+ #[starknet::interface]
11
+ pub trait IExecutor<TContractState> {
12
+ // ================================== Only Owner =====================================
13
+
14
+ /// Upgrades the contract
15
+ ///
16
+ /// # Arguments
17
+ /// * `new_class_hash` - The new class hash to upgrade to
18
+ ///
19
+ /// # Events
20
+ /// * `Upgraded` - Emitted when the contract is upgraded (from OpenZeppelin's
21
+ /// [`UpgradeableComponent`])
22
+ ///
23
+ /// @dev This function is only callable by the owner.
24
+ fn upgrade(ref self: TContractState, new_class_hash: ClassHash);
25
+
26
+ /// Upgrades the contract and calls a function
27
+ ///
28
+ /// # Arguments
29
+ /// * `new_class_hash` - The new class hash to upgrade to
30
+ /// * `selector` - The selector to call
31
+ /// * `data` - The data to pass to the function
32
+ ///
33
+ /// # Returns
34
+ /// * `Span<felt252>` - The response data from the function call
35
+ ///
36
+ /// # Events
37
+ /// * `Upgraded` - Emitted when the contract is upgraded (from OpenZeppelin's
38
+ /// [`UpgradeableComponent`])
39
+ ///
40
+ /// @dev This function is only callable by the owner.
41
+ fn upgrade_and_call(
42
+ ref self: TContractState,
43
+ new_class_hash: ClassHash,
44
+ selector: felt252,
45
+ calldata: Span<felt252>,
46
+ ) -> Span<felt252>;
47
+
48
+ // ================================== Only Admin =====================================
49
+
50
+ /// Sets the destination configurations for one or more endpoint IDs.
51
+ ///
52
+ /// # Arguments
53
+ /// * `params` - An array of `SetDstConfigParams` structs, each specifying a destination EID and
54
+ /// its configuration.
55
+ ///
56
+ /// # Events
57
+ /// * `DstConfigSet` - Emitted when the destination configurations are set.
58
+ ///
59
+ /// @dev This function is only callable by the admin.
60
+ fn set_dst_config(ref self: TContractState, params: Array<SetDstConfigParams>);
61
+
62
+ /// Execute a job
63
+ ///
64
+ /// # Arguments
65
+ /// * `params` - The execution parameters
66
+ ///
67
+ /// # Events
68
+ /// * `ExecuteFailed` - Emitted when the job execution fails
69
+ ///
70
+ /// @dev This function is only callable by the admin.
71
+ fn execute(ref self: TContractState, params: ExecuteParams);
72
+
73
+ /// Compose a message
74
+ ///
75
+ /// # Arguments
76
+ /// * `params` - The composition parameters
77
+ ///
78
+ /// # Events
79
+ /// * `ComposeFailed` - Emitted when the message composition fails
80
+ ///
81
+ /// @dev This function is only callable by the admin.
82
+ fn compose(ref self: TContractState, params: ComposeParams);
83
+
84
+ /// Drop native tokens to receivers.
85
+ ///
86
+ /// # Arguments
87
+ /// * `origin` - The message origin
88
+ /// * `oapp` - The OApp address
89
+ /// * `native_drop_params` - The native drop parameters.
90
+ ///
91
+ /// # Events
92
+ /// * `NativeDropFailed` - Emitted when the native drop fails
93
+ ///
94
+ /// @dev This function is only callable by the admin.
95
+ fn native_drop(
96
+ ref self: TContractState,
97
+ origin: Origin,
98
+ oapp: ContractAddress,
99
+ native_drop_params: Array<NativeDropParams>,
100
+ );
101
+
102
+ /// Drop native tokens to receivers and execute a message.
103
+ ///
104
+ /// # Arguments
105
+ /// * `native_drop_params` - The native drop parameters.
106
+ /// * `execute_params` - The execution parameters.
107
+ ///
108
+ /// # Events
109
+ /// * `NativeDropFailed` - Emitted when the native drop fails
110
+ /// * `ExecuteFailed` - Emitted when the job execution fails
111
+ ///
112
+ /// @dev This function is only callable by the admin.
113
+ fn native_drop_and_execute(
114
+ ref self: TContractState,
115
+ native_drop_params: Array<NativeDropParams>,
116
+ execute_params: ExecuteParams,
117
+ );
118
+
119
+ // ================================== View ==========================================
120
+
121
+ /// Get the destination configuration
122
+ ///
123
+ /// # Arguments
124
+ /// * `dst_eid` - The destination endpoint ID
125
+ ///
126
+ /// # Returns
127
+ /// * `DstConfig` - The destination configuration
128
+ ///
129
+ /// @dev This function is only callable by anyone.
130
+ fn get_dst_config(self: @TContractState, dst_eid: u32) -> DstConfig;
131
+ }
@@ -0,0 +1,244 @@
1
+ //! Executor options
2
+
3
+ use alexandria_bytes::byte_array_ext::ByteArrayTraitExt;
4
+ use core::byte_array::{ByteArray, ByteArrayTrait};
5
+ use starkware_utils::errors::assert_with_byte_array;
6
+ use crate::workers::executor::errors;
7
+ use crate::workers::executor::structs::{
8
+ ExecutorOption, LzComposeOption, LzReadOption, LzReceiveOption, NativeDropOption,
9
+ };
10
+
11
+ // Constants
12
+ pub const OPTION_TYPE_LZRECEIVE: u8 = 1;
13
+ pub const OPTION_TYPE_NATIVE_DROP: u8 = 2;
14
+ pub const OPTION_TYPE_LZCOMPOSE: u8 = 3;
15
+ pub const OPTION_TYPE_ORDERED_EXECUTION: u8 = 4;
16
+ pub const OPTION_TYPE_LZREAD: u8 = 5;
17
+
18
+ pub const EXECUTOR_WORKER_ID: u8 = 1;
19
+
20
+ // This struct holds the aggregated values from parsing the executor options.
21
+ #[derive(Default, Drop, Serde, Debug)]
22
+ pub struct ExecutorOptionsAggregated {
23
+ // The total native value to be sent with the message.
24
+ pub total_value: u128,
25
+ // The total gas limit for the message execution.
26
+ pub total_gas: u128,
27
+ // A flag indicating if ordered execution is requested.
28
+ pub ordered: bool,
29
+ // The number of `lz_compose` options.
30
+ pub num_lz_compose: u32,
31
+ // The size of the calldata.
32
+ pub calldata_size: u32,
33
+ // The gas for `lzReceive`.
34
+ pub lz_receive_gas: u128,
35
+ }
36
+
37
+ // This struct holds the decoded/calculated values needed for quoting.
38
+ #[derive(Copy, Drop, Serde, Debug, PartialEq)]
39
+ pub struct PriceFeedParams {
40
+ // The total native value to be sent with the message.
41
+ pub total_value: u256,
42
+ // The total gas limit for the message execution.
43
+ pub total_gas: u256,
44
+ // The size of the calldata.
45
+ pub calldata_size: u32,
46
+ }
47
+
48
+ pub fn _decode_executor_options(
49
+ is_read: bool,
50
+ is_v1_eid: bool,
51
+ lz_receive_base_gas: u256,
52
+ lz_compose_base_gas: u256,
53
+ native_cap: u128,
54
+ options: @ByteArray,
55
+ ) -> PriceFeedParams {
56
+ let parsed_options = _parse_options_to_array(options);
57
+ let agg_options = _aggregate_options(parsed_options.span(), is_read, is_v1_eid, native_cap);
58
+
59
+ // lz receive only called once
60
+ // lz compose can be called multiple times, based on unique index
61
+ // to simplify the quoting, we add lzComposeBaseGas for each lzComposeOption received
62
+ // if the same index has multiple compose options, the gas will be added multiple times
63
+ let mut total_gas: u256 = lz_receive_base_gas
64
+ + agg_options.total_gas.into()
65
+ + lz_compose_base_gas * agg_options.num_lz_compose.into();
66
+ if agg_options.ordered {
67
+ total_gas = (total_gas * 102) / 100;
68
+ }
69
+
70
+ PriceFeedParams {
71
+ total_value: agg_options.total_value.into(),
72
+ total_gas: total_gas,
73
+ calldata_size: agg_options.calldata_size,
74
+ }
75
+ }
76
+
77
+
78
+ pub fn _parse_options_to_array(options_bytes: @ByteArray) -> Array<ExecutorOption> {
79
+ assert_with_byte_array(options_bytes.len() > 0, errors::err_no_options());
80
+
81
+ let mut options_arr = array![];
82
+ let mut cursor: usize = 0;
83
+ let total_len = options_bytes.len();
84
+
85
+ while cursor != total_len {
86
+ assert_with_byte_array(cursor < total_len, errors::err_malformed_options());
87
+ // skip worker id
88
+ cursor += 1;
89
+
90
+ let (cursor_after_len, option_len_total_u16) = options_bytes.read_u16(cursor);
91
+ let option_len_total: usize = option_len_total_u16.into();
92
+ cursor = cursor_after_len;
93
+
94
+ // ensure we have at least one byte for the option type
95
+ assert_with_byte_array(cursor < total_len, errors::err_malformed_options());
96
+ let (cursor_after_type, option_type) = options_bytes.read_u8(cursor);
97
+ cursor = cursor_after_type;
98
+
99
+ // option_len_total includes the type byte; payload length excludes it
100
+ assert_with_byte_array(option_len_total > 0, errors::err_malformed_options());
101
+ let option_len: usize = option_len_total - 1;
102
+
103
+ let option_data_start_offset = cursor;
104
+ // ensure payload fits within the total buffer
105
+ assert_with_byte_array(
106
+ option_data_start_offset + option_len <= total_len, errors::err_malformed_options(),
107
+ );
108
+
109
+ if option_type == OPTION_TYPE_LZRECEIVE {
110
+ let lz_receive_option = _read_lz_receive_option(
111
+ options_bytes, option_data_start_offset, option_len,
112
+ );
113
+ options_arr.append(ExecutorOption::LzReceive(lz_receive_option));
114
+ } else if option_type == OPTION_TYPE_NATIVE_DROP {
115
+ let native_drop_option = _read_native_drop_option(
116
+ options_bytes, option_data_start_offset, option_len,
117
+ );
118
+ options_arr.append(ExecutorOption::NativeDrop(native_drop_option));
119
+ } else if option_type == OPTION_TYPE_LZCOMPOSE {
120
+ let lz_compose_option = _read_lz_compose_option(
121
+ options_bytes, option_data_start_offset, option_len,
122
+ );
123
+ options_arr.append(ExecutorOption::LzCompose(lz_compose_option));
124
+ } else if option_type == OPTION_TYPE_ORDERED_EXECUTION {
125
+ options_arr.append(ExecutorOption::OrderedExecution);
126
+ } else {
127
+ assert_with_byte_array(
128
+ option_type == OPTION_TYPE_LZREAD, errors::err_unsupported_option_type(),
129
+ );
130
+ let lz_read_option = _read_lz_read_option(
131
+ options_bytes, option_data_start_offset, option_len,
132
+ );
133
+ options_arr.append(ExecutorOption::LzRead(lz_read_option));
134
+ }
135
+ cursor = option_data_start_offset + option_len;
136
+ }
137
+
138
+ options_arr
139
+ }
140
+
141
+ // equivalent to _parseExecutorOptions in ExecutorFeeLib.sol
142
+ pub fn _aggregate_options(
143
+ options_span: Span<ExecutorOption>, is_read: bool, is_v1_eid: bool, native_cap: u128,
144
+ ) -> ExecutorOptionsAggregated {
145
+ let mut options = ExecutorOptionsAggregated {
146
+ total_value: 0,
147
+ total_gas: 0,
148
+ ordered: false,
149
+ num_lz_compose: 0,
150
+ calldata_size: 0,
151
+ lz_receive_gas: 0,
152
+ };
153
+
154
+ let mut temp_options = options_span;
155
+ while let Option::Some(option) = temp_options.pop_front() {
156
+ match option {
157
+ ExecutorOption::LzReceive(lz_receive_option) => {
158
+ assert_with_byte_array(!is_read, errors::err_unsupported_option_lz_receive());
159
+ assert_with_byte_array(
160
+ !is_v1_eid || *lz_receive_option.value == 0,
161
+ errors::err_unsupported_receive_with_value(),
162
+ );
163
+ options.total_value += *lz_receive_option.value;
164
+ options.lz_receive_gas += *lz_receive_option.gas;
165
+ },
166
+ ExecutorOption::NativeDrop(native_drop_option) => {
167
+ assert_with_byte_array(!is_read, errors::err_unsupported_option_native_drop());
168
+ options.total_value += *native_drop_option.amount;
169
+ },
170
+ ExecutorOption::LzCompose(lz_compose_option) => {
171
+ assert_with_byte_array(!is_v1_eid, errors::err_unsupported_option_lz_compose());
172
+ assert_with_byte_array(
173
+ *lz_compose_option.gas > 0, errors::err_zero_lz_compose_gas(),
174
+ );
175
+ options.total_value += *lz_compose_option.value;
176
+ options.total_gas += *lz_compose_option.gas;
177
+ options.num_lz_compose += 1;
178
+ },
179
+ ExecutorOption::OrderedExecution => { options.ordered = true; },
180
+ ExecutorOption::LzRead(lz_read_option) => {
181
+ assert_with_byte_array(is_read, errors::err_unsupported_option_lz_read());
182
+ options.total_value += *lz_read_option.value;
183
+ options.lz_receive_gas += *lz_read_option.gas;
184
+ options.calldata_size += *lz_read_option.size;
185
+ },
186
+ }
187
+ }
188
+
189
+ assert_with_byte_array(
190
+ options.total_value <= native_cap, errors::err_native_amount_exceeds_cap(),
191
+ );
192
+ assert_with_byte_array(options.lz_receive_gas > 0, errors::err_zero_lz_receive_gas());
193
+ if is_read {
194
+ assert_with_byte_array(options.calldata_size > 0, errors::err_zero_calldata_size());
195
+ }
196
+ options.total_gas += options.lz_receive_gas;
197
+ options
198
+ }
199
+
200
+ // Decoding helper functions
201
+ pub fn _read_lz_receive_option(b: @ByteArray, offset: usize, len: usize) -> LzReceiveOption {
202
+ assert_with_byte_array(len == 16 || len == 32, errors::err_invalid_lz_receive_option());
203
+ let (offset, gas) = b.read_u128(offset);
204
+ let value = if len == 32 {
205
+ let (_, value) = b.read_u128(offset);
206
+ value
207
+ } else {
208
+ 0
209
+ };
210
+ LzReceiveOption { gas, value }
211
+ }
212
+
213
+ pub fn _read_native_drop_option(b: @ByteArray, offset: usize, len: usize) -> NativeDropOption {
214
+ assert_with_byte_array(len == 48, errors::err_invalid_native_drop_option());
215
+ let (offset, amount) = b.read_u128(offset);
216
+ let (_, receiver) = b.read_u256(offset);
217
+ NativeDropOption { amount, receiver: receiver.into() }
218
+ }
219
+
220
+ pub fn _read_lz_compose_option(b: @ByteArray, offset: usize, len: usize) -> LzComposeOption {
221
+ assert_with_byte_array(len == 18 || len == 34, errors::err_invalid_lz_compose_option());
222
+ let (offset, index) = b.read_u16(offset);
223
+ let (offset, gas) = b.read_u128(offset);
224
+ let value = if len == 34 {
225
+ let (_, value) = b.read_u128(offset);
226
+ value
227
+ } else {
228
+ 0
229
+ };
230
+ LzComposeOption { index, gas, value }
231
+ }
232
+
233
+ pub fn _read_lz_read_option(b: @ByteArray, offset: usize, len: usize) -> LzReadOption {
234
+ assert_with_byte_array(len == 20 || len == 36, errors::err_invalid_lz_read_option());
235
+ let (offset, gas) = b.read_u128(offset);
236
+ let (offset, size) = b.read_u32(offset);
237
+ let value = if len == 36 {
238
+ let (_, value) = b.read_u128(offset);
239
+ value
240
+ } else {
241
+ 0
242
+ };
243
+ LzReadOption { gas, size, value }
244
+ }
@@ -0,0 +1,119 @@
1
+ //! Executor structs
2
+
3
+ use lz_utils::bytes::Bytes32;
4
+ use starknet::ContractAddress;
5
+ use crate::Origin;
6
+
7
+ #[derive(Copy, Drop, Serde, starknet::Store, PartialEq, Default, Debug)]
8
+ pub struct DstConfig {
9
+ /// The base gas for `lz_receive`
10
+ pub lz_receive_base_gas: u64,
11
+ /// The gas multiplier in basis points
12
+ pub multiplier_bps: u16,
13
+ /// The floor margin in USD (uses priceFeed PRICE_RATIO_DENOMINATOR)
14
+ pub floor_margin_usd: u128,
15
+ /// The native token cap
16
+ pub native_cap: u128,
17
+ /// The base gas for `lz_compose`
18
+ pub lz_compose_base_gas: u64,
19
+ }
20
+
21
+ #[derive(Copy, Drop, Serde, PartialEq)]
22
+ pub struct SetDstConfigParams {
23
+ /// The destination endpoint ID
24
+ pub dst_eid: u32,
25
+ /// The destination configuration
26
+ pub config: DstConfig,
27
+ }
28
+
29
+ #[derive(Drop, Serde, Clone)]
30
+ pub struct ExecuteParams {
31
+ /// The address of the receiver contract
32
+ pub receiver: ContractAddress,
33
+ /// The origin information of the message
34
+ pub origin: Origin,
35
+ /// The globally unique identifier for the message
36
+ pub guid: Bytes32,
37
+ /// The amount of native tokens to be sent with the message
38
+ pub value: u256,
39
+ /// The message payload
40
+ pub message: ByteArray,
41
+ /// The gas limit for the execution
42
+ pub gas_limit: u256,
43
+ /// Extra data for the execution
44
+ pub extra_data: ByteArray,
45
+ }
46
+
47
+ #[derive(Drop, Serde, Clone)]
48
+ pub struct ComposeParams {
49
+ /// The address of the receiver contract
50
+ pub receiver: ContractAddress,
51
+ /// The address of the sender contract
52
+ pub sender: ContractAddress,
53
+ /// The globally unique identifier for the message
54
+ pub guid: Bytes32,
55
+ /// The index for composing messages
56
+ pub index: u16,
57
+ /// The amount of native tokens to be sent with the message
58
+ pub value: u256,
59
+ /// The message payload
60
+ pub message: ByteArray,
61
+ /// Extra data for composing the message
62
+ pub extra_data: ByteArray,
63
+ /// The gas limit for the composition
64
+ pub gas_limit: u256,
65
+ }
66
+
67
+ #[derive(Drop, Serde)]
68
+ pub enum ExecutorOption {
69
+ LzReceive: LzReceiveOption,
70
+ NativeDrop: NativeDropOption,
71
+ LzCompose: LzComposeOption,
72
+ OrderedExecution,
73
+ LzRead: LzReadOption,
74
+ }
75
+
76
+ #[derive(Debug, Drop, Serde, Clone)]
77
+ pub struct LzReceiveOption {
78
+ /// The gas limit for `lz_receive`
79
+ pub gas: u128,
80
+ /// The native token value to be sent with `lz_receive`
81
+ pub value: u128,
82
+ }
83
+
84
+ #[derive(Drop, Serde, Clone)]
85
+ pub struct NativeDropOption {
86
+ /// The amount of native tokens to drop
87
+ pub amount: u128,
88
+ /// The recipient address for the native drop
89
+ pub receiver: Bytes32,
90
+ }
91
+
92
+ /// Native drop parameters.
93
+ #[derive(Drop, Serde, Clone)]
94
+ pub struct NativeDropParams {
95
+ /// Amount of the native tokens
96
+ pub amount: u256,
97
+ /// Receiver of the native tokens
98
+ pub receiver: ContractAddress,
99
+ }
100
+
101
+ #[derive(Debug, Drop, Serde, Clone)]
102
+ pub struct LzComposeOption {
103
+ /// The index for composing messages
104
+ pub index: u16,
105
+ /// The gas limit for `lz_compose`
106
+ pub gas: u128,
107
+ /// The native token value to be sent with `lz_compose`
108
+ pub value: u128,
109
+ }
110
+
111
+ #[derive(Drop, Serde, Clone)]
112
+ pub struct LzReadOption {
113
+ /// The gas limit for the read operation
114
+ pub gas: u128,
115
+ /// The size of the data to be read
116
+ pub size: u32,
117
+ /// The native token value to be sent with the read operation
118
+ pub value: u128,
119
+ }
@@ -0,0 +1,32 @@
1
+ //! ILayerZeroWorker interface used by the DVN and Executor workers
2
+
3
+ use crate::workers::base::structs::QuoteParams;
4
+
5
+ #[starknet::interface]
6
+ pub trait ILayerZeroWorker<TContractState> {
7
+ // ================================== Only Message Lib =====================================
8
+
9
+ /// Assign a job
10
+ ///
11
+ /// # Arguments
12
+ /// * `params` - Parameters for assigning a job
13
+ ///
14
+ /// # Returns
15
+ /// * `u256` - The fee for the job
16
+ ///
17
+ /// @dev This function is only callable by message libs.
18
+ fn assign_job(ref self: TContractState, params: QuoteParams) -> u256;
19
+
20
+ // ================================== View =====================================
21
+
22
+ /// Quote the fee for a job
23
+ ///
24
+ /// # Arguments
25
+ /// * `params` - Parameters for quoting the fee
26
+ ///
27
+ /// # Returns
28
+ /// * `u256` - The fee for the job
29
+ ///
30
+ /// @dev This function is callable by anyone.
31
+ fn quote(self: @TContractState, params: QuoteParams) -> u256;
32
+ }
@@ -0,0 +1,7 @@
1
+ //! Price feed constants
2
+
3
+ /// Price ratio denominator (10^20)
4
+ pub const PRICE_RATIO_DENOMINATOR: u128 = 100_000_000_000_000_000_000_u128;
5
+
6
+ /// Arbitrum compression percent
7
+ pub const ARBITRUM_COMPRESSION_PERCENT: u32 = 47;
@@ -0,0 +1,28 @@
1
+ use lz_utils::error::{Error, format_error};
2
+
3
+ #[derive(Drop)]
4
+ pub enum PriceFeedError {
5
+ OnlyPriceUpdater,
6
+ NotAnOpStack,
7
+ }
8
+
9
+ impl ErrorNameImpl of Error<PriceFeedError> {
10
+ fn prefix() -> ByteArray {
11
+ "LZ_PRICE_FEED"
12
+ }
13
+
14
+ fn name(self: PriceFeedError) -> ByteArray {
15
+ match self {
16
+ PriceFeedError::OnlyPriceUpdater => "ONLY_PRICE_UPDATER",
17
+ PriceFeedError::NotAnOpStack => "NOT_AN_OP_STACK",
18
+ }
19
+ }
20
+ }
21
+
22
+ pub fn err_lz_price_feed_only_price_updater() -> ByteArray {
23
+ format_error(PriceFeedError::OnlyPriceUpdater, "")
24
+ }
25
+
26
+ pub fn err_lz_pricefeed_not_an_op_stack() -> ByteArray {
27
+ format_error(PriceFeedError::NotAnOpStack, "")
28
+ }
@@ -0,0 +1,13 @@
1
+ //! Price feed events
2
+
3
+ use starknet::ContractAddress;
4
+
5
+ /// Event emitted when fees are withdrawn
6
+ #[derive(Drop, starknet::Event)]
7
+ pub struct FeeWithdrawn {
8
+ #[key]
9
+ pub token_address: ContractAddress,
10
+ #[key]
11
+ pub to: ContractAddress,
12
+ pub amount: u256,
13
+ }