@layerzerolabs/protocol-stellar-v2 0.2.121 → 0.2.122
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/Cargo.toml +22 -37
- package/docs/error-spec.md +24 -24
- package/docs/layerzero-v2-on-stellar.md +8 -6
- package/docs/oapp-guide.md +2 -402
- package/docs/oft-guide.md +2 -401
- package/{contracts/endpoint-v2 → endpoint-v2}/Cargo.toml +3 -2
- package/{contracts/layerzero-views → layerzero-views}/Cargo.toml +1 -6
- package/{contracts/message-libs → message-libs}/blocked-message-lib/Cargo.toml +0 -1
- package/{contracts/message-libs → message-libs}/message-lib-common/Cargo.toml +2 -2
- package/{contracts/message-libs → message-libs}/simple-message-lib/Cargo.toml +1 -2
- package/{contracts/message-libs → message-libs}/treasury/Cargo.toml +1 -2
- package/{contracts/message-libs → message-libs}/uln-302/Cargo.toml +3 -2
- package/package.json +32 -15
- package/rustfmt.toml +0 -2
- package/{contracts/upgrader → upgrader}/Cargo.toml +0 -1
- package/{contracts/workers → workers}/dvn/Cargo.toml +1 -2
- package/{contracts/workers → workers}/dvn-fee-lib/Cargo.toml +1 -2
- package/{contracts/workers → workers}/executor/Cargo.toml +3 -2
- package/{contracts/workers → workers}/executor-fee-lib/Cargo.toml +1 -2
- package/{contracts/workers → workers}/executor-helper/Cargo.toml +0 -1
- package/{contracts/workers → workers}/fee-lib-interfaces/Cargo.toml +0 -1
- package/{contracts/workers → workers}/price-feed/Cargo.toml +1 -2
- package/{contracts/workers → workers}/worker/Cargo.toml +0 -1
- package/.turbo/turbo-build.log +0 -1363
- package/.turbo/turbo-lint.log +0 -401
- package/.turbo/turbo-test.log +0 -1952
- package/Cargo.lock +0 -2357
- package/contracts/common-macros/Cargo.toml +0 -20
- package/contracts/common-macros/src/auth.rs +0 -95
- package/contracts/common-macros/src/contract_ttl.rs +0 -92
- package/contracts/common-macros/src/error.rs +0 -43
- package/contracts/common-macros/src/lib.rs +0 -585
- package/contracts/common-macros/src/lz_contract.rs +0 -105
- package/contracts/common-macros/src/rbac.rs +0 -90
- package/contracts/common-macros/src/storage.rs +0 -522
- package/contracts/common-macros/src/tests/auth.rs +0 -230
- package/contracts/common-macros/src/tests/contract_ttl.rs +0 -695
- package/contracts/common-macros/src/tests/error.rs +0 -156
- package/contracts/common-macros/src/tests/lz_contract.rs +0 -87
- package/contracts/common-macros/src/tests/mod.rs +0 -11
- package/contracts/common-macros/src/tests/rbac.rs +0 -523
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +0 -31
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +0 -39
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_only_auth_preserves_function_signature.snap +0 -19
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap +0 -77
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contracttrait_code.snap +0 -46
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__error__snapshot_generated_contract_error_code.snap +0 -20
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__lz_contract__snapshot_generated_lz_contract_code.snap +0 -51
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__rbac__snapshot_authorizer_role.snap +0 -21
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__rbac__snapshot_preserve_function_signature.snap +0 -21
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +0 -10
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_extendable__snapshot_generated_ttl_extendable_code.snap +0 -8
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +0 -28
- package/contracts/common-macros/src/tests/storage/extract_fields.rs +0 -87
- package/contracts/common-macros/src/tests/storage/gen_accessor_methods.rs +0 -223
- package/contracts/common-macros/src/tests/storage/gen_args.rs +0 -65
- package/contracts/common-macros/src/tests/storage/gen_enum_variant.rs +0 -78
- package/contracts/common-macros/src/tests/storage/gen_key.rs +0 -108
- package/contracts/common-macros/src/tests/storage/gen_params.rs +0 -105
- package/contracts/common-macros/src/tests/storage/generate_storage.rs +0 -410
- package/contracts/common-macros/src/tests/storage/is_primitive_type.rs +0 -48
- package/contracts/common-macros/src/tests/storage/mod.rs +0 -16
- package/contracts/common-macros/src/tests/storage/parse_default.rs +0 -164
- package/contracts/common-macros/src/tests/storage/parse_name.rs +0 -158
- package/contracts/common-macros/src/tests/storage/parse_no_ttl_extension.rs +0 -124
- package/contracts/common-macros/src/tests/storage/parse_storage_type.rs +0 -174
- package/contracts/common-macros/src/tests/storage/snapshots/common_macros__tests__storage__generate_storage__snapshot_generated_storage_code.snap +0 -412
- package/contracts/common-macros/src/tests/storage/storage_kind.rs +0 -39
- package/contracts/common-macros/src/tests/storage/test_setup.rs +0 -25
- package/contracts/common-macros/src/tests/storage/validate_attrs.rs +0 -138
- package/contracts/common-macros/src/tests/storage/variant_config.rs +0 -226
- package/contracts/common-macros/src/tests/test_helpers.rs +0 -87
- package/contracts/common-macros/src/tests/ttl_configurable.rs +0 -34
- package/contracts/common-macros/src/tests/ttl_extendable.rs +0 -32
- package/contracts/common-macros/src/tests/upgradeable.rs +0 -169
- package/contracts/common-macros/src/tests/utils.rs +0 -267
- package/contracts/common-macros/src/ttl_configurable.rs +0 -24
- package/contracts/common-macros/src/ttl_extendable.rs +0 -28
- package/contracts/common-macros/src/upgradeable.rs +0 -136
- package/contracts/common-macros/src/utils.rs +0 -56
- package/contracts/macro-integration-tests/Cargo.toml +0 -20
- package/contracts/macro-integration-tests/src/lib.rs +0 -1
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/constructor.rs +0 -61
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/contract_impl_ttl_extension.rs +0 -97
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/contract_trait_ttl_extension.rs +0 -99
- package/contracts/macro-integration-tests/tests/runtime/contract_ttl/mod.rs +0 -3
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/mod.rs +0 -5
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_default.rs +0 -86
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_multisig.rs +0 -47
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_multisig_upgradeable.rs +0 -77
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_upgradeable.rs +0 -114
- package/contracts/macro-integration-tests/tests/runtime/lz_contract/wrapper_upgradeable_no_migration.rs +0 -105
- package/contracts/macro-integration-tests/tests/runtime/multisig/admin_entrypoints.rs +0 -242
- package/contracts/macro-integration-tests/tests/runtime/multisig/mod.rs +0 -9
- package/contracts/macro-integration-tests/tests/runtime/multisig/self_auth.rs +0 -54
- package/contracts/macro-integration-tests/tests/runtime/oapp/mod.rs +0 -46
- package/contracts/macro-integration-tests/tests/runtime/oapp/oapp_core.rs +0 -170
- package/contracts/macro-integration-tests/tests/runtime/oapp/options_type3.rs +0 -154
- package/contracts/macro-integration-tests/tests/runtime/oapp/receiver.rs +0 -338
- package/contracts/macro-integration-tests/tests/runtime/oapp/sender.rs +0 -437
- package/contracts/macro-integration-tests/tests/runtime/ownable/initialization.rs +0 -78
- package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +0 -23
- package/contracts/macro-integration-tests/tests/runtime/ownable/only_auth_guard.rs +0 -97
- package/contracts/macro-integration-tests/tests/runtime/ownable/ownership_transfer.rs +0 -170
- package/contracts/macro-integration-tests/tests/runtime/ownable/two_step_transfer.rs +0 -221
- package/contracts/macro-integration-tests/tests/runtime/rbac/guard_behavior.rs +0 -91
- package/contracts/macro-integration-tests/tests/runtime/rbac/mod.rs +0 -30
- package/contracts/macro-integration-tests/tests/runtime/storage/keyed_roundtrip.rs +0 -266
- package/contracts/macro-integration-tests/tests/runtime/storage/mod.rs +0 -4
- package/contracts/macro-integration-tests/tests/runtime/storage/name_override_runtime.rs +0 -52
- package/contracts/macro-integration-tests/tests/runtime/storage/ttl_extension.rs +0 -293
- package/contracts/macro-integration-tests/tests/runtime/storage/unkeyed_roundtrip.rs +0 -147
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +0 -206
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +0 -143
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/mod.rs +0 -2
- package/contracts/macro-integration-tests/tests/runtime/ttl_extendable/extend_instance_ttl.rs +0 -64
- package/contracts/macro-integration-tests/tests/runtime/ttl_extendable/mod.rs +0 -16
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/migrate_guard_and_state.rs +0 -243
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/mod.rs +0 -3
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/no_migration.rs +0 -59
- package/contracts/macro-integration-tests/tests/runtime/upgradeable/upgrade_then_migrate.rs +0 -88
- package/contracts/macro-integration-tests/tests/runtime.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui/contract_impl/fail/not_impl_item.rs +0 -6
- package/contracts/macro-integration-tests/tests/ui/contract_impl/fail/not_impl_item.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/contract_impl/pass/basic.rs +0 -102
- package/contracts/macro-integration-tests/tests/ui/contract_trait/fail/not_a_trait.rs +0 -6
- package/contracts/macro-integration-tests/tests/ui/contract_trait/fail/not_a_trait.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/contract_trait/pass/basic.rs +0 -83
- package/contracts/macro-integration-tests/tests/ui/error/fail/decreasing_discriminant.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui/error/fail/decreasing_discriminant.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/error/fail/discriminant_too_large.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui/error/fail/discriminant_too_large.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_enum_input.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_enum_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_int_discriminant.rs +0 -21
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_int_discriminant.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_unit_variant.rs +0 -13
- package/contracts/macro-integration-tests/tests/ui/error/fail/non_unit_variant.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/error/pass/basic.rs +0 -22
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/invalid_option.rs +0 -6
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/invalid_option.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/multisig_rejects_ownable_api.rs +0 -20
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/multisig_rejects_ownable_api.stderr +0 -20
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/not_a_struct.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/not_a_struct.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_invalid_inner_option.rs +0 -10
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_invalid_inner_option.stderr +0 -30
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.rs +0 -20
- package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.stderr +0 -56
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/basic.rs +0 -45
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/multisig.rs +0 -34
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/multisig_upgradeable.rs +0 -30
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable.rs +0 -39
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable_no_migration.rs +0 -28
- package/contracts/macro-integration-tests/tests/ui/lz_contract/pass/upgradeable_rbac.rs +0 -44
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/non_struct_input.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/non_struct_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_api.rs +0 -20
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_api.stderr +0 -12
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_trait.rs +0 -20
- package/contracts/macro-integration-tests/tests/ui/multisig/fail/rejects_ownable_trait.stderr +0 -5
- package/contracts/macro-integration-tests/tests/ui/multisig/pass/basic.rs +0 -49
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_auth_trait.rs +0 -28
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_auth_trait.stderr +0 -397
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.rs +0 -9
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.stderr +0 -71
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.rs +0 -10
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_all.rs +0 -42
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_single_trait.rs +0 -103
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/minimal_contract.rs +0 -65
- package/contracts/macro-integration-tests/tests/ui/oapp/pass/struct_with_fields.rs +0 -48
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/non_struct_input.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/non_struct_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_auth.rs +0 -19
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_auth.stderr +0 -12
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.rs +0 -22
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.stderr +0 -16
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/basic.rs +0 -39
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/only_auth_env_param_variants.rs +0 -52
- package/contracts/macro-integration-tests/tests/ui/rbac/fail/missing_env.rs +0 -18
- package/contracts/macro-integration-tests/tests/ui/rbac/fail/missing_env.stderr +0 -16
- package/contracts/macro-integration-tests/tests/ui/rbac/fail/param_not_address.rs +0 -18
- package/contracts/macro-integration-tests/tests/ui/rbac/fail/param_not_address.stderr +0 -24
- package/contracts/macro-integration-tests/tests/ui/rbac/fail/param_not_found.rs +0 -18
- package/contracts/macro-integration-tests/tests/ui/rbac/fail/param_not_found.stderr +0 -24
- package/contracts/macro-integration-tests/tests/ui/rbac/pass/basic.rs +0 -80
- package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.rs +0 -13
- package/contracts/macro-integration-tests/tests/ui/storage/fail/invalid_storage_type_param.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.rs +0 -13
- package/contracts/macro-integration-tests/tests/ui/storage/fail/missing_storage_type_param.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_default_values.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_default_values.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_name_attrs.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_name_attrs.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_no_ttl_extension.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_no_ttl_extension.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_storage_kinds.rs +0 -10
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_storage_kinds.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui/storage/fail/multiple_type_params.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_on_non_persistent.rs +0 -10
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_on_non_persistent.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_rejects_args.rs +0 -13
- package/contracts/macro-integration-tests/tests/ui/storage/fail/no_ttl_extension_rejects_args.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/non_enum_input.rs +0 -10
- package/contracts/macro-integration-tests/tests/ui/storage/fail/non_enum_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/tuple_variant_rejected.rs +0 -13
- package/contracts/macro-integration-tests/tests/ui/storage/fail/tuple_variant_rejected.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/fail/unknown_variant_attr.rs +0 -13
- package/contracts/macro-integration-tests/tests/ui/storage/fail/unknown_variant_attr.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/storage/pass/api_surface.rs +0 -102
- package/contracts/macro-integration-tests/tests/ui/storage/pass/basic.rs +0 -43
- package/contracts/macro-integration-tests/tests/ui/storage/pass/multi_key.rs +0 -38
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/missing_auth_trait.rs +0 -14
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/missing_auth_trait.stderr +0 -71
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/non_struct_input.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/fail/non_struct_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/basic.rs +0 -46
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/multisig_contract.rs +0 -28
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/ownable_contract.rs +0 -32
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/fail/non_struct_input.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/fail/non_struct_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/pass/basic.rs +0 -23
- package/contracts/macro-integration-tests/tests/ui/ttl_extendable/pass/no_user_contractimpl.rs +0 -21
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/attr_args.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/attr_args.stderr +0 -29
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.rs +0 -20
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.stderr +0 -41
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.rs +0 -10
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.stderr +0 -49
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/non_struct_input.rs +0 -8
- package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/non_struct_input.stderr +0 -7
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/basic.rs +0 -41
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/multisig_contract.rs +0 -33
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_migration.rs +0 -28
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_user_contractimpl.rs +0 -27
- package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/rbac.rs +0 -44
- package/contracts/macro-integration-tests/tests/ui_contract_impl.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui_contract_trait.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui_error.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui_lz_contract.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui_multisig.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui_oapp.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui_ownable.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui_rbac.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui_storage.rs +0 -11
- package/contracts/macro-integration-tests/tests/ui_ttl_configurable.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui_ttl_extendable.rs +0 -12
- package/contracts/macro-integration-tests/tests/ui_upgradeable.rs +0 -11
- package/contracts/message-libs/Cargo.toml +0 -12
- package/contracts/message-libs/lib.rs +0 -2
- package/contracts/oapps/Cargo.toml +0 -12
- package/contracts/oapps/counter/Cargo.toml +0 -39
- package/contracts/oapps/counter/integration_tests/mod.rs +0 -7
- package/contracts/oapps/counter/integration_tests/setup_sml.rs +0 -171
- package/contracts/oapps/counter/integration_tests/setup_uln.rs +0 -1019
- package/contracts/oapps/counter/integration_tests/signing.rs +0 -62
- package/contracts/oapps/counter/integration_tests/test_with_blocked.rs +0 -67
- package/contracts/oapps/counter/integration_tests/test_with_sml.rs +0 -135
- package/contracts/oapps/counter/integration_tests/test_with_uln.rs +0 -314
- package/contracts/oapps/counter/integration_tests/utils.rs +0 -294
- package/contracts/oapps/counter/src/codec.rs +0 -62
- package/contracts/oapps/counter/src/counter.rs +0 -274
- package/contracts/oapps/counter/src/errors.rs +0 -9
- package/contracts/oapps/counter/src/lib.rs +0 -16
- package/contracts/oapps/counter/src/options.rs +0 -30
- package/contracts/oapps/counter/src/storage.rs +0 -32
- package/contracts/oapps/counter/src/tests/mod.rs +0 -24
- package/contracts/oapps/counter/src/tests/test_codec.rs +0 -64
- package/contracts/oapps/counter/src/tests/test_counter.rs +0 -387
- package/contracts/oapps/counter/src/tests/test_u256_ext.rs +0 -48
- package/contracts/oapps/counter/src/u256_ext.rs +0 -21
- package/contracts/oapps/lib.rs +0 -2
- package/contracts/oapps/oapp/Cargo.toml +0 -22
- package/contracts/oapps/oapp/src/errors.rs +0 -13
- package/contracts/oapps/oapp/src/interfaces/mod.rs +0 -3
- package/contracts/oapps/oapp/src/interfaces/oapp_msg_inspector.rs +0 -70
- package/contracts/oapps/oapp/src/lib.rs +0 -15
- package/contracts/oapps/oapp/src/oapp_core.rs +0 -143
- package/contracts/oapps/oapp/src/oapp_options_type3.rs +0 -133
- package/contracts/oapps/oapp/src/oapp_receiver.rs +0 -195
- package/contracts/oapps/oapp/src/oapp_sender.rs +0 -152
- package/contracts/oapps/oapp/src/tests/mod.rs +0 -5
- package/contracts/oapps/oapp/src/tests/oapp_core.rs +0 -225
- package/contracts/oapps/oapp/src/tests/oapp_options_type3.rs +0 -246
- package/contracts/oapps/oapp/src/tests/oapp_receiver.rs +0 -383
- package/contracts/oapps/oapp/src/tests/oapp_sender.rs +0 -570
- package/contracts/oapps/oapp/src/tests/test_macros.rs +0 -434
- package/contracts/oapps/oapp-macros/Cargo.toml +0 -18
- package/contracts/oapps/oapp-macros/src/generators.rs +0 -147
- package/contracts/oapps/oapp-macros/src/lib.rs +0 -166
- package/contracts/oapps/oapp-macros/src/tests/mod.rs +0 -2
- package/contracts/oapps/oapp-macros/src/tests/oapp.rs +0 -74
- package/contracts/oapps/oapp-macros/src/tests/parse_custom_impls.rs +0 -90
- package/contracts/oapps/oapp-macros/src/tests/snapshots/oapp_macros__tests__oapp__snapshot_generate_oapp.snap +0 -111
- package/contracts/oapps/oft/Cargo.toml +0 -30
- package/contracts/oapps/oft/integration-tests/extensions/mod.rs +0 -3
- package/contracts/oapps/oft/integration-tests/extensions/test_oft_fee.rs +0 -172
- package/contracts/oapps/oft/integration-tests/extensions/test_pausable.rs +0 -161
- package/contracts/oapps/oft/integration-tests/extensions/test_rate_limiter.rs +0 -336
- package/contracts/oapps/oft/integration-tests/mod.rs +0 -3
- package/contracts/oapps/oft/integration-tests/setup.rs +0 -306
- package/contracts/oapps/oft/integration-tests/utils.rs +0 -609
- package/contracts/oapps/oft/src/extensions/mod.rs +0 -3
- package/contracts/oapps/oft/src/extensions/oft_fee.rs +0 -281
- package/contracts/oapps/oft/src/extensions/pausable.rs +0 -119
- package/contracts/oapps/oft/src/extensions/rate_limiter.rs +0 -286
- package/contracts/oapps/oft/src/interfaces/mintable.rs +0 -14
- package/contracts/oapps/oft/src/interfaces/mod.rs +0 -3
- package/contracts/oapps/oft/src/lib.rs +0 -24
- package/contracts/oapps/oft/src/oft.rs +0 -176
- package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +0 -50
- package/contracts/oapps/oft/src/oft_types/mint_burn.rs +0 -51
- package/contracts/oapps/oft/src/oft_types/mod.rs +0 -24
- package/contracts/oapps/oft/src/tests/extensions/mod.rs +0 -3
- package/contracts/oapps/oft/src/tests/extensions/oft_fee.rs +0 -260
- package/contracts/oapps/oft/src/tests/extensions/pausable.rs +0 -155
- package/contracts/oapps/oft/src/tests/extensions/rate_limiter.rs +0 -601
- package/contracts/oapps/oft/src/tests/mod.rs +0 -2
- package/contracts/oapps/oft/src/tests/oft_types/lock_unlock.rs +0 -185
- package/contracts/oapps/oft/src/tests/oft_types/mod.rs +0 -1
- package/contracts/oapps/oft-core/Cargo.toml +0 -24
- package/contracts/oapps/oft-core/integration-tests/mod.rs +0 -3
- package/contracts/oapps/oft-core/integration-tests/setup.rs +0 -346
- package/contracts/oapps/oft-core/integration-tests/test_with_sml.rs +0 -156
- package/contracts/oapps/oft-core/integration-tests/utils.rs +0 -220
- package/contracts/oapps/oft-core/src/codec/mod.rs +0 -2
- package/contracts/oapps/oft-core/src/codec/oft_compose_msg_codec.rs +0 -55
- package/contracts/oapps/oft-core/src/codec/oft_msg_codec.rs +0 -58
- package/contracts/oapps/oft-core/src/errors.rs +0 -15
- package/contracts/oapps/oft-core/src/events.rs +0 -32
- package/contracts/oapps/oft-core/src/lib.rs +0 -22
- package/contracts/oapps/oft-core/src/oft_core.rs +0 -594
- package/contracts/oapps/oft-core/src/storage.rs +0 -19
- package/contracts/oapps/oft-core/src/tests/mod.rs +0 -14
- package/contracts/oapps/oft-core/src/tests/test_decimals.rs +0 -124
- package/contracts/oapps/oft-core/src/tests/test_lz_receive.rs +0 -282
- package/contracts/oapps/oft-core/src/tests/test_msg_inspector.rs +0 -324
- package/contracts/oapps/oft-core/src/tests/test_oft_compose_msg_codec.rs +0 -68
- package/contracts/oapps/oft-core/src/tests/test_oft_msg_codec.rs +0 -64
- package/contracts/oapps/oft-core/src/tests/test_oft_version_and_approval.rs +0 -22
- package/contracts/oapps/oft-core/src/tests/test_quote_oft.rs +0 -159
- package/contracts/oapps/oft-core/src/tests/test_quote_send.rs +0 -195
- package/contracts/oapps/oft-core/src/tests/test_resolve_address.rs +0 -37
- package/contracts/oapps/oft-core/src/tests/test_send.rs +0 -915
- package/contracts/oapps/oft-core/src/tests/test_token.rs +0 -47
- package/contracts/oapps/oft-core/src/tests/test_utils.rs +0 -870
- package/contracts/oapps/oft-core/src/types.rs +0 -58
- package/contracts/oapps/oft-core/src/utils.rs +0 -71
- package/contracts/oapps/sac-manager/Cargo.toml +0 -24
- package/contracts/oapps/sac-manager/src/interfaces/mod.rs +0 -3
- package/contracts/oapps/sac-manager/src/interfaces/sac_admin_wrapper.rs +0 -49
- package/contracts/oapps/sac-manager/src/lib.rs +0 -19
- package/contracts/oapps/sac-manager/src/sac_manager.rs +0 -95
- package/contracts/oapps/sac-manager/src/storage.rs +0 -13
- package/contracts/oapps/sac-manager/src/tests/mod.rs +0 -10
- package/contracts/oapps/sac-manager/src/tests/sac_manager/clawback.rs +0 -84
- package/contracts/oapps/sac-manager/src/tests/sac_manager/mint.rs +0 -53
- package/contracts/oapps/sac-manager/src/tests/sac_manager/mod.rs +0 -6
- package/contracts/oapps/sac-manager/src/tests/sac_manager/set_admin.rs +0 -46
- package/contracts/oapps/sac-manager/src/tests/sac_manager/set_authorized.rs +0 -53
- package/contracts/oapps/sac-manager/src/tests/sac_manager/test_helper.rs +0 -35
- package/contracts/oapps/sac-manager/src/tests/sac_manager/view_functions.rs +0 -13
- package/contracts/oapps/sac-manager/src/tests/test_helper.rs +0 -138
- package/contracts/utils/Cargo.toml +0 -20
- package/contracts/utils/src/auth.rs +0 -48
- package/contracts/utils/src/buffer_reader.rs +0 -194
- package/contracts/utils/src/buffer_writer.rs +0 -138
- package/contracts/utils/src/bytes_ext.rs +0 -18
- package/contracts/utils/src/errors.rs +0 -82
- package/contracts/utils/src/lib.rs +0 -20
- package/contracts/utils/src/multisig.rs +0 -247
- package/contracts/utils/src/option_ext.rs +0 -38
- package/contracts/utils/src/ownable.rs +0 -227
- package/contracts/utils/src/rbac.rs +0 -438
- package/contracts/utils/src/testing_utils.rs +0 -180
- package/contracts/utils/src/tests/auth.rs +0 -179
- package/contracts/utils/src/tests/buffer_reader.rs +0 -969
- package/contracts/utils/src/tests/buffer_writer.rs +0 -689
- package/contracts/utils/src/tests/bytes_ext.rs +0 -160
- package/contracts/utils/src/tests/mod.rs +0 -13
- package/contracts/utils/src/tests/multisig.rs +0 -760
- package/contracts/utils/src/tests/option_ext.rs +0 -18
- package/contracts/utils/src/tests/ownable.rs +0 -822
- package/contracts/utils/src/tests/rbac.rs +0 -559
- package/contracts/utils/src/tests/test_helper.rs +0 -67
- package/contracts/utils/src/tests/testing_utils.rs +0 -522
- package/contracts/utils/src/tests/ttl_configurable.rs +0 -586
- package/contracts/utils/src/tests/ttl_extendable.rs +0 -64
- package/contracts/utils/src/tests/upgradeable.rs +0 -529
- package/contracts/utils/src/ttl_configurable.rs +0 -169
- package/contracts/utils/src/ttl_extendable.rs +0 -25
- package/contracts/utils/src/upgradeable.rs +0 -103
- package/contracts/workers/Cargo.toml +0 -13
- package/contracts/workers/lib.rs +0 -2
- package/sdk/.turbo/turbo-build.log +0 -5
- package/sdk/.turbo/turbo-test.log +0 -1507
- package/sdk/LICENSE +0 -23
- package/sdk/dist/generated/bml.d.ts +0 -670
- package/sdk/dist/generated/bml.d.ts.map +0 -1
- package/sdk/dist/generated/bml.js +0 -292
- package/sdk/dist/generated/bml.js.map +0 -1
- package/sdk/dist/generated/counter.d.ts +0 -1253
- package/sdk/dist/generated/counter.d.ts.map +0 -1
- package/sdk/dist/generated/counter.js +0 -391
- package/sdk/dist/generated/counter.js.map +0 -1
- package/sdk/dist/generated/dvn.d.ts +0 -1569
- package/sdk/dist/generated/dvn.d.ts.map +0 -1
- package/sdk/dist/generated/dvn.js +0 -459
- package/sdk/dist/generated/dvn.js.map +0 -1
- package/sdk/dist/generated/dvn_fee_lib.d.ts +0 -587
- package/sdk/dist/generated/dvn_fee_lib.d.ts.map +0 -1
- package/sdk/dist/generated/dvn_fee_lib.js +0 -186
- package/sdk/dist/generated/dvn_fee_lib.js.map +0 -1
- package/sdk/dist/generated/endpoint.d.ts +0 -1304
- package/sdk/dist/generated/endpoint.d.ts.map +0 -1
- package/sdk/dist/generated/endpoint.js +0 -396
- package/sdk/dist/generated/endpoint.js.map +0 -1
- package/sdk/dist/generated/executor.d.ts +0 -1554
- package/sdk/dist/generated/executor.d.ts.map +0 -1
- package/sdk/dist/generated/executor.js +0 -447
- package/sdk/dist/generated/executor.js.map +0 -1
- package/sdk/dist/generated/executor_fee_lib.d.ts +0 -1037
- package/sdk/dist/generated/executor_fee_lib.d.ts.map +0 -1
- package/sdk/dist/generated/executor_fee_lib.js +0 -351
- package/sdk/dist/generated/executor_fee_lib.js.map +0 -1
- package/sdk/dist/generated/executor_helper.d.ts +0 -883
- package/sdk/dist/generated/executor_helper.d.ts.map +0 -1
- package/sdk/dist/generated/executor_helper.js +0 -354
- package/sdk/dist/generated/executor_helper.js.map +0 -1
- package/sdk/dist/generated/layerzero_view.d.ts +0 -1153
- package/sdk/dist/generated/layerzero_view.d.ts.map +0 -1
- package/sdk/dist/generated/layerzero_view.js +0 -457
- package/sdk/dist/generated/layerzero_view.js.map +0 -1
- package/sdk/dist/generated/oft.d.ts +0 -1638
- package/sdk/dist/generated/oft.d.ts.map +0 -1
- package/sdk/dist/generated/oft.js +0 -463
- package/sdk/dist/generated/oft.js.map +0 -1
- package/sdk/dist/generated/price_feed.d.ts +0 -787
- package/sdk/dist/generated/price_feed.d.ts.map +0 -1
- package/sdk/dist/generated/price_feed.js +0 -231
- package/sdk/dist/generated/price_feed.js.map +0 -1
- package/sdk/dist/generated/sac_manager.d.ts +0 -567
- package/sdk/dist/generated/sac_manager.d.ts.map +0 -1
- package/sdk/dist/generated/sac_manager.js +0 -198
- package/sdk/dist/generated/sac_manager.js.map +0 -1
- package/sdk/dist/generated/sml.d.ts +0 -934
- package/sdk/dist/generated/sml.d.ts.map +0 -1
- package/sdk/dist/generated/sml.js +0 -366
- package/sdk/dist/generated/sml.js.map +0 -1
- package/sdk/dist/generated/treasury.d.ts +0 -892
- package/sdk/dist/generated/treasury.d.ts.map +0 -1
- package/sdk/dist/generated/treasury.js +0 -352
- package/sdk/dist/generated/treasury.js.map +0 -1
- package/sdk/dist/generated/uln302.d.ts +0 -1268
- package/sdk/dist/generated/uln302.d.ts.map +0 -1
- package/sdk/dist/generated/uln302.js +0 -477
- package/sdk/dist/generated/uln302.js.map +0 -1
- package/sdk/dist/generated/upgrader.d.ts +0 -292
- package/sdk/dist/generated/upgrader.d.ts.map +0 -1
- package/sdk/dist/generated/upgrader.js +0 -144
- package/sdk/dist/generated/upgrader.js.map +0 -1
- package/sdk/dist/index.d.ts +0 -17
- package/sdk/dist/index.d.ts.map +0 -1
- package/sdk/dist/index.js +0 -21
- package/sdk/dist/index.js.map +0 -1
- package/sdk/node_modules/.bin/tsc +0 -21
- package/sdk/node_modules/.bin/tsserver +0 -21
- package/sdk/node_modules/.bin/vitest +0 -21
- package/sdk/package.json +0 -50
- package/sdk/src/index.ts +0 -23
- package/sdk/test/counter-sml.test.ts +0 -480
- package/sdk/test/counter-uln.test.ts +0 -584
- package/sdk/test/oft-sml.test.ts +0 -750
- package/sdk/test/sac-manager.test.ts +0 -464
- package/sdk/test/secp256k1.ts +0 -59
- package/sdk/test/suites/constants.ts +0 -51
- package/sdk/test/suites/deploy.ts +0 -312
- package/sdk/test/suites/dummyContractClient.ts +0 -168
- package/sdk/test/suites/globalSetup.ts +0 -604
- package/sdk/test/suites/localnet.ts +0 -192
- package/sdk/test/suites/scan.ts +0 -202
- package/sdk/test/test_data/test_upgradeable_dvn.wasm +0 -0
- package/sdk/test/upgrader.test.ts +0 -194
- package/sdk/test/utils.ts +0 -671
- package/sdk/tsconfig.json +0 -21
- package/sdk/tsconfig.test.json +0 -10
- package/sdk/turbo.json +0 -15
- package/sdk/vitest.config.ts +0 -21
- package/ts-bindings-gen.toml +0 -67
- package/turbo-snapshot.lock.json +0 -194
- package/turbo.json +0 -26
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/endpoint_v2.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/errors.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/events.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/layerzero_composer.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/layerzero_endpoint_v2.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/layerzero_receiver.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/message_lib.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/message_lib_manager.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/messaging_channel.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/messaging_composer.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/mod.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/interfaces/send_lib.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/lib.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/message_lib_manager.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/messaging_channel.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/messaging_composer.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/storage.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_setup.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/build_outbound_packet.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/clear.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/delegate.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/initializable.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/lz_receive_alert.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/mod.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/native_token.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/owner.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/pay_messaging_fees.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/quote.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/recover_token.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/require_oapp_auth.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/send.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/set_delegate.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/set_zro.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/transfer_ownership.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/ttl_config.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/verifiable.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/verify.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/zro.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/default_receive_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/default_receive_library_timeout.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/default_send_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/get_config.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/get_library_index.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/get_receive_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/get_registered_libraries.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/get_send_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/is_registered_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/is_supported_eid.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/is_valid_receive_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/mod.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/receive_library_timeout.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/register_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/registered_libraries_count.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/require_registered.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/require_send_lib_for_eid.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/require_supported_eid.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/set_config.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/set_default_receive_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/set_default_send_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/set_receive_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/set_receive_library_timeout.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/set_send_library.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/timeout.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/burn.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/clear_payload.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/inbound.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/inbound_nonce.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/inbound_payload_hash.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/insert_and_drain_pending_nonces.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/mod.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/next_guid.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/nilify.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/outbound.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/outbound_nonce.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/pending_inbound_nonces.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/skip.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_composer/clear_compose.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_composer/compose_queue.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_composer/lz_compose_alert.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_composer/mod.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_composer/send_compose.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/mock.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/mod.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/util/build_payload.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/util/compute_guid.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/util/keccak256.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/util/mod.rs +0 -0
- /package/{contracts/endpoint-v2 → endpoint-v2}/src/util.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/errors.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/layerzero_view.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/lib.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/storage.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/tests/layerzero_view_tests.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/tests/mod.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/tests/setup.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/tests/types_tests.rs +0 -0
- /package/{contracts/layerzero-views → layerzero-views}/src/types.rs +0 -0
- /package/{contracts/message-libs → message-libs}/blocked-message-lib/src/lib.rs +0 -0
- /package/{contracts/message-libs → message-libs}/blocked-message-lib/src/tests/blocked_message_lib_tests.rs +0 -0
- /package/{contracts/message-libs → message-libs}/blocked-message-lib/src/tests/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/blocked-message-lib/src/tests/setup.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/errors.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/interfaces/dvn.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/interfaces/executor.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/interfaces/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/interfaces/treasury.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/lib.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/packet_codec_v1.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/testing_utils.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/packet_codec_v1/decode_packet_header.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/packet_codec_v1/encode_packet.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/packet_codec_v1/encode_packet_header.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/packet_codec_v1/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/packet_codec_v1/payload.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/packet_codec_v1/payload_hash.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/packet_codec_v1/test_helper.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/append_dvn_option.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/append_lz_receive_option.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/append_native_drop_option.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/convert_legacy_options.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/tests/worker_options/split_worker_options.rs +0 -0
- /package/{contracts/message-libs → message-libs}/message-lib-common/src/worker_options.rs +0 -0
- /package/{contracts/message-libs → message-libs}/simple-message-lib/src/errors.rs +0 -0
- /package/{contracts/message-libs → message-libs}/simple-message-lib/src/lib.rs +0 -0
- /package/{contracts/message-libs → message-libs}/simple-message-lib/src/simple_message_lib.rs +0 -0
- /package/{contracts/message-libs → message-libs}/simple-message-lib/src/storage.rs +0 -0
- /package/{contracts/message-libs → message-libs}/simple-message-lib/src/tests/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/simple-message-lib/src/tests/setup.rs +0 -0
- /package/{contracts/message-libs → message-libs}/simple-message-lib/src/tests/simple_message_lib_tests.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/errors.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/events.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/interfaces/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/interfaces/zro_fee_lib.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/lib.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/storage.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/tests/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/tests/setup.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/tests/treasury_tests.rs +0 -0
- /package/{contracts/message-libs → message-libs}/treasury/src/treasury.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/errors.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/events.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/interfaces/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/interfaces/receive_uln.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/interfaces/send_uln.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/lib.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/receive_uln.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/send_uln.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/storage.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/config/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/config/oapp_uln_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/config/uln_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/receive_uln302/commit_verification.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/receive_uln302/confirmations.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/receive_uln302/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/receive_uln302/verifiable.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/receive_uln302/verify.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/effective_executor_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/quote.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/send.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/set_default_executor_configs.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/set_default_send_uln_configs.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/setup.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/testing_utils.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/uln302/get_app_receive_uln_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/uln302/get_app_send_uln_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/uln302/get_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/uln302/get_oapp_executor_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/uln302/mod.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/tests/uln302/set_config.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/types.rs +0 -0
- /package/{contracts/message-libs → message-libs}/uln-302/src/uln302.rs +0 -0
- /package/{contracts/upgrader → upgrader}/src/lib.rs +0 -0
- /package/{contracts/upgrader → upgrader}/src/tests/mod.rs +0 -0
- /package/{contracts/upgrader → upgrader}/src/tests/test_data/test_upgradeable_contract1.wasm +0 -0
- /package/{contracts/upgrader → upgrader}/src/tests/test_data/test_upgradeable_contract2.wasm +0 -0
- /package/{contracts/upgrader → upgrader}/src/tests/test_data/test_upgradeable_contract3.wasm +0 -0
- /package/{contracts/upgrader → upgrader}/src/tests/test_data/test_upgradeable_contract4.wasm +0 -0
- /package/{contracts/upgrader → upgrader}/src/tests/test_upgrader.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/auth.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/dvn.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/errors.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/events.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/interfaces/dvn.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/interfaces/mod.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/storage.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/tests/auth.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/tests/dvn.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/tests/key_pair.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/tests/mod.rs +0 -0
- /package/{contracts/workers → workers}/dvn/src/tests/setup.rs +0 -0
- /package/{contracts/workers → workers}/dvn-fee-lib/src/dvn_fee_lib.rs +0 -0
- /package/{contracts/workers → workers}/dvn-fee-lib/src/errors.rs +0 -0
- /package/{contracts/workers → workers}/dvn-fee-lib/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/dvn-fee-lib/src/tests/dvn_fee_lib.rs +0 -0
- /package/{contracts/workers → workers}/dvn-fee-lib/src/tests/mod.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/auth.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/errors.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/events.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/executor.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/interfaces/executor.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/interfaces/mod.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/storage.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/tests/auth.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/tests/executor.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/tests/mod.rs +0 -0
- /package/{contracts/workers → workers}/executor/src/tests/setup.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/errors.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/executor_fee_lib.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/executor_option.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/tests/executor_fee_lib.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/tests/executor_option.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/tests/mod.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/tests/setup.rs +0 -0
- /package/{contracts/workers → workers}/executor-helper/src/executor_helper.rs +0 -0
- /package/{contracts/workers → workers}/executor-helper/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/executor-helper/src/tests/executor_helper.rs +0 -0
- /package/{contracts/workers → workers}/executor-helper/src/tests/mod.rs +0 -0
- /package/{contracts/workers → workers}/executor-helper/src/tests/setup.rs +0 -0
- /package/{contracts/workers → workers}/fee-lib-interfaces/src/dvn_fee_lib.rs +0 -0
- /package/{contracts/workers → workers}/fee-lib-interfaces/src/executor_fee_lib.rs +0 -0
- /package/{contracts/workers → workers}/fee-lib-interfaces/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/fee-lib-interfaces/src/price_feed.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/errors.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/events.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/price_feed.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/storage.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/tests/mod.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/tests/price_feed.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/tests/setup.rs +0 -0
- /package/{contracts/workers → workers}/price-feed/src/types.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/errors.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/events.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/lib.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/storage.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/tests/mod.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/tests/setup.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/tests/worker.rs +0 -0
- /package/{contracts/workers → workers}/worker/src/worker.rs +0 -0
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
use crate::{errors::OAppError, oapp_receiver::RECEIVER_VERSION, oapp_sender::SENDER_VERSION};
|
|
2
|
-
use common_macros::{contract_trait, only_role, storage};
|
|
3
|
-
use endpoint_v2::LayerZeroEndpointV2Client;
|
|
4
|
-
use soroban_sdk::{contractevent, Address, BytesN, Env};
|
|
5
|
-
use utils::{
|
|
6
|
-
option_ext::OptionExt,
|
|
7
|
-
ownable::{Ownable, OwnableInitializer},
|
|
8
|
-
rbac::{RoleBasedAccessControl, AUTHORIZER},
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// =====================================================
|
|
12
|
-
// OAppCore Storage and Events
|
|
13
|
-
// =====================================================
|
|
14
|
-
|
|
15
|
-
#[storage]
|
|
16
|
-
pub enum OAppCoreStorage {
|
|
17
|
-
// Endpoint address - set once during initialization
|
|
18
|
-
#[instance(Address)]
|
|
19
|
-
Endpoint,
|
|
20
|
-
|
|
21
|
-
// Mapping from endpoint ID to remote peer address
|
|
22
|
-
#[persistent(BytesN<32>)]
|
|
23
|
-
Peer { eid: u32 },
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
#[contractevent]
|
|
27
|
-
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
28
|
-
pub struct PeerSet {
|
|
29
|
-
pub eid: u32,
|
|
30
|
-
pub peer: Option<BytesN<32>>,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// =====================================================
|
|
34
|
-
// OAppCore Interface and Default Implementation
|
|
35
|
-
// =====================================================
|
|
36
|
-
|
|
37
|
-
#[contract_trait]
|
|
38
|
-
pub trait OAppCore: Ownable + RoleBasedAccessControl {
|
|
39
|
-
/// Retrieves the OApp version information.
|
|
40
|
-
///
|
|
41
|
-
/// # Returns
|
|
42
|
-
/// A tuple containing:
|
|
43
|
-
/// - `sender_version`: The version of the OAppSender
|
|
44
|
-
/// - `receiver_version`: The version of the OAppReceiver
|
|
45
|
-
fn oapp_version(_env: &soroban_sdk::Env) -> (u64, u64) {
|
|
46
|
-
(SENDER_VERSION, RECEIVER_VERSION)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/// Retrieves the LayerZero endpoint address associated with the OApp.
|
|
50
|
-
///
|
|
51
|
-
/// # Returns
|
|
52
|
-
/// The LayerZero endpoint address
|
|
53
|
-
fn endpoint(env: &soroban_sdk::Env) -> soroban_sdk::Address {
|
|
54
|
-
OAppCoreStorage::endpoint(env).unwrap()
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/// Retrieves the peer (OApp) associated with a corresponding endpoint.
|
|
58
|
-
///
|
|
59
|
-
/// # Arguments
|
|
60
|
-
/// * `eid` - The endpoint ID
|
|
61
|
-
///
|
|
62
|
-
/// # Returns
|
|
63
|
-
/// The peer address (OApp instance) associated with the corresponding endpoint
|
|
64
|
-
fn peer(env: &soroban_sdk::Env, eid: u32) -> Option<soroban_sdk::BytesN<32>> {
|
|
65
|
-
OAppCoreStorage::peer(env, eid)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/// Sets or removes the peer address (OApp instance) for a corresponding endpoint.
|
|
69
|
-
///
|
|
70
|
-
/// # Arguments
|
|
71
|
-
/// * `eid` - The endpoint ID
|
|
72
|
-
/// * `peer` - The address of the peer to be associated with the corresponding endpoint, or None to remove the peer
|
|
73
|
-
/// * `operator` - The authorizer address
|
|
74
|
-
#[only_role(operator, AUTHORIZER)]
|
|
75
|
-
fn set_peer(
|
|
76
|
-
env: &soroban_sdk::Env,
|
|
77
|
-
eid: u32,
|
|
78
|
-
peer: &Option<soroban_sdk::BytesN<32>>,
|
|
79
|
-
operator: &soroban_sdk::Address,
|
|
80
|
-
) {
|
|
81
|
-
OAppCoreStorage::set_or_remove_peer(env, eid, peer);
|
|
82
|
-
PeerSet { eid, peer: peer.clone() }.publish(env);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/// Sets the delegate address for the OApp Core.
|
|
86
|
-
///
|
|
87
|
-
/// # Arguments
|
|
88
|
-
/// * `delegate` - The address of the delegate to be set, or None to remove the delegate
|
|
89
|
-
/// * `operator` - The authorizer address
|
|
90
|
-
#[only_role(operator, AUTHORIZER)]
|
|
91
|
-
fn set_delegate(env: &soroban_sdk::Env, delegate: &Option<soroban_sdk::Address>, operator: &soroban_sdk::Address) {
|
|
92
|
-
endpoint_client::<Self>(env).set_delegate(&env.current_contract_address(), delegate);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// =====================================================
|
|
97
|
-
// Helper Functions
|
|
98
|
-
// =====================================================
|
|
99
|
-
|
|
100
|
-
/// Initializes the OApp with the specified configuration.
|
|
101
|
-
///
|
|
102
|
-
/// This function sets up the OApp by initializing ownership, storing the LayerZero endpoint,
|
|
103
|
-
/// and setting a delegate address for the endpoint.
|
|
104
|
-
///
|
|
105
|
-
/// # Arguments
|
|
106
|
-
/// * `env` - The Soroban environment
|
|
107
|
-
/// * `owner` - The address that will own this OApp
|
|
108
|
-
/// * `endpoint` - The LayerZero endpoint address to associate with this OApp
|
|
109
|
-
/// * `delegate` - The delegate address to set on the endpoint for this OApp
|
|
110
|
-
pub fn init_ownable_oapp<T: OAppCore + OwnableInitializer>(
|
|
111
|
-
env: &Env,
|
|
112
|
-
owner: &Address,
|
|
113
|
-
endpoint: &Address,
|
|
114
|
-
delegate: &Address,
|
|
115
|
-
) {
|
|
116
|
-
T::init_owner(env, owner);
|
|
117
|
-
OAppCoreStorage::set_endpoint(env, endpoint);
|
|
118
|
-
LayerZeroEndpointV2Client::new(env, endpoint)
|
|
119
|
-
.set_delegate(&env.current_contract_address(), &Some(delegate.clone()));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/// Retrieves the peer address associated with a specific endpoint ID; panics if NOT set.
|
|
123
|
-
///
|
|
124
|
-
/// This is a safe getter that ensures a peer has been configured for the given endpoint.
|
|
125
|
-
/// If no peer is set (i.e., the peer is `None`), it will panic with `OAppError::NoPeer`.
|
|
126
|
-
///
|
|
127
|
-
/// # Arguments
|
|
128
|
-
/// * `env` - The Soroban environment
|
|
129
|
-
/// * `eid` - The endpoint ID
|
|
130
|
-
///
|
|
131
|
-
/// # Returns
|
|
132
|
-
/// The peer address (`BytesN<32>`) associated with the specified endpoint
|
|
133
|
-
///
|
|
134
|
-
/// # Panics
|
|
135
|
-
/// Panics with `OAppError::NoPeer` if no peer is set for the given endpoint ID
|
|
136
|
-
pub fn get_peer_or_panic<T: OAppCore>(env: &Env, eid: u32) -> BytesN<32> {
|
|
137
|
-
T::peer(env, eid).unwrap_or_panic(env, OAppError::NoPeer)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/// Returns a client for the LayerZero endpoint.
|
|
141
|
-
pub fn endpoint_client<'a, T: OAppCore>(env: &'a Env) -> LayerZeroEndpointV2Client<'a> {
|
|
142
|
-
LayerZeroEndpointV2Client::new(env, &T::endpoint(env))
|
|
143
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
use crate::{self as oapp, errors::OAppError};
|
|
2
|
-
use common_macros::{contract_trait, only_role, storage};
|
|
3
|
-
use soroban_sdk::{assert_with_error, contractevent, contracttype, panic_with_error, Bytes, Env, Vec};
|
|
4
|
-
use utils::{buffer_reader::BufferReader, rbac::{RoleBasedAccessControl, AUTHORIZER}};
|
|
5
|
-
|
|
6
|
-
pub const OPTION_TYPE3: u16 = 3;
|
|
7
|
-
|
|
8
|
-
#[contracttype]
|
|
9
|
-
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
10
|
-
pub struct EnforcedOptionParam {
|
|
11
|
-
pub eid: u32,
|
|
12
|
-
pub msg_type: u32,
|
|
13
|
-
pub options: Option<Bytes>,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#[storage]
|
|
17
|
-
pub enum OAppOptionsType3Storage {
|
|
18
|
-
#[persistent(Bytes)]
|
|
19
|
-
EnforcedOptions { eid: u32, msg_type: u32 },
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
#[contractevent]
|
|
23
|
-
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
24
|
-
pub struct EnforcedOptionSet {
|
|
25
|
-
pub enforced_options: Vec<EnforcedOptionParam>,
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// =========================================================================
|
|
29
|
-
// OAppOptionsType3 Trait and Default Implementation
|
|
30
|
-
// =========================================================================
|
|
31
|
-
|
|
32
|
-
#[contract_trait]
|
|
33
|
-
pub trait OAppOptionsType3: RoleBasedAccessControl {
|
|
34
|
-
/// Retrieves the enforced options for a given endpoint and message type.
|
|
35
|
-
///
|
|
36
|
-
/// # Arguments
|
|
37
|
-
/// * `eid` - The endpoint ID
|
|
38
|
-
/// * `msg_type` - The OApp message type
|
|
39
|
-
///
|
|
40
|
-
/// # Returns
|
|
41
|
-
/// The enforced options for the given endpoint and message type
|
|
42
|
-
fn enforced_options(env: &soroban_sdk::Env, eid: u32, msg_type: u32) -> Option<soroban_sdk::Bytes> {
|
|
43
|
-
OAppOptionsType3Storage::enforced_options(env, eid, msg_type)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// Sets or removes the enforced options for specific endpoint and message type combinations.
|
|
47
|
-
///
|
|
48
|
-
/// Only the `authorizer` of the OApp can call this function.
|
|
49
|
-
/// Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
|
|
50
|
-
/// These enforced options can vary as the potential options/execution on the remote may differ as per the msg_type.
|
|
51
|
-
/// e.g. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you don't want to pay
|
|
52
|
-
/// if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
|
|
53
|
-
///
|
|
54
|
-
/// # Arguments
|
|
55
|
-
/// * `options` - A vector of EnforcedOptionParam structures specifying enforced options
|
|
56
|
-
/// * `operator` - The authorizer address
|
|
57
|
-
#[only_role(operator, AUTHORIZER)]
|
|
58
|
-
fn set_enforced_options(
|
|
59
|
-
env: &soroban_sdk::Env,
|
|
60
|
-
options: &soroban_sdk::Vec<oapp::oapp_options_type3::EnforcedOptionParam>,
|
|
61
|
-
operator: &soroban_sdk::Address,
|
|
62
|
-
) {
|
|
63
|
-
for param in options {
|
|
64
|
-
if let Some(ref opts) = param.options {
|
|
65
|
-
assert_option_type3(env, opts);
|
|
66
|
-
}
|
|
67
|
-
OAppOptionsType3Storage::set_or_remove_enforced_options(env, param.eid, param.msg_type, ¶m.options);
|
|
68
|
-
}
|
|
69
|
-
EnforcedOptionSet { enforced_options: options.clone() }.publish(env);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/// Combines options for a given endpoint and message type.
|
|
73
|
-
///
|
|
74
|
-
/// If there is an enforced lzReceive option:
|
|
75
|
-
/// - {gas_limit: 200k, value: 1 XLM} AND a caller supplies a lzReceive option: {gas_limit: 100k, value: 0.5 XLM}
|
|
76
|
-
/// - The resulting options will be {gas_limit: 300k, value: 1.5 XLM} when the message is executed on the remote lz_receive() function.
|
|
77
|
-
/// The presence of duplicated options is handled off-chain in the verifier/executor.
|
|
78
|
-
///
|
|
79
|
-
/// # Arguments
|
|
80
|
-
/// * `eid` - The endpoint ID
|
|
81
|
-
/// * `msg_type` - The OApp message type
|
|
82
|
-
/// * `extra_options` - Additional options passed by the caller
|
|
83
|
-
///
|
|
84
|
-
/// # Returns
|
|
85
|
-
/// The combination of caller specified options AND enforced options
|
|
86
|
-
fn combine_options(
|
|
87
|
-
env: &soroban_sdk::Env,
|
|
88
|
-
eid: u32,
|
|
89
|
-
msg_type: u32,
|
|
90
|
-
extra_options: &soroban_sdk::Bytes,
|
|
91
|
-
) -> soroban_sdk::Bytes {
|
|
92
|
-
let enforced_options_opt = Self::enforced_options(env, eid, msg_type);
|
|
93
|
-
|
|
94
|
-
// No enforced options, pass whatever the caller supplied, even if it's empty or legacy type 1/2 options.
|
|
95
|
-
if enforced_options_opt.is_none() {
|
|
96
|
-
return extra_options.clone();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// No caller options, return enforced
|
|
100
|
-
let mut enforced_options = enforced_options_opt.unwrap(); // unwrap is safe because we checked if it is none above
|
|
101
|
-
if extra_options.is_empty() {
|
|
102
|
-
return enforced_options;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// If caller provided extra_options, must be type 3 as its the ONLY type that can be combined.
|
|
106
|
-
if extra_options.len() >= 2 {
|
|
107
|
-
assert_option_type3(env, extra_options);
|
|
108
|
-
|
|
109
|
-
// Remove the first 2 bytes containing the type from the extra_options and combine with enforced.
|
|
110
|
-
enforced_options.append(&extra_options.slice(2..));
|
|
111
|
-
return enforced_options;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// No valid set of options was found.
|
|
115
|
-
panic_with_error!(env, OAppError::InvalidOptions);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// =========================================================================
|
|
120
|
-
// Helpers Functions
|
|
121
|
-
// =========================================================================
|
|
122
|
-
|
|
123
|
-
/// Asserts that the provided options are of type 3.
|
|
124
|
-
///
|
|
125
|
-
/// # Arguments
|
|
126
|
-
/// * `options` - The options to be checked
|
|
127
|
-
///
|
|
128
|
-
/// # Panics
|
|
129
|
-
/// If the options are not of type 3
|
|
130
|
-
pub fn assert_option_type3(env: &Env, options: &Bytes) {
|
|
131
|
-
let options_type = BufferReader::new(options).read_u16();
|
|
132
|
-
assert_with_error!(env, options_type == OPTION_TYPE3, OAppError::InvalidOptions);
|
|
133
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
use crate::{
|
|
2
|
-
errors::OAppError,
|
|
3
|
-
oapp_core::{endpoint_client, get_peer_or_panic, OAppCore},
|
|
4
|
-
};
|
|
5
|
-
use common_macros::contract_trait;
|
|
6
|
-
use endpoint_v2::Origin;
|
|
7
|
-
use soroban_sdk::{assert_with_error, token::TokenClient, Address, Bytes, BytesN, Env};
|
|
8
|
-
|
|
9
|
-
/// The version of the OAppReceiver implementation.
|
|
10
|
-
/// Version is bumped when changes are made to this contract.
|
|
11
|
-
pub const RECEIVER_VERSION: u64 = 1;
|
|
12
|
-
|
|
13
|
-
// =====================================================
|
|
14
|
-
// LzReceiveInternal Trait
|
|
15
|
-
// =====================================================
|
|
16
|
-
|
|
17
|
-
/// Application-specific handler for incoming LayerZero messages.
|
|
18
|
-
///
|
|
19
|
-
/// Implement this trait to define how your OApp processes cross-chain messages.
|
|
20
|
-
/// The default `OAppReceiver::lz_receive` calls `clear_payload_and_transfer` first,
|
|
21
|
-
/// then delegates to your `__lz_receive` implementation.
|
|
22
|
-
///
|
|
23
|
-
/// **Important:** Do NOT call `clear_payload_and_transfer` in your implementation -
|
|
24
|
-
/// it is handled automatically by the default `lz_receive`.
|
|
25
|
-
pub trait LzReceiveInternal {
|
|
26
|
-
/// Processes a verified cross-chain message.
|
|
27
|
-
///
|
|
28
|
-
/// Called after payload verification. Implement your message handling logic here.
|
|
29
|
-
fn __lz_receive(
|
|
30
|
-
env: &Env,
|
|
31
|
-
origin: &Origin,
|
|
32
|
-
guid: &BytesN<32>,
|
|
33
|
-
message: &Bytes,
|
|
34
|
-
extra_data: &Bytes,
|
|
35
|
-
executor: &Address,
|
|
36
|
-
value: i128,
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// =====================================================
|
|
41
|
-
// OAppReceiver Trait
|
|
42
|
-
// =====================================================
|
|
43
|
-
|
|
44
|
-
/// Receiver trait for OApps that accept cross-chain messages from LayerZero.
|
|
45
|
-
///
|
|
46
|
-
/// Mirrors `ILayerZeroReceiver` function signatures, allowing the executor to call
|
|
47
|
-
/// these methods via `LayerZeroReceiverClient`.
|
|
48
|
-
///
|
|
49
|
-
/// # Default Implementations
|
|
50
|
-
/// | Method | Behavior |
|
|
51
|
-
/// |--------------------------|----------------------------------------------------------------|
|
|
52
|
-
/// | `allow_initialize_path` | Returns true if origin sender matches configured peer |
|
|
53
|
-
/// | `next_nonce` | Returns 0 (unordered delivery) |
|
|
54
|
-
/// | `lz_receive` | Verifies payload, then calls `LzReceiveInternal::__lz_receive` |
|
|
55
|
-
/// | `is_compose_msg_sender` | Returns true if sender is current contract |
|
|
56
|
-
///
|
|
57
|
-
/// # Usage
|
|
58
|
-
///
|
|
59
|
-
/// ```ignore
|
|
60
|
-
/// use oapp::oapp_receiver::LzReceiveInternal;
|
|
61
|
-
///
|
|
62
|
-
/// #[common_macros::lz_contract]
|
|
63
|
-
/// #[oapp_macros::oapp]
|
|
64
|
-
/// pub struct MyOApp;
|
|
65
|
-
///
|
|
66
|
-
/// impl LzReceiveInternal for MyOApp {
|
|
67
|
-
/// fn __lz_receive(env: &Env, origin: &Origin, guid: &BytesN<32>,
|
|
68
|
-
/// message: &Bytes, extra_data: &Bytes, executor: &Address, value: i128) {
|
|
69
|
-
/// // Your message handling logic here
|
|
70
|
-
/// }
|
|
71
|
-
/// }
|
|
72
|
-
/// ```
|
|
73
|
-
///
|
|
74
|
-
/// # Customization
|
|
75
|
-
/// For custom behavior (e.g., ordered nonce enforcement), use `#[oapp(custom = [receiver])]`
|
|
76
|
-
/// and implement both `LzReceiveInternal` and `OAppReceiver`.
|
|
77
|
-
#[contract_trait]
|
|
78
|
-
pub trait OAppReceiver: OAppCore + LzReceiveInternal {
|
|
79
|
-
/// Checks if a messaging path can be initialized for the given origin.
|
|
80
|
-
///
|
|
81
|
-
/// # Arguments
|
|
82
|
-
/// * `origin` - The origin of the message
|
|
83
|
-
///
|
|
84
|
-
/// # Returns
|
|
85
|
-
/// True if the path can be initialized, false otherwise
|
|
86
|
-
fn allow_initialize_path(env: &soroban_sdk::Env, origin: &endpoint_v2::Origin) -> bool {
|
|
87
|
-
let peer = Self::peer(env, origin.src_eid);
|
|
88
|
-
peer.is_some_and(|peer| peer == origin.sender)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/// Retrieves the next nonce for a given source endpoint and sender address.
|
|
92
|
-
///
|
|
93
|
-
/// The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
|
|
94
|
-
/// This is required by the off-chain executor to determine if the OApp expects message execution to be ordered.
|
|
95
|
-
/// This is also enforced by the OApp.
|
|
96
|
-
/// By default this is NOT enabled, i.e. next_nonce is hardcoded to return 0.
|
|
97
|
-
///
|
|
98
|
-
/// # Arguments
|
|
99
|
-
/// * `src_eid` - The source endpoint ID
|
|
100
|
-
/// * `sender` - The sender OApp address
|
|
101
|
-
///
|
|
102
|
-
/// # Returns
|
|
103
|
-
/// The next nonce
|
|
104
|
-
fn next_nonce(_env: &soroban_sdk::Env, _src_eid: u32, _sender: &soroban_sdk::BytesN<32>) -> u64 {
|
|
105
|
-
0
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/// Entry point for receiving messages or packets from the LayerZero endpoint.
|
|
109
|
-
///
|
|
110
|
-
/// The default implementation calls `clear_payload_and_transfer` to validate the message
|
|
111
|
-
/// and clear it from the endpoint, then delegates to `__lz_receive` for application logic.
|
|
112
|
-
///
|
|
113
|
-
/// # Arguments
|
|
114
|
-
/// * `executor` - The address of the executor for the received message
|
|
115
|
-
/// * `origin` - The origin information containing the source endpoint and sender address:
|
|
116
|
-
/// - `src_eid`: The source endpoint ID
|
|
117
|
-
/// - `sender`: The sender address on the source chain
|
|
118
|
-
/// - `nonce`: The nonce of the message
|
|
119
|
-
/// * `guid` - The unique identifier for the received LayerZero message
|
|
120
|
-
/// * `message` - The payload of the received message
|
|
121
|
-
/// * `extra_data` - Additional arbitrary data provided by the corresponding executor
|
|
122
|
-
/// * `value` - The native token value sent with the message
|
|
123
|
-
fn lz_receive(
|
|
124
|
-
env: &soroban_sdk::Env,
|
|
125
|
-
executor: &soroban_sdk::Address,
|
|
126
|
-
origin: &endpoint_v2::Origin,
|
|
127
|
-
guid: &soroban_sdk::BytesN<32>,
|
|
128
|
-
message: &soroban_sdk::Bytes,
|
|
129
|
-
extra_data: &soroban_sdk::Bytes,
|
|
130
|
-
value: i128,
|
|
131
|
-
) {
|
|
132
|
-
clear_payload_and_transfer::<Self>(env, executor, origin, guid, message, value);
|
|
133
|
-
Self::__lz_receive(env, origin, guid, message, extra_data, executor, value)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/// Indicates whether an address is an approved composeMsg sender to the Endpoint.
|
|
137
|
-
///
|
|
138
|
-
/// Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.
|
|
139
|
-
/// The default sender IS the OAppReceiver implementer.
|
|
140
|
-
///
|
|
141
|
-
/// # Arguments
|
|
142
|
-
/// * `origin` - The origin information containing the source endpoint and sender address
|
|
143
|
-
/// * `message` - The lzReceive payload
|
|
144
|
-
/// * `sender` - The sender address to check
|
|
145
|
-
///
|
|
146
|
-
/// # Returns
|
|
147
|
-
/// True if the sender is a valid composeMsg sender, false otherwise
|
|
148
|
-
fn is_compose_msg_sender(
|
|
149
|
-
env: &soroban_sdk::Env,
|
|
150
|
-
_origin: &endpoint_v2::Origin,
|
|
151
|
-
_message: &soroban_sdk::Bytes,
|
|
152
|
-
sender: &soroban_sdk::Address,
|
|
153
|
-
) -> bool {
|
|
154
|
-
env.current_contract_address() == *sender
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// =====================================================
|
|
159
|
-
// Helper functions
|
|
160
|
-
// =====================================================
|
|
161
|
-
|
|
162
|
-
/// Clears the message payload from the endpoint and transfers native tokens from the executor to the oapp if has value.
|
|
163
|
-
///
|
|
164
|
-
/// # Arguments
|
|
165
|
-
/// * `env` - The environment
|
|
166
|
-
/// * `executor` - The address of the executor delivering the message
|
|
167
|
-
/// * `origin` - The origin information (source EID, sender, nonce)
|
|
168
|
-
/// * `guid` - The unique identifier for the LayerZero message to clear the payload from
|
|
169
|
-
/// * `message` - The message payload to clear
|
|
170
|
-
/// * `value` - The native token value to transfer from the executor to the oapp if has value
|
|
171
|
-
pub fn clear_payload_and_transfer<T: OAppCore>(
|
|
172
|
-
env: &Env,
|
|
173
|
-
executor: &Address,
|
|
174
|
-
origin: &Origin,
|
|
175
|
-
guid: &BytesN<32>,
|
|
176
|
-
message: &Bytes,
|
|
177
|
-
value: i128,
|
|
178
|
-
) {
|
|
179
|
-
// Require authorization from the executor and transfer the value from the executor to the oapp if has value
|
|
180
|
-
executor.require_auth();
|
|
181
|
-
// Assert that the message is from the expected peer
|
|
182
|
-
assert_with_error!(env, get_peer_or_panic::<T>(env, origin.src_eid) == origin.sender, OAppError::OnlyPeer);
|
|
183
|
-
|
|
184
|
-
let this_address = env.current_contract_address();
|
|
185
|
-
let endpoint_client = endpoint_client::<T>(env);
|
|
186
|
-
|
|
187
|
-
// Transfer the value from the executor to the oapp if has value
|
|
188
|
-
if value != 0 {
|
|
189
|
-
let token_client = TokenClient::new(env, &endpoint_client.native_token());
|
|
190
|
-
token_client.transfer(executor, &this_address, &value);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Clear the message payload from the endpoint
|
|
194
|
-
endpoint_client.clear(&this_address, origin, &this_address, guid, message);
|
|
195
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
use crate::{
|
|
2
|
-
errors::OAppError,
|
|
3
|
-
oapp_core::{endpoint_client, get_peer_or_panic, OAppCore},
|
|
4
|
-
};
|
|
5
|
-
use endpoint_v2::{MessagingFee, MessagingParams, MessagingReceipt};
|
|
6
|
-
use soroban_sdk::{contracttype, token::TokenClient, Address, Bytes, Env};
|
|
7
|
-
use utils::option_ext::OptionExt;
|
|
8
|
-
|
|
9
|
-
/// The version of the OAppSender implementation.
|
|
10
|
-
/// Version is bumped when changes are made to this contract.
|
|
11
|
-
pub const SENDER_VERSION: u64 = 1;
|
|
12
|
-
|
|
13
|
-
/// Represents a fee payer address with explicit authorization state.
|
|
14
|
-
///
|
|
15
|
-
/// This enum forces callers of `__lz_send` to explicitly declare whether
|
|
16
|
-
/// `require_auth()` has already been called for the fee payer address.
|
|
17
|
-
/// This prevents the common mistake of forgetting to authorize the fee payer.
|
|
18
|
-
///
|
|
19
|
-
/// # Variants
|
|
20
|
-
/// - `Unverified` — Safe default. `__lz_send` will call `require_auth()` on the address.
|
|
21
|
-
/// Use this when the caller has **not** already authorized the fee payer.
|
|
22
|
-
/// - `Verified` — Caller asserts that `require_auth()` has already been called.
|
|
23
|
-
/// Use this to avoid a duplicate `require_auth()` node in the Soroban auth tree
|
|
24
|
-
/// (e.g., when the same address was already authorized as the message sender).
|
|
25
|
-
#[contracttype]
|
|
26
|
-
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
27
|
-
pub enum FeePayer {
|
|
28
|
-
/// The fee payer has **not** been authorized yet.
|
|
29
|
-
/// `__lz_send` will call `fee_payer.require_auth()` before transferring fees.
|
|
30
|
-
/// This is the safe default — use this if unsure.
|
|
31
|
-
Unverified(Address),
|
|
32
|
-
|
|
33
|
-
/// The fee payer has **already** been authorized by the caller via `require_auth()`.
|
|
34
|
-
/// `__lz_send` will skip the auth check to avoid creating a duplicate auth node
|
|
35
|
-
/// in the Soroban authorization tree.
|
|
36
|
-
///
|
|
37
|
-
/// # Safety
|
|
38
|
-
/// Only use this variant if you have already called `require_auth()` on this address
|
|
39
|
-
/// in the current contract invocation. Misuse may allow unauthorized fee deductions.
|
|
40
|
-
Verified(Address),
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
impl FeePayer {
|
|
44
|
-
/// Returns a reference to the underlying address.
|
|
45
|
-
pub fn address(&self) -> &Address {
|
|
46
|
-
match self {
|
|
47
|
-
FeePayer::Unverified(addr) | FeePayer::Verified(addr) => addr,
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/// A helper trait for sending cross-chain messages via LayerZero.
|
|
53
|
-
///
|
|
54
|
-
/// Contracts should implement this trait to gain access to the `__quote` and `__lz_send` helper
|
|
55
|
-
/// methods for cross-chain messaging. This trait provides default implementations that handle
|
|
56
|
-
/// fee payment and message dispatch through the LayerZero endpoint.
|
|
57
|
-
///
|
|
58
|
-
/// # Important
|
|
59
|
-
/// This trait is intended to be used as an **internal helper** only. Do **NOT** expose these
|
|
60
|
-
/// methods as part of your contract's public interface (i.e., do not use `#[contract_impl]` on
|
|
61
|
-
/// the implementation of this trait). Instead, call these methods internally from your
|
|
62
|
-
/// contract's own public functions.
|
|
63
|
-
pub trait OAppSenderInternal: OAppCore {
|
|
64
|
-
/// Quote the messaging fee for sending a message to the other chain
|
|
65
|
-
///
|
|
66
|
-
/// # Arguments
|
|
67
|
-
/// * `dst_eid`: The destination endpoint ID
|
|
68
|
-
/// * `message`: The message to send
|
|
69
|
-
/// * `options`: The options for the message
|
|
70
|
-
/// * `pay_in_zro`: Whether to pay the fee in ZRO
|
|
71
|
-
///
|
|
72
|
-
/// # Returns
|
|
73
|
-
/// * `MessagingFee`: The messaging fee for the message
|
|
74
|
-
fn __quote(env: &Env, dst_eid: u32, message: &Bytes, options: &Bytes, pay_in_zro: bool) -> MessagingFee {
|
|
75
|
-
let receiver = get_peer_or_panic::<Self>(env, dst_eid);
|
|
76
|
-
endpoint_client::<Self>(env).quote(
|
|
77
|
-
&env.current_contract_address(),
|
|
78
|
-
&MessagingParams { dst_eid, receiver, message: message.clone(), options: options.clone(), pay_in_zro },
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/// Send a message to the other chain
|
|
83
|
-
///
|
|
84
|
-
/// # Arguments
|
|
85
|
-
/// * `dst_eid`: The destination endpoint ID
|
|
86
|
-
/// * `message`: The message to send
|
|
87
|
-
/// * `options`: The options for the message
|
|
88
|
-
/// * `fee_payer`: The fee payer, wrapped in [`FeePayer`] to indicate authorization state.
|
|
89
|
-
/// Use `FeePayer::Unverified(addr)` if auth has not been checked (safe default),
|
|
90
|
-
/// or `FeePayer::Verified(addr)` if `addr.require_auth()` was already called by the caller.
|
|
91
|
-
/// * `fee`: The messaging fee
|
|
92
|
-
/// * `refund_address`: The address to receive any excess fees
|
|
93
|
-
///
|
|
94
|
-
/// # Returns
|
|
95
|
-
/// * `MessagingReceipt`: The receipt for the sent message
|
|
96
|
-
fn __lz_send(
|
|
97
|
-
env: &Env,
|
|
98
|
-
dst_eid: u32,
|
|
99
|
-
message: &Bytes,
|
|
100
|
-
options: &Bytes,
|
|
101
|
-
fee_payer: &FeePayer,
|
|
102
|
-
fee: &MessagingFee,
|
|
103
|
-
refund_address: &Address,
|
|
104
|
-
) -> MessagingReceipt {
|
|
105
|
-
// Enforce fee payer authorization if not already verified by the caller
|
|
106
|
-
let payer = match fee_payer {
|
|
107
|
-
FeePayer::Unverified(addr) => {
|
|
108
|
-
addr.require_auth();
|
|
109
|
-
addr
|
|
110
|
-
}
|
|
111
|
-
FeePayer::Verified(addr) => addr,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
// Pay the messaging fees
|
|
115
|
-
Self::__pay_native(env, payer, fee.native_fee);
|
|
116
|
-
// Skip the ZRO payment call only when the fee is exactly zero. Using `!= 0` instead of
|
|
117
|
-
// `> 0` so that an invalid negative value still reaches `__pay_zro` and fails loudly
|
|
118
|
-
// rather than being silently ignored.
|
|
119
|
-
let pay_in_zro = fee.zro_fee != 0;
|
|
120
|
-
if pay_in_zro {
|
|
121
|
-
Self::__pay_zro(env, payer, fee.zro_fee);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Send the message to the other chain
|
|
125
|
-
let receiver = get_peer_or_panic::<Self>(env, dst_eid);
|
|
126
|
-
endpoint_client::<Self>(env).send(
|
|
127
|
-
&env.current_contract_address(),
|
|
128
|
-
&MessagingParams { dst_eid, receiver, message: message.clone(), options: options.clone(), pay_in_zro },
|
|
129
|
-
refund_address,
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/// Pay the native fee to the endpoint for sending a message to the other chain
|
|
134
|
-
///
|
|
135
|
-
/// # Arguments
|
|
136
|
-
/// * `fee_payer`: The address of the fee payer
|
|
137
|
-
/// * `native_fee`: The native fee to pay
|
|
138
|
-
fn __pay_native(env: &Env, fee_payer: &Address, native_fee: i128) {
|
|
139
|
-
let token_client = TokenClient::new(env, &endpoint_client::<Self>(env).native_token());
|
|
140
|
-
token_client.transfer(fee_payer, Self::endpoint(env), &native_fee);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/// Pay the ZRO fee to the endpoint for sending a message to the other chain
|
|
144
|
-
///
|
|
145
|
-
/// # Arguments
|
|
146
|
-
/// * `fee_payer`: The address of the fee payer
|
|
147
|
-
/// * `zro_fee`: The ZRO fee to pay
|
|
148
|
-
fn __pay_zro(env: &Env, fee_payer: &Address, zro_fee: i128) {
|
|
149
|
-
let zro_token = endpoint_client::<Self>(env).zro().unwrap_or_panic(env, OAppError::ZroTokenUnavailable);
|
|
150
|
-
TokenClient::new(env, &zro_token).transfer(fee_payer, Self::endpoint(env), &zro_fee);
|
|
151
|
-
}
|
|
152
|
-
}
|