@layerzerolabs/protocol-stellar-v2 0.2.44 → 0.2.46

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 (30) hide show
  1. package/.turbo/turbo-build.log +331 -66
  2. package/.turbo/turbo-lint.log +88 -153
  3. package/.turbo/turbo-test.log +1814 -1764
  4. package/LICENSE +42 -0
  5. package/contracts/common-macros/src/lib.rs +17 -1
  6. package/contracts/macro-integration-tests/tests/runtime/oapp/mod.rs +3 -3
  7. package/contracts/oapps/counter/src/tests/mod.rs +2 -2
  8. package/contracts/oapps/oapp/src/oapp_core.rs +5 -5
  9. package/contracts/oapps/oapp/src/oapp_options_type3.rs +3 -3
  10. package/contracts/oapps/oapp/src/tests/mod.rs +3 -3
  11. package/contracts/oapps/oft/integration-tests/setup.rs +2 -2
  12. package/contracts/oapps/oft/integration-tests/utils.rs +10 -10
  13. package/contracts/oapps/oft/src/extensions/oft_fee.rs +7 -7
  14. package/contracts/oapps/oft/src/extensions/rate_limiter.rs +4 -4
  15. package/contracts/oapps/oft/src/tests/extensions/oft_fee.rs +3 -3
  16. package/contracts/oapps/oft/src/tests/extensions/rate_limiter.rs +3 -3
  17. package/contracts/oapps/oft-core/integration-tests/setup.rs +4 -4
  18. package/contracts/oapps/oft-core/src/oft_core.rs +4 -4
  19. package/contracts/oapps/oft-core/src/tests/test_msg_inspector.rs +3 -3
  20. package/contracts/oapps/oft-core/src/tests/test_utils.rs +4 -4
  21. package/package.json +7 -5
  22. package/sdk/.turbo/turbo-test.log +282 -280
  23. package/sdk/dist/generated/counter.d.ts +6 -6
  24. package/sdk/dist/generated/counter.js +6 -6
  25. package/sdk/dist/generated/oft.d.ts +12 -12
  26. package/sdk/dist/generated/oft.js +11 -11
  27. package/sdk/package.json +3 -2
  28. package/sdk/test/counter-sml.test.ts +4 -4
  29. package/sdk/test/counter-uln.test.ts +4 -4
  30. package/sdk/test/oft-sml.test.ts +5 -5
