@layerzerolabs/protocol-stellar-v2 0.2.20 → 0.2.21

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 (198) hide show
  1. package/.turbo/turbo-build.log +783 -802
  2. package/.turbo/turbo-lint.log +320 -157
  3. package/.turbo/turbo-test.log +1414 -1457
  4. package/Cargo.lock +109 -108
  5. package/Cargo.toml +32 -18
  6. package/contracts/common-macros/Cargo.toml +7 -7
  7. package/contracts/common-macros/src/auth.rs +18 -37
  8. package/contracts/common-macros/src/contract_ttl.rs +2 -2
  9. package/contracts/common-macros/src/lib.rs +27 -10
  10. package/contracts/common-macros/src/lz_contract.rs +38 -7
  11. package/contracts/common-macros/src/storage.rs +251 -292
  12. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +6 -12
  13. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +12 -17
  14. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +2 -7
  15. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +20 -9
  16. package/contracts/common-macros/src/tests/upgradeable.rs +26 -4
  17. package/contracts/common-macros/src/ttl_configurable.rs +2 -10
  18. package/contracts/common-macros/src/ttl_extendable.rs +2 -10
  19. package/contracts/common-macros/src/upgradeable.rs +56 -15
  20. package/contracts/common-macros/src/utils.rs +0 -9
  21. package/contracts/endpoint-v2/src/lib.rs +3 -2
  22. package/contracts/endpoint-v2/src/tests/endpoint_v2/clear.rs +2 -2
  23. package/contracts/endpoint-v2/src/tests/endpoint_v2/lz_receive_alert.rs +3 -3
  24. package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +4 -4
  25. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_delegate.rs +17 -5
  26. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +4 -4
  27. package/contracts/endpoint-v2/src/tests/endpoint_v2/verify.rs +2 -2
  28. package/contracts/endpoint-v2/src/tests/message_lib_manager/register_library.rs +2 -2
  29. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_lib_timeout.rs +6 -6
  30. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_receive_library.rs +67 -37
  31. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_default_send_library.rs +5 -5
  32. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library.rs +44 -54
  33. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_receive_library_timeout.rs +7 -7
  34. package/contracts/endpoint-v2/src/tests/message_lib_manager/set_send_library.rs +8 -8
  35. package/contracts/endpoint-v2/src/tests/messaging_channel/burn.rs +3 -3
  36. package/contracts/endpoint-v2/src/tests/messaging_channel/nilify.rs +4 -4
  37. package/contracts/endpoint-v2/src/tests/messaging_channel/skip.rs +3 -3
  38. package/contracts/endpoint-v2/src/tests/messaging_composer/clear_compose.rs +2 -2
  39. package/contracts/endpoint-v2/src/tests/messaging_composer/lz_compose_alert.rs +3 -3
  40. package/contracts/endpoint-v2/src/tests/messaging_composer/send_compose.rs +2 -2
  41. package/contracts/layerzero-views/Cargo.toml +0 -1
  42. package/contracts/layerzero-views/src/layerzero_view.rs +1 -13
  43. package/contracts/macro-integration-tests/Cargo.toml +5 -15
  44. package/contracts/macro-integration-tests/tests/runtime/oapp/mod.rs +48 -0
  45. package/contracts/macro-integration-tests/tests/runtime/oapp/oapp_core.rs +170 -0
  46. package/contracts/macro-integration-tests/tests/runtime/oapp/options_type3.rs +154 -0
  47. package/contracts/macro-integration-tests/tests/runtime/oapp/receiver.rs +338 -0
  48. package/contracts/macro-integration-tests/tests/runtime/oapp/sender.rs +435 -0
  49. package/contracts/macro-integration-tests/tests/runtime.rs +1 -0
  50. package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.rs +8 -0
  51. package/contracts/macro-integration-tests/tests/ui/oapp/fail/custom_wrong_value.stderr +5 -0
  52. package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.rs +8 -0
  53. package/contracts/macro-integration-tests/tests/ui/oapp/fail/missing_lz_receive_internal.stderr +71 -0
  54. package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.rs +10 -0
  55. package/contracts/macro-integration-tests/tests/ui/oapp/fail/non_struct_input.stderr +5 -0
  56. package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.rs +8 -0
  57. package/contracts/macro-integration-tests/tests/ui/oapp/fail/unknown_custom_option.stderr +5 -0
  58. package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.rs +8 -0
  59. package/contracts/macro-integration-tests/tests/ui/oapp/fail/wrong_key.stderr +5 -0
  60. package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_all.rs +38 -0
  61. package/contracts/macro-integration-tests/tests/ui/oapp/pass/custom_single_trait.rs +96 -0
  62. package/contracts/macro-integration-tests/tests/ui/oapp/pass/minimal_contract.rs +64 -0
  63. package/contracts/macro-integration-tests/tests/ui/oapp/pass/struct_with_fields.rs +46 -0
  64. package/contracts/macro-integration-tests/tests/ui/ownable/fail/only_auth_missing_env.stderr +8 -0
  65. package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +1 -1
  66. package/contracts/macro-integration-tests/tests/ui/ownable/pass/only_auth_env_param_variants.rs +1 -1
  67. package/contracts/macro-integration-tests/tests/ui_oapp.rs +11 -0
  68. package/contracts/message-libs/message-lib-common/Cargo.toml +0 -1
  69. package/contracts/message-libs/message-lib-common/src/errors.rs +1 -1
  70. package/contracts/message-libs/treasury/Cargo.toml +0 -2
  71. package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +2 -2
  72. package/contracts/message-libs/uln-302/src/tests/receive_uln302/effective_receive_uln_config.rs +2 -2
  73. package/contracts/message-libs/uln-302/src/tests/receive_uln302/set_default_receive_uln_configs.rs +2 -2
  74. package/contracts/message-libs/uln-302/src/tests/receive_uln302/verify.rs +2 -2
  75. package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_executor_config.rs +2 -2
  76. package/contracts/message-libs/uln-302/src/tests/send_uln302/effective_send_uln_config.rs +2 -2
  77. package/contracts/message-libs/uln-302/src/tests/send_uln302/send.rs +7 -27
  78. package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_executor_configs.rs +2 -2
  79. package/contracts/message-libs/uln-302/src/tests/send_uln302/set_default_send_uln_configs.rs +2 -2
  80. package/contracts/oapps/counter/Cargo.toml +4 -6
  81. package/contracts/oapps/counter/integration_tests/utils.rs +19 -12
  82. package/contracts/oapps/oapp/src/errors.rs +1 -1
  83. package/contracts/oapps/oapp/src/interfaces/mod.rs +3 -0
  84. package/contracts/oapps/oapp/src/interfaces/oapp_msg_inspector.rs +47 -0
  85. package/contracts/oapps/oapp/src/lib.rs +1 -0
  86. package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +4 -4
  87. package/contracts/oapps/oapp/src/oapp_core.rs +5 -5
  88. package/contracts/oapps/oapp/src/oapp_options_type3.rs +12 -4
  89. package/contracts/oapps/oapp/src/oapp_receiver.rs +14 -9
  90. package/contracts/oapps/oapp/src/tests/mod.rs +4 -4
  91. package/contracts/oapps/oapp/src/tests/{test_oapp_core.rs → oapp_core.rs} +4 -4
  92. package/contracts/oapps/oapp/src/tests/{test_oapp_options_type3.rs → oapp_options_type3.rs} +3 -4
  93. package/contracts/oapps/oapp-macros/Cargo.toml +8 -4
  94. package/contracts/oapps/oapp-macros/src/generators.rs +9 -34
  95. package/contracts/oapps/oapp-macros/src/lib.rs +3 -0
  96. package/contracts/oapps/oapp-macros/src/tests/mod.rs +2 -0
  97. package/contracts/oapps/oapp-macros/src/tests/oapp.rs +88 -0
  98. package/contracts/oapps/oapp-macros/src/tests/parse_custom_impls.rs +86 -0
  99. package/contracts/oapps/oapp-macros/src/tests/snapshots/oapp_macros__tests__oapp__snapshot_generate_oapp.snap +103 -0
  100. package/contracts/oapps/oft/integration-tests/utils.rs +28 -8
  101. package/contracts/oapps/oft/src/extensions/oft_fee.rs +136 -74
  102. package/contracts/oapps/oft/src/extensions/pausable.rs +44 -10
  103. package/contracts/oapps/oft/src/extensions/rate_limiter.rs +170 -130
  104. package/contracts/oapps/oft/src/oft.rs +19 -12
  105. package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +1 -1
  106. package/contracts/oapps/oft/src/oft_types/mint_burn.rs +1 -1
  107. package/contracts/oapps/oft-core/Cargo.toml +1 -4
  108. package/contracts/oapps/oft-core/integration-tests/setup.rs +2 -2
  109. package/contracts/oapps/oft-core/integration-tests/utils.rs +21 -3
  110. package/contracts/oapps/oft-core/src/errors.rs +3 -2
  111. package/contracts/oapps/oft-core/src/events.rs +6 -0
  112. package/contracts/oapps/oft-core/src/lib.rs +1 -1
  113. package/contracts/oapps/oft-core/src/oft_core.rs +115 -60
  114. package/contracts/oapps/oft-core/src/storage.rs +7 -3
  115. package/contracts/oapps/oft-core/src/tests/mod.rs +1 -0
  116. package/contracts/oapps/oft-core/src/tests/test_decimals.rs +37 -2
  117. package/contracts/oapps/oft-core/src/tests/test_lz_receive.rs +2 -2
  118. package/contracts/oapps/oft-core/src/tests/test_msg_inspector.rs +323 -0
  119. package/contracts/oapps/oft-core/src/tests/test_send.rs +2 -2
  120. package/contracts/oapps/oft-core/src/tests/test_utils.rs +59 -14
  121. package/contracts/utils/Cargo.toml +0 -1
  122. package/contracts/utils/src/errors.rs +1 -1
  123. package/contracts/utils/src/multisig.rs +17 -8
  124. package/contracts/utils/src/ownable.rs +6 -6
  125. package/contracts/utils/src/testing_utils.rs +124 -54
  126. package/contracts/utils/src/tests/multisig.rs +12 -12
  127. package/contracts/utils/src/tests/ownable.rs +6 -6
  128. package/contracts/utils/src/tests/testing_utils.rs +50 -167
  129. package/contracts/utils/src/tests/ttl_configurable.rs +5 -5
  130. package/contracts/utils/src/tests/upgradeable.rs +1 -1
  131. package/contracts/utils/src/ttl_configurable.rs +10 -4
  132. package/contracts/utils/src/upgradeable.rs +5 -5
  133. package/contracts/workers/dvn/Cargo.toml +5 -6
  134. package/contracts/workers/dvn/src/dvn.rs +2 -12
  135. package/contracts/workers/dvn-fee-lib/Cargo.toml +1 -1
  136. package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +37 -19
  137. package/contracts/workers/dvn-fee-lib/src/lib.rs +12 -2
  138. package/contracts/workers/dvn-fee-lib/src/tests/dvn_fee_lib.rs +15 -13
  139. package/contracts/workers/executor/Cargo.toml +3 -0
  140. package/contracts/workers/executor/src/executor.rs +2 -12
  141. package/contracts/workers/executor/src/lib.rs +2 -2
  142. package/contracts/workers/executor/src/tests/auth.rs +394 -0
  143. package/contracts/workers/executor/src/tests/executor.rs +410 -0
  144. package/contracts/workers/executor/src/tests/mod.rs +3 -0
  145. package/contracts/workers/executor/src/tests/setup.rs +250 -0
  146. package/contracts/workers/executor-fee-lib/Cargo.toml +5 -0
  147. package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +1 -12
  148. package/contracts/workers/executor-fee-lib/src/lib.rs +8 -2
  149. package/contracts/workers/executor-helper/Cargo.toml +0 -1
  150. package/contracts/workers/price-feed/Cargo.toml +5 -0
  151. package/contracts/workers/price-feed/src/lib.rs +9 -4
  152. package/contracts/workers/price-feed/src/price_feed.rs +1 -11
  153. package/contracts/workers/worker/src/errors.rs +1 -1
  154. package/contracts/workers/worker/src/tests/setup.rs +1 -1
  155. package/contracts/workers/worker/src/tests/worker.rs +55 -41
  156. package/contracts/workers/worker/src/worker.rs +34 -25
  157. package/docs/error-spec.md +55 -0
  158. package/docs/layerzero-v2-on-stellar.md +447 -0
  159. package/docs/oapp-guide.md +212 -0
  160. package/docs/oft-guide.md +314 -0
  161. package/package.json +3 -3
  162. package/sdk/.turbo/turbo-test.log +260 -257
  163. package/sdk/dist/generated/bml.d.ts +3 -3
  164. package/sdk/dist/generated/bml.js +4 -4
  165. package/sdk/dist/generated/counter.d.ts +295 -295
  166. package/sdk/dist/generated/counter.js +43 -43
  167. package/sdk/dist/generated/dvn.d.ts +91 -91
  168. package/sdk/dist/generated/dvn.js +24 -24
  169. package/sdk/dist/generated/dvn_fee_lib.d.ts +92 -92
  170. package/sdk/dist/generated/dvn_fee_lib.js +25 -25
  171. package/sdk/dist/generated/endpoint.d.ts +99 -99
  172. package/sdk/dist/generated/endpoint.js +16 -16
  173. package/sdk/dist/generated/executor.d.ts +91 -91
  174. package/sdk/dist/generated/executor.js +24 -24
  175. package/sdk/dist/generated/executor_fee_lib.d.ts +92 -92
  176. package/sdk/dist/generated/executor_fee_lib.js +25 -25
  177. package/sdk/dist/generated/executor_helper.d.ts +3 -3
  178. package/sdk/dist/generated/executor_helper.js +4 -4
  179. package/sdk/dist/generated/layerzero_view.d.ts +186 -186
  180. package/sdk/dist/generated/layerzero_view.js +35 -35
  181. package/sdk/dist/generated/oft.d.ts +366 -352
  182. package/sdk/dist/generated/oft.js +74 -79
  183. package/sdk/dist/generated/price_feed.d.ts +198 -198
  184. package/sdk/dist/generated/price_feed.js +39 -39
  185. package/sdk/dist/generated/sml.d.ts +99 -99
  186. package/sdk/dist/generated/sml.js +16 -16
  187. package/sdk/dist/generated/treasury.d.ts +99 -99
  188. package/sdk/dist/generated/treasury.js +16 -16
  189. package/sdk/dist/generated/uln302.d.ts +99 -99
  190. package/sdk/dist/generated/uln302.js +16 -16
  191. package/sdk/dist/generated/upgrader.d.ts +3 -3
  192. package/sdk/dist/generated/upgrader.js +3 -3
  193. package/sdk/package.json +1 -1
  194. package/sdk/test/suites/localnet.ts +84 -20
  195. package/contracts/ERROR_SPEC.md +0 -51
  196. package/contracts/endpoint-v2/ARCHITECTURE.md +0 -233
  197. /package/contracts/oapps/oapp/src/tests/{test_oapp_receiver.rs → oapp_receiver.rs} +0 -0
  198. /package/contracts/oapps/oapp/src/tests/{test_oapp_sender.rs → oapp_sender.rs} +0 -0
