@layerzerolabs/protocol-stellar-v2 0.2.28 → 0.2.30

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 (205) hide show
  1. package/.turbo/turbo-build.log +371 -321
  2. package/.turbo/turbo-lint.log +211 -202
  3. package/.turbo/turbo-test.log +1766 -1673
  4. package/Cargo.lock +11 -1
  5. package/contracts/common-macros/src/lib.rs +0 -2
  6. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +1 -0
  7. package/contracts/endpoint-v2/src/messaging_channel.rs +32 -3
  8. package/contracts/endpoint-v2/src/tests/endpoint_setup.rs +1 -1
  9. package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +1 -1
  10. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +6 -6
  11. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound_payload_hash.rs +1 -1
  12. package/contracts/endpoint-v2/src/tests/messaging_channel/outbound.rs +16 -10
  13. package/contracts/macro-integration-tests/tests/runtime/oapp/options_type3.rs +10 -10
  14. package/contracts/macro-integration-tests/tests/runtime/oapp/receiver.rs +3 -3
  15. package/contracts/macro-integration-tests/tests/runtime/oapp/sender.rs +4 -3
  16. package/contracts/macro-integration-tests/tests/runtime/upgradeable/migrate_guard_and_state.rs +1 -57
  17. package/contracts/macro-integration-tests/tests/ui/lz_contract/fail/upgradeable_missing_internal.stderr +0 -30
  18. package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.stderr +5 -3
  19. package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.stderr +6 -4
  20. package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.stderr +5 -3
  21. package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.stderr +5 -3
  22. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_auth_trait.stderr +0 -30
  23. package/contracts/macro-integration-tests/tests/ui/upgradeable/fail/missing_upgradeable_internal.stderr +0 -30
  24. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/basic.rs +0 -2
  25. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/multisig_contract.rs +0 -2
  26. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_migration.rs +0 -2
  27. package/contracts/macro-integration-tests/tests/ui/upgradeable/pass/no_user_contractimpl.rs +1 -3
  28. package/contracts/message-libs/message-lib-common/src/packet_codec_v1.rs +3 -6
  29. package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +10 -0
  30. package/contracts/message-libs/message-lib-common/src/worker_options.rs +6 -2
  31. package/contracts/message-libs/treasury/src/interfaces/zro_fee_lib.rs +3 -3
  32. package/contracts/message-libs/treasury/src/lib.rs +2 -1
  33. package/contracts/message-libs/treasury/src/tests/setup.rs +1 -1
  34. package/contracts/message-libs/treasury/src/treasury.rs +5 -2
  35. package/contracts/message-libs/uln-302/src/errors.rs +2 -0
  36. package/contracts/message-libs/uln-302/src/events.rs +3 -3
  37. package/contracts/message-libs/uln-302/src/interfaces/receive_uln.rs +8 -0
  38. package/contracts/message-libs/uln-302/src/lib.rs +2 -1
  39. package/contracts/message-libs/uln-302/src/receive_uln.rs +16 -13
  40. package/contracts/message-libs/uln-302/src/send_uln.rs +51 -24
  41. package/contracts/message-libs/uln-302/src/storage.rs +2 -2
  42. package/contracts/message-libs/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +45 -1
  43. package/contracts/message-libs/uln-302/src/tests/receive_uln302/verifiable.rs +63 -0
  44. package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_executor_config.rs +47 -2
  45. package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +50 -1
  46. package/contracts/message-libs/uln-302/src/uln302.rs +0 -8
  47. package/contracts/oapps/counter/Cargo.toml +4 -4
  48. package/contracts/oapps/counter/integration_tests/setup_uln.rs +22 -2
  49. package/contracts/oapps/counter/src/counter.rs +8 -8
  50. package/contracts/oapps/oapp/src/interfaces/oapp_msg_inspector.rs +33 -10
  51. package/contracts/oapps/oapp/src/lib.rs +6 -2
  52. package/contracts/oapps/oapp/src/oapp_core.rs +49 -24
  53. package/contracts/oapps/oapp/src/oapp_options_type3.rs +21 -14
  54. package/contracts/oapps/oapp/src/oapp_receiver.rs +17 -16
  55. package/contracts/oapps/oapp/src/oapp_sender.rs +66 -15
  56. package/contracts/oapps/oapp/src/tests/oapp_core.rs +5 -5
  57. package/contracts/oapps/oapp/src/tests/oapp_options_type3.rs +18 -18
  58. package/contracts/oapps/oapp/src/tests/oapp_receiver.rs +4 -4
  59. package/contracts/oapps/oapp/src/tests/oapp_sender.rs +3 -3
  60. package/contracts/oapps/oapp-macros/Cargo.toml +0 -1
  61. package/contracts/oapps/oapp-macros/src/generators.rs +87 -46
  62. package/contracts/oapps/oapp-macros/src/lib.rs +3 -61
  63. package/contracts/oapps/oapp-macros/src/tests/oapp.rs +9 -23
  64. package/contracts/oapps/oapp-macros/src/tests/parse_custom_impls.rs +15 -11
  65. package/contracts/oapps/oft/Cargo.toml +1 -1
  66. package/contracts/oapps/oft/integration-tests/extensions/test_oft_fee.rs +3 -3
  67. package/contracts/oapps/oft/integration-tests/extensions/test_pausable.rs +4 -4
  68. package/contracts/oapps/oft/integration-tests/extensions/test_rate_limiter.rs +144 -8
  69. package/contracts/oapps/oft/integration-tests/setup.rs +4 -2
  70. package/contracts/oapps/oft/integration-tests/utils.rs +25 -11
  71. package/contracts/oapps/oft/src/extensions/oft_fee.rs +65 -63
  72. package/contracts/oapps/oft/src/extensions/pausable.rs +2 -3
  73. package/contracts/oapps/oft/src/extensions/rate_limiter.rs +22 -5
  74. package/contracts/oapps/oft/src/interfaces/mint_burnable.rs +18 -0
  75. package/contracts/oapps/oft/src/interfaces/mod.rs +3 -0
  76. package/contracts/oapps/oft/src/lib.rs +4 -2
  77. package/contracts/oapps/oft/src/oft.rs +35 -36
  78. package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +13 -9
  79. package/contracts/oapps/oft/src/oft_types/mint_burn.rs +14 -9
  80. package/contracts/oapps/oft/src/oft_types/mod.rs +14 -12
  81. package/contracts/oapps/oft/src/tests/extensions/oft_fee.rs +28 -20
  82. package/contracts/oapps/oft/src/tests/extensions/rate_limiter.rs +136 -2
  83. package/contracts/oapps/oft/src/tests/oft_types/lock_unlock.rs +12 -8
  84. package/contracts/oapps/oft-core/integration-tests/setup.rs +8 -9
  85. package/contracts/oapps/oft-core/integration-tests/test_with_sml.rs +7 -6
  86. package/contracts/oapps/oft-core/integration-tests/utils.rs +5 -4
  87. package/contracts/oapps/oft-core/src/codec/oft_compose_msg_codec.rs +2 -2
  88. package/contracts/oapps/oft-core/src/codec/oft_msg_codec.rs +33 -37
  89. package/contracts/oapps/oft-core/src/errors.rs +2 -1
  90. package/contracts/oapps/oft-core/src/events.rs +6 -0
  91. package/contracts/oapps/oft-core/src/lib.rs +8 -4
  92. package/contracts/oapps/oft-core/src/oft_core.rs +205 -148
  93. package/contracts/oapps/oft-core/src/storage.rs +4 -2
  94. package/contracts/oapps/oft-core/src/tests/test_decimals.rs +2 -2
  95. package/contracts/oapps/oft-core/src/tests/test_lz_receive.rs +6 -6
  96. package/contracts/oapps/oft-core/src/tests/test_msg_inspector.rs +7 -6
  97. package/contracts/oapps/oft-core/src/tests/test_oft_msg_codec.rs +11 -82
  98. package/contracts/oapps/oft-core/src/tests/test_quote_oft.rs +13 -13
  99. package/contracts/oapps/oft-core/src/tests/test_quote_send.rs +1 -1
  100. package/contracts/oapps/oft-core/src/tests/test_resolve_address.rs +2 -2
  101. package/contracts/oapps/oft-core/src/tests/test_send.rs +22 -22
  102. package/contracts/oapps/oft-core/src/tests/test_utils.rs +20 -22
  103. package/contracts/oapps/oft-core/src/utils.rs +12 -8
  104. package/contracts/sac-manager/Cargo.toml +25 -0
  105. package/contracts/sac-manager/src/errors.rs +18 -0
  106. package/contracts/sac-manager/src/extensions/mod.rs +6 -0
  107. package/contracts/sac-manager/src/extensions/redistribution.rs +109 -0
  108. package/contracts/sac-manager/src/extensions/supply_control/mod.rs +488 -0
  109. package/contracts/sac-manager/src/extensions/supply_control/rate_limit.rs +126 -0
  110. package/contracts/sac-manager/src/interfaces/mod.rs +3 -0
  111. package/contracts/sac-manager/src/interfaces/sac_manager.rs +52 -0
  112. package/contracts/sac-manager/src/lib.rs +23 -0
  113. package/contracts/sac-manager/src/sac_manager.rs +193 -0
  114. package/contracts/sac-manager/src/storage.rs +20 -0
  115. package/contracts/sac-manager/src/tests/mod.rs +14 -0
  116. package/contracts/sac-manager/src/tests/redistribution/mod.rs +1 -0
  117. package/contracts/sac-manager/src/tests/redistribution/redistribute_funds.rs +82 -0
  118. package/contracts/sac-manager/src/tests/sac_manager/admin_mint.rs +206 -0
  119. package/contracts/sac-manager/src/tests/sac_manager/burn.rs +215 -0
  120. package/contracts/sac-manager/src/tests/sac_manager/clawback.rs +209 -0
  121. package/contracts/sac-manager/src/tests/sac_manager/mint.rs +252 -0
  122. package/contracts/sac-manager/src/tests/sac_manager/mod.rs +9 -0
  123. package/contracts/sac-manager/src/tests/sac_manager/set_admin.rs +36 -0
  124. package/contracts/sac-manager/src/tests/sac_manager/set_authorized.rs +43 -0
  125. package/contracts/sac-manager/src/tests/sac_manager/set_oft_address.rs +47 -0
  126. package/contracts/sac-manager/src/tests/sac_manager/test_helper.rs +75 -0
  127. package/contracts/sac-manager/src/tests/sac_manager/view_functions.rs +60 -0
  128. package/contracts/sac-manager/src/tests/supply_control/enumerable_set.rs +256 -0
  129. package/contracts/sac-manager/src/tests/supply_control/mod.rs +8 -0
  130. package/contracts/sac-manager/src/tests/supply_control/refill.rs +90 -0
  131. package/contracts/sac-manager/src/tests/supply_control/set_mint_whitelist.rs +245 -0
  132. package/contracts/sac-manager/src/tests/supply_control/set_supply_controller.rs +267 -0
  133. package/contracts/sac-manager/src/tests/supply_control/set_supply_controller_manager.rs +122 -0
  134. package/contracts/sac-manager/src/tests/supply_control/test_helper.rs +38 -0
  135. package/contracts/sac-manager/src/tests/supply_control/update_allow_any_mint_burn.rs +114 -0
  136. package/contracts/sac-manager/src/tests/supply_control/update_limit_config.rs +257 -0
  137. package/contracts/sac-manager/src/tests/test_helper.rs +190 -0
  138. package/contracts/upgrader/src/lib.rs +2 -1
  139. package/contracts/utils/src/errors.rs +0 -1
  140. package/contracts/utils/src/tests/upgradeable.rs +0 -66
  141. package/contracts/utils/src/upgradeable.rs +0 -18
  142. package/contracts/workers/dvn/src/dvn.rs +2 -2
  143. package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
  144. package/contracts/workers/dvn/src/lib.rs +2 -1
  145. package/contracts/workers/dvn-fee-lib/src/lib.rs +3 -1
  146. package/contracts/workers/executor/src/auth.rs +42 -26
  147. package/contracts/workers/executor/src/executor.rs +28 -3
  148. package/contracts/workers/executor/src/lib.rs +4 -2
  149. package/contracts/workers/executor/src/storage.rs +21 -1
  150. package/contracts/workers/executor/src/tests/auth.rs +64 -20
  151. package/contracts/workers/executor/src/tests/executor.rs +1 -1
  152. package/contracts/workers/executor/src/tests/setup.rs +18 -0
  153. package/contracts/workers/executor-fee-lib/src/lib.rs +4 -1
  154. package/contracts/workers/executor-helper/src/executor_helper.rs +24 -10
  155. package/contracts/workers/executor-helper/src/tests/setup.rs +147 -34
  156. package/contracts/workers/price-feed/src/lib.rs +3 -1
  157. package/contracts/workers/worker/src/lib.rs +2 -1
  158. package/contracts/workers/worker/src/worker.rs +31 -17
  159. package/docs/oapp-guide.md +17 -8
  160. package/docs/oft-guide.md +3 -3
  161. package/package.json +3 -3
  162. package/sdk/.turbo/turbo-test.log +512 -351
  163. package/sdk/dist/generated/bml.d.ts +3 -9
  164. package/sdk/dist/generated/bml.js +6 -7
  165. package/sdk/dist/generated/counter.d.ts +22 -28
  166. package/sdk/dist/generated/counter.js +11 -12
  167. package/sdk/dist/generated/dvn.d.ts +36 -54
  168. package/sdk/dist/generated/dvn.js +10 -15
  169. package/sdk/dist/generated/dvn_fee_lib.d.ts +3 -21
  170. package/sdk/dist/generated/dvn_fee_lib.js +6 -11
  171. package/sdk/dist/generated/endpoint.d.ts +3 -9
  172. package/sdk/dist/generated/endpoint.js +6 -7
  173. package/sdk/dist/generated/executor.d.ts +80 -54
  174. package/sdk/dist/generated/executor.js +16 -16
  175. package/sdk/dist/generated/executor_fee_lib.d.ts +3 -21
  176. package/sdk/dist/generated/executor_fee_lib.js +6 -11
  177. package/sdk/dist/generated/executor_helper.d.ts +36 -42
  178. package/sdk/dist/generated/executor_helper.js +9 -10
  179. package/sdk/dist/generated/layerzero_view.d.ts +20 -32
  180. package/sdk/dist/generated/layerzero_view.js +25 -26
  181. package/sdk/dist/generated/oft.d.ts +147 -79
  182. package/sdk/dist/generated/oft.js +47 -54
  183. package/sdk/dist/generated/price_feed.d.ts +20 -38
  184. package/sdk/dist/generated/price_feed.js +15 -20
  185. package/sdk/dist/generated/sac_manager.d.ts +1309 -0
  186. package/sdk/dist/generated/sac_manager.js +484 -0
  187. package/sdk/dist/generated/sml.d.ts +3 -9
  188. package/sdk/dist/generated/sml.js +6 -7
  189. package/sdk/dist/generated/treasury.d.ts +3 -9
  190. package/sdk/dist/generated/treasury.js +8 -9
  191. package/sdk/dist/generated/uln302.d.ts +20 -20
  192. package/sdk/dist/generated/uln302.js +25 -22
  193. package/sdk/dist/generated/upgrader.d.ts +3 -9
  194. package/sdk/dist/generated/upgrader.js +6 -7
  195. package/sdk/dist/index.d.ts +1 -0
  196. package/sdk/dist/index.js +1 -0
  197. package/sdk/package.json +1 -1
  198. package/sdk/src/index.ts +1 -0
  199. package/sdk/test/oft-sml.test.ts +7 -5
  200. package/sdk/test/sac-manager-redistribution.test.ts +578 -0
  201. package/sdk/test/suites/globalSetup.ts +11 -6
  202. package/sdk/test/test_data/test_upgradeable_dvn.wasm +0 -0
  203. package/sdk/test/upgrader.test.ts +75 -202
  204. package/sdk/test/utils.ts +40 -0
  205. package/tools/ts-bindings-gen/src/main.rs +1 -0
