@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.
- package/.turbo/turbo-build.log +186 -0
- package/.turbo/turbo-lint.log +71 -0
- package/.turbo/turbo-test.log +937 -0
- package/README.md +41 -0
- package/Scarb.lock +211 -0
- package/Scarb.toml +2 -0
- package/dist/4XD3ZRZ4.cjs +301 -0
- package/dist/4XD3ZRZ4.cjs.map +1 -0
- package/dist/4Z5IPBC3.js +299 -0
- package/dist/4Z5IPBC3.js.map +1 -0
- package/dist/5NEZDLVQ.cjs +474 -0
- package/dist/5NEZDLVQ.cjs.map +1 -0
- package/dist/6JYCOKDE.js +472 -0
- package/dist/6JYCOKDE.js.map +1 -0
- package/dist/7C4PFMIZ.cjs +1288 -0
- package/dist/7C4PFMIZ.cjs.map +1 -0
- package/dist/7ZSGGZUE.js +1229 -0
- package/dist/7ZSGGZUE.js.map +1 -0
- package/dist/ARHOGUYH.cjs +2136 -0
- package/dist/ARHOGUYH.cjs.map +1 -0
- package/dist/CRCRIUFX.js +1264 -0
- package/dist/CRCRIUFX.js.map +1 -0
- package/dist/DB7CQSED.cjs +430 -0
- package/dist/DB7CQSED.cjs.map +1 -0
- package/dist/DFXLWHYP.cjs +1266 -0
- package/dist/DFXLWHYP.cjs.map +1 -0
- package/dist/EOLZCMCK.js +988 -0
- package/dist/EOLZCMCK.js.map +1 -0
- package/dist/FFDPTOWG.cjs +331 -0
- package/dist/FFDPTOWG.cjs.map +1 -0
- package/dist/FOJGEAIO.js +2134 -0
- package/dist/FOJGEAIO.js.map +1 -0
- package/dist/IWIUMVGB.js +629 -0
- package/dist/IWIUMVGB.js.map +1 -0
- package/dist/MUEN6AWV.cjs +697 -0
- package/dist/MUEN6AWV.cjs.map +1 -0
- package/dist/ORE6VBZ4.cjs +990 -0
- package/dist/ORE6VBZ4.cjs.map +1 -0
- package/dist/OUFKWPZ7.js +732 -0
- package/dist/OUFKWPZ7.js.map +1 -0
- package/dist/T2QTYQXJ.js +1229 -0
- package/dist/T2QTYQXJ.js.map +1 -0
- package/dist/UPJTM7BR.cjs +631 -0
- package/dist/UPJTM7BR.cjs.map +1 -0
- package/dist/VNVNX2P3.cjs +1231 -0
- package/dist/VNVNX2P3.cjs.map +1 -0
- package/dist/VUOMXK5T.js +6 -0
- package/dist/VUOMXK5T.js.map +1 -0
- package/dist/WISWRTDG.js +1286 -0
- package/dist/WISWRTDG.js.map +1 -0
- package/dist/WU5L7YIQ.cjs +1231 -0
- package/dist/WU5L7YIQ.cjs.map +1 -0
- package/dist/X3B5JDMZ.js +695 -0
- package/dist/X3B5JDMZ.js.map +1 -0
- package/dist/XYNBDBBV.cjs +297 -0
- package/dist/XYNBDBBV.cjs.map +1 -0
- package/dist/Y5JFPCYJ.cjs +734 -0
- package/dist/Y5JFPCYJ.cjs.map +1 -0
- package/dist/YEHL7IYO.js +295 -0
- package/dist/YEHL7IYO.js.map +1 -0
- package/dist/YJF4D23A.cjs +8 -0
- package/dist/YJF4D23A.cjs.map +1 -0
- package/dist/YTS44OEA.js +428 -0
- package/dist/YTS44OEA.js.map +1 -0
- package/dist/Z2NIUZMW.js +329 -0
- package/dist/Z2NIUZMW.js.map +1 -0
- package/dist/abis/blocked-message-lib.cjs +13 -0
- package/dist/abis/blocked-message-lib.cjs.map +1 -0
- package/dist/abis/blocked-message-lib.d.ts +338 -0
- package/dist/abis/blocked-message-lib.d.ts.map +1 -0
- package/dist/abis/blocked-message-lib.js +4 -0
- package/dist/abis/blocked-message-lib.js.map +1 -0
- package/dist/abis/dvn-fee-lib.cjs +13 -0
- package/dist/abis/dvn-fee-lib.cjs.map +1 -0
- package/dist/abis/dvn-fee-lib.d.ts +214 -0
- package/dist/abis/dvn-fee-lib.d.ts.map +1 -0
- package/dist/abis/dvn-fee-lib.js +4 -0
- package/dist/abis/dvn-fee-lib.js.map +1 -0
- package/dist/abis/dvn.cjs +13 -0
- package/dist/abis/dvn.cjs.map +1 -0
- package/dist/abis/dvn.d.ts +952 -0
- package/dist/abis/dvn.d.ts.map +1 -0
- package/dist/abis/dvn.js +4 -0
- package/dist/abis/dvn.js.map +1 -0
- package/dist/abis/endpoint-v2.cjs +13 -0
- package/dist/abis/endpoint-v2.cjs.map +1 -0
- package/dist/abis/endpoint-v2.d.ts +1580 -0
- package/dist/abis/endpoint-v2.d.ts.map +1 -0
- package/dist/abis/endpoint-v2.js +4 -0
- package/dist/abis/endpoint-v2.js.map +1 -0
- package/dist/abis/executor-fee-lib.cjs +13 -0
- package/dist/abis/executor-fee-lib.cjs.map +1 -0
- package/dist/abis/executor-fee-lib.d.ts +217 -0
- package/dist/abis/executor-fee-lib.d.ts.map +1 -0
- package/dist/abis/executor-fee-lib.js +4 -0
- package/dist/abis/executor-fee-lib.js.map +1 -0
- package/dist/abis/executor.cjs +13 -0
- package/dist/abis/executor.cjs.map +1 -0
- package/dist/abis/executor.d.ts +914 -0
- package/dist/abis/executor.d.ts.map +1 -0
- package/dist/abis/executor.js +4 -0
- package/dist/abis/executor.js.map +1 -0
- package/dist/abis/o-app.cjs +13 -0
- package/dist/abis/o-app.cjs.map +1 -0
- package/dist/abis/o-app.d.ts +311 -0
- package/dist/abis/o-app.d.ts.map +1 -0
- package/dist/abis/o-app.js +4 -0
- package/dist/abis/o-app.js.map +1 -0
- package/dist/abis/oft-adapter.cjs +13 -0
- package/dist/abis/oft-adapter.cjs.map +1 -0
- package/dist/abis/oft-adapter.d.ts +722 -0
- package/dist/abis/oft-adapter.d.ts.map +1 -0
- package/dist/abis/oft-adapter.js +4 -0
- package/dist/abis/oft-adapter.js.map +1 -0
- package/dist/abis/oft.cjs +13 -0
- package/dist/abis/oft.cjs.map +1 -0
- package/dist/abis/oft.d.ts +922 -0
- package/dist/abis/oft.d.ts.map +1 -0
- package/dist/abis/oft.js +4 -0
- package/dist/abis/oft.js.map +1 -0
- package/dist/abis/omni-counter.cjs +13 -0
- package/dist/abis/omni-counter.cjs.map +1 -0
- package/dist/abis/omni-counter.d.ts +459 -0
- package/dist/abis/omni-counter.d.ts.map +1 -0
- package/dist/abis/omni-counter.js +4 -0
- package/dist/abis/omni-counter.js.map +1 -0
- package/dist/abis/price-feed.cjs +13 -0
- package/dist/abis/price-feed.cjs.map +1 -0
- package/dist/abis/price-feed.d.ts +505 -0
- package/dist/abis/price-feed.d.ts.map +1 -0
- package/dist/abis/price-feed.js +4 -0
- package/dist/abis/price-feed.js.map +1 -0
- package/dist/abis/simple-message-lib.cjs +13 -0
- package/dist/abis/simple-message-lib.cjs.map +1 -0
- package/dist/abis/simple-message-lib.d.ts +535 -0
- package/dist/abis/simple-message-lib.d.ts.map +1 -0
- package/dist/abis/simple-message-lib.js +4 -0
- package/dist/abis/simple-message-lib.js.map +1 -0
- package/dist/abis/treasury.cjs +13 -0
- package/dist/abis/treasury.cjs.map +1 -0
- package/dist/abis/treasury.d.ts +240 -0
- package/dist/abis/treasury.d.ts.map +1 -0
- package/dist/abis/treasury.js +4 -0
- package/dist/abis/treasury.js.map +1 -0
- package/dist/abis/ultra-light-node.cjs +13 -0
- package/dist/abis/ultra-light-node.cjs.map +1 -0
- package/dist/abis/ultra-light-node.d.ts +900 -0
- package/dist/abis/ultra-light-node.d.ts.map +1 -0
- package/dist/abis/ultra-light-node.js +4 -0
- package/dist/abis/ultra-light-node.js.map +1 -0
- package/dist/index.cjs +78 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/scripts/build-abi.cjs +28 -0
- package/dist/scripts/build-abi.cjs.map +1 -0
- package/dist/scripts/build-abi.d.ts +2 -0
- package/dist/scripts/build-abi.d.ts.map +1 -0
- package/dist/scripts/build-abi.js +26 -0
- package/dist/scripts/build-abi.js.map +1 -0
- package/layerzero/README.md +244 -0
- package/layerzero/Scarb.lock +203 -0
- package/layerzero/Scarb.toml +30 -0
- package/layerzero/snfoundry.toml +11 -0
- package/layerzero/src/common/constants.cairo +26 -0
- package/layerzero/src/common/conversions.cairo +16 -0
- package/layerzero/src/common/guid.cairo +20 -0
- package/layerzero/src/common/packet_v1_codec.cairo +307 -0
- package/layerzero/src/common/structs/messaging.cairo +40 -0
- package/layerzero/src/common/structs/packet.cairo +31 -0
- package/layerzero/src/endpoint/constants.cairo +14 -0
- package/layerzero/src/endpoint/endpoint.cairo +688 -0
- package/layerzero/src/endpoint/errors.cairo +108 -0
- package/layerzero/src/endpoint/events.cairo +124 -0
- package/layerzero/src/endpoint/interfaces/endpoint.cairo +286 -0
- package/layerzero/src/endpoint/interfaces/layerzero_composer.cairo +62 -0
- package/layerzero/src/endpoint/interfaces/layerzero_receiver.cairo +63 -0
- package/layerzero/src/endpoint/message_lib_manager/errors.cairo +95 -0
- package/layerzero/src/endpoint/message_lib_manager/events.cairo +90 -0
- package/layerzero/src/endpoint/message_lib_manager/interface.cairo +449 -0
- package/layerzero/src/endpoint/message_lib_manager/message_lib_manager.cairo +720 -0
- package/layerzero/src/endpoint/message_lib_manager/structs.cairo +33 -0
- package/layerzero/src/endpoint/messaging_channel/errors.cairo +37 -0
- package/layerzero/src/endpoint/messaging_channel/events.cairo +58 -0
- package/layerzero/src/endpoint/messaging_channel/interface.cairo +171 -0
- package/layerzero/src/endpoint/messaging_channel/messaging_channel.cairo +453 -0
- package/layerzero/src/endpoint/messaging_composer/errors.cairo +46 -0
- package/layerzero/src/endpoint/messaging_composer/events.cairo +67 -0
- package/layerzero/src/endpoint/messaging_composer/interface.cairo +132 -0
- package/layerzero/src/endpoint/messaging_composer/messaging_composer.cairo +223 -0
- package/layerzero/src/lib.cairo +189 -0
- package/layerzero/src/message_lib/blocked_message_lib.cairo +114 -0
- package/layerzero/src/message_lib/interface.cairo +63 -0
- package/layerzero/src/message_lib/sml/errors.cairo +23 -0
- package/layerzero/src/message_lib/sml/events.cairo +32 -0
- package/layerzero/src/message_lib/sml/simple_message_lib.cairo +312 -0
- package/layerzero/src/message_lib/structs.cairo +22 -0
- package/layerzero/src/message_lib/uln/errors.cairo +128 -0
- package/layerzero/src/message_lib/uln/events.cairo +97 -0
- package/layerzero/src/message_lib/uln/interface.cairo +83 -0
- package/layerzero/src/message_lib/uln/options.cairo +64 -0
- package/layerzero/src/message_lib/uln/structs/executor_config.cairo +35 -0
- package/layerzero/src/message_lib/uln/structs/payment_info.cairo +7 -0
- package/layerzero/src/message_lib/uln/structs/uln_config.cairo +155 -0
- package/layerzero/src/message_lib/uln/structs/uln_config_storage_node.cairo +91 -0
- package/layerzero/src/message_lib/uln/structs/verification.cairo +7 -0
- package/layerzero/src/message_lib/uln/ultra_light_node.cairo +965 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/errors.cairo +22 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/events.cairo +6 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/interface.cairo +34 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/oapp_options_type_3.cairo +120 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/structs.cairo +6 -0
- package/layerzero/src/oapps/counter/constants.cairo +3 -0
- package/layerzero/src/oapps/counter/counter.cairo +170 -0
- package/layerzero/src/oapps/counter/interface.cairo +27 -0
- package/layerzero/src/oapps/counter/structs.cairo +20 -0
- package/layerzero/src/oapps/message_inspector/interface.cairo +21 -0
- package/layerzero/src/oapps/oapp/errors.cairo +72 -0
- package/layerzero/src/oapps/oapp/events.cairo +9 -0
- package/layerzero/src/oapps/oapp/interface.cairo +67 -0
- package/layerzero/src/oapps/oapp/oapp.cairo +70 -0
- package/layerzero/src/oapps/oapp/oapp_core.cairo +448 -0
- package/layerzero/src/oapps/oft/errors.cairo +42 -0
- package/layerzero/src/oapps/oft/events.cairo +33 -0
- package/layerzero/src/oapps/oft/interface.cairo +87 -0
- package/layerzero/src/oapps/oft/oft.cairo +188 -0
- package/layerzero/src/oapps/oft/oft_adapter.cairo +175 -0
- package/layerzero/src/oapps/oft/oft_compose_msg_codec.cairo +128 -0
- package/layerzero/src/oapps/oft/oft_core.cairo +542 -0
- package/layerzero/src/oapps/oft/oft_msg_codec.cairo +131 -0
- package/layerzero/src/oapps/oft/structs.cairo +72 -0
- package/layerzero/src/treasury/errors.cairo +22 -0
- package/layerzero/src/treasury/events.cairo +5 -0
- package/layerzero/src/treasury/interfaces/layerzero_treasury.cairo +54 -0
- package/layerzero/src/treasury/interfaces/lz_token_fee_lib.cairo +45 -0
- package/layerzero/src/treasury/interfaces/treasury_admin.cairo +39 -0
- package/layerzero/src/treasury/treasury.cairo +140 -0
- package/layerzero/src/workers/access_control.cairo +11 -0
- package/layerzero/src/workers/base/base.cairo +238 -0
- package/layerzero/src/workers/base/errors.cairo +24 -0
- package/layerzero/src/workers/base/events.cairo +43 -0
- package/layerzero/src/workers/base/interface.cairo +93 -0
- package/layerzero/src/workers/base/structs.cairo +10 -0
- package/layerzero/src/workers/common.cairo +59 -0
- package/layerzero/src/workers/dvn/constants.cairo +11 -0
- package/layerzero/src/workers/dvn/dvn.cairo +338 -0
- package/layerzero/src/workers/dvn/errors.cairo +80 -0
- package/layerzero/src/workers/dvn/events.cairo +30 -0
- package/layerzero/src/workers/dvn/fee_lib/dvn_fee_lib.cairo +152 -0
- package/layerzero/src/workers/dvn/fee_lib/interface.cairo +45 -0
- package/layerzero/src/workers/dvn/interface.cairo +131 -0
- package/layerzero/src/workers/dvn/options.cairo +125 -0
- package/layerzero/src/workers/dvn/structs.cairo +51 -0
- package/layerzero/src/workers/executor/errors.cairo +159 -0
- package/layerzero/src/workers/executor/events.cairo +32 -0
- package/layerzero/src/workers/executor/executor.cairo +392 -0
- package/layerzero/src/workers/executor/fee_lib/executor_fee_lib.cairo +160 -0
- package/layerzero/src/workers/executor/fee_lib/interface.cairo +87 -0
- package/layerzero/src/workers/executor/interface.cairo +131 -0
- package/layerzero/src/workers/executor/options.cairo +244 -0
- package/layerzero/src/workers/executor/structs.cairo +119 -0
- package/layerzero/src/workers/interface.cairo +32 -0
- package/layerzero/src/workers/price_feed/constants.cairo +7 -0
- package/layerzero/src/workers/price_feed/errors.cairo +28 -0
- package/layerzero/src/workers/price_feed/events.cairo +13 -0
- package/layerzero/src/workers/price_feed/interface.cairo +264 -0
- package/layerzero/src/workers/price_feed/price_feed.cairo +392 -0
- package/layerzero/src/workers/price_feed/structs.cairo +74 -0
- package/layerzero/tests/common/test_constants.cairo +21 -0
- package/layerzero/tests/common/test_guid.cairo +232 -0
- package/layerzero/tests/common/test_packet_v1_codec.cairo +372 -0
- package/layerzero/tests/common/utils.cairo +23 -0
- package/layerzero/tests/e2e/oft_utils.cairo +121 -0
- package/layerzero/tests/e2e/test_counter_with_sml.cairo +194 -0
- package/layerzero/tests/e2e/test_counter_with_uln.cairo +352 -0
- package/layerzero/tests/e2e/test_dvn.cairo +406 -0
- package/layerzero/tests/e2e/test_lz_token.cairo +354 -0
- package/layerzero/tests/e2e/test_oft_compose_with_uln.cairo +364 -0
- package/layerzero/tests/e2e/test_oft_with_sml.cairo +240 -0
- package/layerzero/tests/e2e/test_oft_with_uln.cairo +299 -0
- package/layerzero/tests/e2e/utils.cairo +490 -0
- package/layerzero/tests/endpoint/message_lib_manager/test_message_lib_manager.cairo +2051 -0
- package/layerzero/tests/endpoint/message_lib_manager/utils.cairo +45 -0
- package/layerzero/tests/endpoint/messaging_channel/test_messaging_channel.cairo +621 -0
- package/layerzero/tests/endpoint/messaging_channel/utils.cairo +96 -0
- package/layerzero/tests/endpoint/messaging_composer/test_messaging_composer.cairo +456 -0
- package/layerzero/tests/endpoint/messaging_composer/utils.cairo +75 -0
- package/layerzero/tests/endpoint/test_endpoint_commit.cairo +763 -0
- package/layerzero/tests/endpoint/test_endpoint_lzreceive.cairo +1253 -0
- package/layerzero/tests/endpoint/test_endpoint_quote.cairo +71 -0
- package/layerzero/tests/endpoint/test_endpoint_send.cairo +1327 -0
- package/layerzero/tests/endpoint/utils.cairo +129 -0
- package/layerzero/tests/fuzzable/blockchain_config.cairo +89 -0
- package/layerzero/tests/fuzzable/bytes32.cairo +16 -0
- package/layerzero/tests/fuzzable/contract_address.cairo +67 -0
- package/layerzero/tests/fuzzable/dst_config.cairo +37 -0
- package/layerzero/tests/fuzzable/eid.cairo +23 -0
- package/layerzero/tests/fuzzable/eth_address.cairo +17 -0
- package/layerzero/tests/fuzzable/expiry.cairo +27 -0
- package/layerzero/tests/fuzzable/felt_array.cairo +38 -0
- package/layerzero/tests/fuzzable/inbound_params.cairo +21 -0
- package/layerzero/tests/fuzzable/keys.cairo +16 -0
- package/layerzero/tests/fuzzable/model_type.cairo +27 -0
- package/layerzero/tests/fuzzable/origin.cairo +21 -0
- package/layerzero/tests/fuzzable/price.cairo +32 -0
- package/layerzero/tests/fuzzable/role_admin.cairo +29 -0
- package/layerzero/tests/fuzzable/small_byte_array.cairo +61 -0
- package/layerzero/tests/lib.cairo +177 -0
- package/layerzero/tests/message_lib/sml/test_simple_message_lib.cairo +224 -0
- package/layerzero/tests/message_lib/uln/test_uln_admin.cairo +2150 -0
- package/layerzero/tests/message_lib/uln/test_uln_config.cairo +527 -0
- package/layerzero/tests/message_lib/uln/test_uln_config_storage_node.cairo +69 -0
- package/layerzero/tests/message_lib/uln/test_uln_executor_config.cairo +173 -0
- package/layerzero/tests/message_lib/uln/test_uln_options.cairo +329 -0
- package/layerzero/tests/message_lib/uln/test_uln_quote.cairo +1038 -0
- package/layerzero/tests/message_lib/uln/test_uln_receive.cairo +715 -0
- package/layerzero/tests/message_lib/uln/test_uln_send.cairo +1155 -0
- package/layerzero/tests/message_lib/uln/utils.cairo +59 -0
- package/layerzero/tests/mocks/composer_target.cairo +76 -0
- package/layerzero/tests/mocks/endpoint.cairo +199 -0
- package/layerzero/tests/mocks/erc20/erc20.cairo +50 -0
- package/layerzero/tests/mocks/erc20/interface.cairo +8 -0
- package/layerzero/tests/mocks/message_inspector/message_inspector.cairo +17 -0
- package/layerzero/tests/mocks/message_lib_manager.cairo +98 -0
- package/layerzero/tests/mocks/messaging_channel/interface.cairo +23 -0
- package/layerzero/tests/mocks/messaging_channel/messaging_channel.cairo +138 -0
- package/layerzero/tests/mocks/messaging_composer.cairo +171 -0
- package/layerzero/tests/mocks/oapp_core/interface.cairo +53 -0
- package/layerzero/tests/mocks/oapp_core/oapp_core.cairo +142 -0
- package/layerzero/tests/mocks/oapp_options_type3.cairo +42 -0
- package/layerzero/tests/mocks/oft_core/interface.cairo +28 -0
- package/layerzero/tests/mocks/oft_core/oft_core.cairo +242 -0
- package/layerzero/tests/mocks/receiver.cairo +54 -0
- package/layerzero/tests/mocks/treasury/lz_token_fee_lib.cairo +57 -0
- package/layerzero/tests/mocks/treasury/treasury.cairo +74 -0
- package/layerzero/tests/mocks/uln_config/interface.cairo +12 -0
- package/layerzero/tests/mocks/uln_config/uln_config.cairo +35 -0
- package/layerzero/tests/mocks/workers/base.cairo +80 -0
- package/layerzero/tests/mocks/workers/dvn.cairo +115 -0
- package/layerzero/tests/mocks/workers/executor/decode/decode.cairo +97 -0
- package/layerzero/tests/mocks/workers/executor/decode/interface.cairo +59 -0
- package/layerzero/tests/mocks/workers/executor/executor.cairo +176 -0
- package/layerzero/tests/oapps/common/test_oapp_options_type_3.cairo +279 -0
- package/layerzero/tests/oapps/oft/test_oft_adapter.cairo +441 -0
- package/layerzero/tests/oapps/oft/test_oft_compose_msg_codec.cairo +139 -0
- package/layerzero/tests/oapps/oft/test_oft_core.cairo +751 -0
- package/layerzero/tests/oapps/oft/test_oft_msg_codec.cairo +268 -0
- package/layerzero/tests/oapps/test_counter.cairo +470 -0
- package/layerzero/tests/oapps/test_oapp_core.cairo +750 -0
- package/layerzero/tests/treasury/test_lz_token_fee_lib.cairo +63 -0
- package/layerzero/tests/treasury/test_treasury.cairo +458 -0
- package/layerzero/tests/treasury/utils.cairo +8 -0
- package/layerzero/tests/utils.cairo +48 -0
- package/layerzero/tests/workers/base/test_worker_base.cairo +1097 -0
- package/layerzero/tests/workers/base/utils.cairo +76 -0
- package/layerzero/tests/workers/dvn/fee_lib/test_dvn_fee_lib.cairo +361 -0
- package/layerzero/tests/workers/dvn/test_dvn.cairo +1101 -0
- package/layerzero/tests/workers/dvn/test_dvn_options.cairo +312 -0
- package/layerzero/tests/workers/dvn/utils.cairo +236 -0
- package/layerzero/tests/workers/executor/fee_lib/test_executor_fee_lib.cairo +223 -0
- package/layerzero/tests/workers/executor/test_decode.cairo +612 -0
- package/layerzero/tests/workers/executor/test_executor.cairo +1472 -0
- package/layerzero/tests/workers/executor/utils.cairo +296 -0
- package/layerzero/tests/workers/price_feed/test_price_feed.cairo +879 -0
- package/layerzero/tests/workers/price_feed/utils.cairo +37 -0
- package/libs/enumerable_set/Scarb.lock +24 -0
- package/libs/enumerable_set/Scarb.toml +17 -0
- package/libs/enumerable_set/src/enumerable_set.cairo +118 -0
- package/libs/enumerable_set/src/lib.cairo +4 -0
- package/libs/enumerable_set/tests/lib.cairo +5 -0
- package/libs/enumerable_set/tests/mocks/mock_enumerable_set.cairo +61 -0
- package/libs/enumerable_set/tests/test_enumerable_set.cairo +379 -0
- package/libs/lz_utils/Scarb.lock +24 -0
- package/libs/lz_utils/Scarb.toml +17 -0
- package/libs/lz_utils/src/bytes.cairo +33 -0
- package/libs/lz_utils/src/error.cairo +12 -0
- package/libs/lz_utils/src/keccak.cairo +28 -0
- package/libs/lz_utils/src/lib.cairo +3 -0
- package/libs/multisig/Scarb.lock +172 -0
- package/libs/multisig/Scarb.toml +23 -0
- package/libs/multisig/src/errors.cairo +84 -0
- package/libs/multisig/src/events.cairo +13 -0
- package/libs/multisig/src/interface.cairo +73 -0
- package/libs/multisig/src/lib.cairo +7 -0
- package/libs/multisig/src/multisig.cairo +241 -0
- package/libs/multisig/tests/lib.cairo +4 -0
- package/libs/multisig/tests/mocks/mock_multisig.cairo +57 -0
- package/libs/multisig/tests/test_multisig.cairo +452 -0
- package/package.json +41 -0
- package/src/scripts/build-abi.ts +51 -0
- package/target/CACHEDIR.TAG +3 -0
- package/target/dev/.fingerprint/alexandria_bytes-5ea6u5t70d7qi/alexandria_bytes +1 -0
- package/target/dev/.fingerprint/alexandria_data_structures-0aue3g6q80gs0/alexandria_data_structures +1 -0
- package/target/dev/.fingerprint/alexandria_math-h2fi7jdq4isuu/alexandria_math +1 -0
- package/target/dev/.fingerprint/core-lq3u730l5p1ag/core +1 -0
- package/target/dev/.fingerprint/core-vf7fc6rvic5vi/core +1 -0
- package/target/dev/.fingerprint/enumerable_set-eaerkg8njl85o/enumerable_set +1 -0
- package/target/dev/.fingerprint/enumerable_set-r54oje7t06ku8/enumerable_set +1 -0
- package/target/dev/.fingerprint/layerzero-oqgdqsaddpi2k/layerzero +1 -0
- package/target/dev/.fingerprint/lz_utils-kfkkeueiqg0pa/lz_utils +1 -0
- package/target/dev/.fingerprint/lz_utils-u4v1os6e7gkng/lz_utils +1 -0
- package/target/dev/.fingerprint/multisig-0fjetugejecge/multisig +1 -0
- package/target/dev/.fingerprint/multisig-6j5kqs436hm54/multisig +1 -0
- package/target/dev/.fingerprint/openzeppelin-ei1id1hu088lo/openzeppelin +1 -0
- package/target/dev/.fingerprint/openzeppelin-j9d5nd1qhfnu6/openzeppelin +1 -0
- package/target/dev/.fingerprint/openzeppelin_access-3oa41aikpaek0/openzeppelin_access +1 -0
- package/target/dev/.fingerprint/openzeppelin_access-p5h849v8so76q/openzeppelin_access +1 -0
- package/target/dev/.fingerprint/openzeppelin_account-4qhv5fks84g9u/openzeppelin_account +1 -0
- package/target/dev/.fingerprint/openzeppelin_account-hgbm8ln9ah7rm/openzeppelin_account +1 -0
- package/target/dev/.fingerprint/openzeppelin_finance-n70q9al0cps8i/openzeppelin_finance +1 -0
- package/target/dev/.fingerprint/openzeppelin_finance-nnd4f8703t3ak/openzeppelin_finance +1 -0
- package/target/dev/.fingerprint/openzeppelin_governance-3gnk21ubp5lis/openzeppelin_governance +1 -0
- package/target/dev/.fingerprint/openzeppelin_governance-rj1bfont4fij4/openzeppelin_governance +1 -0
- package/target/dev/.fingerprint/openzeppelin_introspection-3fja9hd1gvbcq/openzeppelin_introspection +1 -0
- package/target/dev/.fingerprint/openzeppelin_introspection-jc3nf5525eet6/openzeppelin_introspection +1 -0
- package/target/dev/.fingerprint/openzeppelin_merkle_tree-4en77ogr2r2l2/openzeppelin_merkle_tree +1 -0
- package/target/dev/.fingerprint/openzeppelin_merkle_tree-4t190frqs4db8/openzeppelin_merkle_tree +1 -0
- package/target/dev/.fingerprint/openzeppelin_presets-aqb0f6p9c0bp6/openzeppelin_presets +1 -0
- package/target/dev/.fingerprint/openzeppelin_presets-nseg8korhin8e/openzeppelin_presets +1 -0
- package/target/dev/.fingerprint/openzeppelin_security-g7p73ji1ih1qg/openzeppelin_security +1 -0
- package/target/dev/.fingerprint/openzeppelin_security-qp5328v80452u/openzeppelin_security +1 -0
- package/target/dev/.fingerprint/openzeppelin_token-jjf7tl9rphc6k/openzeppelin_token +1 -0
- package/target/dev/.fingerprint/openzeppelin_token-r6s43vlpj6rqk/openzeppelin_token +1 -0
- package/target/dev/.fingerprint/openzeppelin_upgrades-0dpbnre7engca/openzeppelin_upgrades +1 -0
- package/target/dev/.fingerprint/openzeppelin_upgrades-2sqgvbuv9s800/openzeppelin_upgrades +1 -0
- package/target/dev/.fingerprint/openzeppelin_utils-mj395ivff1ffo/openzeppelin_utils +1 -0
- package/target/dev/.fingerprint/openzeppelin_utils-oh1hse8sjumgm/openzeppelin_utils +1 -0
- package/target/dev/.fingerprint/starkware_utils-1qnnjnq0pf9u0/starkware_utils +1 -0
- package/target/dev/.fingerprint/starkware_utils-mh8e3te65lju4/starkware_utils +1 -0
- package/target/dev/enumerable_set.sierra.json +1 -0
- package/target/dev/incremental/alexandria_bytes-5ea6u5t70d7qi.bin +0 -0
- package/target/dev/incremental/alexandria_data_structures-0aue3g6q80gs0.bin +0 -0
- package/target/dev/incremental/alexandria_math-h2fi7jdq4isuu.bin +0 -0
- package/target/dev/incremental/core-lq3u730l5p1ag.bin +0 -0
- package/target/dev/incremental/core-vf7fc6rvic5vi.bin +0 -0
- package/target/dev/incremental/enumerable_set-eaerkg8njl85o.bin +0 -0
- package/target/dev/incremental/enumerable_set-r54oje7t06ku8.bin +0 -0
- package/target/dev/incremental/layerzero-oqgdqsaddpi2k.bin +0 -0
- package/target/dev/incremental/lz_utils-kfkkeueiqg0pa.bin +0 -0
- package/target/dev/incremental/lz_utils-u4v1os6e7gkng.bin +0 -0
- package/target/dev/incremental/multisig-0fjetugejecge.bin +0 -0
- package/target/dev/incremental/multisig-6j5kqs436hm54.bin +0 -0
- package/target/dev/incremental/openzeppelin-ei1id1hu088lo.bin +0 -0
- package/target/dev/incremental/openzeppelin-j9d5nd1qhfnu6.bin +0 -0
- package/target/dev/incremental/openzeppelin_access-3oa41aikpaek0.bin +0 -0
- package/target/dev/incremental/openzeppelin_access-p5h849v8so76q.bin +0 -0
- package/target/dev/incremental/openzeppelin_account-4qhv5fks84g9u.bin +0 -0
- package/target/dev/incremental/openzeppelin_account-hgbm8ln9ah7rm.bin +0 -0
- package/target/dev/incremental/openzeppelin_finance-n70q9al0cps8i.bin +0 -0
- package/target/dev/incremental/openzeppelin_finance-nnd4f8703t3ak.bin +0 -0
- package/target/dev/incremental/openzeppelin_governance-3gnk21ubp5lis.bin +0 -0
- package/target/dev/incremental/openzeppelin_governance-rj1bfont4fij4.bin +0 -0
- package/target/dev/incremental/openzeppelin_introspection-3fja9hd1gvbcq.bin +0 -0
- package/target/dev/incremental/openzeppelin_introspection-jc3nf5525eet6.bin +0 -0
- package/target/dev/incremental/openzeppelin_merkle_tree-4en77ogr2r2l2.bin +0 -0
- package/target/dev/incremental/openzeppelin_merkle_tree-4t190frqs4db8.bin +0 -0
- package/target/dev/incremental/openzeppelin_presets-aqb0f6p9c0bp6.bin +0 -0
- package/target/dev/incremental/openzeppelin_presets-nseg8korhin8e.bin +0 -0
- package/target/dev/incremental/openzeppelin_security-g7p73ji1ih1qg.bin +0 -0
- package/target/dev/incremental/openzeppelin_security-qp5328v80452u.bin +0 -0
- package/target/dev/incremental/openzeppelin_token-jjf7tl9rphc6k.bin +0 -0
- package/target/dev/incremental/openzeppelin_token-r6s43vlpj6rqk.bin +0 -0
- package/target/dev/incremental/openzeppelin_upgrades-0dpbnre7engca.bin +0 -0
- package/target/dev/incremental/openzeppelin_upgrades-2sqgvbuv9s800.bin +0 -0
- package/target/dev/incremental/openzeppelin_utils-mj395ivff1ffo.bin +0 -0
- package/target/dev/incremental/openzeppelin_utils-oh1hse8sjumgm.bin +0 -0
- package/target/dev/incremental/starkware_utils-1qnnjnq0pf9u0.bin +0 -0
- package/target/dev/incremental/starkware_utils-mh8e3te65lju4.bin +0 -0
- package/target/dev/layerzero.starknet_artifacts.json +1 -0
- package/target/dev/layerzero_BlockedMessageLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_BlockedMessageLib.contract_class.json +1 -0
- package/target/dev/layerzero_Dvn.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Dvn.contract_class.json +1 -0
- package/target/dev/layerzero_DvnFeeLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_DvnFeeLib.contract_class.json +1 -0
- package/target/dev/layerzero_Endpoint.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Endpoint.contract_class.json +1 -0
- package/target/dev/layerzero_Executor.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Executor.contract_class.json +1 -0
- package/target/dev/layerzero_ExecutorFeeLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_ExecutorFeeLib.contract_class.json +1 -0
- package/target/dev/layerzero_OApp.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OApp.contract_class.json +1 -0
- package/target/dev/layerzero_OFT.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OFT.contract_class.json +1 -0
- package/target/dev/layerzero_OFTAdapter.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OFTAdapter.contract_class.json +1 -0
- package/target/dev/layerzero_OmniCounter.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OmniCounter.contract_class.json +1 -0
- package/target/dev/layerzero_PriceFeed.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_PriceFeed.contract_class.json +1 -0
- package/target/dev/layerzero_SimpleMessageLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_SimpleMessageLib.contract_class.json +1 -0
- package/target/dev/layerzero_Treasury.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Treasury.contract_class.json +1 -0
- package/target/dev/layerzero_UltraLightNode.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_UltraLightNode.contract_class.json +1 -0
- package/target/dev/lz_utils.sierra.json +1 -0
- package/target/dev/multisig.sierra.json +1 -0
- package/tools/update_contracts.sh +19 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +7 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//! Message lib manager errors
|
|
2
|
+
|
|
3
|
+
use lz_utils::error::{Error, format_error};
|
|
4
|
+
|
|
5
|
+
#[derive(Drop)]
|
|
6
|
+
pub enum MessageLibManagerError {
|
|
7
|
+
/// Triggered when attempting to register a message library that is already registered.
|
|
8
|
+
AlreadyRegistered,
|
|
9
|
+
/// Triggered when the default send library is required but not set.
|
|
10
|
+
DefaultSendLibUnavailable,
|
|
11
|
+
/// Triggered when the default receive library is required but not set.
|
|
12
|
+
DefaultReceiveLibUnavailable,
|
|
13
|
+
/// Triggered when an invalid expiry value is provided.
|
|
14
|
+
InvalidExpiry,
|
|
15
|
+
/// Triggered when a default library is used where a non-default library is required.
|
|
16
|
+
OnlyNonDefaultLib,
|
|
17
|
+
/// Triggered when a library that is not a receive library is used in a receive-only context.
|
|
18
|
+
OnlyReceiveLib,
|
|
19
|
+
/// Triggered when an unregistered library is used.
|
|
20
|
+
OnlyRegisteredLib,
|
|
21
|
+
/// Triggered when a library that is not registered or a default library is used.
|
|
22
|
+
OnlyRegisteredOrDefaultLib,
|
|
23
|
+
/// Triggered when a library that is not a send library is used in a send-only context.
|
|
24
|
+
OnlySendLib,
|
|
25
|
+
/// Triggered when a new value is the same as the current value.
|
|
26
|
+
SameValue,
|
|
27
|
+
/// Triggered when an unsupported endpoint ID is used.
|
|
28
|
+
UnsupportedEid,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
impl ErrorNameImpl of Error<MessageLibManagerError> {
|
|
32
|
+
fn prefix() -> ByteArray {
|
|
33
|
+
"LZ_MESSAGE_LIB_MANAGER"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fn name(self: MessageLibManagerError) -> ByteArray {
|
|
37
|
+
match self {
|
|
38
|
+
MessageLibManagerError::AlreadyRegistered => "ALREADY_REGISTERED",
|
|
39
|
+
MessageLibManagerError::DefaultSendLibUnavailable => "DEFAULT_SEND_LIB_UNAVAILABLE",
|
|
40
|
+
MessageLibManagerError::DefaultReceiveLibUnavailable => "DEFAULT_RECEIVE_LIB_UNAVAILABLE",
|
|
41
|
+
MessageLibManagerError::InvalidExpiry => "INVALID_EXPIRY",
|
|
42
|
+
MessageLibManagerError::OnlyNonDefaultLib => "ONLY_NON_DEFAULT_LIB",
|
|
43
|
+
MessageLibManagerError::OnlyReceiveLib => "ONLY_RECEIVE_LIB",
|
|
44
|
+
MessageLibManagerError::OnlyRegisteredLib => "ONLY_REGISTERED_LIB",
|
|
45
|
+
MessageLibManagerError::OnlyRegisteredOrDefaultLib => "ONLY_REGISTERED_OR_DEFAULT_LIB",
|
|
46
|
+
MessageLibManagerError::OnlySendLib => "ONLY_SEND_LIB",
|
|
47
|
+
MessageLibManagerError::SameValue => "SAME_VALUE",
|
|
48
|
+
MessageLibManagerError::UnsupportedEid => "UNSUPPORTED_EID",
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
pub fn err_already_registered() -> ByteArray {
|
|
54
|
+
format_error(MessageLibManagerError::AlreadyRegistered, "")
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
pub fn err_default_send_lib_unavailable() -> ByteArray {
|
|
58
|
+
format_error(MessageLibManagerError::DefaultSendLibUnavailable, "")
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
pub fn err_default_receive_lib_unavailable() -> ByteArray {
|
|
62
|
+
format_error(MessageLibManagerError::DefaultReceiveLibUnavailable, "")
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
pub fn err_invalid_expiry() -> ByteArray {
|
|
66
|
+
format_error(MessageLibManagerError::InvalidExpiry, "")
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
pub fn err_only_non_default_lib() -> ByteArray {
|
|
70
|
+
format_error(MessageLibManagerError::OnlyNonDefaultLib, "")
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub fn err_only_receive_lib() -> ByteArray {
|
|
74
|
+
format_error(MessageLibManagerError::OnlyReceiveLib, "")
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
pub fn err_only_registered_lib() -> ByteArray {
|
|
78
|
+
format_error(MessageLibManagerError::OnlyRegisteredLib, "")
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pub fn err_only_registered_or_default_lib() -> ByteArray {
|
|
82
|
+
format_error(MessageLibManagerError::OnlyRegisteredOrDefaultLib, "")
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
pub fn err_only_send_lib() -> ByteArray {
|
|
86
|
+
format_error(MessageLibManagerError::OnlySendLib, "")
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
pub fn err_same_value() -> ByteArray {
|
|
90
|
+
format_error(MessageLibManagerError::SameValue, "")
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
pub fn err_unsupported_eid(eid: u32) -> ByteArray {
|
|
94
|
+
format_error(MessageLibManagerError::UnsupportedEid, format!("EID: {}", eid))
|
|
95
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//! Message lib manager events
|
|
2
|
+
|
|
3
|
+
use starknet::ContractAddress;
|
|
4
|
+
|
|
5
|
+
/// Emitted when a new message library is registered.
|
|
6
|
+
#[derive(Drop, starknet::Event)]
|
|
7
|
+
pub struct LibraryRegistered {
|
|
8
|
+
/// The address of the registered library.
|
|
9
|
+
#[key]
|
|
10
|
+
pub library: ContractAddress,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/// Emitted when a send library is set for a specific sender and destination EID.
|
|
14
|
+
#[derive(Drop, starknet::Event)]
|
|
15
|
+
pub struct SendLibrarySet {
|
|
16
|
+
/// The sender's address.
|
|
17
|
+
#[key]
|
|
18
|
+
pub sender: ContractAddress,
|
|
19
|
+
/// The destination EID.
|
|
20
|
+
#[key]
|
|
21
|
+
pub dst_eid: u32,
|
|
22
|
+
/// The address of the send library.
|
|
23
|
+
#[key]
|
|
24
|
+
pub library: ContractAddress,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// Emitted when a receive library is set for a specific receiver and source EID.
|
|
28
|
+
#[derive(Drop, starknet::Event)]
|
|
29
|
+
pub struct ReceiveLibrarySet {
|
|
30
|
+
/// The receiver's address.
|
|
31
|
+
#[key]
|
|
32
|
+
pub receiver: ContractAddress,
|
|
33
|
+
/// The source EID.
|
|
34
|
+
#[key]
|
|
35
|
+
pub src_eid: u32,
|
|
36
|
+
/// The address of the receive library.
|
|
37
|
+
#[key]
|
|
38
|
+
pub library: ContractAddress,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/// Emitted when a default send library is set for a specific EID.
|
|
42
|
+
#[derive(Drop, starknet::Event)]
|
|
43
|
+
pub struct DefaultSendLibrarySet {
|
|
44
|
+
/// The EID for which the default send library is set.
|
|
45
|
+
#[key]
|
|
46
|
+
pub eid: u32,
|
|
47
|
+
/// The address of the default send library.
|
|
48
|
+
#[key]
|
|
49
|
+
pub library: ContractAddress,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// Emitted when a default receive library is set for a specific EID.
|
|
53
|
+
#[derive(Drop, starknet::Event)]
|
|
54
|
+
pub struct DefaultReceiveLibrarySet {
|
|
55
|
+
/// The EID for which the default receive library is set.
|
|
56
|
+
#[key]
|
|
57
|
+
pub eid: u32,
|
|
58
|
+
/// The address of the default receive library.
|
|
59
|
+
#[key]
|
|
60
|
+
pub library: ContractAddress,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/// Emitted when a timeout is set for a receive library.
|
|
64
|
+
#[derive(Drop, starknet::Event)]
|
|
65
|
+
pub struct ReceiveLibraryTimeoutSet {
|
|
66
|
+
/// The OApp's address.
|
|
67
|
+
#[key]
|
|
68
|
+
pub oapp: ContractAddress,
|
|
69
|
+
/// The EID for which the timeout is set.
|
|
70
|
+
#[key]
|
|
71
|
+
pub eid: u32,
|
|
72
|
+
/// The address of the receive library.
|
|
73
|
+
#[key]
|
|
74
|
+
pub library: ContractAddress,
|
|
75
|
+
/// The expiry timestamp for the timeout.
|
|
76
|
+
pub expiry: u64,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/// Emitted when a timeout is set for a default receive library.
|
|
80
|
+
#[derive(Drop, starknet::Event)]
|
|
81
|
+
pub struct DefaultReceiveLibraryTimeoutSet {
|
|
82
|
+
/// The EID for which the timeout is set.
|
|
83
|
+
#[key]
|
|
84
|
+
pub eid: u32,
|
|
85
|
+
/// The address of the default receive library.
|
|
86
|
+
#[key]
|
|
87
|
+
pub library: ContractAddress,
|
|
88
|
+
/// The expiry timestamp for the timeout.
|
|
89
|
+
pub expiry: u64,
|
|
90
|
+
}
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
use starknet::ContractAddress;
|
|
2
|
+
use crate::endpoint::message_lib_manager::structs::{GetLibraryResponse, Timeout};
|
|
3
|
+
use crate::message_lib::structs::SetConfigParam;
|
|
4
|
+
|
|
5
|
+
/// # `IMessageLibManager` Interface
|
|
6
|
+
///
|
|
7
|
+
/// The `IMessageLibManager` is responsible for managing the lifecycle and configuration of
|
|
8
|
+
/// message libraries within the LayerZero protocol. It handles both default (system-wide)
|
|
9
|
+
/// and custom (OApp-specific) library configurations for sending and receiving messages.
|
|
10
|
+
///
|
|
11
|
+
/// ## Key responsibilities
|
|
12
|
+
/// - Library registration and validation
|
|
13
|
+
/// - Default library management for the protocol
|
|
14
|
+
/// - Per-OApp library configuration
|
|
15
|
+
/// - Grace period management for library upgrades
|
|
16
|
+
/// - Configuration delegation to message libraries
|
|
17
|
+
#[starknet::interface]
|
|
18
|
+
pub trait IMessageLibManager<TContractState> {
|
|
19
|
+
// ========================= Library Registration =========================
|
|
20
|
+
|
|
21
|
+
/// Register a new message library with the endpoint (owner only)
|
|
22
|
+
///
|
|
23
|
+
/// Only registered libraries can be used as send/receive libraries or set as defaults.
|
|
24
|
+
/// The library must support the IMessageLib interface to be registered.
|
|
25
|
+
///
|
|
26
|
+
/// # Arguments
|
|
27
|
+
/// * `lib` - The contract address of the message library to register
|
|
28
|
+
///
|
|
29
|
+
/// # Panics
|
|
30
|
+
/// * If caller is not the owner
|
|
31
|
+
/// * If library is already registered
|
|
32
|
+
/// * If library doesn't implement the required interface
|
|
33
|
+
fn register_library(ref self: TContractState, lib: ContractAddress);
|
|
34
|
+
|
|
35
|
+
/// Get all registered message libraries
|
|
36
|
+
///
|
|
37
|
+
/// Returns a list of all libraries that have been registered with the endpoint.
|
|
38
|
+
/// This includes both active libraries and any that may be deprecated but still
|
|
39
|
+
/// registered for backward compatibility.
|
|
40
|
+
///
|
|
41
|
+
/// # Returns
|
|
42
|
+
/// * `Array<ContractAddress>` - Array of all registered library addresses
|
|
43
|
+
fn get_registered_libraries(self: @TContractState) -> Array<ContractAddress>;
|
|
44
|
+
|
|
45
|
+
/// Check if a library is registered
|
|
46
|
+
///
|
|
47
|
+
/// Returns true if the library has been registered with the endpoint.
|
|
48
|
+
///
|
|
49
|
+
/// # Arguments
|
|
50
|
+
/// * `lib` - The library address to check
|
|
51
|
+
///
|
|
52
|
+
/// # Returns
|
|
53
|
+
/// * `bool` - True if the library is registered, false otherwise
|
|
54
|
+
fn is_registered_library(self: @TContractState, lib: ContractAddress) -> bool;
|
|
55
|
+
|
|
56
|
+
// ========================= Send Library Management =========================
|
|
57
|
+
|
|
58
|
+
/// Set the send library for the calling OApp and destination endpoint
|
|
59
|
+
///
|
|
60
|
+
/// The send library is responsible for encoding and transmitting messages to the
|
|
61
|
+
/// destination chain. If not set, the OApp will use the default send library.
|
|
62
|
+
/// Only the OApp itself can set its send library.
|
|
63
|
+
///
|
|
64
|
+
/// # Arguments
|
|
65
|
+
/// * `eid` - The destination endpoint ID
|
|
66
|
+
/// * `lib` - The message library address (or DEFAULT_LIB to use default)
|
|
67
|
+
///
|
|
68
|
+
/// # Panics
|
|
69
|
+
/// * If library is not registered (unless DEFAULT_LIB)
|
|
70
|
+
/// * If library doesn't support sending
|
|
71
|
+
/// * If library doesn't support the specified endpoint
|
|
72
|
+
/// * If the same library is already set (no-op protection)
|
|
73
|
+
fn set_send_library(
|
|
74
|
+
ref self: TContractState, oapp: ContractAddress, eid: u32, lib: ContractAddress,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
/// Get the send library for a specific sender and destination endpoint
|
|
78
|
+
///
|
|
79
|
+
/// If the sender hasn't set a custom send library, this resolves to the default
|
|
80
|
+
/// send library configured by LayerZero. The library returned by this function
|
|
81
|
+
/// will be used to process outbound messages.
|
|
82
|
+
///
|
|
83
|
+
/// # Arguments
|
|
84
|
+
/// * `sender` - The OApp address that wants to send messages
|
|
85
|
+
/// * `dst_eid` - The destination endpoint ID
|
|
86
|
+
///
|
|
87
|
+
/// # Returns
|
|
88
|
+
/// * `ContractAddress` - The resolved send library address
|
|
89
|
+
///
|
|
90
|
+
/// # Panics
|
|
91
|
+
/// * If no default send library is configured for the endpoint
|
|
92
|
+
fn get_send_library(
|
|
93
|
+
self: @TContractState, oapp: ContractAddress, dst_eid: u32,
|
|
94
|
+
) -> GetLibraryResponse;
|
|
95
|
+
|
|
96
|
+
/// Get the raw send library for a specific sender and destination endpoint
|
|
97
|
+
///
|
|
98
|
+
/// Returns the raw send library for the given sender and destination endpoint.
|
|
99
|
+
///
|
|
100
|
+
/// # Arguments
|
|
101
|
+
/// * `sender` - The OApp address that wants to send messages
|
|
102
|
+
/// * `dst_eid` - The destination endpoint ID
|
|
103
|
+
///
|
|
104
|
+
/// # Returns
|
|
105
|
+
/// * `ContractAddress` - The raw send library address
|
|
106
|
+
fn get_raw_send_library(
|
|
107
|
+
self: @TContractState, oapp: ContractAddress, dst_eid: u32,
|
|
108
|
+
) -> ContractAddress;
|
|
109
|
+
|
|
110
|
+
/// Check if an OApp is using the default send library
|
|
111
|
+
///
|
|
112
|
+
/// Returns true if the OApp hasn't set a custom send library for the given
|
|
113
|
+
/// destination, meaning it will use the protocol's default send library.
|
|
114
|
+
///
|
|
115
|
+
/// # Arguments
|
|
116
|
+
/// * `sender` - The OApp address to check
|
|
117
|
+
/// * `dst_eid` - The destination endpoint ID
|
|
118
|
+
///
|
|
119
|
+
/// # Returns
|
|
120
|
+
/// * `bool` - True if using default library, false if using custom library
|
|
121
|
+
fn is_default_send_library(self: @TContractState, oapp: ContractAddress, dst_eid: u32) -> bool;
|
|
122
|
+
|
|
123
|
+
/// Set the default send library for an endpoint (owner only)
|
|
124
|
+
///
|
|
125
|
+
/// The default send library is used by OApps that haven't configured a custom
|
|
126
|
+
/// send library. This is a protocol-level configuration that affects all OApps.
|
|
127
|
+
///
|
|
128
|
+
/// # Arguments
|
|
129
|
+
/// * `eid` - The destination endpoint ID
|
|
130
|
+
/// * `lib` - The message library address to set as default
|
|
131
|
+
///
|
|
132
|
+
/// # Panics
|
|
133
|
+
/// * If caller is not the owner
|
|
134
|
+
/// * If library is not registered
|
|
135
|
+
/// * If library doesn't support sending
|
|
136
|
+
/// * If library doesn't support the specified endpoint
|
|
137
|
+
/// * If the same library is already set as default
|
|
138
|
+
fn set_default_send_library(ref self: TContractState, eid: u32, lib: ContractAddress);
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
/// Get the default send library for an endpoint
|
|
142
|
+
///
|
|
143
|
+
/// Returns the default send library for the given endpoint.
|
|
144
|
+
///
|
|
145
|
+
/// # Arguments
|
|
146
|
+
/// * `eid` - The destination endpoint ID
|
|
147
|
+
///
|
|
148
|
+
/// # Returns
|
|
149
|
+
/// * `ContractAddress` - The default send library address
|
|
150
|
+
fn get_default_send_library(self: @TContractState, eid: u32) -> ContractAddress;
|
|
151
|
+
|
|
152
|
+
// ========================= Receive Library Management =========================
|
|
153
|
+
|
|
154
|
+
/// Set the receive library for the calling OApp and source endpoint
|
|
155
|
+
///
|
|
156
|
+
/// The receive library is responsible for verifying and processing incoming messages
|
|
157
|
+
/// from the source chain. An optional grace period can be specified to allow the
|
|
158
|
+
/// old library to remain valid during the transition.
|
|
159
|
+
///
|
|
160
|
+
/// # Arguments
|
|
161
|
+
/// * `eid` - The source endpoint ID
|
|
162
|
+
/// * `lib` - The message library address (or DEFAULT_LIB to use default)
|
|
163
|
+
/// * `grace_period` - Number of blocks to keep the old library valid (0 for immediate switch)
|
|
164
|
+
///
|
|
165
|
+
/// # Panics
|
|
166
|
+
/// * If library is not registered (unless DEFAULT_LIB)
|
|
167
|
+
/// * If library doesn't support receiving
|
|
168
|
+
/// * If library doesn't support the specified endpoint
|
|
169
|
+
/// * If the same library is already set (no-op protection)
|
|
170
|
+
/// * If grace_period > 0 but either old or new library is DEFAULT_LIB
|
|
171
|
+
fn set_receive_library(
|
|
172
|
+
ref self: TContractState,
|
|
173
|
+
oapp: ContractAddress,
|
|
174
|
+
eid: u32,
|
|
175
|
+
lib: ContractAddress,
|
|
176
|
+
grace_period: u64,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
/// Get the receive library for a specific receiver and source endpoint
|
|
180
|
+
///
|
|
181
|
+
/// If the receiver hasn't set a custom receive library, this resolves to the default
|
|
182
|
+
/// receive library configured by LayerZero. The boolean indicates whether the
|
|
183
|
+
/// default library is being used.
|
|
184
|
+
///
|
|
185
|
+
/// # Arguments
|
|
186
|
+
/// * `receiver` - The OApp address that will receive messages
|
|
187
|
+
/// * `src_eid` - The source endpoint ID
|
|
188
|
+
///
|
|
189
|
+
/// # Returns
|
|
190
|
+
/// * `(ContractAddress, bool)` - Tuple of (library_address, is_using_default)
|
|
191
|
+
///
|
|
192
|
+
/// # Panics
|
|
193
|
+
/// * If no default receive library is configured for the endpoint
|
|
194
|
+
fn get_receive_library(
|
|
195
|
+
self: @TContractState, oapp: ContractAddress, src_eid: u32,
|
|
196
|
+
) -> GetLibraryResponse;
|
|
197
|
+
|
|
198
|
+
/// Get the raw receive library for a specific receiver and source endpoint
|
|
199
|
+
///
|
|
200
|
+
/// Returns the raw receive library for the given receiver and source endpoint.
|
|
201
|
+
///
|
|
202
|
+
/// # Arguments
|
|
203
|
+
/// * `receiver` - The OApp address that will receive messages
|
|
204
|
+
/// * `src_eid` - The source endpoint ID
|
|
205
|
+
///
|
|
206
|
+
/// # Returns
|
|
207
|
+
/// * `Array<felt252>` - The raw receive library address
|
|
208
|
+
fn get_raw_receive_library(
|
|
209
|
+
self: @TContractState, oapp: ContractAddress, src_eid: u32,
|
|
210
|
+
) -> ContractAddress;
|
|
211
|
+
|
|
212
|
+
/// Check if a receive library is valid for processing messages
|
|
213
|
+
///
|
|
214
|
+
/// This validates whether the specified library can be used to verify messages
|
|
215
|
+
/// for the given receiver and source endpoint. It considers both the currently
|
|
216
|
+
/// configured library and any libraries in their grace period.
|
|
217
|
+
///
|
|
218
|
+
/// # Arguments
|
|
219
|
+
/// * `receiver` - The OApp address that will receive messages
|
|
220
|
+
/// * `src_eid` - The source endpoint ID
|
|
221
|
+
/// * `lib_address` - The library address attempting to verify the message
|
|
222
|
+
///
|
|
223
|
+
/// # Returns
|
|
224
|
+
/// * `bool` - True if the library is valid for verification, false otherwise
|
|
225
|
+
fn is_valid_receive_library(
|
|
226
|
+
self: @TContractState, oapp: ContractAddress, src_eid: u32, lib: ContractAddress,
|
|
227
|
+
) -> bool;
|
|
228
|
+
|
|
229
|
+
/// Set the default receive library for an endpoint (owner only)
|
|
230
|
+
///
|
|
231
|
+
/// The default receive library is used by OApps that haven't configured a custom
|
|
232
|
+
/// receive library. An optional grace period allows the old default library to
|
|
233
|
+
/// remain valid during the transition.
|
|
234
|
+
///
|
|
235
|
+
/// # Arguments
|
|
236
|
+
/// * `eid` - The source endpoint ID
|
|
237
|
+
/// * `lib` - The message library address to set as default
|
|
238
|
+
/// * `grace_period` - Number of blocks to keep the old library valid (0 for immediate switch)
|
|
239
|
+
///
|
|
240
|
+
/// # Panics
|
|
241
|
+
/// * If caller is not the owner
|
|
242
|
+
/// * If library is not registered
|
|
243
|
+
/// * If library doesn't support receiving
|
|
244
|
+
/// * If library doesn't support the specified endpoint
|
|
245
|
+
/// * If the same library is already set as default
|
|
246
|
+
fn set_default_receive_library(
|
|
247
|
+
ref self: TContractState, eid: u32, lib: ContractAddress, grace_period: u64,
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
/// Get the default receive library for an endpoint
|
|
251
|
+
///
|
|
252
|
+
/// Returns the default receive library for the given endpoint.
|
|
253
|
+
///
|
|
254
|
+
/// # Arguments
|
|
255
|
+
/// * `eid` - The source endpoint ID
|
|
256
|
+
///
|
|
257
|
+
/// # Returns
|
|
258
|
+
/// * `ContractAddress` - The default receive library address
|
|
259
|
+
fn get_default_receive_library(self: @TContractState, eid: u32) -> ContractAddress;
|
|
260
|
+
|
|
261
|
+
/// Check if an OApp is using the default receive library
|
|
262
|
+
///
|
|
263
|
+
/// Returns true if the OApp hasn't set a custom receive library for the given
|
|
264
|
+
/// source, meaning it will use the protocol's default receive library.
|
|
265
|
+
///
|
|
266
|
+
/// # Arguments
|
|
267
|
+
fn is_default_receive_library(
|
|
268
|
+
self: @TContractState, oapp: ContractAddress, src_eid: u32,
|
|
269
|
+
) -> bool;
|
|
270
|
+
|
|
271
|
+
/// Set a timeout for a receive library transition
|
|
272
|
+
///
|
|
273
|
+
/// This allows fine-grained control over when libraries in grace period expire.
|
|
274
|
+
/// Can be used to extend, shorten, or remove grace periods for library transitions.
|
|
275
|
+
/// Only affects non-default library configurations.
|
|
276
|
+
///
|
|
277
|
+
/// # Arguments
|
|
278
|
+
/// * `eid` - The source endpoint ID
|
|
279
|
+
/// * `lib` - The library address to set timeout for
|
|
280
|
+
/// * `expiry` - Block number when the library expires (0 to remove timeout)
|
|
281
|
+
///
|
|
282
|
+
/// # Panics
|
|
283
|
+
/// * If library is not registered
|
|
284
|
+
/// * If library doesn't support receiving
|
|
285
|
+
/// * If library doesn't support the specified endpoint
|
|
286
|
+
/// * If OApp is using default library (can't set custom timeout)
|
|
287
|
+
/// * If expiry is not in the future (when setting non-zero expiry)
|
|
288
|
+
fn set_receive_library_timeout(
|
|
289
|
+
ref self: TContractState,
|
|
290
|
+
oapp: ContractAddress,
|
|
291
|
+
eid: u32,
|
|
292
|
+
lib: ContractAddress,
|
|
293
|
+
expiry: u64,
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
/// Get the timeout for a receive library
|
|
297
|
+
///
|
|
298
|
+
/// Returns the timeout for the specified receive library.
|
|
299
|
+
///
|
|
300
|
+
/// # Arguments
|
|
301
|
+
/// * `eid` - The source endpoint ID
|
|
302
|
+
/// * `lib` - The library address to get timeout for
|
|
303
|
+
///
|
|
304
|
+
/// # Returns
|
|
305
|
+
/// * `Timeout` - The timeout for the specified library
|
|
306
|
+
fn get_receive_library_timeout(
|
|
307
|
+
self: @TContractState, oapp: ContractAddress, eid: u32, lib: ContractAddress,
|
|
308
|
+
) -> Timeout;
|
|
309
|
+
|
|
310
|
+
/// Set a timeout for the default receive library (owner only)
|
|
311
|
+
///
|
|
312
|
+
/// This controls the grace period for the protocol's default receive library.
|
|
313
|
+
/// Unlike the OApp-specific timeout, this affects all OApps using the default library.
|
|
314
|
+
///
|
|
315
|
+
/// # Arguments
|
|
316
|
+
/// * `eid` - The source endpoint ID
|
|
317
|
+
/// * `lib` - The library address to set timeout for
|
|
318
|
+
/// * `expiry` - Block number when the library expires (0 to remove timeout)
|
|
319
|
+
///
|
|
320
|
+
/// # Panics
|
|
321
|
+
/// * If caller is not the owner
|
|
322
|
+
/// * If library is not registered
|
|
323
|
+
/// * If library doesn't support receiving
|
|
324
|
+
/// * If library doesn't support the specified endpoint
|
|
325
|
+
/// * If expiry is not in the future (when setting non-zero expiry)
|
|
326
|
+
fn set_default_receive_library_timeout(
|
|
327
|
+
ref self: TContractState, eid: u32, lib: ContractAddress, expiry: u64,
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
/// Get the timeout for the default receive library
|
|
331
|
+
///
|
|
332
|
+
/// Returns the timeout for the default receive library.
|
|
333
|
+
///
|
|
334
|
+
/// # Arguments
|
|
335
|
+
/// * `eid` - The source endpoint ID
|
|
336
|
+
/// * `lib` - The library address to get timeout for
|
|
337
|
+
///
|
|
338
|
+
/// # Returns
|
|
339
|
+
/// * `Timeout` - The timeout for the default library
|
|
340
|
+
fn get_default_receive_library_timeout(self: @TContractState, eid: u32) -> Timeout;
|
|
341
|
+
|
|
342
|
+
// ========================= Configuration Management =========================
|
|
343
|
+
|
|
344
|
+
/// Set send configuration for an OApp
|
|
345
|
+
///
|
|
346
|
+
/// This function allows an OApp to set configuration parameters for its send library.
|
|
347
|
+
/// The configuration is specific to the message library and endpoint.
|
|
348
|
+
///
|
|
349
|
+
/// # Arguments
|
|
350
|
+
/// * `oapp` - The OApp address setting configuration
|
|
351
|
+
/// * `lib` - The message library to set configuration for
|
|
352
|
+
/// * `params` - Array of configuration parameters to set
|
|
353
|
+
///
|
|
354
|
+
/// # Panics
|
|
355
|
+
/// * If library is not registered
|
|
356
|
+
fn set_send_config(
|
|
357
|
+
ref self: TContractState,
|
|
358
|
+
oapp: ContractAddress,
|
|
359
|
+
lib: ContractAddress,
|
|
360
|
+
params: Array<SetConfigParam>,
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
/// Get send configuration from a message library
|
|
364
|
+
///
|
|
365
|
+
/// This is a pass-through function that delegates configuration queries to the
|
|
366
|
+
/// specified message library. The configuration is OApp-specific and depends on
|
|
367
|
+
/// the library's implementation.
|
|
368
|
+
///
|
|
369
|
+
/// Note: Configuration setting happens directly in the message library via setConfig.
|
|
370
|
+
///
|
|
371
|
+
/// # Arguments
|
|
372
|
+
/// * `oapp` - The OApp address requesting configuration
|
|
373
|
+
/// * `lib` - The message library to query
|
|
374
|
+
/// * `eid` - The endpoint ID for the configuration
|
|
375
|
+
/// * `config_type` - The type of configuration being requested
|
|
376
|
+
///
|
|
377
|
+
/// # Returns
|
|
378
|
+
/// * `Array<felt252>` - The encoded configuration data
|
|
379
|
+
///
|
|
380
|
+
/// # Panics
|
|
381
|
+
/// * If library is not registered
|
|
382
|
+
fn get_send_config(
|
|
383
|
+
self: @TContractState,
|
|
384
|
+
oapp: ContractAddress,
|
|
385
|
+
lib: ContractAddress,
|
|
386
|
+
eid: u32,
|
|
387
|
+
config_type: u32,
|
|
388
|
+
) -> Array<felt252>;
|
|
389
|
+
|
|
390
|
+
/// Set receive configuration for an OApp
|
|
391
|
+
///
|
|
392
|
+
/// This function allows an OApp to set configuration parameters for its receive library.
|
|
393
|
+
/// The configuration is specific to the message library and endpoint.
|
|
394
|
+
///
|
|
395
|
+
/// # Arguments
|
|
396
|
+
/// * `oapp` - The OApp address setting configuration
|
|
397
|
+
/// * `lib` - The message library to set configuration for
|
|
398
|
+
/// * `params` - Array of configuration parameters to set
|
|
399
|
+
///
|
|
400
|
+
/// # Panics
|
|
401
|
+
/// * If library is not registered
|
|
402
|
+
fn set_receive_config(
|
|
403
|
+
ref self: TContractState,
|
|
404
|
+
oapp: ContractAddress,
|
|
405
|
+
lib: ContractAddress,
|
|
406
|
+
params: Array<SetConfigParam>,
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
/// Get receive configuration from a message library
|
|
410
|
+
///
|
|
411
|
+
/// This is a pass-through function that delegates configuration queries to the
|
|
412
|
+
/// specified message library. The configuration is OApp-specific and depends on
|
|
413
|
+
/// the library's implementation.
|
|
414
|
+
///
|
|
415
|
+
/// Note: Configuration setting happens directly in the message library via setConfig.
|
|
416
|
+
///
|
|
417
|
+
/// # Arguments
|
|
418
|
+
/// * `oapp` - The OApp address requesting configuration
|
|
419
|
+
/// * `lib` - The message library to query
|
|
420
|
+
/// * `eid` - The endpoint ID for the configuration
|
|
421
|
+
/// * `config_type` - The type of configuration being requested
|
|
422
|
+
///
|
|
423
|
+
/// # Returns
|
|
424
|
+
/// * `Array<felt252>` - The encoded configuration data
|
|
425
|
+
///
|
|
426
|
+
/// # Panics
|
|
427
|
+
/// * If library is not registered
|
|
428
|
+
fn get_receive_config(
|
|
429
|
+
self: @TContractState,
|
|
430
|
+
oapp: ContractAddress,
|
|
431
|
+
lib: ContractAddress,
|
|
432
|
+
eid: u32,
|
|
433
|
+
config_type: u32,
|
|
434
|
+
) -> Array<felt252>;
|
|
435
|
+
|
|
436
|
+
// ========================= Utility Functions =========================
|
|
437
|
+
|
|
438
|
+
/// Check if an endpoint is supported by the protocol
|
|
439
|
+
///
|
|
440
|
+
/// An endpoint is considered supported if it has both default send and receive
|
|
441
|
+
/// libraries configured. This indicates that the endpoint is ready for general use.
|
|
442
|
+
///
|
|
443
|
+
/// # Arguments
|
|
444
|
+
/// * `eid` - The endpoint ID to check
|
|
445
|
+
///
|
|
446
|
+
/// # Returns
|
|
447
|
+
/// * `bool` - True if the endpoint has both default libraries configured
|
|
448
|
+
fn is_supported_eid(self: @TContractState, eid: u32) -> bool;
|
|
449
|
+
}
|