@layerzerolabs/protocol-stellar-v2 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/.turbo/turbo-build.log +273 -219
  2. package/.turbo/turbo-lint.log +79 -107
  3. package/.turbo/turbo-test.log +1016 -840
  4. package/Cargo.lock +14 -6
  5. package/contracts/common-macros/src/contract_impl.rs +6 -3
  6. package/contracts/common-macros/src/error.rs +9 -17
  7. package/contracts/common-macros/src/lib.rs +4 -37
  8. package/contracts/common-macros/src/ownable.rs +9 -5
  9. package/contracts/common-macros/src/tests/contract_impl.rs +178 -86
  10. package/contracts/common-macros/src/tests/error.rs +168 -0
  11. package/contracts/common-macros/src/tests/mod.rs +2 -4
  12. package/contracts/common-macros/src/tests/ownable.rs +37 -60
  13. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_impl__snapshot_generated_contract_impl_code.snap +16 -6
  14. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__error__snapshot_generated_contract_error_code.snap +20 -0
  15. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +3 -1
  16. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_only_owner_preserves_function_signature.snap +12 -2
  17. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +5 -1
  18. package/contracts/common-macros/src/tests/utils.rs +267 -0
  19. package/contracts/common-macros/src/ttl_configurable.rs +15 -12
  20. package/contracts/common-macros/src/utils.rs +35 -6
  21. package/contracts/endpoint-v2/src/endpoint_v2.rs +4 -4
  22. package/contracts/endpoint-v2/src/events.rs +40 -22
  23. package/contracts/endpoint-v2/src/interfaces/message_lib.rs +2 -2
  24. package/contracts/endpoint-v2/src/interfaces/message_lib_manager.rs +2 -2
  25. package/contracts/endpoint-v2/src/interfaces/messaging_channel.rs +2 -2
  26. package/contracts/endpoint-v2/src/interfaces/messaging_composer.rs +2 -2
  27. package/contracts/endpoint-v2/src/interfaces/send_lib.rs +2 -2
  28. package/contracts/endpoint-v2/src/message_lib_manager.rs +3 -3
  29. package/contracts/endpoint-v2/src/messaging_channel.rs +1 -1
  30. package/contracts/endpoint-v2/src/messaging_composer.rs +1 -1
  31. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +4 -8
  32. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_library.rs +3 -7
  33. package/contracts/message-libs/{block-message-lib → blocked-message-lib}/Cargo.toml +1 -1
  34. package/contracts/message-libs/treasury/src/events.rs +9 -6
  35. package/contracts/message-libs/uln-302/src/events.rs +19 -11
  36. package/contracts/message-libs/uln-302/src/interfaces/receive_uln.rs +2 -2
  37. package/contracts/message-libs/uln-302/src/interfaces/send_uln.rs +2 -2
  38. package/contracts/message-libs/uln-302/src/receive_uln.rs +2 -2
  39. package/contracts/message-libs/uln-302/src/send_uln.rs +3 -3
  40. package/contracts/message-libs/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +5 -5
  41. package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_send_uln_configs.rs +5 -5
  42. package/contracts/message-libs/uln-302/src/tests/setup.rs +3 -3
  43. package/contracts/message-libs/uln-302/src/types.rs +24 -24
  44. package/contracts/message-libs/uln-302/src/uln302.rs +2 -2
  45. package/contracts/oapp-macros/src/oapp_core.rs +1 -1
  46. package/contracts/oapps/counter/integration_tests/utils.rs +1 -1
  47. package/contracts/oapps/oapp/src/oapp_core.rs +4 -3
  48. package/contracts/oapps/oapp/src/oapp_options_type3.rs +4 -3
  49. package/contracts/oapps/oft/integration-tests/setup.rs +4 -3
  50. package/contracts/oapps/oft/integration-tests/utils.rs +1 -1
  51. package/contracts/oapps/oft/src/default_oft_impl.rs +146 -0
  52. package/contracts/oapps/oft/src/events.rs +5 -4
  53. package/contracts/oapps/oft/src/extensions/mod.rs +3 -0
  54. package/contracts/oapps/oft/src/extensions/oft_fee.rs +168 -0
  55. package/contracts/oapps/oft/src/extensions/pausable.rs +50 -0
  56. package/contracts/oapps/oft/src/extensions/rate_limiter.rs +200 -0
  57. package/contracts/oapps/oft/src/lib.rs +2 -3
  58. package/contracts/oapps/oft/src/oft.rs +16 -85
  59. package/contracts/oapps/oft/src/oft_types/mint_burn.rs +1 -1
  60. package/contracts/oapps/oft/src/tests/extensions/mod.rs +11 -0
  61. package/contracts/oapps/oft/src/tests/extensions/setup.rs +888 -0
  62. package/contracts/oapps/oft/src/tests/extensions/test_oft_fee.rs +749 -0
  63. package/contracts/oapps/oft/src/tests/extensions/test_pausable.rs +432 -0
  64. package/contracts/oapps/oft/src/tests/extensions/test_rate_limiter.rs +1078 -0
  65. package/contracts/oapps/oft/src/tests/mod.rs +2 -0
  66. package/contracts/oapps/oft/src/tests/test_utils.rs +24 -6
  67. package/contracts/oapps/{oft-mint-burn → oft-std}/Cargo.toml +1 -8
  68. package/contracts/oapps/oft-std/src/lib.rs +5 -0
  69. package/contracts/oapps/oft-std/src/oft.rs +59 -0
  70. package/contracts/utils/src/ownable.rs +8 -6
  71. package/contracts/utils/src/tests/ownable.rs +0 -63
  72. package/contracts/utils/src/tests/testing_utils.rs +7 -5
  73. package/contracts/utils/src/ttl.rs +21 -2
  74. package/contracts/workers/dvn/src/auth.rs +108 -30
  75. package/contracts/workers/dvn/src/dvn.rs +103 -33
  76. package/contracts/workers/dvn/src/errors.rs +10 -13
  77. package/contracts/workers/dvn/src/events.rs +7 -5
  78. package/contracts/workers/dvn/src/interfaces/dvn.rs +76 -3
  79. package/contracts/workers/dvn/src/interfaces/multisig.rs +41 -0
  80. package/contracts/workers/dvn/src/lib.rs +6 -8
  81. package/contracts/workers/dvn/src/multisig.rs +98 -72
  82. package/contracts/workers/dvn/src/storage.rs +9 -12
  83. package/contracts/workers/dvn/src/tests/auth.rs +56 -26
  84. package/contracts/workers/dvn/src/tests/dvn.rs +40 -41
  85. package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +8 -8
  86. package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +9 -9
  87. package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +6 -6
  88. package/contracts/workers/dvn/src/tests/setup.rs +5 -5
  89. package/contracts/workers/dvn-fee-lib/Cargo.toml +2 -1
  90. package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +4 -3
  91. package/contracts/workers/dvn-fee-lib/src/tests/dvn_fee_lib.rs +8 -6
  92. package/contracts/workers/executor/src/auth.rs +93 -0
  93. package/contracts/workers/executor/src/events.rs +5 -4
  94. package/contracts/workers/executor/src/{lz_executor.rs → executor.rs} +30 -103
  95. package/contracts/workers/executor/src/interfaces/executor.rs +5 -2
  96. package/contracts/workers/executor/src/interfaces/mod.rs +1 -1
  97. package/contracts/workers/executor/src/lib.rs +6 -5
  98. package/contracts/workers/price-feed/Cargo.toml +21 -0
  99. package/contracts/workers/price-feed/src/errors.rs +9 -0
  100. package/contracts/workers/price-feed/src/events.rs +30 -0
  101. package/contracts/workers/price-feed/src/lib.rs +11 -0
  102. package/contracts/workers/price-feed/src/price_feed.rs +265 -0
  103. package/contracts/workers/price-feed/src/storage.rs +42 -0
  104. package/contracts/workers/price-feed/src/types.rs +59 -0
  105. package/contracts/workers/worker/src/events.rs +23 -13
  106. package/contracts/workers/worker/src/interfaces/dvn_fee_lib.rs +2 -1
  107. package/contracts/workers/worker/src/worker.rs +32 -21
  108. package/package.json +3 -3
  109. package/sdk/dist/generated/bml.js +24 -22
  110. package/sdk/dist/generated/counter.d.ts +102 -0
  111. package/sdk/dist/generated/counter.js +36 -24
  112. package/sdk/dist/generated/endpoint.js +24 -22
  113. package/sdk/dist/generated/sml.js +24 -22
  114. package/sdk/dist/generated/uln302.d.ts +1 -1
  115. package/sdk/dist/generated/uln302.js +34 -32
  116. package/sdk/package.json +1 -1
  117. package/sdk/test/index.test.ts +1 -1
  118. package/sdk/test/oft.test.ts +847 -0
  119. package/sdk/test/suites/scan.ts +20 -4
  120. package/tools/ts-bindings-gen/src/main.rs +2 -1
  121. package/contracts/common-macros/src/event.rs +0 -16
  122. package/contracts/oapps/oft/src/macro_tests/mod.rs +0 -2
  123. package/contracts/oapps/oft/src/macro_tests/test_all_default.rs +0 -41
  124. package/contracts/oapps/oft/src/macro_tests/test_override.rs +0 -83
  125. package/contracts/oapps/oft-mint-burn/src/lib.rs +0 -3
  126. package/contracts/oapps/oft-mint-burn/src/oft.rs +0 -28
  127. package/contracts/oapps/oft-mint-burn/src/tests/mod.rs +0 -1
  128. package/contracts/workers/dvn/src/types.rs +0 -26
  129. /package/contracts/message-libs/{block-message-lib → blocked-message-lib}/src/lib.rs +0 -0
