@layerzerolabs/protocol-stellar-v2 0.2.121 → 0.2.123
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/{contracts/endpoint-v2 → endpoint-v2}/Cargo.toml +3 -2
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/pay_messaging_fees.rs +7 -1
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/quote.rs +2 -2
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/ttl_config.rs +4 -1
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/endpoint_v2/verifiable.rs +0 -1
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +9 -3
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/require_send_lib_for_eid.rs +6 -2
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/message_lib_manager/require_supported_eid.rs +6 -2
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/clear_payload.rs +1 -4
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/inbound.rs +1 -4
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/nilify.rs +3 -12
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_channel/pending_inbound_nonces.rs +0 -1
- package/{contracts/endpoint-v2 → endpoint-v2}/src/tests/messaging_composer/lz_compose_alert.rs +1 -0
- 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/{contracts/message-libs → message-libs}/uln-302/src/tests/send_uln302/send.rs +20 -4
- package/{contracts/message-libs → message-libs}/uln-302/src/tests/uln302/get_app_receive_uln_config.rs +2 -2
- package/package.json +32 -15
- package/rustfmt.toml +8 -13
- package/{contracts/upgrader → upgrader}/Cargo.toml +0 -1
- package/upgrader/src/tests/mod.rs +1 -0
- package/{contracts/workers → workers}/dvn/Cargo.toml +1 -2
- package/{contracts/workers → workers}/dvn/src/tests/auth.rs +12 -60
- 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/src/auth.rs +3 -8
- package/{contracts/workers → workers}/executor/src/storage.rs +1 -1
- package/{contracts/workers → workers}/executor/src/tests/auth.rs +6 -1
- package/{contracts/workers → workers}/executor/src/tests/executor.rs +5 -5
- package/{contracts/workers → workers}/executor/src/tests/setup.rs +1 -2
- package/{contracts/workers → workers}/executor-fee-lib/Cargo.toml +1 -2
- package/{contracts/workers → workers}/executor-fee-lib/src/tests/executor_fee_lib.rs +5 -5
- package/{contracts/workers → workers}/executor-fee-lib/src/tests/executor_option.rs +2 -2
- package/{contracts/workers → workers}/executor-helper/Cargo.toml +0 -1
- package/{contracts/workers → workers}/executor-helper/src/executor_helper.rs +0 -1
- package/{contracts/workers → workers}/executor-helper/src/tests/executor_helper.rs +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}/price-feed/src/tests/price_feed.rs +11 -11
- package/{contracts/workers → workers}/worker/Cargo.toml +0 -1
- package/{contracts/workers → workers}/worker/src/tests/worker.rs +27 -27
- 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/upgrader/src/tests/mod.rs +0 -1
- 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/docs/error-spec.md +0 -55
- package/docs/layerzero-v2-on-stellar.md +0 -509
- package/docs/oapp-guide.md +0 -405
- package/docs/oft-guide.md +0 -404
- 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/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/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_registered.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/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 +1 -1
- /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/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/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/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/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_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/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/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/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/tests/mod.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/mod.rs +0 -0
- /package/{contracts/workers → workers}/executor-fee-lib/src/tests/setup.rs +0 -0
- /package/{contracts/workers → workers}/executor-helper/src/lib.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/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/worker.rs +0 -0
|
@@ -1,594 +0,0 @@
|
|
|
1
|
-
//! OFT - traits and implementations for Omnichain Fungible Tokens.
|
|
2
|
-
//!
|
|
3
|
-
//! This module provides:
|
|
4
|
-
//! - `OFTInternal`: Internal methods NOT exposed as contract entrypoints (`__debit`, `__credit`, `__initialize_oft`, `__receive`, etc.)
|
|
5
|
-
//! - `OFTCore`: Public methods exposed as contract entrypoints (using `#[contract_trait]`)
|
|
6
|
-
//! - `impl_oft_lz_receive!`: Macro to implement `LzReceiveInternal` with default OFT receive logic
|
|
7
|
-
//!
|
|
8
|
-
//! ## Usage
|
|
9
|
-
//!
|
|
10
|
-
//! ```ignore
|
|
11
|
-
//! use oapp_macros::oapp;
|
|
12
|
-
//! use oft_core::{OFTInternal, OFTCore, impl_oft_lz_receive};
|
|
13
|
-
//!
|
|
14
|
-
//! #[common_macros::lz_contract]
|
|
15
|
-
//! #[oapp]
|
|
16
|
-
//! pub struct MyOFT;
|
|
17
|
-
//!
|
|
18
|
-
//! #[contract_impl]
|
|
19
|
-
//! impl MyOFT {
|
|
20
|
-
//! pub fn __constructor(env: &Env, token: &Address, owner: &Address, endpoint: &Address, delegate: &Address) {
|
|
21
|
-
//! Self::__initialize_oft(env, token, 6, owner, endpoint, delegate)
|
|
22
|
-
//! }
|
|
23
|
-
//! }
|
|
24
|
-
//!
|
|
25
|
-
//! // Public methods - exposed as contract entrypoints
|
|
26
|
-
//! #[contract_impl(contracttrait)]
|
|
27
|
-
//! impl OFTCore for MyOFT {}
|
|
28
|
-
//!
|
|
29
|
-
//! // Internal methods - NOT exposed as contract entrypoints
|
|
30
|
-
//! // IMPORTANT: Do NOT use #[contract_impl] here to keep methods internal
|
|
31
|
-
//! impl OFTInternal for MyOFT {
|
|
32
|
-
//! fn __debit(env: &Env, from: &Address, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> (i128, i128) {
|
|
33
|
-
//! // Your debit logic: lock tokens (LockUnlock) or burn tokens (MintBurn)
|
|
34
|
-
//! }
|
|
35
|
-
//!
|
|
36
|
-
//! fn __credit(env: &Env, to: &Address, amount_ld: i128, src_eid: u32) -> i128 {
|
|
37
|
-
//! // Your credit logic: unlock tokens (LockUnlock) or mint tokens (MintBurn)
|
|
38
|
-
//! }
|
|
39
|
-
//! }
|
|
40
|
-
//!
|
|
41
|
-
//! // LzReceiveInternal - use the macro for default OFT receive logic
|
|
42
|
-
//! impl_oft_lz_receive!(MyOFT);
|
|
43
|
-
//! ```
|
|
44
|
-
|
|
45
|
-
use crate::{
|
|
46
|
-
self as oft_core,
|
|
47
|
-
codec::{
|
|
48
|
-
oft_compose_msg_codec::OFTComposeMsg,
|
|
49
|
-
oft_msg_codec::{ComposeData, OFTMessage},
|
|
50
|
-
},
|
|
51
|
-
errors::OFTError,
|
|
52
|
-
events::{self, MsgInspectorSet, OFTSent},
|
|
53
|
-
storage::OFTStorage,
|
|
54
|
-
types::{OFTFeeDetail, OFTLimit, OFTReceipt, SendParam, SEND, SEND_AND_CALL},
|
|
55
|
-
utils as oft_utils,
|
|
56
|
-
};
|
|
57
|
-
use common_macros::{contract_trait, only_role};
|
|
58
|
-
use endpoint_v2::{MessagingComposerClient, MessagingFee, MessagingReceipt};
|
|
59
|
-
use oapp::{
|
|
60
|
-
oapp_core::init_ownable_oapp,
|
|
61
|
-
oapp_options_type3::OAppOptionsType3,
|
|
62
|
-
oapp_receiver::OAppReceiver,
|
|
63
|
-
oapp_sender::{FeePayer, OAppSenderInternal},
|
|
64
|
-
OAppMsgInspectorClient,
|
|
65
|
-
};
|
|
66
|
-
use soroban_sdk::{assert_with_error, token::TokenClient, vec, Address, Bytes, Env, Vec};
|
|
67
|
-
use utils::{option_ext::OptionExt, ownable::OwnableInitializer, rbac::AUTHORIZER};
|
|
68
|
-
|
|
69
|
-
// ===========================================================================
|
|
70
|
-
// OFTInternal Trait (NOT exposed as contract entrypoints)
|
|
71
|
-
// ===========================================================================
|
|
72
|
-
|
|
73
|
-
/// Internal OFT trait containing methods that should NOT be exposed as contract entrypoints.
|
|
74
|
-
///
|
|
75
|
-
/// **IMPORTANT**: Implement this trait WITHOUT the `#[contractimpl]` macro to keep
|
|
76
|
-
/// `__debit`, `__credit`, and other internal methods private to the contract.
|
|
77
|
-
///
|
|
78
|
-
/// ```ignore
|
|
79
|
-
/// // Correct - methods stay internal
|
|
80
|
-
/// impl OFTInternal for MyOFT { ... }
|
|
81
|
-
///
|
|
82
|
-
/// // WRONG - would expose methods as entrypoints
|
|
83
|
-
/// #[contractimpl]
|
|
84
|
-
/// impl OFTInternal for MyOFT { ... }
|
|
85
|
-
/// ```
|
|
86
|
-
///
|
|
87
|
-
/// This trait extends all OApp supertraits and contains both the token operations
|
|
88
|
-
/// and the internal sending logic. `OFTCore` serves only as an entrypoint wrapper.
|
|
89
|
-
pub trait OFTInternal: OAppReceiver + OAppSenderInternal + OAppOptionsType3 + OwnableInitializer {
|
|
90
|
-
// =========================================================================
|
|
91
|
-
// Initialization
|
|
92
|
-
// =========================================================================
|
|
93
|
-
|
|
94
|
-
/// Initializes the OFT (Omnichain Fungible Token) contract.
|
|
95
|
-
///
|
|
96
|
-
/// Sets up the OApp infrastructure and configures decimal conversion for cross-chain transfers.
|
|
97
|
-
/// The `shared_decimals` parameter defines the common decimal precision used across all chains,
|
|
98
|
-
/// enabling consistent token amounts regardless of each chain's native token decimals.
|
|
99
|
-
///
|
|
100
|
-
/// # Arguments
|
|
101
|
-
/// * `token` - The underlying token contract address (must implement SEP-41 token interface)
|
|
102
|
-
/// * `shared_decimals` - The shared decimal precision for cross-chain compatibility (must be <= local decimals)
|
|
103
|
-
/// * `owner` - The address that will own this OFT contract
|
|
104
|
-
/// * `endpoint` - The LayerZero endpoint address for cross-chain messaging
|
|
105
|
-
/// * `delegate` - The delegate address for endpoint configuration permissions
|
|
106
|
-
///
|
|
107
|
-
/// # Panics
|
|
108
|
-
/// * `OFTError::InvalidLocalDecimals` - If the token's local decimals are less than `shared_decimals`
|
|
109
|
-
fn __initialize_oft(
|
|
110
|
-
env: &Env,
|
|
111
|
-
token: &Address,
|
|
112
|
-
shared_decimals: u32,
|
|
113
|
-
owner: &Address,
|
|
114
|
-
endpoint: &Address,
|
|
115
|
-
delegate: &Address,
|
|
116
|
-
) {
|
|
117
|
-
// Initialize OApp (includes owner initialization)
|
|
118
|
-
init_ownable_oapp::<Self>(env, owner, endpoint, delegate);
|
|
119
|
-
|
|
120
|
-
let local_decimals = TokenClient::new(env, token).decimals();
|
|
121
|
-
assert_with_error!(env, local_decimals >= shared_decimals, OFTError::InvalidLocalDecimals);
|
|
122
|
-
|
|
123
|
-
// Initialize OFT storage
|
|
124
|
-
OFTStorage::set_token(env, token);
|
|
125
|
-
OFTStorage::set_decimals_diff(env, &(local_decimals - shared_decimals));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// =========================================================================
|
|
129
|
-
// Required Methods (no defaults - user MUST implement)
|
|
130
|
-
// =========================================================================
|
|
131
|
-
|
|
132
|
-
/// Debits tokens from the specified address for cross-chain transfer.
|
|
133
|
-
///
|
|
134
|
-
/// # Arguments
|
|
135
|
-
/// * `from` - The address to debit the tokens from
|
|
136
|
-
/// * `amount_ld` - The amount of tokens to send in local decimals
|
|
137
|
-
/// * `min_amount_ld` - The minimum amount to send in local decimals
|
|
138
|
-
/// * `dst_eid` - The destination endpoint ID
|
|
139
|
-
///
|
|
140
|
-
/// # Returns
|
|
141
|
-
/// * `amount_sent_ld` - The amount sent in local decimals
|
|
142
|
-
/// * `amount_received_ld` - The amount received in local decimals on the remote
|
|
143
|
-
fn __debit(env: &Env, from: &Address, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> (i128, i128);
|
|
144
|
-
|
|
145
|
-
/// Credits tokens to recipient after receiving cross-chain transfer.
|
|
146
|
-
///
|
|
147
|
-
/// # Arguments
|
|
148
|
-
/// * `to` - The address to credit tokens to
|
|
149
|
-
/// * `amount_ld` - Amount in local decimals to credit
|
|
150
|
-
/// * `src_eid` - Source endpoint ID
|
|
151
|
-
///
|
|
152
|
-
/// # Returns
|
|
153
|
-
/// The amount actually credited
|
|
154
|
-
fn __credit(env: &Env, to: &Address, amount_ld: i128, src_eid: u32) -> i128;
|
|
155
|
-
|
|
156
|
-
// =========================================================================
|
|
157
|
-
// Optional Methods (have defaults - override as needed)
|
|
158
|
-
// =========================================================================
|
|
159
|
-
|
|
160
|
-
// ----- Quote Methods -----
|
|
161
|
-
|
|
162
|
-
/// Quotes an OFT transfer without executing. Returns (limits, fee details, receipt).
|
|
163
|
-
fn __quote_oft(env: &Env, _from: &Address, send_param: &SendParam) -> (OFTLimit, Vec<OFTFeeDetail>, OFTReceipt) {
|
|
164
|
-
assert_nonnegative_amount(env, send_param);
|
|
165
|
-
|
|
166
|
-
let limit = OFTLimit { min_amount_ld: 0, max_amount_ld: u64::MAX as i128 };
|
|
167
|
-
let fee_details = vec![env];
|
|
168
|
-
let (amount_sent_ld, amount_received_ld) =
|
|
169
|
-
Self::__debit_view(env, send_param.amount_ld, send_param.min_amount_ld, send_param.dst_eid);
|
|
170
|
-
(limit, fee_details, OFTReceipt { amount_sent_ld, amount_received_ld })
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/// Quotes the LayerZero messaging fee for a send. Builds the message internally
|
|
174
|
-
/// to get an accurate fee estimate from the endpoint.
|
|
175
|
-
fn __quote_send(env: &Env, from: &Address, send_param: &SendParam, pay_in_zro: bool) -> MessagingFee {
|
|
176
|
-
assert_nonnegative_amount(env, send_param);
|
|
177
|
-
|
|
178
|
-
let (_amount_sent_ld, amount_received_ld) =
|
|
179
|
-
Self::__debit_view(env, send_param.amount_ld, send_param.min_amount_ld, send_param.dst_eid);
|
|
180
|
-
|
|
181
|
-
let (message, options) = Self::__build_msg_and_options(env, from, send_param, amount_received_ld);
|
|
182
|
-
Self::__quote(env, send_param.dst_eid, &message, &options, pay_in_zro)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// ----- Send Method -----
|
|
186
|
-
|
|
187
|
-
/// Executes a cross-chain token transfer: debits `from`, builds the OFT message,
|
|
188
|
-
/// and dispatches it via the LayerZero endpoint.
|
|
189
|
-
fn __send(
|
|
190
|
-
env: &Env,
|
|
191
|
-
from: &Address,
|
|
192
|
-
send_param: &SendParam,
|
|
193
|
-
fee: &MessagingFee,
|
|
194
|
-
refund_address: &Address,
|
|
195
|
-
) -> (MessagingReceipt, OFTReceipt) {
|
|
196
|
-
from.require_auth();
|
|
197
|
-
|
|
198
|
-
assert_nonnegative_amount(env, send_param);
|
|
199
|
-
|
|
200
|
-
let (amount_sent_ld, amount_received_ld) =
|
|
201
|
-
Self::__debit(env, from, send_param.amount_ld, send_param.min_amount_ld, send_param.dst_eid);
|
|
202
|
-
|
|
203
|
-
let (message, options) = Self::__build_msg_and_options(env, from, send_param, amount_received_ld);
|
|
204
|
-
let messaging_receipt = Self::__lz_send(
|
|
205
|
-
env,
|
|
206
|
-
send_param.dst_eid,
|
|
207
|
-
&message,
|
|
208
|
-
&options,
|
|
209
|
-
&FeePayer::Verified(from.clone()),
|
|
210
|
-
fee,
|
|
211
|
-
refund_address,
|
|
212
|
-
);
|
|
213
|
-
|
|
214
|
-
OFTSent {
|
|
215
|
-
guid: messaging_receipt.guid.clone(),
|
|
216
|
-
dst_eid: send_param.dst_eid,
|
|
217
|
-
from: from.clone(),
|
|
218
|
-
amount_sent_ld,
|
|
219
|
-
amount_received_ld,
|
|
220
|
-
}
|
|
221
|
-
.publish(env);
|
|
222
|
-
|
|
223
|
-
(messaging_receipt, OFTReceipt { amount_sent_ld, amount_received_ld })
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// ----- View/Helper Methods -----
|
|
227
|
-
|
|
228
|
-
/// Simulates a debit for quoting — removes dust but charges no fee by default.
|
|
229
|
-
/// Override to add custom fee logic. Panics with `SlippageExceeded` if the
|
|
230
|
-
/// resulting amount is below `min_amount_ld`.
|
|
231
|
-
///
|
|
232
|
-
/// # Returns
|
|
233
|
-
/// * `amount_sent_ld` - The amount sent in local decimals
|
|
234
|
-
/// * `amount_received_ld` - The amount received in local decimals on the remote
|
|
235
|
-
fn __debit_view(env: &Env, amount_ld: i128, min_amount_ld: i128, _dst_eid: u32) -> (i128, i128) {
|
|
236
|
-
let conversion_rate = Self::__decimal_conversion_rate(env);
|
|
237
|
-
let amount_sent_ld = oft_utils::remove_dust(amount_ld, conversion_rate);
|
|
238
|
-
let amount_received_ld = amount_sent_ld;
|
|
239
|
-
|
|
240
|
-
assert_with_error!(env, amount_received_ld >= min_amount_ld, OFTError::SlippageExceeded);
|
|
241
|
-
|
|
242
|
-
(amount_sent_ld, amount_received_ld)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/// Encodes the OFT message payload and merges enforced + extra options.
|
|
246
|
-
/// Runs the message inspector (if set) before returning `(message, options)`.
|
|
247
|
-
fn __build_msg_and_options(
|
|
248
|
-
env: &Env,
|
|
249
|
-
from: &Address,
|
|
250
|
-
send_param: &SendParam,
|
|
251
|
-
amount_received_ld: i128,
|
|
252
|
-
) -> (Bytes, Bytes) {
|
|
253
|
-
let has_compose = !send_param.compose_msg.is_empty();
|
|
254
|
-
let compose_data = has_compose
|
|
255
|
-
.then(|| ComposeData { from: oft_utils::address_payload(env, from), msg: send_param.compose_msg.clone() });
|
|
256
|
-
|
|
257
|
-
// Build the OFT message
|
|
258
|
-
let conversion_rate = Self::__decimal_conversion_rate(env);
|
|
259
|
-
let message = OFTMessage {
|
|
260
|
-
send_to: send_param.to.clone(),
|
|
261
|
-
amount_sd: oft_utils::to_sd(env, amount_received_ld, conversion_rate),
|
|
262
|
-
compose: compose_data,
|
|
263
|
-
}
|
|
264
|
-
.encode(env);
|
|
265
|
-
|
|
266
|
-
// Combine the options with the message type
|
|
267
|
-
let msg_type = if has_compose { SEND_AND_CALL } else { SEND };
|
|
268
|
-
let options = Self::combine_options(env, send_param.dst_eid, msg_type, &send_param.extra_options);
|
|
269
|
-
|
|
270
|
-
// Optionally inspect message and options if inspector is set
|
|
271
|
-
// If it fails inspection, needs to revert in the implementation. ie. does not rely on return boolean
|
|
272
|
-
if let Some(inspector) = Self::__msg_inspector(env) {
|
|
273
|
-
OAppMsgInspectorClient::new(env, &inspector).inspect(&env.current_contract_address(), &message, &options);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
(message, options)
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// ----- Storage Accessors -----
|
|
280
|
-
|
|
281
|
-
/// Retrieves the token address associated with this OFT.
|
|
282
|
-
fn __token(env: &Env) -> Address {
|
|
283
|
-
OFTStorage::token(env).unwrap_or_panic(env, OFTError::NotInitialized)
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/// Retrieves the difference between local and shared decimals (`local_decimals - shared_decimals`).
|
|
287
|
-
fn __decimals_diff(env: &Env) -> u32 {
|
|
288
|
-
OFTStorage::decimals_diff(env).unwrap_or_panic(env, OFTError::NotInitialized)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/// Retrieves the decimal conversion rate used for cross-chain normalization.
|
|
292
|
-
fn __decimal_conversion_rate(env: &Env) -> i128 {
|
|
293
|
-
10_i128.pow(Self::__decimals_diff(env))
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/// Retrieves the shared decimals used for cross-chain normalization.
|
|
297
|
-
fn __shared_decimals(env: &Env) -> u32 {
|
|
298
|
-
let local_decimals = TokenClient::new(env, &Self::__token(env)).decimals();
|
|
299
|
-
local_decimals - Self::__decimals_diff(env)
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/// Returns the message inspector address if set.
|
|
303
|
-
fn __msg_inspector(env: &Env) -> Option<Address> {
|
|
304
|
-
OFTStorage::msg_inspector(env)
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/// Sets or removes the message inspector address.
|
|
308
|
-
fn __set_msg_inspector(env: &Env, inspector: &Option<Address>) {
|
|
309
|
-
OFTStorage::set_or_remove_msg_inspector(env, inspector);
|
|
310
|
-
MsgInspectorSet { inspector: inspector.clone() }.publish(env);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// ----- Receive Handler -----
|
|
314
|
-
|
|
315
|
-
/// Handles incoming cross-chain OFT transfer from LayerZero endpoint.
|
|
316
|
-
///
|
|
317
|
-
/// Credits tokens to the recipient and optionally queues a compose message.
|
|
318
|
-
/// Override this method to implement custom receive logic (e.g., pausable, rate limiting).
|
|
319
|
-
///
|
|
320
|
-
/// # Arguments
|
|
321
|
-
/// * `origin` - The origin information (source chain, sender, nonce)
|
|
322
|
-
/// * `guid` - The unique message identifier
|
|
323
|
-
/// * `message` - The encoded OFT message payload
|
|
324
|
-
/// * `extra_data` - Additional data (unused in default implementation)
|
|
325
|
-
/// * `executor` - The address of the executor handling the message (unused in default implementation)
|
|
326
|
-
/// * `value` - The native token value sent with the message (unused in default implementation)
|
|
327
|
-
fn __receive(
|
|
328
|
-
env: &Env,
|
|
329
|
-
origin: &endpoint_v2::Origin,
|
|
330
|
-
guid: &soroban_sdk::BytesN<32>,
|
|
331
|
-
message: &Bytes,
|
|
332
|
-
_extra_data: &Bytes,
|
|
333
|
-
_executor: &Address,
|
|
334
|
-
_value: i128,
|
|
335
|
-
) {
|
|
336
|
-
let oft_msg = OFTMessage::decode(message);
|
|
337
|
-
let send_to = oft_utils::resolve_address(env, &oft_msg.send_to);
|
|
338
|
-
|
|
339
|
-
// Convert the amount to local decimals and credit the recipient
|
|
340
|
-
let conversion_rate = Self::__decimal_conversion_rate(env);
|
|
341
|
-
let amount_received_ld =
|
|
342
|
-
Self::__credit(env, &send_to, oft_utils::to_ld(oft_msg.amount_sd, conversion_rate), origin.src_eid);
|
|
343
|
-
|
|
344
|
-
// If there is a compose message, send it
|
|
345
|
-
if let Some(compose) = oft_msg.compose {
|
|
346
|
-
let compose_msg = OFTComposeMsg {
|
|
347
|
-
nonce: origin.nonce,
|
|
348
|
-
src_eid: origin.src_eid,
|
|
349
|
-
amount_ld: amount_received_ld,
|
|
350
|
-
compose_from: compose.from,
|
|
351
|
-
compose_msg: compose.msg,
|
|
352
|
-
}
|
|
353
|
-
.encode(env);
|
|
354
|
-
|
|
355
|
-
let endpoint_client = MessagingComposerClient::new(env, &Self::endpoint(env));
|
|
356
|
-
endpoint_client.send_compose(&env.current_contract_address(), &send_to, guid, &0, &compose_msg);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
events::OFTReceived { guid: guid.clone(), src_eid: origin.src_eid, to: send_to, amount_received_ld }
|
|
360
|
-
.publish(env);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// ===========================================================================
|
|
365
|
-
// OFTCore Trait (exposed as contract entrypoints)
|
|
366
|
-
// ===========================================================================
|
|
367
|
-
|
|
368
|
-
/// Public OFT (Omnichain Fungible Token) interface for cross-chain token transfers.
|
|
369
|
-
///
|
|
370
|
-
/// `OFTCore` defines the externally callable contract entrypoints for interacting with an
|
|
371
|
-
/// OFT deployment. Every method in this trait becomes a Soroban contract function via
|
|
372
|
-
/// `#[contract_trait]`. All business logic lives in [`OFTInternal`] — this trait is a
|
|
373
|
-
/// thin entrypoint layer that delegates to the internal implementations.
|
|
374
|
-
///
|
|
375
|
-
/// # Typical Client Workflow
|
|
376
|
-
///
|
|
377
|
-
/// 1. Call [`quote_oft`](OFTCore::quote_oft) to preview transfer limits, fees, and the
|
|
378
|
-
/// estimated receipt (amounts sent vs. received after dust removal and fees).
|
|
379
|
-
/// 2. Call [`quote_send`](OFTCore::quote_send) to obtain the LayerZero messaging fee.
|
|
380
|
-
/// 3. Call [`send`](OFTCore::send) to execute the cross-chain transfer, supplying the
|
|
381
|
-
/// quoted fee and a refund address for any excess.
|
|
382
|
-
#[contract_trait(client_name = "OFTClient")]
|
|
383
|
-
pub trait OFTCore: OFTInternal {
|
|
384
|
-
/// Returns the address of the underlying SEP-41 token managed by this OFT.
|
|
385
|
-
fn token(env: &soroban_sdk::Env) -> soroban_sdk::Address {
|
|
386
|
-
Self::__token(env)
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/// Returns the OFT messaging protocol version as `(major, minor)`.
|
|
390
|
-
///
|
|
391
|
-
/// The version is used by off-chain tooling and peer contracts to verify wire-format
|
|
392
|
-
/// compatibility.
|
|
393
|
-
fn oft_version(_env: &soroban_sdk::Env) -> (u64, u64) {
|
|
394
|
-
(1, 1)
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/// Returns the **shared decimals** — the common decimal precision used in cross-chain
|
|
398
|
-
/// messages.
|
|
399
|
-
///
|
|
400
|
-
/// Token amounts are normalized to this precision before encoding into LayerZero
|
|
401
|
-
/// messages, ensuring consistent values regardless of each chain's native token
|
|
402
|
-
/// decimals. For example, a token with 18 local decimals and 6 shared decimals has a
|
|
403
|
-
/// conversion rate of 10^12.
|
|
404
|
-
fn shared_decimals(env: &soroban_sdk::Env) -> u32 {
|
|
405
|
-
Self::__shared_decimals(env)
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/// Returns the **decimal conversion rate** (`10 ^ (local_decimals - shared_decimals)`).
|
|
409
|
-
///
|
|
410
|
-
/// This multiplier converts between local-decimal amounts (used on-chain) and
|
|
411
|
-
/// shared-decimal amounts (used in cross-chain messages). Any sub-conversion-rate
|
|
412
|
-
/// remainder ("dust") is stripped before sending to avoid rounding discrepancies
|
|
413
|
-
/// across chains.
|
|
414
|
-
fn decimal_conversion_rate(env: &soroban_sdk::Env) -> i128 {
|
|
415
|
-
Self::__decimal_conversion_rate(env)
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/// Indicates whether the caller must approve a token allowance before calling [`send`](OFTCore::send).
|
|
419
|
-
///
|
|
420
|
-
/// - **`false`** (default) — no separate approval step is needed.
|
|
421
|
-
/// - **`true`** — the caller must grant a token allowance to this contract before
|
|
422
|
-
/// sending (e.g., via `token.approve(oft_address, amount, ...)`).
|
|
423
|
-
///
|
|
424
|
-
/// Wallet and frontend integrators should check this to determine whether an approval
|
|
425
|
-
/// transaction must precede the send.
|
|
426
|
-
fn approval_required(_env: &soroban_sdk::Env) -> bool {
|
|
427
|
-
false
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/// Returns the current message inspector contract address, or `None` if unset.
|
|
431
|
-
///
|
|
432
|
-
/// When set, the inspector's `inspect` method is invoked during both
|
|
433
|
-
/// [`quote_send`](OFTCore::quote_send) and [`send`](OFTCore::send) to validate the
|
|
434
|
-
/// outgoing message payload and options before they reach the LayerZero endpoint.
|
|
435
|
-
fn msg_inspector(env: &soroban_sdk::Env) -> Option<soroban_sdk::Address> {
|
|
436
|
-
Self::__msg_inspector(env)
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/// Sets or removes the message inspector contract.
|
|
440
|
-
///
|
|
441
|
-
/// The message inspector is an **optional** validation hook. When configured, every
|
|
442
|
-
/// outbound message (from both `send` and `quote_send`) is passed to the inspector
|
|
443
|
-
/// contract's `inspect(contract, message, options)` method. The inspector should
|
|
444
|
-
/// **panic** to reject invalid messages, acting as an on-chain policy gate.
|
|
445
|
-
///
|
|
446
|
-
/// Pass `None` to remove the inspector and disable outbound validation.
|
|
447
|
-
///
|
|
448
|
-
/// # Authorization
|
|
449
|
-
/// Requires the caller to be the authorizer.
|
|
450
|
-
///
|
|
451
|
-
/// # Arguments
|
|
452
|
-
/// * `inspector` - Address of the inspector contract, or `None` to remove it
|
|
453
|
-
/// * `operator` - The authorizer address
|
|
454
|
-
#[only_role(operator, AUTHORIZER)]
|
|
455
|
-
fn set_msg_inspector(
|
|
456
|
-
env: &soroban_sdk::Env,
|
|
457
|
-
inspector: &Option<soroban_sdk::Address>,
|
|
458
|
-
operator: &soroban_sdk::Address,
|
|
459
|
-
) {
|
|
460
|
-
Self::__set_msg_inspector(env, inspector);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/// Previews an OFT transfer **without executing** it.
|
|
464
|
-
///
|
|
465
|
-
/// Use this to display transfer details to the user before they commit. Returns:
|
|
466
|
-
///
|
|
467
|
-
/// - **`OFTLimit`** — the minimum and maximum transferable amounts in local decimals.
|
|
468
|
-
/// - **`Vec<OFTFeeDetail>`** — itemized fees (empty by default; populated when custom
|
|
469
|
-
/// fee logic is implemented via [`OFTInternal::__quote_oft`]).
|
|
470
|
-
/// - **`OFTReceipt`** — estimated `amount_sent_ld` and `amount_received_ld` after
|
|
471
|
-
/// dust removal and any fees.
|
|
472
|
-
///
|
|
473
|
-
/// # Arguments
|
|
474
|
-
/// * `from` - The address that would initiate the transfer
|
|
475
|
-
/// * `send_param` - The proposed transfer parameters (destination, amount, options, etc.)
|
|
476
|
-
fn quote_oft(
|
|
477
|
-
env: &soroban_sdk::Env,
|
|
478
|
-
from: &soroban_sdk::Address,
|
|
479
|
-
send_param: &oft_core::SendParam,
|
|
480
|
-
) -> (oft_core::OFTLimit, soroban_sdk::Vec<oft_core::OFTFeeDetail>, oft_core::OFTReceipt) {
|
|
481
|
-
Self::__quote_oft(env, from, send_param)
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
/// Quotes the **LayerZero messaging fee** required for a cross-chain send.
|
|
485
|
-
///
|
|
486
|
-
/// Builds the outgoing message and options from `send_param`, then queries the
|
|
487
|
-
/// LayerZero endpoint for the corresponding fee. If a message inspector is set, it
|
|
488
|
-
/// will also validate the message at this stage.
|
|
489
|
-
///
|
|
490
|
-
/// # Arguments
|
|
491
|
-
/// * `from` - The address that would initiate the transfer
|
|
492
|
-
/// * `send_param` - The proposed transfer parameters
|
|
493
|
-
/// * `pay_in_zro` - `true` to pay the messaging fee in the ZRO token; `false` to pay
|
|
494
|
-
/// in the chain's native token
|
|
495
|
-
///
|
|
496
|
-
/// # Returns
|
|
497
|
-
/// A [`MessagingFee`](endpoint_v2::MessagingFee) containing the `native_fee` and
|
|
498
|
-
/// `zro_fee` required by the endpoint. Pass this value (or a superset) to
|
|
499
|
-
/// [`send`](OFTCore::send).
|
|
500
|
-
fn quote_send(
|
|
501
|
-
env: &soroban_sdk::Env,
|
|
502
|
-
from: &soroban_sdk::Address,
|
|
503
|
-
send_param: &oft_core::SendParam,
|
|
504
|
-
pay_in_zro: bool,
|
|
505
|
-
) -> endpoint_v2::MessagingFee {
|
|
506
|
-
Self::__quote_send(env, from, send_param, pay_in_zro)
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/// Executes a cross-chain token transfer via the LayerZero endpoint.
|
|
510
|
-
///
|
|
511
|
-
/// Builds the OFT message and options, then sends the message through the LayerZero endpoint.
|
|
512
|
-
///
|
|
513
|
-
/// # Arguments
|
|
514
|
-
/// * `from` - The token sender (must authorize the call)
|
|
515
|
-
/// * `send_param` - Transfer parameters including destination chain (`dst_eid`),
|
|
516
|
-
/// recipient (`to`), amount, slippage floor (`min_amount_ld`), extra options, and
|
|
517
|
-
/// an optional compose message
|
|
518
|
-
/// * `fee` - The messaging fee to pay (obtain from [`quote_send`](OFTCore::quote_send))
|
|
519
|
-
/// * `refund_address` - Address to receive any excess fee refund
|
|
520
|
-
///
|
|
521
|
-
/// # Returns
|
|
522
|
-
/// * [`MessagingReceipt`](endpoint_v2::MessagingReceipt) — the LayerZero message GUID,
|
|
523
|
-
/// nonce, and fee actually consumed
|
|
524
|
-
/// * [`OFTReceipt`](crate::types::OFTReceipt) — `amount_sent_ld` (debited) and
|
|
525
|
-
/// `amount_received_ld` (credited on destination after dust removal / fees)
|
|
526
|
-
fn send(
|
|
527
|
-
env: &soroban_sdk::Env,
|
|
528
|
-
from: &soroban_sdk::Address,
|
|
529
|
-
send_param: &oft_core::SendParam,
|
|
530
|
-
fee: &endpoint_v2::MessagingFee,
|
|
531
|
-
refund_address: &soroban_sdk::Address,
|
|
532
|
-
) -> (endpoint_v2::MessagingReceipt, oft_core::OFTReceipt) {
|
|
533
|
-
Self::__send(env, from, send_param, fee, refund_address)
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
// ===========================================================================
|
|
538
|
-
// LzReceive Handler (called by OAppReceiver)
|
|
539
|
-
// ===========================================================================
|
|
540
|
-
|
|
541
|
-
/// Implements `LzReceiveInternal` for an OFT contract using the default OFT receive logic.
|
|
542
|
-
///
|
|
543
|
-
/// This macro generates the boilerplate `LzReceiveInternal` implementation that delegates
|
|
544
|
-
/// to `OFTInternal::__receive`, which handles decoding the OFT message, crediting
|
|
545
|
-
/// tokens to the recipient, and optionally queuing compose messages.
|
|
546
|
-
///
|
|
547
|
-
/// # Usage
|
|
548
|
-
///
|
|
549
|
-
/// ```ignore
|
|
550
|
-
/// use oft_core::impl_oft_lz_receive;
|
|
551
|
-
///
|
|
552
|
-
/// #[oapp]
|
|
553
|
-
/// pub struct MyOFT;
|
|
554
|
-
///
|
|
555
|
-
/// impl OFTInternal for MyOFT {
|
|
556
|
-
/// // ... implement __debit and __credit ...
|
|
557
|
-
/// }
|
|
558
|
-
///
|
|
559
|
-
/// // Instead of manually implementing LzReceiveInternal:
|
|
560
|
-
/// impl_oft_lz_receive!(MyOFT);
|
|
561
|
-
/// ```
|
|
562
|
-
#[macro_export]
|
|
563
|
-
macro_rules! impl_oft_lz_receive {
|
|
564
|
-
($contract:ty) => {
|
|
565
|
-
impl oapp::oapp_receiver::LzReceiveInternal for $contract {
|
|
566
|
-
fn __lz_receive(
|
|
567
|
-
env: &soroban_sdk::Env,
|
|
568
|
-
origin: &endpoint_v2::Origin,
|
|
569
|
-
guid: &soroban_sdk::BytesN<32>,
|
|
570
|
-
message: &soroban_sdk::Bytes,
|
|
571
|
-
extra_data: &soroban_sdk::Bytes,
|
|
572
|
-
executor: &soroban_sdk::Address,
|
|
573
|
-
value: i128,
|
|
574
|
-
) {
|
|
575
|
-
<Self as oft_core::OFTInternal>::__receive(env, origin, guid, message, extra_data, executor, value)
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
// ===========================================================================
|
|
582
|
-
// Helper Functions
|
|
583
|
-
// ===========================================================================
|
|
584
|
-
|
|
585
|
-
/// Asserts that the send amount and min_amount are nonnegative.
|
|
586
|
-
/// # Arguments
|
|
587
|
-
/// * `env` - The environment
|
|
588
|
-
/// * `send_param` - The send parameters to assert
|
|
589
|
-
///
|
|
590
|
-
/// # Panics
|
|
591
|
-
/// * `OFTError::InvalidAmount` - If the send amount or min_amount is negative
|
|
592
|
-
pub fn assert_nonnegative_amount(env: &Env, send_param: &SendParam) {
|
|
593
|
-
assert_with_error!(env, send_param.amount_ld >= 0 && send_param.min_amount_ld >= 0, OFTError::InvalidAmount);
|
|
594
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
use common_macros::storage;
|
|
2
|
-
use soroban_sdk::Address;
|
|
3
|
-
|
|
4
|
-
#[storage]
|
|
5
|
-
pub enum OFTStorage {
|
|
6
|
-
/// The difference between local and shared decimals (local_decimals - shared_decimals).
|
|
7
|
-
/// Immutable: set once during construction and never modified.
|
|
8
|
-
#[instance(u32)]
|
|
9
|
-
DecimalsDiff,
|
|
10
|
-
|
|
11
|
-
/// The address of the underlying token contract.
|
|
12
|
-
/// Immutable: set once during construction and never modified.
|
|
13
|
-
#[instance(Address)]
|
|
14
|
-
Token,
|
|
15
|
-
|
|
16
|
-
/// The optional message inspector contract address
|
|
17
|
-
#[instance(Address)]
|
|
18
|
-
MsgInspector,
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
pub mod test_utils;
|
|
2
|
-
|
|
3
|
-
pub mod test_oft_compose_msg_codec;
|
|
4
|
-
pub mod test_oft_msg_codec;
|
|
5
|
-
|
|
6
|
-
pub mod test_decimals;
|
|
7
|
-
pub mod test_lz_receive;
|
|
8
|
-
pub mod test_msg_inspector;
|
|
9
|
-
pub mod test_oft_version_and_approval;
|
|
10
|
-
pub mod test_quote_oft;
|
|
11
|
-
pub mod test_quote_send;
|
|
12
|
-
pub mod test_resolve_address;
|
|
13
|
-
pub mod test_send;
|
|
14
|
-
pub mod test_token;
|