@@ -253,7 +253,7 @@ impl MockExecutor {
253
253
  origin: &Origin,
254
254
  dst_eid: u32,
255
255
  oapp: &Address,
256
- params: &Vec<NativeDropParams>,
256
+ native_drop_params: &Vec<NativeDropParams>,
257
257
  ) {
258
258
  admin.require_auth();
259
259
  let record = NativeDropRecord {
@@ -261,7 +261,7 @@ impl MockExecutor {
261
261
  origin: origin.clone(),
262
262
  dst_eid,
263
263
  oapp: oapp.clone(),
264
- params: params.clone(),
264
+ params: native_drop_params.clone(),
265
265
  };
266
266
  env.storage().instance().set(&Symbol::new(env, "native_drop"), &record);
267
267
  }
@@ -278,6 +278,7 @@ impl MockExecutor {
278
278
  pub struct TestSetup<'a> {
279
279
  pub env: Env,
280
280
  pub executor_helper_client: ExecutorHelperClient<'a>,
281
+ pub executor_helper: Address,
281
282
  pub executor: Address,
282
283
  pub endpoint: Address,
283
284
  pub receiver: Address,
@@ -314,12 +315,13 @@ impl<'a> TestSetup<'a> {
314
315
  let admin = Address::generate(&env);
315
316
 
316
317
  // Register ExecutorHelper contract
317
- let contract_id = env.register(ExecutorHelper, ());
318
- let client = ExecutorHelperClient::new(&env, &contract_id);
318
+ let executor_helper = env.register(ExecutorHelper, ());
319
+ let client = ExecutorHelperClient::new(&env, &executor_helper);
319
320
 
320
321
  Self {
321
322
  env,
322
323
  executor_helper_client: client,
324
+ executor_helper,
323
325
  executor,
324
326
  endpoint,
325
327
  receiver,
@@ -349,37 +351,147 @@ impl<'a> TestSetup<'a> {
349
351
  }
350
352
 
351
353
  pub fn mock_lz_receive_auth(&self, executor: &Address, params: &ExecutionParams) {
352
- self.env.mock_auths(&[MockAuth {
353
- address: executor,
354
- invoke: &MockAuthInvoke {
355
- contract: &params.receiver,
356
- fn_name: "lz_receive",
357
- args: (executor, &params.origin, &params.guid, &params.message, &params.extra_data, &params.value)
358
- .into_val(&self.env),
359
- sub_invokes: &[],
360
- },
361
- }]);
354
+ if params.value == 0 {
355
+ // No value transfer - executor auth with lz_receive sub-invoke
356
+ self.env.mock_auths(&[MockAuth {
357
+ address: executor,
358
+ invoke: &MockAuthInvoke {
359
+ contract: &self.executor_helper,
360
+ fn_name: "execute",
361
+ args: (executor, params, &self.admin).into_val(&self.env),
362
+ sub_invokes: &[MockAuthInvoke {
363
+ contract: &params.receiver,
364
+ fn_name: "lz_receive",
365
+ args: (
366
+ executor,
367
+ &params.origin,
368
+ &params.guid,
369
+ &params.message,
370
+ &params.extra_data,
371
+ &params.value,
372
+ )
373
+ .into_val(&self.env),
374
+ sub_invokes: &[],
375
+ }],
376
+ },
377
+ }]);
378
+ } else {
379
+ // With value transfer - executor auth with lz_receive and transfer sub-invokes
380
+ self.env.mock_auths(&[
381
+ MockAuth {
382
+ address: executor,
383
+ invoke: &MockAuthInvoke {
384
+ contract: &self.executor_helper,
385
+ fn_name: "execute",
386
+ args: (executor, params, &self.admin).into_val(&self.env),
387
+ sub_invokes: &[
388
+ MockAuthInvoke {
389
+ contract: &params.receiver,
390
+ fn_name: "lz_receive",
391
+ args: (
392
+ executor,
393
+ &params.origin,
394
+ &params.guid,
395
+ &params.message,
396
+ &params.extra_data,
397
+ &params.value,
398
+ )
399
+ .into_val(&self.env),
400
+ sub_invokes: &[],
401
+ },
402
+ MockAuthInvoke {
403
+ contract: &self.native_token,
404
+ fn_name: "transfer",
405
+ args: (&self.admin, executor, &params.value).into_val(&self.env),
406
+ sub_invokes: &[],
407
+ },
408
+ ],
409
+ },
410
+ },
411
+ MockAuth {
412
+ address: &self.admin,
413
+ invoke: &MockAuthInvoke {
414
+ contract: &self.native_token,
415
+ fn_name: "transfer",
416
+ args: (&self.admin, executor, &params.value).into_val(&self.env),
417
+ sub_invokes: &[],
418
+ },
419
+ },
420
+ ]);
421
+ }
362
422
  }
363
423
 
364
424
  pub fn mock_lz_compose_auth(&self, executor: &Address, params: &ComposeParams) {
365
- self.env.mock_auths(&[MockAuth {
366
- address: executor,
367
- invoke: &MockAuthInvoke {
368
- contract: &params.to,
369
- fn_name: "lz_compose",
370
- args: (
371
- executor,
372
- &params.from,
373
- &params.guid,
374
- &params.index,
375
- &params.message,
376
- &params.extra_data,
377
- &params.value,
378
- )
379
- .into_val(&self.env),
380
- sub_invokes: &[],
381
- },
382
- }]);
425
+ if params.value == 0 {
426
+ // No value transfer - executor auth with lz_compose sub-invoke
427
+ self.env.mock_auths(&[MockAuth {
428
+ address: executor,
429
+ invoke: &MockAuthInvoke {
430
+ contract: &self.executor_helper,
431
+ fn_name: "compose",
432
+ args: (executor, params, &self.admin).into_val(&self.env),
433
+ sub_invokes: &[MockAuthInvoke {
434
+ contract: &params.to,
435
+ fn_name: "lz_compose",
436
+ args: (
437
+ executor,
438
+ &params.from,
439
+ &params.guid,
440
+ &params.index,
441
+ &params.message,
442
+ &params.extra_data,
443
+ &params.value,
444
+ )
445
+ .into_val(&self.env),
446
+ sub_invokes: &[],
447
+ }],
448
+ },
449
+ }]);
450
+ } else {
451
+ // With value transfer - executor auth with lz_compose and transfer sub-invokes
452
+ self.env.mock_auths(&[
453
+ MockAuth {
454
+ address: executor,
455
+ invoke: &MockAuthInvoke {
456
+ contract: &self.executor_helper,
457
+ fn_name: "compose",
458
+ args: (executor, params, &self.admin).into_val(&self.env),
459
+ sub_invokes: &[
460
+ MockAuthInvoke {
461
+ contract: &params.to,
462
+ fn_name: "lz_compose",
463
+ args: (
464
+ executor,
465
+ &params.from,
466
+ &params.guid,
467
+ &params.index,
468
+ &params.message,
469
+ &params.extra_data,
470
+ &params.value,
471
+ )
472
+ .into_val(&self.env),
473
+ sub_invokes: &[],
474
+ },
475
+ MockAuthInvoke {
476
+ contract: &self.native_token,
477
+ fn_name: "transfer",
478
+ args: (&self.admin, executor, &params.value).into_val(&self.env),
479
+ sub_invokes: &[],
480
+ },
481
+ ],
482
+ },
483
+ },
484
+ MockAuth {
485
+ address: &self.admin,
486
+ invoke: &MockAuthInvoke {
487
+ contract: &self.native_token,
488
+ fn_name: "transfer",
489
+ args: (&self.admin, executor, &params.value).into_val(&self.env),
490
+ sub_invokes: &[],
491
+ },
492
+ },
493
+ ]);
494
+ }
383
495
  }
384
496
 
385
497
  pub fn mock_native_drop_auth(
@@ -389,14 +501,15 @@ impl<'a> TestSetup<'a> {
389
501
  origin: &Origin,
390
502
  dst_eid: u32,
391
503
  oapp: &Address,
392
- params: &Vec<NativeDropParams>,
504
+ native_drop_params: &Vec<NativeDropParams>,
393
505
  ) {
506
+ // native_drop on executor contract only requires admin auth
394
507
  self.env.mock_auths(&[MockAuth {
395
508
  address: admin,
396
509
  invoke: &MockAuthInvoke {
397
510
  contract: executor,
398
511
  fn_name: "native_drop",
399
- args: (admin, origin, &dst_eid, oapp, params).into_val(&self.env),
512
+ args: (admin, origin, &dst_eid, oapp, native_drop_params).into_val(&self.env),
400
513
  sub_invokes: &[],
401
514
  },
402
515
  }]);
@@ -1,9 +1,11 @@
1
1
  #![no_std]
2
2
 
3
- pub mod errors;
4
3
  pub mod events;
5
4
  pub mod types;
6
5
 
6
+ mod errors;
7
+ pub use errors::*;
8
+
7
9
  cfg_if::cfg_if! {
8
10
  // Include implementation when NOT in library mode, OR when testutils is enabled (for tests)
9
11
  if #[cfg(any(not(feature = "library"), feature = "testutils"))] {
@@ -1,11 +1,12 @@
1
1
  #![no_std]
2
2
 
3
- pub mod errors;
4
3
  pub mod events;
5
4
  pub mod storage;
6
5
 
6
+ mod errors;
7
7
  mod worker;
8
8
 
9
+ pub use errors::*;
9
10
  pub use worker::*;
10
11
 
11
12
  #[cfg(test)]
@@ -6,9 +6,9 @@ use crate::{
6
6
  },
7
7
  storage::WorkerStorage,
8
8
  };
9
- use common_macros::contract_trait;
9
+ use common_macros::{contract_trait, only_auth};
10
10
  use soroban_sdk::{assert_with_error, panic_with_error, Address, Env, Vec};
11
- use utils::auth::{self, Auth};
11
+ use utils::auth::Auth;
12
12
 
13
13
  /// Worker interface providing common functionality for LayerZero workers.
14
14
  ///
@@ -28,10 +28,11 @@ pub trait Worker: Auth {
28
28
  ///
29
29
  /// # Arguments
30
30
  /// * `paused` - `true` to pause, `false` to unpause
31
+ #[only_auth]
31
32
  fn set_paused(env: &soroban_sdk::Env, paused: bool) {
32
- let authorizer = auth::enforce_auth::<Self>(env);
33
33
  assert_with_error!(env, Self::paused(env) != paused, WorkerError::PauseStatusUnchanged);
34
34
 
35
+ let authorizer = Self::authorizer(env);
35
36
  WorkerStorage::set_paused(env, &paused);
36
37
  if paused {
37
38
  Paused { pauser: authorizer }.publish(env);
@@ -48,8 +49,8 @@ pub trait Worker: Auth {
48
49
  /// # Arguments
49
50
  /// * `admin` - The address to set admin status for
50
51
  /// * `active` - `true` to add admin, `false` to remove
52
+ #[only_auth]
51
53
  fn set_admin(env: &soroban_sdk::Env, admin: &soroban_sdk::Address, active: bool) {
52
- auth::require_auth::<Self>(env);
53
54
  set_admin_no_auth::<Self>(env, admin, active);
54
55
  }
55
56
 
@@ -61,8 +62,8 @@ pub trait Worker: Auth {
61
62
  /// # Arguments
62
63
  /// * `message_lib` - The message library contract address
63
64
  /// * `supported` - `true` to add support, `false` to remove support
65
+ #[only_auth]
64
66
  fn set_supported_message_lib(env: &soroban_sdk::Env, message_lib: &soroban_sdk::Address, supported: bool) {
65
- auth::require_auth::<Self>(env);
66
67
  set_message_lib_no_auth::<Self>(env, message_lib, supported);
67
68
  }
68
69
 
@@ -75,9 +76,8 @@ pub trait Worker: Auth {
75
76
  /// # Arguments
76
77
  /// * `oapp` - The OApp contract address
77
78
  /// * `allowed` - `true` to add to allowlist, `false` to remove
79
+ #[only_auth]
78
80
  fn set_allowlist(env: &soroban_sdk::Env, oapp: &soroban_sdk::Address, allowed: bool) {
79
- auth::require_auth::<Self>(env);
80
-
81
81
  let is_on_list = Self::is_on_allowlist(env, oapp);
82
82
  if allowed {
83
83
  // Add to allowlist - ensure not already present
@@ -105,8 +105,8 @@ pub trait Worker: Auth {
105
105
  /// # Arguments
106
106
  /// * `oapp` - The OApp contract address
107
107
  /// * `denied` - `true` to add to denylist, `false` to remove
108
+ #[only_auth]
108
109
  fn set_denylist(env: &soroban_sdk::Env, oapp: &soroban_sdk::Address, denied: bool) {
109
- auth::require_auth::<Self>(env);
110
110
  let is_on_list = Self::is_on_denylist(env, oapp);
111
111
 
112
112
  if denied {
@@ -151,8 +151,7 @@ pub trait Worker: Auth {
151
151
  deposit_address: &soroban_sdk::Address,
152
152
  ) {
153
153
  require_admin_auth::<Self>(env, admin);
154
- WorkerStorage::set_deposit_address(env, deposit_address);
155
- SetDepositAddress { deposit_address: deposit_address.clone() }.publish(env);
154
+ set_deposit_address_no_auth(env, deposit_address);
156
155
  }
157
156
 
158
157
  /// Sets supported executor option types for a destination endpoint.
@@ -181,8 +180,7 @@ pub trait Worker: Auth {
181
180
  /// * `worker_fee_lib` - Fee library contract address implementing `IExecutorFeeLib`
182
181
  fn set_worker_fee_lib(env: &soroban_sdk::Env, admin: &soroban_sdk::Address, worker_fee_lib: &soroban_sdk::Address) {
183
182
  require_admin_auth::<Self>(env, admin);
184
- WorkerStorage::set_worker_fee_lib(env, worker_fee_lib);
185
- SetWorkerFeeLib { fee_lib: worker_fee_lib.clone() }.publish(env);
183
+ set_worker_fee_lib_no_auth(env, worker_fee_lib);
186
184
  }
187
185
 
188
186
  /// Sets the price feed contract address.
@@ -195,8 +193,7 @@ pub trait Worker: Auth {
195
193
  /// * `price_feed` - Price feed contract address implementing `ILayerZeroPriceFeed`
196
194
  fn set_price_feed(env: &soroban_sdk::Env, admin: &soroban_sdk::Address, price_feed: &soroban_sdk::Address) {
197
195
  require_admin_auth::<Self>(env, admin);
198
- WorkerStorage::set_price_feed(env, price_feed);
199
- SetPriceFeed { price_feed: price_feed.clone() }.publish(env);
196
+ set_price_feed_no_auth(env, price_feed);
200
197
  }
201
198
 
202
199
  // ========================================================================
@@ -329,9 +326,8 @@ pub fn init_worker<T: Worker>(
329
326
 
330
327
  set_price_feed_no_auth(env, price_feed);
331
328
  set_default_multiplier_bps_no_auth(env, default_multiplier_bps);
332
-
333
- WorkerStorage::set_worker_fee_lib(env, worker_fee_lib);
334
- WorkerStorage::set_deposit_address(env, deposit_address);
329
+ set_worker_fee_lib_no_auth(env, worker_fee_lib);
330
+ set_deposit_address_no_auth(env, deposit_address);
335
331
  }
336
332
 
337
333
  // ============================================================================================
@@ -449,6 +445,24 @@ fn set_message_lib_no_auth<T: Worker>(env: &Env, message_lib: &Address, supporte
449
445
  SetSupportedMessageLib { message_lib: message_lib.clone(), supported }.publish(env);
450
446
  }
451
447
 
448
+ /// Sets the deposit address without authentication.
449
+ ///
450
+ /// # Arguments
451
+ /// * `deposit_address` - Address to receive collected fees
452
+ fn set_deposit_address_no_auth(env: &Env, deposit_address: &Address) {
453
+ WorkerStorage::set_deposit_address(env, deposit_address);
454
+ SetDepositAddress { deposit_address: deposit_address.clone() }.publish(env);
455
+ }
456
+
457
+ /// Sets the worker fee library contract address without authentication.
458
+ ///
459
+ /// # Arguments
460
+ /// * `worker_fee_lib` - Fee library contract address
461
+ fn set_worker_fee_lib_no_auth(env: &Env, worker_fee_lib: &Address) {
462
+ WorkerStorage::set_worker_fee_lib(env, worker_fee_lib);
463
+ SetWorkerFeeLib { fee_lib: worker_fee_lib.clone() }.publish(env);
464
+ }
465
+
452
466
  /// Sets the price feed contract address without authentication.
453
467
  ///
454
468
  /// # Arguments
@@ -40,8 +40,11 @@ impl LzReceiveInternal for MyOApp {
40
40
 
41
41
  The macro automatically generates:
42
42
 
43
- - `#[contract]` attribute
44
- - `#[ownable]` trait implementation
43
+ - `#[common_macros::lz_contract]` attribute, which combines:
44
+ - `#[soroban_sdk::contract]` makes the struct a Soroban contract
45
+ - `#[common_macros::ownable]` — adds single-owner access control
46
+ - `#[common_macros::ttl_configurable]` — adds TTL configuration with auth
47
+ - `#[common_macros::ttl_extendable]` — adds manual TTL extension support
45
48
  - `OAppCore` implementation
46
49
  - `OAppSenderInternal` implementation
47
50
  - `OAppReceiver` implementation
@@ -57,7 +60,7 @@ use oapp::oapp_core::initialize_oapp;
57
60
  #[contract_impl]
58
61
  impl MyOApp {
59
62
  pub fn __constructor(env: &Env, owner: &Address, endpoint: &Address, delegate: &Address) {
60
- initialize_oapp::<Self>(env, owner, endpoint, &Some(delegate.clone()));
63
+ initialize_oapp::<Self>(env, owner, endpoint, delegate);
61
64
  }
62
65
  }
63
66
  ```
@@ -66,7 +69,7 @@ The `initialize_oapp` function:
66
69
 
67
70
  1. Sets the contract owner
68
71
  2. Stores the LayerZero endpoint address
69
- 3. Optionally sets a delegate on the endpoint
72
+ 3. Sets a delegate on the endpoint
70
73
 
71
74
  ## Peer management
72
75
 
@@ -90,14 +93,15 @@ Peers are stored as `BytesN<32>` to maintain cross-chain address compatibility.
90
93
  Use the internal sender methods to send cross-chain messages:
91
94
 
92
95
  ```rust
93
- use oapp::oapp_sender::OAppSenderInternal;
96
+ use oapp::oapp_sender::{FeePayer, OAppSenderInternal};
94
97
 
95
98
  impl MyOApp {
96
99
  pub fn send_message(env: &Env, caller: &Address, dst_eid: u32, message: &Bytes, options: &Bytes, fee: &MessagingFee) {
97
100
  caller.require_auth();
98
101
 
99
- // Send the message (handles fee payment automatically)
100
- Self::__lz_send(env, dst_eid, message, options, caller, fee, caller);
102
+ // Send the message caller already authorized, use FeePayer::Verified to avoid
103
+ // a duplicate require_auth() node in the Soroban auth tree.
104
+ Self::__lz_send(env, dst_eid, message, options, &FeePayer::Verified(caller.clone()), fee, caller);
101
105
  }
102
106
 
103
107
  pub fn quote(env: &Env, dst_eid: u32, message: &Bytes, options: &Bytes, pay_in_zro: bool) -> MessagingFee {
@@ -106,7 +110,12 @@ impl MyOApp {
106
110
  }
107
111
  ```
108
112
 
109
- The `__lz_send` method:
113
+ The `__lz_send` method accepts a [`FeePayer`] enum that indicates authorization state:
114
+
115
+ - `FeePayer::Unverified(addr)` — Safe default. `__lz_send` will call `addr.require_auth()`.
116
+ - `FeePayer::Verified(addr)` — Caller already called `require_auth()` on this address.
117
+
118
+ The method then:
110
119
 
111
120
  1. Transfers the native fee from the payer to the endpoint
112
121
  2. Transfers the ZRO fee if applicable
package/docs/oft-guide.md CHANGED
@@ -107,10 +107,10 @@ impl MyOFT {
107
107
  token: &Address,
108
108
  owner: &Address,
109
109
  endpoint: &Address,
110
- delegate: &Option<Address>,
110
+ delegate: &Address,
111
111
  ) {
112
112
  // shared_decimals = 6 is common for cross-chain compatibility
113
- Self::__initialize_oft(env, owner, token, endpoint, delegate, 6);
113
+ Self::__initialize_oft(env, token, 6, owner, endpoint, delegate);
114
114
  }
115
115
  }
116
116
 
@@ -159,7 +159,7 @@ Receive: 1_500_000 shared → 1.5 tokens in local decimals
159
159
 
160
160
  ```rust
161
161
  // 1. Quote the transfer
162
- let (limit, fee_details, receipt) = oft.quote_oft(&send_param);
162
+ let (limit, fee_details, receipt) = oft.quote_oft(&from, &send_param);
163
163
 
164
164
  // 2. Quote LayerZero fees
165
165
  let messaging_fee = oft.quote_send(&from, &send_param, false);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@layerzerolabs/protocol-stellar-v2",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "private": false,
5
5
  "devDependencies": {
6
6
  "@types/node": "^22.18.6",
7
7
  "tsx": "^4.19.3",
8
8
  "typescript": "^5.8.2",
9
- "@layerzerolabs/common-node-utils": "0.2.28",
10
- "@layerzerolabs/vm-tooling-stellar": "0.2.28"
9
+ "@layerzerolabs/common-node-utils": "0.2.30",
10
+ "@layerzerolabs/vm-tooling-stellar": "0.2.30"
11
11
  },
12
12
  "publishConfig": {
13
13
  "access": "restricted",