package/LICENSE ADDED
@@ -0,0 +1,42 @@
1
+ LayerZero Business License 1.2
2
+ LZBL-1.2
3
+
4
+ Notes
5
+
6
+ The LayerZero Business License (this "Agreement", or the "License") is not an open source license. However, the Licensed Work (as defined below) will eventually be made available under an open source license, as stated in this License, for Permissionless Applications. Permissioned Applications may not use the Licensed Work. The license parameters are: restrictions on usage, a Change Date, and the open source license that will govern usage of the Licensed Work after the Change Date.
7
+
8
+ Terms
9
+
10
+ Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work.
11
+
12
+ On the Change Date (as defined below), this License shall covert into the Change License (as defined below), and the rights granted in the paragraph above terminate. You may not modify this License in any other way.
13
+
14
+ If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
15
+
16
+ All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
17
+
18
+ You must conspicuously display this License and the License Text (defined below) on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
19
+
20
+ Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
21
+
22
+ This License does not grant you any right in any trademark or logo of Licensor or its affiliates.
23
+
24
+ THE LICENSED WORK IS PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
25
+
26
+
27
+ Definitions
28
+ Change Date means 4 years from December 14, 2023 with respect to Permissionless Applications. Permissioned Applications shall not have a Change Date and may not use the Licensed Work.
29
+
30
+ Change License means the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version.
31
+
32
+ Licensor means LayerZero Labs Ltd.
33
+
34
+ License Text means:
35
+ LayerZero Business License 1.2
36
+ License text copyright © 2023 LayerZero Labs Ltd., All Rights Reserved.
37
+
38
+ Licensed Work means LayerZero as described in Whitepaper "LayerZero" published on December 14, 2023.
39
+
40
+ Permissionless Applications means blockchain networks or applications that users can freely join, interact with, or participate in without first obtaining permission, approval, or authorization and excludes Permissionless Applications.
41
+
42
+ Permissioned Applications means blockchain networks or applications that are limited only to designated participants or that limit who is allows allowed to participate in financial (or other) activities, and excludes Permissionless Applications.
@@ -244,6 +244,16 @@ pub fn only_auth(_attr: TokenStream, item: TokenStream) -> TokenStream {
244
244
  /// Injects a role check at the start of the function. Panics with
245
245
  /// `RbacError::Unauthorized` if the account does not have the role (aligns with OpenZeppelin).
246
246
  ///
247
+ /// # Security Warning
248
+ ///
249
+ /// **IMPORTANT**: This macro checks role membership but does NOT call
250
+ /// `require_auth()`. Use this macro when:
251
+ ///
252
+ /// 1. Your function already contains a `require_auth()` call for the account
253
+ /// 2. You need role-based access control without authorization enforcement
254
+ ///
255
+ /// If you need both role checking AND authorization, use `#[only_role]` instead.
256
+ ///
247
257
  /// # Requirements
248
258
  /// - The function must have an `Env` parameter
249
259
  /// - The function must have a parameter matching the first macro arg (of type `Address` or `&Address`)
@@ -264,7 +274,7 @@ pub fn only_auth(_attr: TokenStream, item: TokenStream) -> TokenStream {
264
274
  /// ```ignore
265
275
  /// pub fn mint(env: Env, caller: Address, amount: i128) {
266
276
  /// utils::rbac::ensure_role(&env, &soroban_sdk::Symbol::new(&env, "minter"), &caller);
267
- /// // Original function body
277
+ /// // Original function body (no require_auth)
268
278
  /// }
269
279
  /// ```
270
280
  #[proc_macro_attribute]
@@ -277,6 +287,12 @@ pub fn has_role(attr: TokenStream, item: TokenStream) -> TokenStream {
277
287
  /// Same as `#[has_role]` but also calls `account.require_auth()` to ensure
278
288
  /// the caller has authorized the transaction.
279
289
  ///
290
+ /// **IMPORTANT**: This macro both checks role membership AND enforces
291
+ /// authorization. In Stellar contracts, duplicate `require_auth()` calls for
292
+ /// the same account will cause panics. If your function already contains a
293
+ /// `require_auth()` call for the same account, use `#[has_role]` instead to
294
+ /// avoid duplicate authorization checks.
295
+ ///
280
296
  /// # Requirements
281
297
  /// Same as `#[has_role]`.
282
298
  ///
@@ -1,5 +1,5 @@
1
1
  use endpoint_v2::Origin;
2
- use oapp::oapp_core::OAPP_ADMIN_ROLE;
2
+ use oapp::oapp_core::OAPP_MANAGER_ROLE;
3
3
  use oapp::oapp_receiver::LzReceiveInternal;
4
4
  use oapp_macros::oapp;
5
5
  use soroban_sdk::{
@@ -50,10 +50,10 @@ impl TestOApp {
50
50
  }
51
51
  }
52
52
 
53
- /// Grants `OAPP_ADMIN_ROLE` to `owner` via the public `grant_role` interface.
53
+ /// Grants `OAPP_MANAGER_ROLE` to `owner` via the public `grant_role` interface.
54
54
  /// Call after `init()` in tests that exercise RBAC-protected entrypoints.
55
55
  pub fn grant_oapp_admin(env: &Env, contract: &Address, owner: &Address) {
56
- let role = Symbol::new(env, OAPP_ADMIN_ROLE);
56
+ let role = Symbol::new(env, OAPP_MANAGER_ROLE);
57
57
  env.mock_auths(&[MockAuth {
58
58
  address: owner,
59
59
  invoke: &MockAuthInvoke {
@@ -1,4 +1,4 @@
1
- use oapp::oapp_core::OAPP_ADMIN_ROLE;
1
+ use oapp::oapp_core::OAPP_MANAGER_ROLE;
2
2
  use soroban_sdk::{
3
3
  testutils::{MockAuth, MockAuthInvoke},
4
4
  token::StellarAssetClient,
@@ -25,7 +25,7 @@ pub fn mint_to(env: &Env, owner: &Address, native_token: &Address, to: &Address,
25
25
  }
26
26
 
27
27
  pub fn grant_oapp_admin(env: &Env, contract: &Address, owner: &Address) {
28
- let role = Symbol::new(env, OAPP_ADMIN_ROLE);
28
+ let role = Symbol::new(env, OAPP_MANAGER_ROLE);
29
29
  env.mock_auths(&[MockAuth {
30
30
  address: owner,
31
31
  invoke: &MockAuthInvoke {
@@ -9,7 +9,7 @@ use utils::{
9
9
  };
10
10
 
11
11
  /// Role for OApp administrative actions (set_peer, set_delegate, set_enforced_options).
12
- pub const OAPP_ADMIN_ROLE: &str = "OAPP_ADMIN_ROLE";
12
+ pub const OAPP_MANAGER_ROLE: &str = "OAPP_MANAGER_ROLE";
13
13
 
14
14
  // =====================================================
15
15
  // OAppCore Storage and Events
@@ -73,8 +73,8 @@ pub trait OAppCore: Ownable + RoleBasedAccessControl {
73
73
  /// # Arguments
74
74
  /// * `eid` - The endpoint ID
75
75
  /// * `peer` - The address of the peer to be associated with the corresponding endpoint, or None to remove the peer
76
- /// * `operator` - The address that must have OAPP_ADMIN_ROLE
77
- #[only_role(operator, OAPP_ADMIN_ROLE)]
76
+ /// * `operator` - The address that must have OAPP_MANAGER_ROLE
77
+ #[only_role(operator, OAPP_MANAGER_ROLE)]
78
78
  fn set_peer(
79
79
  env: &soroban_sdk::Env,
80
80
  eid: u32,
@@ -89,8 +89,8 @@ pub trait OAppCore: Ownable + RoleBasedAccessControl {
89
89
  ///
90
90
  /// # Arguments
91
91
  /// * `delegate` - The address of the delegate to be set, or None to remove the delegate
92
- /// * `operator` - The address that must have OAPP_ADMIN_ROLE
93
- #[only_role(operator, OAPP_ADMIN_ROLE)]
92
+ /// * `operator` - The address that must have OAPP_MANAGER_ROLE
93
+ #[only_role(operator, OAPP_MANAGER_ROLE)]
94
94
  fn set_delegate(env: &soroban_sdk::Env, delegate: &Option<soroban_sdk::Address>, operator: &soroban_sdk::Address) {
95
95
  endpoint_client::<Self>(env).set_delegate(&env.current_contract_address(), delegate);
96
96
  }
@@ -1,4 +1,4 @@
1
- use crate::{self as oapp, errors::OAppError, oapp_core::OAPP_ADMIN_ROLE};
1
+ use crate::{self as oapp, errors::OAppError, oapp_core::OAPP_MANAGER_ROLE};
2
2
  use common_macros::{contract_trait, only_role, storage};
3
3
  use soroban_sdk::{assert_with_error, contractevent, contracttype, panic_with_error, Bytes, Env, Vec};
4
4
  use utils::{buffer_reader::BufferReader, rbac::RoleBasedAccessControl};
@@ -53,8 +53,8 @@ pub trait OAppOptionsType3: RoleBasedAccessControl {
53
53
  ///
54
54
  /// # Arguments
55
55
  /// * `options` - A vector of EnforcedOptionParam structures specifying enforced options
56
- /// * `operator` - The address that must have OAPP_ADMIN_ROLE
57
- #[only_role(operator, OAPP_ADMIN_ROLE)]
56
+ /// * `operator` - The address that must have OAPP_MANAGER_ROLE
57
+ #[only_role(operator, OAPP_MANAGER_ROLE)]
58
58
  fn set_enforced_options(
59
59
  env: &soroban_sdk::Env,
60
60
  options: &soroban_sdk::Vec<oapp::oapp_options_type3::EnforcedOptionParam>,
@@ -4,15 +4,15 @@ mod oapp_receiver;
4
4
  mod oapp_sender;
5
5
  mod test_macros;
6
6
 
7
- use crate::oapp_core::OAPP_ADMIN_ROLE;
7
+ use crate::oapp_core::OAPP_MANAGER_ROLE;
8
8
  use soroban_sdk::{
9
9
  testutils::{MockAuth, MockAuthInvoke},
10
10
  Address, Env, IntoVal, Symbol,
11
11
  };
12
12
 
13
- /// Grants `OAPP_ADMIN_ROLE` to `owner` via the public `grant_role` interface.
13
+ /// Grants `OAPP_MANAGER_ROLE` to `owner` via the public `grant_role` interface.
14
14
  pub(super) fn grant_oapp_admin(env: &Env, contract: &Address, owner: &Address) {
15
- let role = Symbol::new(env, OAPP_ADMIN_ROLE);
15
+ let role = Symbol::new(env, OAPP_MANAGER_ROLE);
16
16
  env.mock_auths(&[MockAuth {
17
17
  address: owner,
18
18
  invoke: &MockAuthInvoke {
@@ -10,7 +10,7 @@ use crate::{
10
10
  oft_types::OftType,
11
11
  };
12
12
  use endpoint_v2::{EndpointV2, EndpointV2Client};
13
- use oapp::oapp_core::OAPP_ADMIN_ROLE;
13
+ use oapp::oapp_core::OAPP_MANAGER_ROLE;
14
14
  use simple_message_lib::{SimpleMessageLib, SimpleMessageLibClient};
15
15
  use soroban_sdk::{
16
16
  contract, contractimpl, contracttype, log,
@@ -215,7 +215,7 @@ pub fn wire_oft(env: &Env, chains: &[&ChainSetup<'_>]) {
215
215
  }
216
216
 
217
217
  fn grant_oapp_admin(env: &Env, contract: &Address, owner: &Address) {
218
- let role = Symbol::new(env, OAPP_ADMIN_ROLE);
218
+ let role = Symbol::new(env, OAPP_MANAGER_ROLE);
219
219
  env.mock_auths(&[MockAuth {
220
220
  address: owner,
221
221
  invoke: &MockAuthInvoke {
@@ -1,7 +1,7 @@
1
1
  //! Utility functions for OFT-STD integration tests.
2
2
 
3
- use crate::extensions::rate_limiter::{Direction, Mode, RateLimitConfig, RATE_LIMITER_ADMIN_ROLE};
4
- use crate::extensions::oft_fee::FEE_ADMIN_ROLE;
3
+ use crate::extensions::rate_limiter::{Direction, Mode, RateLimitConfig, RATE_LIMITER_MANAGER_ROLE};
4
+ use crate::extensions::oft_fee::FEE_MANAGER_ROLE;
5
5
  use crate::extensions::pausable::{PAUSER_ROLE, UNPAUSER_ROLE};
6
6
  use crate::integration_tests::setup::{decode_packet, ChainSetup};
7
7
  use crate::MintableClient;
@@ -406,8 +406,8 @@ pub fn is_paused(chain: &ChainSetup<'_>) -> bool {
406
406
  // ============================================================================
407
407
 
408
408
  pub fn set_fee_deposit_address(env: &Env, chain: &ChainSetup<'_>, deposit_address: &Address) {
409
- // `set_fee_deposit_address` is protected by RBAC (`FEE_ADMIN_ROLE`). Grant it to owner for tests.
410
- let role = Symbol::new(env, FEE_ADMIN_ROLE);
409
+ // `set_fee_deposit_address` is protected by RBAC (`FEE_MANAGER_ROLE`). Grant it to owner for tests.
410
+ let role = Symbol::new(env, FEE_MANAGER_ROLE);
411
411
  env.mock_auths(&[MockAuth {
412
412
  address: &chain.owner,
413
413
  invoke: &MockAuthInvoke {
@@ -433,8 +433,8 @@ pub fn set_fee_deposit_address(env: &Env, chain: &ChainSetup<'_>, deposit_addres
433
433
  }
434
434
 
435
435
  pub fn set_default_fee_bps(env: &Env, chain: &ChainSetup<'_>, fee_bps: u32) {
436
- // `set_default_fee_bps` is protected by RBAC (`FEE_ADMIN_ROLE`). Grant it to owner for tests.
437
- let role = Symbol::new(env, FEE_ADMIN_ROLE);
436
+ // `set_default_fee_bps` is protected by RBAC (`FEE_MANAGER_ROLE`). Grant it to owner for tests.
437
+ let role = Symbol::new(env, FEE_MANAGER_ROLE);
438
438
  env.mock_auths(&[MockAuth {
439
439
  address: &chain.owner,
440
440
  invoke: &MockAuthInvoke {
@@ -460,8 +460,8 @@ pub fn set_default_fee_bps(env: &Env, chain: &ChainSetup<'_>, fee_bps: u32) {
460
460
  }
461
461
 
462
462
  pub fn set_fee_bps(env: &Env, chain: &ChainSetup<'_>, dst_eid: u32, fee_bps: u32) {
463
- // `set_fee_bps` is protected by RBAC (`FEE_ADMIN_ROLE`). Grant it to owner for tests.
464
- let role = Symbol::new(env, FEE_ADMIN_ROLE);
463
+ // `set_fee_bps` is protected by RBAC (`FEE_MANAGER_ROLE`). Grant it to owner for tests.
464
+ let role = Symbol::new(env, FEE_MANAGER_ROLE);
465
465
  env.mock_auths(&[MockAuth {
466
466
  address: &chain.owner,
467
467
  invoke: &MockAuthInvoke {
@@ -510,8 +510,8 @@ pub fn set_rate_limit_with_mode(
510
510
  window_seconds: u64,
511
511
  mode: Mode,
512
512
  ) {
513
- // `set_rate_limit` is protected by RBAC (`RATE_LIMITER_ADMIN_ROLE`). Grant it to owner for tests.
514
- let role = Symbol::new(env, RATE_LIMITER_ADMIN_ROLE);
513
+ // `set_rate_limit` is protected by RBAC (`RATE_LIMITER_MANAGER_ROLE`). Grant it to owner for tests.
514
+ let role = Symbol::new(env, RATE_LIMITER_MANAGER_ROLE);
515
515
  env.mock_auths(&[MockAuth {
516
516
  address: &chain.owner,
517
517
  invoke: &MockAuthInvoke {
@@ -3,7 +3,7 @@ use soroban_sdk::{assert_with_error, contractevent, token::TokenClient, Address,
3
3
  use utils::{option_ext::OptionExt, rbac::RoleBasedAccessControl};
4
4
 
5
5
  /// Role for fee configuration (set_default_fee_bps, set_fee_bps, set_fee_deposit_address).
6
- pub const FEE_ADMIN_ROLE: &str = "FEE_ADMIN_ROLE";
6
+ pub const FEE_MANAGER_ROLE: &str = "FEE_MANAGER_ROLE";
7
7
 
8
8
  /// Base fee in basis points (10,000 BPS = 100%)
9
9
  /// Used as denominator in fee calculations
@@ -82,8 +82,8 @@ pub trait OFTFee: OFTFeeInternal + RoleBasedAccessControl {
82
82
  /// - `Some(n)`: sets the default fee to `n` basis points (must be >0 and <=10,000).
83
83
  /// - `Some(0)`: rejected — use `None` to remove the default fee instead.
84
84
  /// - `None`: removes the default fee (effective rate becomes 0).
85
- /// * `operator` - The address that must have FEE_ADMIN_ROLE
86
- #[only_role(operator, FEE_ADMIN_ROLE)]
85
+ /// * `operator` - The address that must have FEE_MANAGER_ROLE
86
+ #[only_role(operator, FEE_MANAGER_ROLE)]
87
87
  fn set_default_fee_bps(env: &soroban_sdk::Env, default_fee_bps: &Option<u32>, operator: &soroban_sdk::Address) {
88
88
  Self::__set_default_fee_bps(env, default_fee_bps);
89
89
  }
@@ -96,8 +96,8 @@ pub trait OFTFee: OFTFeeInternal + RoleBasedAccessControl {
96
96
  /// # Arguments
97
97
  /// * `dst_eid` - The destination endpoint ID
98
98
  /// * `fee_bps` - The fee rate (0-10,000), or None to remove the fee configuration
99
- /// * `operator` - The address that must have FEE_ADMIN_ROLE
100
- #[only_role(operator, FEE_ADMIN_ROLE)]
99
+ /// * `operator` - The address that must have FEE_MANAGER_ROLE
100
+ #[only_role(operator, FEE_MANAGER_ROLE)]
101
101
  fn set_fee_bps(env: &soroban_sdk::Env, dst_eid: u32, fee_bps: &Option<u32>, operator: &soroban_sdk::Address) {
102
102
  Self::__set_fee_bps(env, dst_eid, fee_bps);
103
103
  }
@@ -106,8 +106,8 @@ pub trait OFTFee: OFTFeeInternal + RoleBasedAccessControl {
106
106
  ///
107
107
  /// # Arguments
108
108
  /// * `fee_deposit_address` - The address to deposit fees to, or None to remove the fee deposit address
109
- /// * `operator` - The address that must have FEE_ADMIN_ROLE
110
- #[only_role(operator, FEE_ADMIN_ROLE)]
109
+ /// * `operator` - The address that must have FEE_MANAGER_ROLE
110
+ #[only_role(operator, FEE_MANAGER_ROLE)]
111
111
  fn set_fee_deposit_address(
112
112
  env: &soroban_sdk::Env,
113
113
  fee_deposit_address: &Option<soroban_sdk::Address>,
@@ -4,7 +4,7 @@ use soroban_sdk::{assert_with_error, contractevent, contracttype, Env};
4
4
  use utils::rbac::RoleBasedAccessControl;
5
5
 
6
6
  /// Role for rate limiter configuration (set_rate_limit).
7
- pub const RATE_LIMITER_ADMIN_ROLE: &str = "RATE_LIMITER_ADMIN_ROLE";
7
+ pub const RATE_LIMITER_MANAGER_ROLE: &str = "RATE_LIMITER_MANAGER_ROLE";
8
8
 
9
9
  // =========================================================================
10
10
  // Types
@@ -108,8 +108,8 @@ pub trait RateLimiter: RateLimiterInternal + RoleBasedAccessControl {
108
108
  /// * `direction` - The direction (Inbound or Outbound)
109
109
  /// * `eid` - The endpoint ID
110
110
  /// * `config` - The rate limit configuration, or None to remove the rate limit
111
- /// * `operator` - The address that must have RATE_LIMITER_ADMIN_ROLE
112
- #[only_role(operator, RATE_LIMITER_ADMIN_ROLE)]
111
+ /// * `operator` - The address that must have RATE_LIMITER_MANAGER_ROLE
112
+ #[only_role(operator, RATE_LIMITER_MANAGER_ROLE)]
113
113
  fn set_rate_limit(
114
114
  env: &soroban_sdk::Env,
115
115
  direction: &oft::rate_limiter::Direction,
@@ -279,7 +279,7 @@ fn calculate_decayed_in_flight(env: &Env, state: &RateLimitState) -> i128 {
279
279
  assert_with_error!(env, timestamp >= state.last_update, RateLimitError::InvalidTimestamp);
280
280
 
281
281
  let elapsed = timestamp - state.last_update;
282
- let decay = (elapsed as i128) * state.config.limit / (state.config.window_seconds as i128);
282
+ let decay = (elapsed as i128).saturating_mul(state.config.limit) / (state.config.window_seconds as i128);
283
283
 
284
284
  // Ensure the decayed in-flight amount is not negative
285
285
  (state.in_flight_on_last_update - decay).max(0)
@@ -1,7 +1,7 @@
1
1
  extern crate std;
2
2
 
3
3
  use crate::extensions::oft_fee::{OFTFee, OFTFeeError, OFTFeeInternal};
4
- use crate::extensions::oft_fee::FEE_ADMIN_ROLE;
4
+ use crate::extensions::oft_fee::FEE_MANAGER_ROLE;
5
5
  use soroban_sdk::{
6
6
  contract, contractimpl,
7
7
  testutils::{Address as _, MockAuth, MockAuthInvoke},
@@ -34,10 +34,10 @@ impl RoleBasedAccessControl for FeeTestContract {}
34
34
 
35
35
  #[contractimpl]
36
36
  impl FeeTestContract {
37
- /// Test-only: grants FEE_ADMIN_ROLE to the contract.
37
+ /// Test-only: grants FEE_MANAGER_ROLE to the contract.
38
38
  pub fn init_roles(env: Env) {
39
39
  let contract_id = env.current_contract_address();
40
- grant_role_no_auth(&env, &contract_id, &Symbol::new(&env, FEE_ADMIN_ROLE), &contract_id);
40
+ grant_role_no_auth(&env, &contract_id, &Symbol::new(&env, FEE_MANAGER_ROLE), &contract_id);
41
41
  }
42
42
 
43
43
  pub fn fee_view(env: Env, dst_eid: u32, amount_ld: i128) -> i128 {
@@ -4,7 +4,7 @@ use crate as oft;
4
4
  use crate::extensions::rate_limiter::{
5
5
  Direction, Mode, RateLimitConfig, RateLimitError, RateLimiter, RateLimiterInternal,
6
6
  };
7
- use crate::extensions::rate_limiter::RATE_LIMITER_ADMIN_ROLE;
7
+ use crate::extensions::rate_limiter::RATE_LIMITER_MANAGER_ROLE;
8
8
  use soroban_sdk::{contract, contractimpl, testutils::Ledger as _, Address, Env, Symbol};
9
9
  use utils::auth::Auth;
10
10
  use utils::rbac::{grant_role_no_auth, RoleBasedAccessControl};
@@ -32,13 +32,13 @@ impl RoleBasedAccessControl for RateLimiterTestContract {}
32
32
 
33
33
  #[contractimpl]
34
34
  impl RateLimiterTestContract {
35
- /// Test-only: grants RATE_LIMITER_ADMIN_ROLE to the contract.
35
+ /// Test-only: grants RATE_LIMITER_MANAGER_ROLE to the contract.
36
36
  pub fn init_roles(env: Env) {
37
37
  let contract_id = env.current_contract_address();
38
38
  grant_role_no_auth(
39
39
  &env,
40
40
  &contract_id,
41
- &Symbol::new(&env, RATE_LIMITER_ADMIN_ROLE),
41
+ &Symbol::new(&env, RATE_LIMITER_MANAGER_ROLE),
42
42
  &contract_id,
43
43
  );
44
44
  }
@@ -20,7 +20,7 @@ use soroban_sdk::{
20
20
  token::{StellarAssetClient, TokenClient},
21
21
  Address, Bytes, BytesN, Env, IntoVal, Symbol,
22
22
  };
23
- use oapp::oapp_core::OAPP_ADMIN_ROLE;
23
+ use oapp::oapp_core::OAPP_MANAGER_ROLE;
24
24
  use utils::rbac::grant_role_no_auth;
25
25
 
26
26
  // ============================================================================
@@ -182,9 +182,9 @@ fn setup_chain<'a>(env: &Env) -> ChainSetup<'a> {
182
182
  let shared_decimals: u32 = 6; // Default shared decimals
183
183
  let oft_address = env.register(TestOFT, (&oft_token, &owner, &endpoint_address, &delegate, &shared_decimals));
184
184
 
185
- // Grant OAPP_ADMIN_ROLE to owner so they can call set_peer, set_delegate, set_msg_inspector, etc.
185
+ // Grant OAPP_MANAGER_ROLE to owner so they can call set_peer, set_delegate, set_msg_inspector, etc.
186
186
  env.as_contract(&oft_address, || {
187
- grant_role_no_auth(env, &owner, &Symbol::new(env, OAPP_ADMIN_ROLE), &owner);
187
+ grant_role_no_auth(env, &owner, &Symbol::new(env, OAPP_MANAGER_ROLE), &owner);
188
188
  });
189
189
  let composer_address = env.register(DummyComposer, (&endpoint_address,));
190
190
 
@@ -264,7 +264,7 @@ pub fn wire_oft(env: &Env, chains: &[&ChainSetup<'_>]) {
264
264
  }
265
265
 
266
266
  fn grant_oapp_admin(env: &Env, contract: &Address, owner: &Address) {
267
- let role = soroban_sdk::Symbol::new(env, oapp::oapp_core::OAPP_ADMIN_ROLE);
267
+ let role = soroban_sdk::Symbol::new(env, oapp::oapp_core::OAPP_MANAGER_ROLE);
268
268
  env.mock_auths(&[MockAuth {
269
269
  address: owner,
270
270
  invoke: &MockAuthInvoke {
@@ -58,7 +58,7 @@ use crate::{
58
58
  use common_macros::{contract_trait, only_role};
59
59
  use endpoint_v2::{MessagingComposerClient, MessagingFee, MessagingReceipt};
60
60
  use oapp::{
61
- oapp_core::{init_ownable_oapp, OAPP_ADMIN_ROLE},
61
+ oapp_core::{init_ownable_oapp, OAPP_MANAGER_ROLE},
62
62
  oapp_options_type3::OAppOptionsType3,
63
63
  oapp_receiver::OAppReceiver,
64
64
  oapp_sender::{FeePayer, OAppSenderInternal},
@@ -448,12 +448,12 @@ pub trait OFTCore: OFTInternal {
448
448
  /// Pass `None` to remove the inspector and disable outbound validation.
449
449
  ///
450
450
  /// # Authorization
451
- /// Requires the caller to have `OAPP_ADMIN_ROLE`.
451
+ /// Requires the caller to have `OAPP_MANAGER_ROLE`.
452
452
  ///
453
453
  /// # Arguments
454
454
  /// * `inspector` - Address of the inspector contract, or `None` to remove it
455
- /// * `operator` - The address that must have OAPP_ADMIN_ROLE
456
- #[only_role(operator, OAPP_ADMIN_ROLE)]
455
+ /// * `operator` - The address that must have OAPP_MANAGER_ROLE
456
+ #[only_role(operator, OAPP_MANAGER_ROLE)]
457
457
  fn set_msg_inspector(
458
458
  env: &soroban_sdk::Env,
459
459
  inspector: &Option<soroban_sdk::Address>,
@@ -60,7 +60,7 @@ fn test_set_msg_inspector() {
60
60
  // Deploy a passing inspector
61
61
  let inspector_address = env.register(PassingInspector, ());
62
62
 
63
- // Owner (with OAPP_ADMIN_ROLE) sets the inspector
63
+ // Owner (with OAPP_MANAGER_ROLE) sets the inspector
64
64
  env.mock_auths(&[MockAuth {
65
65
  address: &setup.owner,
66
66
  invoke: &MockAuthInvoke {
@@ -127,7 +127,7 @@ fn test_set_msg_inspector_requires_owner() {
127
127
  // Deploy a passing inspector
128
128
  let inspector_address = env.register(PassingInspector, ());
129
129
 
130
- // Non-owner (without OAPP_ADMIN_ROLE) tries to set the inspector
130
+ // Non-owner (without OAPP_MANAGER_ROLE) tries to set the inspector
131
131
  let non_owner = Address::generate(&env);
132
132
  env.mock_auths(&[MockAuth {
133
133
  address: &non_owner,
@@ -139,7 +139,7 @@ fn test_set_msg_inspector_requires_owner() {
139
139
  },
140
140
  }]);
141
141
 
142
- // This should panic because non_owner does not have OAPP_ADMIN_ROLE
142
+ // This should panic because non_owner does not have OAPP_MANAGER_ROLE
143
143
  setup.oft.set_msg_inspector(&Some(inspector_address), &non_owner);
144
144
  }
145
145
 
@@ -8,7 +8,7 @@ use crate::{
8
8
  types::{OFTReceipt, SendParam},
9
9
  };
10
10
  use endpoint_v2::{LayerZeroReceiverClient, MessagingFee, MessagingParams, MessagingReceipt, Origin};
11
- use oapp::oapp_core::{OAppCoreClient, OAPP_ADMIN_ROLE};
11
+ use oapp::oapp_core::{OAppCoreClient, OAPP_MANAGER_ROLE};
12
12
  use soroban_sdk::{
13
13
  address_payload::AddressPayload,
14
14
  bytes, contract, contractimpl, log, symbol_short,
@@ -101,7 +101,7 @@ pub fn create_origin(src_eid: u32, sender: &BytesN<32>, nonce: u64) -> Origin {
101
101
  }
102
102
 
103
103
  fn grant_oapp_admin(env: &Env, contract: &Address, owner: &Address) {
104
- let role = Symbol::new(env, oapp::oapp_core::OAPP_ADMIN_ROLE);
104
+ let role = Symbol::new(env, oapp::oapp_core::OAPP_MANAGER_ROLE);
105
105
  env.mock_auths(&[MockAuth {
106
106
  address: owner,
107
107
  invoke: &MockAuthInvoke {
@@ -613,12 +613,12 @@ impl<'a> OFTTestSetupBuilder<'a> {
613
613
  OFTTestSetup::mint_to(env, &owner, &native_token, &owner, INITIAL_MINT_AMOUNT);
614
614
  OFTTestSetup::mint_to(env, &owner, &zro_token, &owner, INITIAL_MINT_AMOUNT);
615
615
 
616
- // Grant OAPP_ADMIN_ROLE to owner so they can call set_peer, set_delegate, set_msg_inspector, etc.
616
+ // Grant OAPP_MANAGER_ROLE to owner so they can call set_peer, set_delegate, set_msg_inspector, etc.
617
617
  env.as_contract(&oft_address, || {
618
618
  grant_role_no_auth(
619
619
  env,
620
620
  &owner,
621
- &Symbol::new(env, OAPP_ADMIN_ROLE),
621
+ &Symbol::new(env, OAPP_MANAGER_ROLE),
622
622
  &owner,
623
623
  );
624
624
  });
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@layerzerolabs/protocol-stellar-v2",
3
- "version": "0.2.44",
3
+ "version": "0.2.46",
4
4
  "private": false,
5
+ "license": "LZBL-1.2",
5
6
  "devDependencies": {
6
7
  "@types/node": "^22.18.6",
7
8
  "tsx": "^4.19.3",
8
9
  "typescript": "^5.8.2",
9
- "@layerzerolabs/common-node-utils": "0.2.44",
10
- "@layerzerolabs/stellar-ts-bindings-gen": "0.2.44",
11
- "@layerzerolabs/vm-tooling-stellar": "0.2.44"
10
+ "@layerzerolabs/common-node-utils": "0.2.46",
11
+ "@layerzerolabs/stellar-ts-bindings-gen": "0.2.46",
12
+ "@layerzerolabs/vm-tooling-stellar": "0.2.46"
12
13
  },
13
14
  "publishConfig": {
14
15
  "access": "restricted",
@@ -16,7 +17,8 @@
16
17
  },
17
18
  "externalRepoConfig": {
18
19
  "targets": [
19
- "audit-external"
20
+ "audit-external",
21
+ "everdawn-asset0"
20
22
  ]
21
23
  },
22
24
  "scripts": {