@@ -1,8 +1,8 @@
1
1
  use soroban_sdk::{testutils::Address as _, testutils::Ledger, vec, Address};
2
2
 
3
3
  use crate::{
4
- errors::EndpointError, events::DefaultReceiveLibraryTimeoutSet, storage, tests::endpoint_setup::setup,
5
- MessageLibType, Timeout,
4
+ errors::EndpointError, events::DefaultReceiveLibTimeoutSet, storage, tests::endpoint_setup::setup, MessageLibType,
5
+ Timeout,
6
6
  };
7
7
  use utils::testing_utils::assert_event;
8
8
 
@@ -203,7 +203,7 @@ fn test_set_default_receive_lib_timeout_success() {
203
203
  assert_event(
204
204
  env,
205
205
  &endpoint_client.address,
206
- DefaultReceiveLibraryTimeoutSet { src_eid: context.eid, timeout: timeout.clone() },
206
+ DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: timeout.clone() },
207
207
  );
208
208
 
209
209
  // Verify it was set correctly via public interface
@@ -229,11 +229,7 @@ fn test_set_default_receive_lib_timeout_success_with_none() {
229
229
  endpoint_client.set_default_receive_lib_timeout(&context.eid, &None);
230
230
 
231
231
  // Verify the event was published
232
- assert_event(
233
- env,
234
- &endpoint_client.address,
235
- DefaultReceiveLibraryTimeoutSet { src_eid: context.eid, timeout: None },
236
- );
232
+ assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None });
237
233
 
