@layerzerolabs/protocol-stellar-v2 0.2.15 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +350 -309
- package/.turbo/turbo-lint.log +146 -108
- package/.turbo/turbo-test.log +1423 -1238
- package/Cargo.lock +12 -0
- package/Cargo.toml +3 -0
- package/contracts/ERROR_SPEC.md +44 -0
- package/contracts/common-macros/src/auth.rs +113 -0
- package/contracts/common-macros/src/contract_ttl.rs +84 -0
- package/contracts/common-macros/src/lib.rs +181 -30
- package/contracts/common-macros/src/lz_contract.rs +83 -0
- package/contracts/common-macros/src/tests/{ownable.rs → auth.rs} +48 -15
- package/contracts/common-macros/src/tests/contract_ttl.rs +662 -0
- package/contracts/common-macros/src/tests/mod.rs +2 -2
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +20 -0
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +24 -0
- package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__ownable__snapshot_only_owner_preserves_function_signature.snap → common_macros__tests__auth__snapshot_only_auth_preserves_function_signature.snap} +4 -4
- package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__contract_impl__snapshot_generated_contract_impl_code.snap → common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap} +3 -3
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contracttrait_code.snap +69 -0
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +7 -21
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +2 -2
- package/contracts/common-macros/src/ttl_configurable.rs +19 -34
- package/contracts/common-macros/src/ttl_extendable.rs +36 -0
- package/contracts/common-macros/src/upgradeable.rs +5 -5
- package/contracts/common-macros/src/utils.rs +9 -0
- package/contracts/endpoint-v2/src/constants.rs +4 -4
- package/contracts/endpoint-v2/src/endpoint_v2.rs +38 -40
- package/contracts/endpoint-v2/src/errors.rs +4 -3
- package/contracts/endpoint-v2/src/events.rs +1 -1
- package/contracts/endpoint-v2/src/message_lib_manager.rs +18 -5
- package/contracts/endpoint-v2/src/messaging_channel.rs +11 -1
- package/contracts/endpoint-v2/src/messaging_composer.rs +11 -1
- package/contracts/endpoint-v2/src/storage.rs +1 -1
- package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +3 -3
- package/contracts/endpoint-v2/src/tests/endpoint_v2/quote.rs +1 -1
- package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +2 -2
- package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +3 -3
- package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +4 -4
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +3 -3
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +1 -1
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +3 -3
- package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +1 -1
- package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +4 -4
- package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +1 -1
- package/contracts/layerzero-views/src/layerzero_view.rs +3 -6
- package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +2 -2
- package/contracts/macro-integration-tests/tests/runtime/ownable/{only_owner_guard.rs → only_auth_guard.rs} +1 -1
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +1 -1
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +1 -1
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/mod.rs +0 -1
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.rs → only_auth_missing_env.rs} +3 -3
- package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.stderr → only_auth_missing_env.stderr} +4 -4
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +2 -3
- package/contracts/macro-integration-tests/tests/ui/ownable/pass/{only_owner_env_param_variants.rs → only_auth_env_param_variants.rs} +9 -9
- package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/minimal_contract.rs +6 -6
- package/contracts/message-libs/message-lib-common/src/errors.rs +7 -2
- package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/decode_packet_header.rs +3 -3
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_lz_receive_option.rs +1 -2
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_native_drop_option.rs +1 -2
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/convert_legacy_options.rs +9 -9
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +1 -1
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs +1 -1
- package/contracts/message-libs/message-lib-common/src/tests/worker_options/split_worker_options.rs +2 -2
- package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +7 -9
- package/contracts/message-libs/treasury/src/errors.rs +2 -2
- package/contracts/message-libs/treasury/src/events.rs +1 -1
- package/contracts/message-libs/treasury/src/interfaces/zro_fee_lib.rs +2 -2
- package/contracts/message-libs/treasury/src/storage.rs +1 -1
- package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +1 -1
- package/contracts/message-libs/treasury/src/treasury.rs +14 -16
- package/contracts/message-libs/uln-302/src/receive_uln.rs +13 -2
- package/contracts/message-libs/uln-302/src/send_uln.rs +23 -3
- package/contracts/message-libs/uln-302/src/uln302.rs +6 -24
- package/contracts/oapps/counter/Cargo.toml +14 -1
- package/contracts/oapps/counter/integration_tests/mod.rs +4 -1
- package/contracts/oapps/counter/integration_tests/{setup.rs → setup_sml.rs} +48 -80
- package/contracts/oapps/counter/integration_tests/setup_uln.rs +997 -0
- package/contracts/oapps/counter/integration_tests/signing.rs +62 -0
- package/contracts/oapps/counter/integration_tests/test_with_sml.rs +24 -55
- package/contracts/oapps/counter/integration_tests/test_with_uln.rs +314 -0
- package/contracts/oapps/counter/integration_tests/utils.rs +196 -53
- package/contracts/oapps/counter/src/counter.rs +67 -43
- package/contracts/oapps/counter/src/tests/mod.rs +0 -13
- package/contracts/oapps/counter/src/tests/test_counter.rs +5 -7
- package/contracts/oapps/oapp/src/errors.rs +5 -1
- package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +93 -78
- package/contracts/oapps/oapp/src/oapp_core.rs +36 -21
- package/contracts/oapps/oapp/src/oapp_options_type3.rs +48 -12
- package/contracts/oapps/oapp/src/oapp_receiver.rs +106 -41
- package/contracts/oapps/oapp/src/oapp_sender.rs +26 -34
- package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +9 -8
- package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +25 -17
- package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +7 -7
- package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +14 -15
- package/contracts/oapps/oapp-macros/src/generators.rs +128 -0
- package/contracts/oapps/oapp-macros/src/lib.rs +113 -56
- package/contracts/oapps/oft/integration-tests/setup.rs +25 -7
- package/contracts/oapps/oft/src/errors.rs +6 -1
- package/contracts/oapps/oft/src/extensions/oft_fee.rs +8 -8
- package/contracts/oapps/oft/src/extensions/pausable.rs +4 -4
- package/contracts/oapps/oft/src/extensions/rate_limiter.rs +5 -5
- package/contracts/oapps/oft/src/lib.rs +4 -2
- package/contracts/oapps/oft/src/oft.rs +24 -64
- package/contracts/oapps/oft/src/oft_impl.rs +201 -0
- package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +1 -3
- package/contracts/oapps/oft/src/oft_types/mint_burn.rs +1 -4
- package/contracts/oapps/oft/src/storage.rs +2 -0
- package/contracts/oapps/oft/src/tests/extensions/setup.rs +36 -22
- package/contracts/oapps/oft/src/tests/extensions/test_oft_fee.rs +5 -3
- package/contracts/oapps/oft/src/tests/extensions/test_pausable.rs +5 -3
- package/contracts/oapps/oft/src/tests/extensions/test_rate_limiter.rs +5 -3
- package/contracts/oapps/oft/src/tests/test_decimals.rs +2 -2
- package/contracts/oapps/oft/src/tests/test_oft_msg_codec.rs +1 -2
- package/contracts/oapps/oft/src/tests/test_utils.rs +45 -23
- package/contracts/oapps/oft/src/types.rs +20 -0
- package/contracts/oapps/oft-std/integration-tests/setup.rs +4 -2
- package/contracts/oapps/oft-std/src/oft.rs +24 -6
- package/contracts/upgrader/src/lib.rs +4 -4
- package/contracts/utils/src/auth.rs +44 -0
- package/contracts/utils/src/errors.rs +27 -5
- package/contracts/utils/src/lib.rs +3 -0
- package/contracts/utils/src/multisig.rs +211 -0
- package/contracts/utils/src/ownable.rs +12 -10
- package/contracts/utils/src/tests/buffer_reader.rs +6 -6
- package/contracts/utils/src/tests/buffer_writer.rs +6 -6
- package/contracts/utils/src/tests/bytes_ext.rs +2 -4
- package/contracts/utils/src/tests/mod.rs +1 -0
- package/contracts/utils/src/tests/multisig.rs +731 -0
- package/contracts/utils/src/tests/option_ext.rs +2 -5
- package/contracts/utils/src/tests/ownable.rs +16 -5
- package/contracts/utils/src/tests/ttl_configurable.rs +27 -16
- package/contracts/utils/src/tests/upgradeable.rs +4 -2
- package/contracts/utils/src/ttl_configurable.rs +23 -8
- package/contracts/utils/src/ttl_extendable.rs +27 -0
- package/contracts/utils/src/upgradeable.rs +2 -0
- package/contracts/workers/dvn/Cargo.toml +1 -1
- package/contracts/workers/dvn/src/auth.rs +7 -7
- package/contracts/workers/dvn/src/dvn.rs +10 -38
- package/contracts/workers/dvn/src/errors.rs +0 -7
- package/contracts/workers/dvn/src/events.rs +1 -14
- package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
- package/contracts/workers/dvn/src/interfaces/mod.rs +0 -2
- package/contracts/workers/dvn/src/storage.rs +3 -13
- package/contracts/workers/dvn/src/tests/auth.rs +4 -4
- package/contracts/workers/dvn/src/tests/dvn.rs +1 -2
- package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +7 -8
- package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +11 -8
- package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +11 -12
- package/contracts/workers/dvn/src/tests/setup.rs +5 -5
- package/contracts/workers/dvn-fee-lib/Cargo.toml +1 -1
- package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +3 -6
- package/contracts/workers/executor/src/auth.rs +80 -16
- package/contracts/workers/executor/src/executor.rs +5 -31
- package/contracts/workers/executor/src/storage.rs +2 -9
- package/contracts/workers/executor-fee-lib/Cargo.toml +1 -1
- package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +3 -6
- package/contracts/workers/executor-helper/Cargo.toml +1 -1
- package/contracts/workers/executor-helper/src/executor_helper.rs +53 -73
- package/contracts/workers/price-feed/Cargo.toml +1 -1
- package/contracts/workers/price-feed/src/price_feed.rs +7 -10
- package/contracts/workers/worker/src/errors.rs +4 -0
- package/contracts/workers/worker/src/tests/worker.rs +7 -6
- package/contracts/workers/worker/src/worker.rs +20 -16
- package/package.json +8 -5
- package/sdk/.turbo/turbo-build.log +1 -0
- package/sdk/.turbo/turbo-test.log +1009 -0
- package/sdk/dist/generated/bml.d.ts +65 -8
- package/sdk/dist/generated/bml.js +70 -34
- package/sdk/dist/generated/counter.d.ts +167 -42
- package/sdk/dist/generated/counter.js +86 -45
- package/sdk/dist/generated/dvn.d.ts +282 -229
- package/sdk/dist/generated/dvn.js +119 -81
- package/sdk/dist/generated/dvn_fee_lib.d.ts +142 -67
- package/sdk/dist/generated/dvn_fee_lib.js +64 -24
- package/sdk/dist/generated/endpoint.d.ts +97 -22
- package/sdk/dist/generated/endpoint.js +75 -37
- package/sdk/dist/generated/executor.d.ts +117 -85
- package/sdk/dist/generated/executor.js +102 -59
- package/sdk/dist/generated/executor_fee_lib.d.ts +162 -78
- package/sdk/dist/generated/executor_fee_lib.js +104 -57
- package/sdk/dist/generated/executor_helper.d.ts +133 -21
- package/sdk/dist/generated/executor_helper.js +99 -50
- package/sdk/dist/generated/oft_std.d.ts +233 -55
- package/sdk/dist/generated/oft_std.js +99 -54
- package/sdk/dist/generated/price_feed.d.ts +142 -67
- package/sdk/dist/generated/price_feed.js +64 -24
- package/sdk/dist/generated/sml.d.ts +113 -32
- package/sdk/dist/generated/sml.js +93 -49
- package/sdk/dist/generated/treasury.d.ts +896 -0
- package/sdk/dist/generated/treasury.js +219 -0
- package/sdk/dist/generated/uln302.d.ts +113 -32
- package/sdk/dist/generated/uln302.js +93 -49
- package/sdk/dist/generated/upgrader.d.ts +2 -2
- package/sdk/dist/generated/upgrader.js +1 -1
- package/sdk/dist/index.d.ts +2 -0
- package/sdk/dist/index.js +3 -0
- package/sdk/dist/wasm/blocked-message-lib.d.ts +1 -0
- package/sdk/dist/wasm/blocked-message-lib.js +2 -0
- package/sdk/dist/wasm/counter.d.ts +1 -0
- package/sdk/dist/wasm/counter.js +2 -0
- package/sdk/dist/wasm/dvn-fee-lib.d.ts +1 -0
- package/sdk/dist/wasm/dvn-fee-lib.js +2 -0
- package/sdk/dist/wasm/dvn.d.ts +1 -0
- package/sdk/dist/wasm/dvn.js +2 -0
- package/sdk/dist/wasm/endpoint-v2.d.ts +1 -0
- package/sdk/dist/wasm/endpoint-v2.js +2 -0
- package/sdk/dist/wasm/executor-fee-lib.d.ts +1 -0
- package/sdk/dist/wasm/executor-fee-lib.js +2 -0
- package/sdk/dist/wasm/executor-helper.d.ts +1 -0
- package/sdk/dist/wasm/executor-helper.js +2 -0
- package/sdk/dist/wasm/executor.d.ts +1 -0
- package/sdk/dist/wasm/executor.js +2 -0
- package/sdk/dist/wasm/layerzero-views.d.ts +1 -0
- package/sdk/dist/wasm/layerzero-views.js +2 -0
- package/sdk/dist/wasm/oft-std.d.ts +1 -0
- package/sdk/dist/wasm/oft-std.js +2 -0
- package/sdk/dist/wasm/price-feed.d.ts +1 -0
- package/sdk/dist/wasm/price-feed.js +2 -0
- package/sdk/dist/wasm/simple-message-lib.d.ts +1 -0
- package/sdk/dist/wasm/simple-message-lib.js +2 -0
- package/sdk/dist/wasm/treasury.d.ts +1 -0
- package/sdk/dist/wasm/treasury.js +2 -0
- package/sdk/dist/wasm/uln302.d.ts +1 -0
- package/sdk/dist/wasm/uln302.js +2 -0
- package/sdk/dist/wasm/upgrader.d.ts +1 -0
- package/sdk/dist/wasm/upgrader.js +2 -0
- package/sdk/dist/wasm.d.ts +15 -0
- package/sdk/dist/wasm.js +15 -0
- package/sdk/package.json +4 -2
- package/sdk/src/index.ts +4 -0
- package/sdk/test/counter-sml.test.ts +376 -0
- package/sdk/test/counter-uln.test.ts +493 -0
- package/sdk/test/{oft.test.ts → oft-sml.test.ts} +185 -310
- package/sdk/test/suites/constants.ts +22 -2
- package/sdk/test/suites/globalSetup.ts +450 -0
- package/sdk/test/suites/localnet.ts +23 -6
- package/sdk/test/upgrader.test.ts +7 -16
- package/sdk/test/utils.ts +558 -85
- package/sdk/vitest.config.ts +21 -0
- package/tools/ts-bindings-gen/src/main.rs +1 -0
- package/turbo.json +2 -0
- package/contracts/common-macros/src/contract_impl.rs +0 -52
- package/contracts/common-macros/src/ownable.rs +0 -41
- package/contracts/common-macros/src/tests/contract_impl.rs +0 -386
- package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +0 -12
- package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/extend_instance_ttl.rs +0 -50
- package/contracts/oapps/oapp-macros/src/oapp_core.rs +0 -41
- package/contracts/oapps/oapp-macros/src/oapp_full.rs +0 -21
- package/contracts/oapps/oapp-macros/src/oapp_options_type3.rs +0 -31
- package/contracts/oapps/oapp-macros/src/oapp_receiver.rs +0 -48
- package/contracts/oapps/oapp-macros/src/oapp_sender.rs +0 -21
- package/contracts/oapps/oapp-macros/src/util.rs +0 -107
- package/contracts/oapps/oft/src/constants.rs +0 -5
- package/contracts/oapps/oft/src/default_oft_impl.rs +0 -152
- package/contracts/workers/dvn/src/interfaces/multisig.rs +0 -56
- package/contracts/workers/dvn/src/multisig.rs +0 -157
- package/sdk/test/index.test.ts +0 -375
- /package/sdk/test/suites/{testUpgradeable.ts → dummyContractClient.ts} +0 -0
|
@@ -1,43 +1,76 @@
|
|
|
1
|
-
use crate::{
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
use crate::{
|
|
2
|
+
errors::OAppError,
|
|
3
|
+
oapp_core::{endpoint_client, 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
|
+
// =====================================================
|
|
10
|
+
// LzReceiveInternal Trait
|
|
11
|
+
// =====================================================
|
|
12
|
+
|
|
13
|
+
/// Application-specific handler for incoming LayerZero messages.
|
|
14
|
+
///
|
|
15
|
+
/// Implement this trait to define how your OApp processes cross-chain messages.
|
|
16
|
+
/// The default `OAppReceiver::lz_receive` calls `clear_payload_and_transfer` first,
|
|
17
|
+
/// then delegates to your `__lz_receive` implementation.
|
|
18
|
+
///
|
|
19
|
+
/// **Important:** Do NOT call `clear_payload_and_transfer` in your implementation -
|
|
20
|
+
/// it is handled automatically by the default `lz_receive`.
|
|
21
|
+
pub trait LzReceiveInternal {
|
|
22
|
+
/// Processes a verified cross-chain message.
|
|
23
|
+
///
|
|
24
|
+
/// Called after payload verification. Implement your message handling logic here.
|
|
25
|
+
fn __lz_receive(
|
|
26
|
+
env: &Env,
|
|
27
|
+
origin: &Origin,
|
|
28
|
+
guid: &BytesN<32>,
|
|
29
|
+
message: &Bytes,
|
|
30
|
+
extra_data: &Bytes,
|
|
31
|
+
executor: &Address,
|
|
32
|
+
value: i128,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
4
35
|
|
|
5
36
|
// =====================================================
|
|
6
37
|
// OAppReceiver Trait
|
|
7
38
|
// =====================================================
|
|
8
39
|
|
|
9
|
-
///
|
|
40
|
+
/// Receiver trait for OApps that accept cross-chain messages from LayerZero.
|
|
10
41
|
///
|
|
11
|
-
///
|
|
12
|
-
///
|
|
13
|
-
/// for `allow_initialize_path`, `next_nonce`, and `lz_receive`, which allows the endpoint
|
|
14
|
-
/// to call these methods via `LayerZeroReceiverClient` (client calls are resolved by function name).
|
|
42
|
+
/// Mirrors `ILayerZeroReceiver` function signatures, allowing the executor to call
|
|
43
|
+
/// these methods via `LayerZeroReceiverClient`.
|
|
15
44
|
///
|
|
16
45
|
/// # Default Implementations
|
|
17
|
-
///
|
|
18
|
-
///
|
|
19
|
-
///
|
|
20
|
-
///
|
|
21
|
-
///
|
|
22
|
-
///
|
|
46
|
+
/// | Method | Behavior |
|
|
47
|
+
/// |--------|----------|
|
|
48
|
+
/// | `allow_initialize_path` | Returns true if origin sender matches configured peer |
|
|
49
|
+
/// | `next_nonce` | Returns 0 (unordered delivery) |
|
|
50
|
+
/// | `lz_receive` | Verifies payload, then calls `LzReceiveInternal::__lz_receive` |
|
|
51
|
+
/// | `is_compose_msg_sender` | Returns true if sender is current contract |
|
|
23
52
|
///
|
|
24
53
|
/// # Usage
|
|
25
|
-
/// When using `#[oapp_macros::oapp]`, the macro generates `lz_receive` that
|
|
26
|
-
/// automatically calls `verify_and_clear_payload` before delegating to `__lz_receive`.
|
|
27
|
-
/// **Do NOT call `verify_and_clear_payload` in your `__lz_receive` implementation.**
|
|
28
54
|
///
|
|
29
55
|
/// ```ignore
|
|
56
|
+
/// use oapp::oapp_receiver::LzReceiveInternal;
|
|
57
|
+
///
|
|
30
58
|
/// #[oapp_macros::oapp]
|
|
31
59
|
/// pub struct MyOApp;
|
|
32
60
|
///
|
|
33
|
-
/// impl MyOApp {
|
|
34
|
-
///
|
|
35
|
-
///
|
|
61
|
+
/// impl LzReceiveInternal for MyOApp {
|
|
62
|
+
/// fn __lz_receive(env: &Env, origin: &Origin, guid: &BytesN<32>,
|
|
63
|
+
/// message: &Bytes, extra_data: &Bytes, executor: &Address, value: i128) {
|
|
64
|
+
/// // Your message handling logic here
|
|
36
65
|
/// }
|
|
37
66
|
/// }
|
|
38
67
|
/// ```
|
|
39
|
-
|
|
40
|
-
|
|
68
|
+
///
|
|
69
|
+
/// # Customization
|
|
70
|
+
/// For custom behavior (e.g., ordered nonce enforcement), use `#[oapp(custom = [receiver])]`
|
|
71
|
+
/// and implement both `LzReceiveInternal` and `OAppReceiver`.
|
|
72
|
+
#[contract_trait]
|
|
73
|
+
pub trait OAppReceiver: OAppCore + LzReceiveInternal {
|
|
41
74
|
/// Checks if a messaging path can be initialized for the given origin.
|
|
42
75
|
///
|
|
43
76
|
/// # Arguments
|
|
@@ -50,24 +83,37 @@ pub trait OAppReceiver: OAppCore {
|
|
|
50
83
|
peer.is_some_and(|peer| peer == origin.sender)
|
|
51
84
|
}
|
|
52
85
|
|
|
53
|
-
///
|
|
54
|
-
///
|
|
86
|
+
/// Retrieves the next nonce for a given source endpoint and sender address.
|
|
87
|
+
///
|
|
88
|
+
/// The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
|
|
89
|
+
/// This is required by the off-chain executor to determine if the OApp expects message execution to be ordered.
|
|
90
|
+
/// This is also enforced by the OApp.
|
|
91
|
+
/// By default this is NOT enabled, i.e. next_nonce is hardcoded to return 0.
|
|
55
92
|
///
|
|
56
93
|
/// # Arguments
|
|
57
94
|
/// * `src_eid` - The source endpoint ID
|
|
58
95
|
/// * `sender` - The sender OApp address
|
|
96
|
+
///
|
|
97
|
+
/// # Returns
|
|
98
|
+
/// The next nonce
|
|
59
99
|
fn next_nonce(_env: &Env, _src_eid: u32, _sender: &BytesN<32>) -> u64 {
|
|
60
100
|
0
|
|
61
101
|
}
|
|
62
102
|
|
|
63
|
-
///
|
|
103
|
+
/// Entry point for receiving messages or packets from the LayerZero endpoint.
|
|
104
|
+
///
|
|
105
|
+
/// The default implementation calls `clear_payload_and_transfer` to validate the message
|
|
106
|
+
/// and clear it from the endpoint, then delegates to `__lz_receive` for application logic.
|
|
64
107
|
///
|
|
65
108
|
/// # Arguments
|
|
66
|
-
/// * `executor` - The
|
|
67
|
-
/// * `origin` - The origin information
|
|
68
|
-
///
|
|
69
|
-
///
|
|
70
|
-
///
|
|
109
|
+
/// * `executor` - The address of the executor for the received message
|
|
110
|
+
/// * `origin` - The origin information containing the source endpoint and sender address:
|
|
111
|
+
/// - `src_eid`: The source chain endpoint ID
|
|
112
|
+
/// - `sender`: The sender address on the source chain
|
|
113
|
+
/// - `nonce`: The nonce of the message
|
|
114
|
+
/// * `guid` - The unique identifier for the received LayerZero message
|
|
115
|
+
/// * `message` - The payload of the received message
|
|
116
|
+
/// * `extra_data` - Additional arbitrary data provided by the corresponding executor
|
|
71
117
|
/// * `value` - The native token value sent with the message
|
|
72
118
|
fn lz_receive(
|
|
73
119
|
env: &Env,
|
|
@@ -77,7 +123,10 @@ pub trait OAppReceiver: OAppCore {
|
|
|
77
123
|
message: &Bytes,
|
|
78
124
|
extra_data: &Bytes,
|
|
79
125
|
value: i128,
|
|
80
|
-
)
|
|
126
|
+
) {
|
|
127
|
+
clear_payload_and_transfer::<Self>(env, executor, origin, guid, message, value);
|
|
128
|
+
Self::__lz_receive(env, origin, guid, message, extra_data, executor, value)
|
|
129
|
+
}
|
|
81
130
|
|
|
82
131
|
/// Indicates whether an address is an approved composeMsg sender to the Endpoint.
|
|
83
132
|
///
|
|
@@ -100,7 +149,16 @@ pub trait OAppReceiver: OAppCore {
|
|
|
100
149
|
// Helper functions
|
|
101
150
|
// =====================================================
|
|
102
151
|
|
|
103
|
-
|
|
152
|
+
/// Clears the message payload from the endpoint and transfers native tokens from the executor to the oapp if has value.
|
|
153
|
+
///
|
|
154
|
+
/// # Arguments
|
|
155
|
+
/// * `env` - The environment
|
|
156
|
+
/// * `executor` - The address of the executor delivering the message
|
|
157
|
+
/// * `origin` - The origin information (source EID, sender, nonce)
|
|
158
|
+
/// * `guid` - The unique identifier for the LayerZero message to clear the payload from
|
|
159
|
+
/// * `message` - The message payload to clear
|
|
160
|
+
/// * `value` - The native token value to transfer from the executor to the oapp if has value
|
|
161
|
+
pub fn clear_payload_and_transfer<T: OAppCore>(
|
|
104
162
|
env: &Env,
|
|
105
163
|
executor: &Address,
|
|
106
164
|
origin: &Origin,
|
|
@@ -108,16 +166,23 @@ pub fn verify_and_clear_payload<T: OAppCore>(
|
|
|
108
166
|
message: &Bytes,
|
|
109
167
|
value: i128,
|
|
110
168
|
) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
let curr_address = env.current_contract_address();
|
|
115
|
-
let endpoint = LayerZeroEndpointV2Client::new(env, &T::endpoint(env));
|
|
116
|
-
endpoint.clear(&curr_address, origin, &curr_address, guid, message);
|
|
169
|
+
let this_address = env.current_contract_address();
|
|
170
|
+
let endpoint_client = endpoint_client::<T>(env);
|
|
117
171
|
|
|
172
|
+
// Require authorization from the executor and transfer the value from the executor to the oapp if has value
|
|
173
|
+
executor.require_auth();
|
|
118
174
|
if value > 0 {
|
|
119
|
-
let
|
|
120
|
-
|
|
121
|
-
token_client.transfer(executor, &curr_address, &value);
|
|
175
|
+
let token_client = TokenClient::new(env, &endpoint_client.native_token());
|
|
176
|
+
token_client.transfer(executor, &this_address, &value);
|
|
122
177
|
}
|
|
178
|
+
|
|
179
|
+
// Assert that the message is from the expected peer
|
|
180
|
+
assert_with_error!(
|
|
181
|
+
env,
|
|
182
|
+
T::peer(env, origin.src_eid).is_some_and(|peer| peer == origin.sender),
|
|
183
|
+
OAppError::OnlyPeer
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
// Clear the message payload from the endpoint
|
|
187
|
+
endpoint_client.clear(&this_address, origin, &this_address, guid, message);
|
|
123
188
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
use crate::{
|
|
2
|
-
|
|
1
|
+
use crate::{
|
|
2
|
+
errors::OAppError,
|
|
3
|
+
oapp_core::{endpoint_client, OAppCore},
|
|
4
|
+
};
|
|
5
|
+
use endpoint_v2::{MessagingFee, MessagingParams, MessagingReceipt};
|
|
3
6
|
use soroban_sdk::{token::TokenClient, Address, Bytes, Env};
|
|
4
7
|
use utils::option_ext::OptionExt;
|
|
5
8
|
|
|
6
9
|
/// A helper trait for sending cross-chain messages via LayerZero.
|
|
7
10
|
///
|
|
8
|
-
/// Contracts should implement this trait to gain access to the `
|
|
11
|
+
/// Contracts should implement this trait to gain access to the `__lz_quote` and `__lz_send` helper
|
|
9
12
|
/// methods for cross-chain messaging. This trait provides default implementations that handle
|
|
10
13
|
/// fee payment and message dispatch through the LayerZero endpoint.
|
|
11
14
|
///
|
|
@@ -14,7 +17,7 @@ use utils::option_ext::OptionExt;
|
|
|
14
17
|
/// methods as part of your contract's public interface (i.e., do not use `#[contractimpl]` on
|
|
15
18
|
/// the implementation of this trait). Instead, call these methods internally from your
|
|
16
19
|
/// contract's own public functions.
|
|
17
|
-
pub trait
|
|
20
|
+
pub trait OAppSenderInternal: OAppCore {
|
|
18
21
|
/// Quote the messaging fee for sending a message to the other chain
|
|
19
22
|
///
|
|
20
23
|
/// # Arguments
|
|
@@ -25,11 +28,9 @@ pub trait OAppSender: OAppCore {
|
|
|
25
28
|
///
|
|
26
29
|
/// # Returns
|
|
27
30
|
/// * `MessagingFee`: The messaging fee for the message
|
|
28
|
-
fn
|
|
29
|
-
let endpoint = Self::endpoint(env);
|
|
30
|
-
let endpoint_client = LayerZeroEndpointV2Client::new(env, &endpoint);
|
|
31
|
+
fn __quote(env: &Env, dst_eid: u32, message: &Bytes, options: &Bytes, pay_in_zro: bool) -> MessagingFee {
|
|
31
32
|
let receiver = Self::peer(env, dst_eid).unwrap_or_panic(env, OAppError::NoPeer);
|
|
32
|
-
endpoint_client.quote(
|
|
33
|
+
endpoint_client::<Self>(env).quote(
|
|
33
34
|
&env.current_contract_address(),
|
|
34
35
|
&MessagingParams { dst_eid, receiver, message: message.clone(), options: options.clone(), pay_in_zro },
|
|
35
36
|
)
|
|
@@ -38,38 +39,37 @@ pub trait OAppSender: OAppCore {
|
|
|
38
39
|
/// Send a message to the other chain
|
|
39
40
|
///
|
|
40
41
|
/// # Arguments
|
|
41
|
-
/// * `payer`: The address of the payer
|
|
42
42
|
/// * `dst_eid`: The destination endpoint ID
|
|
43
43
|
/// * `message`: The message to send
|
|
44
44
|
/// * `options`: The options for the message
|
|
45
|
+
/// * `fee_payer`: The address of the payer for paying the messaging fees
|
|
45
46
|
/// * `fee`: The messaging fee
|
|
46
47
|
/// * `refund_address`: The address to receive any excess fees
|
|
47
48
|
///
|
|
48
49
|
/// # Returns
|
|
49
50
|
/// * `MessagingReceipt`: The receipt for the sent message
|
|
50
|
-
fn
|
|
51
|
+
fn __lz_send(
|
|
51
52
|
env: &Env,
|
|
52
|
-
payer: &Address,
|
|
53
53
|
dst_eid: u32,
|
|
54
54
|
message: &Bytes,
|
|
55
55
|
options: &Bytes,
|
|
56
|
+
fee_payer: &Address,
|
|
56
57
|
fee: &MessagingFee,
|
|
57
58
|
refund_address: &Address,
|
|
58
59
|
) -> MessagingReceipt {
|
|
59
60
|
// Pay the messaging fees
|
|
60
|
-
Self::
|
|
61
|
-
if fee.zro_fee
|
|
62
|
-
Self::
|
|
61
|
+
Self::__pay_native(env, fee_payer, fee.native_fee);
|
|
62
|
+
if fee.zro_fee != 0 {
|
|
63
|
+
Self::__pay_zro(env, fee_payer, fee.zro_fee);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
// Send the message to the other chain
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
endpoint_client.send(
|
|
67
|
+
let receiver = Self::peer(env, dst_eid).unwrap_or_panic(env, OAppError::NoPeer);
|
|
68
|
+
endpoint_client::<Self>(env).send(
|
|
69
69
|
&env.current_contract_address(),
|
|
70
70
|
&MessagingParams {
|
|
71
71
|
dst_eid,
|
|
72
|
-
receiver
|
|
72
|
+
receiver,
|
|
73
73
|
message: message.clone(),
|
|
74
74
|
options: options.clone(),
|
|
75
75
|
pay_in_zro: fee.zro_fee > 0,
|
|
@@ -81,28 +81,20 @@ pub trait OAppSender: OAppCore {
|
|
|
81
81
|
/// Pay the native fee to the endpoint for sending a message to the other chain
|
|
82
82
|
///
|
|
83
83
|
/// # Arguments
|
|
84
|
-
/// * `
|
|
84
|
+
/// * `fee_payer`: The address of the fee payer
|
|
85
85
|
/// * `native_fee`: The native fee to pay
|
|
86
|
-
fn
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
let native_token = endpoint_client.native_token();
|
|
90
|
-
let token_client = TokenClient::new(env, &native_token);
|
|
91
|
-
|
|
92
|
-
token_client.transfer(payer, &endpoint, &native_fee);
|
|
86
|
+
fn __pay_native(env: &Env, fee_payer: &Address, native_fee: i128) {
|
|
87
|
+
let token_client = TokenClient::new(env, &endpoint_client::<Self>(env).native_token());
|
|
88
|
+
token_client.transfer(fee_payer, Self::endpoint(env), &native_fee);
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
/// Pay the ZRO fee to the endpoint for sending a message to the other chain
|
|
96
92
|
///
|
|
97
93
|
/// # Arguments
|
|
98
|
-
/// * `
|
|
94
|
+
/// * `fee_payer`: The address of the fee payer
|
|
99
95
|
/// * `zro_fee`: The ZRO fee to pay
|
|
100
|
-
fn
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
let zro_token = endpoint_client.zro().unwrap_or_panic(env, OAppError::ZROTokenUnavailable);
|
|
104
|
-
let token_client = TokenClient::new(env, &zro_token);
|
|
105
|
-
|
|
106
|
-
token_client.transfer(payer, &endpoint, &zro_fee);
|
|
96
|
+
fn __pay_zro(env: &Env, fee_payer: &Address, zro_fee: i128) {
|
|
97
|
+
let zro_token = endpoint_client::<Self>(env).zro().unwrap_or_panic(env, OAppError::ZroTokenUnavailable);
|
|
98
|
+
TokenClient::new(env, &zro_token).transfer(fee_payer, Self::endpoint(env), &zro_fee);
|
|
107
99
|
}
|
|
108
100
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
use crate::{self as oapp, oapp_core::PeerSet};
|
|
1
|
+
use crate::{self as oapp, oapp_core::PeerSet, oapp_receiver::LzReceiveInternal};
|
|
2
|
+
use endpoint_v2::Origin;
|
|
2
3
|
use soroban_sdk::{
|
|
3
4
|
contract, contractimpl,
|
|
4
5
|
testutils::{Address as _, MockAuth, MockAuthInvoke},
|
|
5
|
-
Address, BytesN, Env, IntoVal,
|
|
6
|
+
Address, Bytes, BytesN, Env, IntoVal,
|
|
6
7
|
};
|
|
7
8
|
use utils::testing_utils::assert_event;
|
|
8
9
|
|
|
@@ -19,14 +20,14 @@ impl DummyEndpoint {
|
|
|
19
20
|
#[oapp_macros::oapp]
|
|
20
21
|
pub struct DummyOApp;
|
|
21
22
|
|
|
22
|
-
impl DummyOApp {
|
|
23
|
+
impl LzReceiveInternal for DummyOApp {
|
|
23
24
|
fn __lz_receive(
|
|
24
25
|
_env: &Env,
|
|
25
|
-
|
|
26
|
-
_origin: &endpoint_v2::Origin,
|
|
26
|
+
_origin: &Origin,
|
|
27
27
|
_guid: &BytesN<32>,
|
|
28
|
-
_message: &
|
|
29
|
-
_extra_data: &
|
|
28
|
+
_message: &Bytes,
|
|
29
|
+
_extra_data: &Bytes,
|
|
30
|
+
_executor: &Address,
|
|
30
31
|
_value: i128,
|
|
31
32
|
) {
|
|
32
33
|
// Not used in core tests
|
|
@@ -36,7 +37,7 @@ impl DummyOApp {
|
|
|
36
37
|
#[contractimpl]
|
|
37
38
|
impl DummyOApp {
|
|
38
39
|
pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address) {
|
|
39
|
-
oapp::oapp_core::
|
|
40
|
+
oapp::oapp_core::initialize_oapp::<Self>(env, owner, endpoint, &None);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
use crate
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
use crate::{
|
|
2
|
+
self as oapp,
|
|
3
|
+
oapp_core::OAppCore,
|
|
4
|
+
oapp_options_type3::{EnforcedOptionParam, EnforcedOptionSet},
|
|
5
|
+
oapp_receiver::{LzReceiveInternal, OAppReceiver},
|
|
6
|
+
};
|
|
4
7
|
use common_macros::contract_impl;
|
|
5
|
-
use
|
|
6
|
-
use soroban_sdk::contractimpl;
|
|
8
|
+
use endpoint_v2::Origin;
|
|
7
9
|
use soroban_sdk::{
|
|
10
|
+
contract, contractimpl,
|
|
8
11
|
testutils::{Address as _, MockAuth, MockAuthInvoke},
|
|
9
|
-
vec, Address, Bytes, Env, IntoVal,
|
|
12
|
+
vec, Address, Bytes, BytesN, Env, IntoVal,
|
|
10
13
|
};
|
|
11
14
|
use utils::testing_utils::assert_event;
|
|
12
15
|
|
|
@@ -26,31 +29,36 @@ impl DummyEndpoint {
|
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
#[oapp_macros::oapp]
|
|
30
|
-
#[oapp_macros::oapp_manual_impl(core, sender, receiver)]
|
|
32
|
+
#[oapp_macros::oapp(custom = [core, sender, receiver])]
|
|
31
33
|
pub struct DummyOAppOptionsType3;
|
|
32
34
|
|
|
33
|
-
#[contract_impl]
|
|
34
|
-
impl DummyOAppOptionsType3 {
|
|
35
|
-
pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address, delegate: &Option<Address>) {
|
|
36
|
-
oapp::oapp_core::oapp_initialize::<Self>(env, owner, endpoint, delegate);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
35
|
+
#[contract_impl(contracttrait)]
|
|
36
|
+
impl OAppCore for DummyOAppOptionsType3 {}
|
|
39
37
|
|
|
40
|
-
impl DummyOAppOptionsType3 {
|
|
38
|
+
impl LzReceiveInternal for DummyOAppOptionsType3 {
|
|
41
39
|
fn __lz_receive(
|
|
42
40
|
_env: &Env,
|
|
43
|
-
_executor: &Address,
|
|
44
41
|
_origin: &endpoint_v2::Origin,
|
|
45
|
-
_guid: &
|
|
42
|
+
_guid: &BytesN<32>,
|
|
46
43
|
_message: &Bytes,
|
|
47
44
|
_extra_data: &Bytes,
|
|
45
|
+
_executor: &Address,
|
|
48
46
|
_value: i128,
|
|
49
47
|
) {
|
|
50
48
|
// Dummy implementation for testing
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
|
|
52
|
+
#[contract_impl(contracttrait)]
|
|
53
|
+
impl OAppReceiver for DummyOAppOptionsType3 {}
|
|
54
|
+
|
|
55
|
+
#[contract_impl]
|
|
56
|
+
impl DummyOAppOptionsType3 {
|
|
57
|
+
pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address, delegate: &Option<Address>) {
|
|
58
|
+
oapp::oapp_core::initialize_oapp::<Self>(env, owner, endpoint, delegate);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
struct TestSetup<'a> {
|
|
55
63
|
env: Env,
|
|
56
64
|
owner: Address,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
use crate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
use crate::{
|
|
2
|
+
self as oapp, errors::OAppError, oapp_core::OAppCoreStorage, oapp_receiver::LzReceiveInternal,
|
|
3
|
+
tests::test_oapp_core::DummyEndpoint,
|
|
4
|
+
};
|
|
5
5
|
use endpoint_v2::Origin;
|
|
6
6
|
use soroban_sdk::{assert_with_error, contractimpl, testutils::Address as _, Address, Bytes, BytesN, Env};
|
|
7
7
|
use utils::option_ext::OptionExt;
|
|
@@ -9,14 +9,14 @@ use utils::option_ext::OptionExt;
|
|
|
9
9
|
#[oapp_macros::oapp]
|
|
10
10
|
pub struct DummyOAppReceiver;
|
|
11
11
|
|
|
12
|
-
impl DummyOAppReceiver {
|
|
12
|
+
impl LzReceiveInternal for DummyOAppReceiver {
|
|
13
13
|
fn __lz_receive(
|
|
14
14
|
_env: &Env,
|
|
15
|
-
_executor: &Address,
|
|
16
15
|
_origin: &Origin,
|
|
17
16
|
_guid: &BytesN<32>,
|
|
18
17
|
_message: &Bytes,
|
|
19
18
|
_extra_data: &Bytes,
|
|
19
|
+
_executor: &Address,
|
|
20
20
|
_value: i128,
|
|
21
21
|
) {
|
|
22
22
|
// do nothing
|
|
@@ -26,7 +26,7 @@ impl DummyOAppReceiver {
|
|
|
26
26
|
#[contractimpl]
|
|
27
27
|
impl DummyOAppReceiver {
|
|
28
28
|
pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address) {
|
|
29
|
-
oapp::oapp_core::
|
|
29
|
+
oapp::oapp_core::initialize_oapp::<Self>(env, owner, endpoint, &None);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
pub fn assert_allowed_peer(env: &Env, origin: &Origin) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
use crate as oapp;
|
|
2
|
-
use
|
|
3
|
-
use endpoint_v2::{MessagingFee, MessagingParams, MessagingReceipt};
|
|
1
|
+
use crate::{self as oapp, errors::OAppError, oapp_receiver::LzReceiveInternal};
|
|
2
|
+
use endpoint_v2::{MessagingFee, MessagingParams, MessagingReceipt, Origin};
|
|
4
3
|
use soroban_sdk::{
|
|
5
4
|
contract, contractimpl, symbol_short,
|
|
6
5
|
testutils::{Address as _, MockAuth, MockAuthInvoke},
|
|
@@ -49,14 +48,14 @@ impl MockEndpoint {
|
|
|
49
48
|
#[oapp_macros::oapp]
|
|
50
49
|
pub struct DummyOAppSender;
|
|
51
50
|
|
|
52
|
-
impl DummyOAppSender {
|
|
51
|
+
impl LzReceiveInternal for DummyOAppSender {
|
|
53
52
|
fn __lz_receive(
|
|
54
53
|
_env: &Env,
|
|
55
|
-
|
|
56
|
-
_origin: &endpoint_v2::Origin,
|
|
54
|
+
_origin: &Origin,
|
|
57
55
|
_guid: &BytesN<32>,
|
|
58
56
|
_message: &Bytes,
|
|
59
57
|
_extra_data: &Bytes,
|
|
58
|
+
_executor: &Address,
|
|
60
59
|
_value: i128,
|
|
61
60
|
) {
|
|
62
61
|
// Not used in sender tests
|
|
@@ -66,11 +65,11 @@ impl DummyOAppSender {
|
|
|
66
65
|
#[contractimpl]
|
|
67
66
|
impl DummyOAppSender {
|
|
68
67
|
pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address) {
|
|
69
|
-
oapp::oapp_core::
|
|
68
|
+
oapp::oapp_core::initialize_oapp::<Self>(env, owner, endpoint, &None);
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
pub fn quote(env: &Env, dst_eid: u32, message: &Bytes, options: &Bytes, pay_in_zro: bool) -> MessagingFee {
|
|
73
|
-
Self::
|
|
72
|
+
Self::__quote(env, dst_eid, message, options, pay_in_zro)
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
pub fn send(
|
|
@@ -83,17 +82,17 @@ impl DummyOAppSender {
|
|
|
83
82
|
refund_address: &Address,
|
|
84
83
|
) -> MessagingReceipt {
|
|
85
84
|
sender.require_auth();
|
|
86
|
-
Self::
|
|
85
|
+
Self::__lz_send(env, dst_eid, message, options, sender, fee, refund_address)
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
pub fn pay_native_fee(env: &Env,
|
|
90
|
-
|
|
91
|
-
Self::
|
|
88
|
+
pub fn pay_native_fee(env: &Env, fee_payer: &Address, native_fee: i128) {
|
|
89
|
+
fee_payer.require_auth();
|
|
90
|
+
Self::__pay_native(env, fee_payer, native_fee)
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
pub fn pay_zro_fee(env: &Env,
|
|
95
|
-
|
|
96
|
-
Self::
|
|
93
|
+
pub fn pay_zro_fee(env: &Env, fee_payer: &Address, zro_fee: i128) {
|
|
94
|
+
fee_payer.require_auth();
|
|
95
|
+
Self::__pay_zro(env, fee_payer, zro_fee)
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
|