@@ -7,7 +7,7 @@ use crate::{
7
7
  storage::WorkerStorage,
8
8
  };
9
9
  use common_macros::contract_trait;
10
- use soroban_sdk::{assert_with_error, panic_with_error, Address, Bytes, Env, Vec};
10
+ use soroban_sdk::{assert_with_error, panic_with_error, Address, Env, Vec};
11
11
  use utils::auth::{self, Auth};
12
12
 
13
13
  /// Worker interface providing common functionality for LayerZero workers.
@@ -28,7 +28,7 @@ pub trait Worker: Auth {
28
28
  ///
29
29
  /// # Arguments
30
30
  /// * `paused` - `true` to pause, `false` to unpause
31
- fn set_paused(env: &Env, paused: bool) {
31
+ fn set_paused(env: &soroban_sdk::Env, paused: bool) {
32
32
  let authorizer = auth::enforce_auth::<Self>(env);
33
33
  assert_with_error!(env, Self::paused(env) != paused, WorkerError::PauseStatusUnchanged);
34
34
 
@@ -48,7 +48,7 @@ pub trait Worker: Auth {
48
48
  /// # Arguments
49
49
  /// * `admin` - The address to set admin status for
50
50
  /// * `active` - `true` to add admin, `false` to remove
51
- fn set_admin(env: &Env, admin: &Address, active: bool) {
51
+ fn set_admin(env: &soroban_sdk::Env, admin: &soroban_sdk::Address, active: bool) {
52
52
  auth::require_auth::<Self>(env);
53
53
  set_admin_no_auth::<Self>(env, admin, active);
54
54
  }
@@ -61,7 +61,7 @@ pub trait Worker: Auth {
61
61
  /// # Arguments
62
62
  /// * `message_lib` - The message library contract address
63
63
  /// * `supported` - `true` to add support, `false` to remove support
64
- fn set_supported_message_lib(env: &Env, message_lib: &Address, supported: bool) {
64
+ fn set_supported_message_lib(env: &soroban_sdk::Env, message_lib: &soroban_sdk::Address, supported: bool) {
65
65
  auth::require_auth::<Self>(env);
66
66
  set_message_lib_no_auth::<Self>(env, message_lib, supported);
67
67
  }
@@ -75,7 +75,7 @@ pub trait Worker: Auth {
75
75
  /// # Arguments
76
76
  /// * `oapp` - The OApp contract address
77
77
  /// * `allowed` - `true` to add to allowlist, `false` to remove
78
- fn set_allowlist(env: &Env, oapp: &Address, allowed: bool) {
78
+ fn set_allowlist(env: &soroban_sdk::Env, oapp: &soroban_sdk::Address, allowed: bool) {
79
79
  auth::require_auth::<Self>(env);
80
80
 
81
81
  let is_on_list = Self::is_on_allowlist(env, oapp);
@@ -105,7 +105,7 @@ 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
- fn set_denylist(env: &Env, oapp: &Address, denied: bool) {
108
+ fn set_denylist(env: &soroban_sdk::Env, oapp: &soroban_sdk::Address, denied: bool) {
109
109
  auth::require_auth::<Self>(env);
110
110
  let is_on_list = Self::is_on_denylist(env, oapp);
111
111
 
@@ -133,7 +133,7 @@ pub trait Worker: Auth {
133
133
  /// # Arguments
134
134
  /// * `admin` - Admin address (must provide authorization)
135
135
  /// * `multiplier_bps` - Multiplier in basis points (10000 = 1x, 12000 = 1.2x)
136
- fn set_default_multiplier_bps(env: &Env, admin: &Address, multiplier_bps: u32) {
136
+ fn set_default_multiplier_bps(env: &soroban_sdk::Env, admin: &soroban_sdk::Address, multiplier_bps: u32) {
137
137
  require_admin_auth::<Self>(env, admin);
138
138
  set_default_multiplier_bps_no_auth(env, multiplier_bps);
139
139
  }
@@ -145,7 +145,11 @@ pub trait Worker: Auth {
145
145
  /// # Arguments
146
146
  /// * `admin` - Admin address (must provide authorization)
147
147
  /// * `deposit_address` - Address to receive collected fees
148
- fn set_deposit_address(env: &Env, admin: &Address, deposit_address: &Address) {
148
+ fn set_deposit_address(
149
+ env: &soroban_sdk::Env,
150
+ admin: &soroban_sdk::Address,
151
+ deposit_address: &soroban_sdk::Address,
152
+ ) {
149
153
  require_admin_auth::<Self>(env, admin);
150
154
  WorkerStorage::set_deposit_address(env, deposit_address);
151
155
  SetDepositAddress { deposit_address: deposit_address.clone() }.publish(env);
@@ -157,7 +161,12 @@ pub trait Worker: Auth {
157
161
  /// * `admin` - Admin address (must provide authorization)
158
162
  /// * `eid` - Destination endpoint ID (chain identifier)
159
163
  /// * `option_types` - Supported option types. Each byte represents an option type.
160
- fn set_supported_option_types(env: &Env, admin: &Address, eid: u32, option_types: &Bytes) {
164
+ fn set_supported_option_types(
165
+ env: &soroban_sdk::Env,
166
+ admin: &soroban_sdk::Address,
167
+ eid: u32,
168
+ option_types: &soroban_sdk::Bytes,
169
+ ) {
161
170
  require_admin_auth::<Self>(env, admin);
162
171
  WorkerStorage::set_supported_option_types(env, eid, option_types);
163
172
  SetSupportedOptionTypes { dst_eid: eid, option_types: option_types.clone() }.publish(env);
@@ -170,7 +179,7 @@ pub trait Worker: Auth {
170
179
  /// # Arguments
171
180
  /// * `admin` - Admin address (must provide authorization)
172
181
  /// * `worker_fee_lib` - Fee library contract address implementing `IExecutorFeeLib`
173
- fn set_worker_fee_lib(env: &Env, admin: &Address, worker_fee_lib: &Address) {
182
+ fn set_worker_fee_lib(env: &soroban_sdk::Env, admin: &soroban_sdk::Address, worker_fee_lib: &soroban_sdk::Address) {
174
183
  require_admin_auth::<Self>(env, admin);
175
184
  WorkerStorage::set_worker_fee_lib(env, worker_fee_lib);
176
185
  SetWorkerFeeLib { fee_lib: worker_fee_lib.clone() }.publish(env);
@@ -184,7 +193,7 @@ pub trait Worker: Auth {
184
193
  /// # Arguments
185
194
  /// * `admin` - Admin address (must provide authorization)
186
195
  /// * `price_feed` - Price feed contract address implementing `ILayerZeroPriceFeed`
187
- fn set_price_feed(env: &Env, admin: &Address, price_feed: &Address) {
196
+ fn set_price_feed(env: &soroban_sdk::Env, admin: &soroban_sdk::Address, price_feed: &soroban_sdk::Address) {
188
197
  require_admin_auth::<Self>(env, admin);
189
198
  WorkerStorage::set_price_feed(env, price_feed);
190
199
  SetPriceFeed { price_feed: price_feed.clone() }.publish(env);
@@ -195,7 +204,7 @@ pub trait Worker: Auth {
195
204
  // ========================================================================
196
205
 
197
206
  /// Returns whether the worker is paused.
198
- fn paused(env: &Env) -> bool {
207
+ fn paused(env: &soroban_sdk::Env) -> bool {
199
208
  WorkerStorage::paused(env)
200
209
  }
201
210
 
@@ -203,12 +212,12 @@ pub trait Worker: Auth {
203
212
  ///
204
213
  /// # Arguments
205
214
  /// * `admin` - The address to check
206
- fn is_admin(env: &Env, admin: &Address) -> bool {
215
+ fn is_admin(env: &soroban_sdk::Env, admin: &soroban_sdk::Address) -> bool {
207
216
  Self::admins(env).contains(admin)
208
217
  }
209
218
 
210
219
  /// Returns all admin addresses.
211
- fn admins(env: &Env) -> Vec<Address> {
220
+ fn admins(env: &soroban_sdk::Env) -> soroban_sdk::Vec<soroban_sdk::Address> {
212
221
  WorkerStorage::admins(env)
213
222
  }
214
223
 
@@ -216,7 +225,7 @@ pub trait Worker: Auth {
216
225
  ///
217
226
  /// # Arguments
218
227
  /// * `message_lib` - Message library contract address
219
- fn is_supported_message_lib(env: &Env, message_lib: &Address) -> bool {
228
+ fn is_supported_message_lib(env: &soroban_sdk::Env, message_lib: &soroban_sdk::Address) -> bool {
220
229
  Self::message_libs(env).contains(message_lib)
221
230
  }
222
231
 
@@ -224,7 +233,7 @@ pub trait Worker: Auth {
224
233
  ///
225
234
  /// # Returns
226
235
  /// Vector of supported message library contract addresses.
227
- fn message_libs(env: &Env) -> Vec<Address> {
236
+ fn message_libs(env: &soroban_sdk::Env) -> soroban_sdk::Vec<soroban_sdk::Address> {
228
237
  WorkerStorage::message_libs(env)
229
238
  }
230
239
 
@@ -232,12 +241,12 @@ pub trait Worker: Auth {
232
241
  ///
233
242
  /// # Arguments
234
243
  /// * `oapp` - OApp contract address
235
- fn is_on_allowlist(env: &Env, oapp: &Address) -> bool {
244
+ fn is_on_allowlist(env: &soroban_sdk::Env, oapp: &soroban_sdk::Address) -> bool {
236
245
  WorkerStorage::has_allowlist(env, oapp)
237
246
  }
238
247
 
239
248
  /// Returns the number of addresses on the allowlist.
240
- fn allowlist_size(env: &Env) -> u32 {
249
+ fn allowlist_size(env: &soroban_sdk::Env) -> u32 {
241
250
  WorkerStorage::allowlist_size(env)
242
251
  }
243
252
 
@@ -245,7 +254,7 @@ pub trait Worker: Auth {
245
254
  ///
246
255
  /// # Arguments
247
256
  /// * `oapp` - OApp contract address
248
- fn is_on_denylist(env: &Env, oapp: &Address) -> bool {
257
+ fn is_on_denylist(env: &soroban_sdk::Env, oapp: &soroban_sdk::Address) -> bool {
249
258
  WorkerStorage::has_denylist(env, oapp)
250
259
  }
251
260
 
@@ -258,17 +267,17 @@ pub trait Worker: Auth {
258
267
  ///
259
268
  /// # Arguments
260
269
  /// * `oapp` - OApp contract address to check
261
- fn has_acl(env: &Env, oapp: &Address) -> bool {
270
+ fn has_acl(env: &soroban_sdk::Env, oapp: &soroban_sdk::Address) -> bool {
262
271
  !Self::is_on_denylist(env, oapp) && (Self::allowlist_size(env) == 0 || Self::is_on_allowlist(env, oapp))
263
272
  }
264
273
 
265
274
  /// Returns the default fee multiplier in basis points.
266
- fn default_multiplier_bps(env: &Env) -> u32 {
275
+ fn default_multiplier_bps(env: &soroban_sdk::Env) -> u32 {
267
276
  WorkerStorage::default_multiplier_bps(env)
268
277
  }
269
278
 
270
279
  /// Returns the deposit address where fees are collected.
271
- fn deposit_address(env: &Env) -> Option<Address> {
280
+ fn deposit_address(env: &soroban_sdk::Env) -> Option<soroban_sdk::Address> {
272
281
  WorkerStorage::deposit_address(env)
273
282
  }
274
283
 
@@ -276,17 +285,17 @@ pub trait Worker: Auth {
276
285
  ///
277
286
  /// # Arguments
278
287
  /// * `eid` - Destination endpoint ID (chain identifier)
279
- fn get_supported_option_types(env: &Env, eid: u32) -> Option<Bytes> {
288
+ fn get_supported_option_types(env: &soroban_sdk::Env, eid: u32) -> Option<soroban_sdk::Bytes> {
280
289
  WorkerStorage::supported_option_types(env, eid)
281
290
  }
282
291
 
283
292
  /// Returns the worker fee library contract address.
284
- fn worker_fee_lib(env: &Env) -> Option<Address> {
293
+ fn worker_fee_lib(env: &soroban_sdk::Env) -> Option<soroban_sdk::Address> {
285
294
  WorkerStorage::worker_fee_lib(env)
286
295
  }
287
296
 
288
297
  /// Returns the price feed contract address.
289
- fn price_feed(env: &Env) -> Option<Address> {
298
+ fn price_feed(env: &soroban_sdk::Env) -> Option<soroban_sdk::Address> {
290
299
  WorkerStorage::price_feed(env)
291
300
  }
292
301
  }
@@ -0,0 +1,55 @@
1
+ # Stellar LayerZero Protocol - Error Code Specification
2
+
3
+ This document defines the error code allocation strategy for the Stellar LayerZero contracts.
4
+
5
+ ## Purpose
6
+
7
+ Each library has a unique error code range to:
8
+
9
+ - **Prevent collisions**: Avoid error code conflicts between different libraries
10
+ - **Enable traceability**: Quickly identify which library an error originated from based on its code
11
+ - **Simplify debugging**: Error codes are globally unique, making it easier to track and diagnose issues
12
+
13
+ ## Allocation Rules
14
+
15
+ - **Contract-specific errors**: Each contract uses auto-incrementing error codes starting from 1. These are local to the contract and do not need global uniqueness since the contract address provides context.
16
+ - **Library errors**: Libraries that are shared across multiple contracts use reserved ranges (1000+) to ensure global uniqueness.
17
+ - **Library allocation**: Each library is allocated a 100-unit block (e.g., 1000-1099, 1100-1199). Total errors in one library should not exceed 100.
18
+ - **Sub-range allocation**: Each error type within a library is allocated a 10-unit block. If an error type exceeds 10 errors, it extends into the next block but the following error type should start at the next 10-unit boundary.
19
+ - **Auto-increment**: Within each error enum, values auto-increment from the starting value.
20
+
21
+ ## Error Code Ranges
22
+
23
+ ### Contract-Specific Errors (1-999)
24
+
25
+ Contract-specific errors auto-increment from 1 and are scoped to each contract.
26
+
27
+ | Contract | Location |
28
+ | ----------------- | ----------------------------------------------- |
29
+ | EndpointV2 | `endpoint-v2/src/errors.rs` |
30
+ | ULN302 | `message-libs/uln-302/src/errors.rs` |
31
+ | Treasury | `message-libs/treasury/src/errors.rs` |
32
+ | SimpleMessageLib | `message-libs/simple-message-lib/src/errors.rs` |
33
+ | DVN | `workers/dvn/src/errors.rs` |
34
+ | Executor | `workers/executor/src/errors.rs` |
35
+ | DVN Fee Lib | `workers/dvn-fee-lib/src/errors.rs` |
36
+ | Executor Fee Lib | `workers/executor-fee-lib/src/errors.rs` |
37
+ | Price Feed | `workers/price-feed/src/errors.rs` |
38
+ | LayerZero Views | `layerzero-views/src/errors.rs` |
39
+ | Counter (example) | `oapps/counter/src/errors.rs` |
40
+
41
+ ### Library Errors (1000+)
42
+
43
+ Libraries shared across contracts use reserved ranges for global uniqueness.
44
+
45
+ | Range | Category | Library | Location |
46
+ | --------- | ------------ | ------------------ | ----------------------------------------------- |
47
+ | 1000-1099 | Protocol Lib | utils | `utils/src/errors.rs` |
48
+ | 1100-1199 | Protocol Lib | message-lib-common | `message-libs/message-lib-common/src/errors.rs` |
49
+ | 1200-1299 | Protocol Lib | worker | `workers/worker/src/errors.rs` |
50
+ | 1300-1999 | Protocol Lib | (reserved) | Future protocol libs |
51
+ | 2000-2099 | OApp Lib | oapp | `oapps/oapp/src/errors.rs` |
52
+ | 2100-2999 | OApp Lib | (reserved) | Future OApp libs |
53
+ | 3000-3099 | OFT Lib | oft-core | `oapps/oft-core/src/errors.rs` |
54
+ | 3100-3199 | OFT Lib | oft (extensions) | `oapps/oft/src/extensions/` |
55
+ | 3200-3999 | OFT Lib | (reserved) | Future OFT libs |