238
234
  // Verify it was cleared via public interface
239
235
  assert_eq!(endpoint_client.default_receive_library_timeout(&context.eid), None);
@@ -5,7 +5,7 @@ use soroban_sdk::{
5
5
 
6
6
  use crate::{
7
7
  errors::EndpointError,
8
- events::{DefaultReceiveLibrarySet, DefaultReceiveLibraryTimeoutSet},
8
+ events::{DefaultReceiveLibTimeoutSet, DefaultReceiveLibrarySet},
9
9
  storage,
10
10
  tests::endpoint_setup::setup,
11
11
  MessageLibType, Timeout,
@@ -131,11 +131,7 @@ fn test_set_default_receive_library_success() {
131
131
  &endpoint_client.address,
132
132
  DefaultReceiveLibrarySet { src_eid: context.eid, new_lib: receive_lib.clone() },
133
133
  );
134
- assert_event(
135
- env,
136
- &endpoint_client.address,
137
- DefaultReceiveLibraryTimeoutSet { src_eid: context.eid, timeout: None },
138
- );
134
+ assert_event(env, &endpoint_client.address, DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: None });
139
135
 
140
136
  // Verify it was set correctly via public interface
141
137
  assert_eq!(endpoint_client.default_receive_library(&context.eid), Some(receive_lib.clone()));
@@ -193,7 +189,7 @@ fn test_set_default_receive_library_success_with_grace_period() {
193
189
  assert_event(
194
190
  env,
195
191
  &endpoint_client.address,
196
- DefaultReceiveLibraryTimeoutSet { src_eid: context.eid, timeout: expected_timeout.clone() },
192
+ DefaultReceiveLibTimeoutSet { src_eid: context.eid, timeout: expected_timeout.clone() },
197
193
  );
198
194
 
199
195
  // Verify it was set correctly via public interface
@@ -1,5 +1,5 @@
1
1
  [package]
2
- name = "block-message-lib"
2
+ name = "blocked-message-lib"
3
3
  version.workspace = true
4
4
  edition.workspace = true
5
5
  license.workspace = true
@@ -1,26 +1,29 @@
1
- use common_macros::event;
2
- use soroban_sdk::Address;
1
+ use soroban_sdk::{contractevent, Address};
3
2
 
4
3
  /// Emitted when the native fee basis points is updated.
5
- #[event]
4
+ #[contractevent]
5
+ #[derive(Clone, Debug, Eq, PartialEq)]
6
6
  pub struct NativeFeeBpSet {
7
7
  pub native_fee_bp: u32,
8
8
  }
9
9
 
10
10
  /// Emitted when fee collection is enabled or disabled.
11
- #[event]
11
+ #[contractevent]
12
+ #[derive(Clone, Debug, Eq, PartialEq)]
12
13
  pub struct FeeEnabledSet {
13
14
  pub fee_enabled: bool,
14
15
  }
15
16
 
16
17
  /// Emitted when the ZRO fee library is set or removed.
17
- #[event]
18
+ #[contractevent]
19
+ #[derive(Clone, Debug, Eq, PartialEq)]
18
20
  pub struct ZROFeeLibSet {
19
21
  pub zro_fee_lib: Option<Address>,
20
22
  }
21
23
 
22
24
  /// Emitted when a token (including native XLM) is withdrawn from the contract.
23
- #[event]
25
+ #[contractevent]
26
+ #[derive(Clone, Debug, Eq, PartialEq)]
24
27
  pub struct TokenWithdrawn {
25
28
  pub token: Address,
26
29
  pub to: Address,
@@ -2,11 +2,11 @@ use crate::{
2
2
  interfaces::{OAppExecutorConfig, OAppUlnConfig, SetDefaultUlnConfigParam},
3
3
  SetDefaultExecutorConfigParam,
4
4
  };
5
- use common_macros::event;
6
5
  use endpoint_v2::FeeRecipient;
7
- use soroban_sdk::{Address, Bytes, BytesN, Vec};
6
+ use soroban_sdk::{contractevent, Address, Bytes, BytesN, Vec};
8
7
 
9
- #[event]
8
+ #[contractevent]
9
+ #[derive(Clone, Debug, Eq, PartialEq)]
10
10
  pub struct ExecutorConfigSet {
11
11
  #[topic]
12
12
  pub sender: Address,
@@ -15,7 +15,8 @@ pub struct ExecutorConfigSet {
15
15
  pub config: OAppExecutorConfig,
16
16
  }
17
17
 
18
- #[event]
18
+ #[contractevent]
19
+ #[derive(Clone, Debug, Eq, PartialEq)]
19
20
  pub struct UlnSendConfigSet {
20
21
  #[topic]
21
22
  pub sender: Address,
@@ -24,7 +25,8 @@ pub struct UlnSendConfigSet {
24
25
  pub config: OAppUlnConfig,
25
26
  }
26
27
 
27
- #[event]
28
+ #[contractevent]
29
+ #[derive(Clone, Debug, Eq, PartialEq)]
28
30
  pub struct UlnReceiveConfigSet {
29
31
  #[topic]
30
32
  pub receiver: Address,
@@ -33,36 +35,42 @@ pub struct UlnReceiveConfigSet {
33
35
  pub config: OAppUlnConfig,
34
36
  }
35
37
 
36
- #[event]
38
+ #[contractevent]
39
+ #[derive(Clone, Debug, Eq, PartialEq)]
37
40
  pub struct DefaultExecutorConfigSet {
38
41
  pub params: Vec<SetDefaultExecutorConfigParam>,
39
42
  }
40
43
 
41
- #[event]
44
+ #[contractevent]
45
+ #[derive(Clone, Debug, Eq, PartialEq)]
42
46
  pub struct DefaultUlnSendConfigSet {
43
47
  pub params: Vec<SetDefaultUlnConfigParam>,
44
48
  }
45
49
 
46
- #[event]
50
+ #[contractevent]
51
+ #[derive(Clone, Debug, Eq, PartialEq)]
47
52
  pub struct DefaultUlnReceiveConfigSet {
48
53
  pub params: Vec<SetDefaultUlnConfigParam>,
49
54
  }
50
55
 
51
- #[event]
56
+ #[contractevent]
57
+ #[derive(Clone, Debug, Eq, PartialEq)]
52
58
  pub struct ExecutorFeePaid {
53
59
  #[topic]
54
60
  pub executor: Address,
55
61
  pub fee: FeeRecipient,
56
62
  }
57
63
 
58
- #[event]
64
+ #[contractevent]
65
+ #[derive(Clone, Debug, Eq, PartialEq)]
59
66
  pub struct DVNFeePaid {
60
67
  #[topic]
61
68
  pub dvns: Vec<Address>,
62
69
  pub fees: Vec<FeeRecipient>,
63
70
  }
64
71
 
65
- #[event]
72
+ #[contractevent]
73
+ #[derive(Clone, Debug, Eq, PartialEq)]
66
74
  pub struct PayloadVerified {
67
75
  #[topic]
68
76
  pub dvn: Address,
@@ -1,10 +1,10 @@
1
1
  use crate::types::{OAppUlnConfig, SetDefaultUlnConfigParam, UlnConfig};
2
- use soroban_sdk::{contracttrait, Address, Bytes, BytesN, Env, Vec};
2
+ use soroban_sdk::{contractclient, Address, Bytes, BytesN, Env, Vec};
3
3
 
4
4
  /// Interface for ULN302 receive library functions.
5
5
  ///
6
6
  /// Handles DVN verification and message commitment on the receiving chain.
7
- #[contracttrait(client_name = "ReceiveUln302Client")]
7
+ #[contractclient(name = "ReceiveUln302Client")]
8
8
  pub trait IReceiveUln302 {
9
9
  /// Called by a DVN to verify a message with a specific number of confirmations.
10
10
  ///
@@ -3,7 +3,7 @@ pub use crate::types::{
3
3
  UlnConfig,
4
4
  };
5
5
  use endpoint_v2::ISendLib;
6
- use soroban_sdk::{contracttrait, Address, Env, Vec};
6
+ use soroban_sdk::{contractclient, Address, Env, Vec};
7
7
 
8
8
  // ============================================================================================
9
9
  // ISendUln302 Trait
@@ -12,7 +12,7 @@ use soroban_sdk::{contracttrait, Address, Env, Vec};
12
12
  /// Interface for ULN302 send library functions.
13
13
  ///
14
14
  /// Extends `ISendLib` with ULN-specific configuration management for executors and DVNs.
15
- #[contracttrait(client_name = "SendUln302Client")]
15
+ #[contractclient(name = "SendUln302Client")]
16
16
  pub trait ISendUln302: ISendLib {
17
17
  /// Returns the treasury address for fee collection.
18
18
  fn treasury(env: &Env) -> Address;
@@ -4,7 +4,7 @@ use super::*;
4
4
  // IReceiveUln302 Contract Implementation
5
5
  // ============================================================================================
6
6
 
7
- #[contractimpl(contracttrait)]
7
+ #[contract_impl]
8
8
  impl IReceiveUln302 for Uln302 {
9
9
  /// Called by a DVN to verify a message with a specific number of block confirmations.
10
10
  ///
@@ -62,7 +62,7 @@ impl IReceiveUln302 for Uln302 {
62
62
  fn set_default_receive_uln_configs(env: &Env, params: &Vec<SetDefaultUlnConfigParam>) {
63
63
  for param in params {
64
64
  param.config.validate_default_config(env);
65
- UlnStorage::set_default_receive_uln_configs(env, param.dst_eid, &param.config);
65
+ UlnStorage::set_default_receive_uln_configs(env, param.eid, &param.config);
66
66
  }
67
67
 
68
68
  DefaultUlnReceiveConfigSet { params: params.clone() }.publish(env);
@@ -4,7 +4,7 @@ use super::*;
4
4
  // ISendLib Contract Implementation
5
5
  // ==============================================================================
6
6
 
7
- #[contractimpl(contracttrait)]
7
+ #[contract_impl]
8
8
  impl ISendLib for Uln302 {
9
9
  /// Quotes the total fee for sending a cross-chain message.
10
10
  ///
@@ -81,7 +81,7 @@ impl ISendLib for Uln302 {
81
81
  // ISendUln302 Contract Implementation
82
82
  // ==============================================================================
83
83
 
84
- #[contractimpl(contracttrait)]
84
+ #[contract_impl]
85
85
  impl ISendUln302 for Uln302 {
86
86
  /// Sets default executor configurations for multiple destination endpoints.
87
87
  #[only_owner]
@@ -98,7 +98,7 @@ impl ISendUln302 for Uln302 {
98
98
  fn set_default_send_uln_configs(env: &Env, params: &Vec<SetDefaultUlnConfigParam>) {
99
99
  for param in params {
100
100
  param.config.validate_default_config(env);
101
- UlnStorage::set_default_send_uln_configs(env, param.dst_eid, &param.config);
101
+ UlnStorage::set_default_send_uln_configs(env, param.eid, &param.config);
102
102
  }
103
103
  DefaultUlnSendConfigSet { params: params.clone() }.publish(env);
104
104
  }
@@ -17,8 +17,8 @@ fn test_set_default_receive_uln_configs() {
17
17
 
18
18
  let oapp_receive_uln_configs = vec![
19
19
  &env,
20
- SetDefaultUlnConfigParam { dst_eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) },
21
- SetDefaultUlnConfigParam { dst_eid: 101, config: UlnConfig::generate(&env, 2, 1, 3, 1) },
20
+ SetDefaultUlnConfigParam { eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) },
21
+ SetDefaultUlnConfigParam { eid: 101, config: UlnConfig::generate(&env, 2, 1, 3, 1) },
22
22
  ];
23
23
 
24
24
  env.mock_auths(&[MockAuth {
@@ -37,7 +37,7 @@ fn test_set_default_receive_uln_configs() {
37
37
 
38
38
  let uln302_receive_client = ReceiveUln302Client::new(&env, &uln302.address);
39
39
  for config in oapp_receive_uln_configs.clone() {
40
- assert_eq!(uln302_receive_client.default_receive_uln_config(&config.dst_eid), Some(config.config));
40
+ assert_eq!(uln302_receive_client.default_receive_uln_config(&config.eid), Some(config.config));
41
41
  }
42
42
  }
43
43
 
@@ -47,7 +47,7 @@ fn test_set_default_receive_uln_configs_authorization() {
47
47
  let TestSetup { env, uln302, .. } = setup();
48
48
 
49
49
  let oapp_receive_uln_configs =
50
- vec![&env, SetDefaultUlnConfigParam { dst_eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) }];
50
+ vec![&env, SetDefaultUlnConfigParam { eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) }];
51
51
 
52
52
  uln302.set_default_receive_uln_configs(&oapp_receive_uln_configs);
53
53
  }
@@ -58,7 +58,7 @@ fn test_set_default_receive_uln_configs_assert_default_config() {
58
58
 
59
59
  let mut config = UlnConfig::generate(&env, 1, 1, 3, 1);
60
60
  config.required_dvns.push_back(config.required_dvns.get(0).unwrap().clone());
61
- let oapp_receive_uln_configs = vec![&env, SetDefaultUlnConfigParam { dst_eid: 100, config }];
61
+ let oapp_receive_uln_configs = vec![&env, SetDefaultUlnConfigParam { eid: 100, config }];
62
62
 
63
63
  env.mock_all_auths();
64
64
  let result = uln302.try_set_default_receive_uln_configs(&oapp_receive_uln_configs);
@@ -18,8 +18,8 @@ fn test_set_default_send_uln_configs() {
18
18
 
19
19
  let oapp_send_uln_configs = vec![
20
20
  &env,
21
- SetDefaultUlnConfigParam { dst_eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) },
22
- SetDefaultUlnConfigParam { dst_eid: 101, config: UlnConfig::generate(&env, 2, 1, 3, 1) },
21
+ SetDefaultUlnConfigParam { eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) },
22
+ SetDefaultUlnConfigParam { eid: 101, config: UlnConfig::generate(&env, 2, 1, 3, 1) },
23
23
  ];
24
24
 
25
25
  env.mock_auths(&[MockAuth {
@@ -38,7 +38,7 @@ fn test_set_default_send_uln_configs() {
38
38
 
39
39
  let uln302_send_client = SendUln302Client::new(&env, &uln302.address);
40
40
  for config in oapp_send_uln_configs.clone() {
41
- assert_eq!(uln302_send_client.default_send_uln_config(&config.dst_eid), Some(config.config));
41
+ assert_eq!(uln302_send_client.default_send_uln_config(&config.eid), Some(config.config));
42
42
  }
43
43
  }
44
44
 
@@ -48,7 +48,7 @@ fn test_set_default_send_uln_configs_authorization() {
48
48
  let TestSetup { env, uln302, .. } = setup();
49
49
 
50
50
  let oapp_send_uln_configs =
51
- vec![&env, SetDefaultUlnConfigParam { dst_eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) }];
51
+ vec![&env, SetDefaultUlnConfigParam { eid: 100, config: UlnConfig::generate(&env, 1, 1, 3, 1) }];
52
52
 
53
53
  uln302.set_default_send_uln_configs(&oapp_send_uln_configs);
54
54
  }
@@ -59,7 +59,7 @@ fn test_set_default_send_uln_configs_assert_default_config() {
59
59
 
60
60
  let mut config = UlnConfig::generate(&env, 1, 1, 3, 1);
61
61
  config.required_dvns.push_back(config.required_dvns.get(0).unwrap().clone());
62
- let oapp_send_uln_configs = vec![&env, SetDefaultUlnConfigParam { dst_eid: 100, config }];
62
+ let oapp_send_uln_configs = vec![&env, SetDefaultUlnConfigParam { eid: 100, config }];
63
63
 
64
64
  env.mock_all_auths();
65
65
  let result = uln302.try_set_default_send_uln_configs(&oapp_send_uln_configs);
@@ -1,6 +1,6 @@
1
+ use common_macros::contract_impl;
1
2
  use endpoint_v2::{FeeRecipient, MessageLibClient, MessageLibManagerClient, Origin, SetConfigParam};
2
3
  use message_lib_common::interfaces::{ILayerZeroDVN, ILayerZeroExecutor, ILayerZeroTreasury};
3
- use common_macros::contract_impl;
4
4
  use soroban_sdk::{
5
5
  contract, log, symbol_short,
6
6
  testutils::{Address as _, MockAuth, MockAuthInvoke},
@@ -212,7 +212,7 @@ impl<'a> TestSetup<'a> {
212
212
  }
213
213
 
214
214
  pub fn set_default_send_uln_config(&self, eid: u32, config: UlnConfig) {
215
- let params = vec![&self.env, SetDefaultUlnConfigParam { dst_eid: eid, config }];
215
+ let params = vec![&self.env, SetDefaultUlnConfigParam { eid, config }];
216
216
  self.env.mock_auths(&[MockAuth {
217
217
  address: &self.owner,
218
218
  invoke: &MockAuthInvoke {
@@ -226,7 +226,7 @@ impl<'a> TestSetup<'a> {
226
226
  }
227
227
 
228
228
  pub fn set_default_receive_uln_config(&self, eid: u32, config: UlnConfig) {
229
- let params = vec![&self.env, SetDefaultUlnConfigParam { dst_eid: eid, config }];
229
+ let params = vec![&self.env, SetDefaultUlnConfigParam { eid, config }];
230
230
  self.env.mock_auths(&[MockAuth {
231
231
  address: &self.owner,
232
232
  invoke: &MockAuthInvoke {
@@ -23,6 +23,23 @@ pub struct UlnConfig {
23
23
  }
24
24
 
25
25
  impl UlnConfig {
26
+ /// Creates a new UlnConfig with default values.
27
+ pub fn default(env: &Env) -> Self {
28
+ UlnConfig { confirmations: 0, required_dvns: vec![&env], optional_dvns: vec![&env], optional_dvn_threshold: 0 }
29
+ }
30
+
31
+ /// Validates a UlnConfig for using as a default config.
32
+ ///
33
+ /// Performs comprehensive validation including:
34
+ /// - Required DVNs validation (no duplicates, within limits)
35
+ /// - Optional DVNs validation (no duplicates, within limits, valid threshold)
36
+ /// - At least one DVN requirement (either required or optional with threshold > 0)
37
+ pub fn validate_default_config(&self, env: &Env) {
38
+ self.validate_required_dvns(env);
39
+ self.validate_optional_dvns(env);
40
+ self.validate_at_least_one_dvn(env);
41
+ }
42
+
26
43
  /// Validates the required DVNs configuration.
27
44
  ///
28
45
  /// Checks:
@@ -50,18 +67,6 @@ impl UlnConfig {
50
67
  );
51
68
  }
52
69
 
53
- /// Validates a UlnConfig for using as a default config.
54
- ///
55
- /// Performs comprehensive validation including:
56
- /// - Required DVNs validation (no duplicates, within limits)
57
- /// - Optional DVNs validation (no duplicates, within limits, valid threshold)
58
- /// - At least one DVN requirement (either required or optional with threshold > 0)
59
- pub fn validate_default_config(&self, env: &Env) {
60
- self.validate_required_dvns(env);
61
- self.validate_optional_dvns(env);
62
- self.validate_at_least_one_dvn(env);
63
- }
64
-
65
70
  /// Validates that the configuration has at least one DVN for verification.
66
71
  ///
67
72
  /// A valid configuration must have either:
@@ -97,12 +102,7 @@ impl OAppUlnConfig {
97
102
  use_default_confirmations: true,
98
103
  use_default_required_dvns: true,
99
104
  use_default_optional_dvns: true,
100
- uln_config: UlnConfig {
101
- confirmations: 0,
102
- required_dvns: vec![&env],
103
- optional_dvns: vec![&env],
104
- optional_dvn_threshold: 0,
105
- },
105
+ uln_config: UlnConfig::default(env),
106
106
  }
107
107
  }
108
108
 
@@ -112,11 +112,9 @@ impl OAppUlnConfig {
112
112
  /// - When using defaults, corresponding config values must be empty/zero
113
113
  /// - When not using defaults, the provided values must be valid
114
114
  pub fn validate_oapp_config(&self, env: &Env) {
115
- assert_with_error!(
116
- env,
117
- !self.use_default_confirmations || self.uln_config.confirmations == 0,
118
- Uln302Error::InvalidConfirmations
119
- );
115
+ if self.use_default_confirmations {
116
+ assert_with_error!(env, self.uln_config.confirmations == 0, Uln302Error::InvalidConfirmations);
117
+ }
120
118
 
121
119
  if self.use_default_required_dvns {
122
120
  assert_with_error!(env, self.uln_config.required_dvns.is_empty(), Uln302Error::InvalidRequiredDVNs);
@@ -139,11 +137,13 @@ impl OAppUlnConfig {
139
137
  pub fn apply_default_config(&self, default_config: &UlnConfig) -> UlnConfig {
140
138
  let confirmations =
141
139
  if self.use_default_confirmations { default_config.confirmations } else { self.uln_config.confirmations };
140
+
142
141
  let required_dvns = if self.use_default_required_dvns {
143
142
  default_config.required_dvns.clone()
144
143
  } else {
145
144
  self.uln_config.required_dvns.clone()
146
145
  };
146
+
147
147
  let (optional_dvns, optional_dvn_threshold) = if self.use_default_optional_dvns {
148
148
  (default_config.optional_dvns.clone(), default_config.optional_dvn_threshold)
149
149
  } else {
@@ -159,7 +159,7 @@ impl OAppUlnConfig {
159
159
  #[derive(Clone, Eq, PartialEq, Debug)]
160
160
  pub struct SetDefaultUlnConfigParam {
161
161
  /// The destination endpoint ID (for send) or source endpoint ID (for receive).
162
- pub dst_eid: u32,
162
+ pub eid: u32,
163
163
  /// The ULN configuration to set as default.
164
164
  pub config: UlnConfig,
165
165
  }
@@ -22,7 +22,7 @@ use message_lib_common::{
22
22
  };
23
23
  use soroban_sdk::{
24
24
  address_payload::AddressPayload,
25
- assert_with_error, bytes, contract, contractimpl, panic_with_error, vec,
25
+ assert_with_error, bytes, contract, panic_with_error, vec,
26
26
  xdr::{FromXdr, ToXdr},
27
27
  Address, Bytes, BytesN, Env, Map, Vec,
28
28
  };
@@ -54,7 +54,7 @@ impl Uln302 {
54
54
  }
55
55
  }
56
56
 
57
- #[contractimpl(contracttrait)]
57
+ #[contract_impl]
58
58
  impl IMessageLib for Uln302 {
59
59
  /// Sets OApp-specific configuration parameters for the message library.
60
60
  ///
@@ -31,8 +31,8 @@ pub fn generate_impl(name: &Ident, item_struct: ItemStruct, manual_impl_core: bo
31
31
  });
32
32
 
33
33
  quote! {
34
- #[common_macros::ownable]
35
34
  #[soroban_sdk::contract]
35
+ #[common_macros::ttl_configurable]
36
36
  #item_struct
37
37
 
38
38
  #manual_impl
@@ -128,7 +128,7 @@ pub fn lz_compose(env: &Env, chain: &ChainSetup<'_>, executor: &Address, packet:
128
128
  pub fn scan_packet_sent_event(env: &Env, endpoint: &Address) -> Option<(Bytes, Bytes, Address)> {
129
129
  let mut packet = None;
130
130
  for (emitter, topics, data) in env.events().all() {
131
- let packet_sent_symbol = Symbol::new(env, "PacketSent").to_val();
131
+ let packet_sent_symbol = Symbol::new(env, "packet_sent").to_val();
132
132
  if emitter == *endpoint && topics.contains(packet_sent_symbol) {
133
133
  let map: Map<Symbol, Val> = data.into_val(env);
134
134
 
@@ -1,6 +1,6 @@
1
- use common_macros::{event, only_owner, storage};
1
+ use common_macros::{only_owner, storage};
2
2
  use endpoint_v2::LayerZeroEndpointV2Client;
3
- use soroban_sdk::{contracttrait, Address, BytesN, Env};
3
+ use soroban_sdk::{contractevent, contracttrait, Address, BytesN, Env};
4
4
  use utils::ownable::Ownable;
5
5
  use utils::ownable::OwnableInitializer;
6
6
 
@@ -30,7 +30,8 @@ pub enum OAppCoreStorage {
30
30
  Peer { eid: u32 },
31
31
  }
32
32
 
33
- #[event]
33
+ #[contractevent]
34
+ #[derive(Clone, Debug, Eq, PartialEq)]
34
35
  pub struct PeerSet {
35
36
  pub eid: u32,
36
37
  pub peer: Option<BytesN<32>>,
@@ -1,6 +1,6 @@
1
1
  use crate::errors::OAppError;
2
- use common_macros::{event, only_owner, storage};
3
- use soroban_sdk::{assert_with_error, contracttrait, contracttype, panic_with_error, Bytes, Env, Vec};
2
+ use common_macros::{only_owner, storage};
3
+ use soroban_sdk::{assert_with_error, contractevent, contracttrait, contracttype, panic_with_error, Bytes, Env, Vec};
4
4
  use utils::ownable::Ownable;
5
5
 
6
6
  pub const OPTION_TYPE3: u32 = 3;
@@ -20,7 +20,8 @@ pub enum OAppOptionsType3Storage {
20
20
  EnforcedOptions { eid: u32, msg_type: u32 },
21
21
  }
22
22
 
23
- #[event]
23
+ #[contractevent]
24
+ #[derive(Clone, Debug, Eq, PartialEq)]
24
25
  pub struct EnforcedOptionSet {
25
26
  pub enforced_option_params: Vec<EnforcedOptionParam>,
26
27
  }
@@ -29,8 +29,8 @@ pub struct TestOFT;
29
29
 
30
30
  #[contract_impl]
31
31
  impl TestOFT {
32
- pub fn __constructor(env: &Env, token: &Address, owner: &Address, endpoint: &Address, delegate: &Option<Address>) {
33
- oft_initialize::<Self>(env, owner, token, endpoint, delegate)
32
+ pub fn __constructor(env: &Env, token: &Address, owner: &Address, endpoint: &Address, delegate: &Option<Address>, shared_decimals: u32) {
33
+ oft_initialize::<Self>(env, owner, token, endpoint, delegate, shared_decimals)
34
34
  }
35
35
  }
36
36
 
@@ -153,7 +153,8 @@ fn setup_chain<'a>(env: &Env) -> ChainSetup<'a> {
153
153
  let fee_recipient = Address::generate(env);
154
154
  let sml_address = env.register(SimpleMessageLib, (&owner, &endpoint_address, &fee_recipient));
155
155
  let delegate: Option<Address> = Some(owner.clone());
156
- let oft_address = env.register(TestOFT, (&oft_token, &owner, &endpoint_address, &delegate));
156
+ let shared_decimals: u32 = 6; // Default shared decimals
157
+ let oft_address = env.register(TestOFT, (&oft_token, &owner, &endpoint_address, &delegate, &shared_decimals));
157
158
  let composer_address = env.register(DummyComposer, (&endpoint_address,));
158
159
 
159
160
  let endpoint = EndpointV2Client::new(env, &endpoint_address);
@@ -157,7 +157,7 @@ pub fn lz_compose(
157
157
  pub fn scan_packet_sent_event(env: &Env, endpoint: &Address) -> Option<(Bytes, Bytes, Address)> {
158
158
  let mut packet = None;
159
159
  for (emitter, topics, data) in env.events().all() {
160
- let packet_sent_symbol = Symbol::new(env, "PacketSent").to_val();
160
+ let packet_sent_symbol = Symbol::new(env, "packet_sent").to_val();
161
161
  if emitter == *endpoint && topics.contains(packet_sent_symbol) {
162
162
  let map: Map<Symbol, Val> = data.into_val(env);
163
163