@layerzerolabs/protocol-stellar-v2 0.2.15 → 0.2.19

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 (262) hide show
  1. package/.turbo/turbo-build.log +365 -297
  2. package/.turbo/turbo-lint.log +142 -110
  3. package/.turbo/turbo-test.log +1273 -1222
  4. package/Cargo.lock +20 -5
  5. package/Cargo.toml +4 -1
  6. package/contracts/ERROR_SPEC.md +44 -0
  7. package/contracts/common-macros/src/auth.rs +113 -0
  8. package/contracts/common-macros/src/contract_ttl.rs +84 -0
  9. package/contracts/common-macros/src/lib.rs +181 -30
  10. package/contracts/common-macros/src/lz_contract.rs +83 -0
  11. package/contracts/common-macros/src/tests/{ownable.rs → auth.rs} +48 -15
  12. package/contracts/common-macros/src/tests/contract_ttl.rs +662 -0
  13. package/contracts/common-macros/src/tests/mod.rs +2 -2
  14. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_multisig_code.snap +20 -0
  15. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__auth__snapshot_generated_ownable_code.snap +24 -0
  16. package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__ownable__snapshot_only_owner_preserves_function_signature.snap → common_macros__tests__auth__snapshot_only_auth_preserves_function_signature.snap} +4 -4
  17. package/contracts/common-macros/src/tests/snapshots/{common_macros__tests__contract_impl__snapshot_generated_contract_impl_code.snap → common_macros__tests__contract_ttl__snapshot_generated_contractimpl_code.snap} +3 -3
  18. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_ttl__snapshot_generated_contracttrait_code.snap +69 -0
  19. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +7 -21
  20. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__upgradeable__snapshot_generated_upgradeable_code.snap +2 -2
  21. package/contracts/common-macros/src/ttl_configurable.rs +19 -34
  22. package/contracts/common-macros/src/ttl_extendable.rs +36 -0
  23. package/contracts/common-macros/src/upgradeable.rs +5 -5
  24. package/contracts/common-macros/src/utils.rs +9 -0
  25. package/contracts/endpoint-v2/src/constants.rs +4 -4
  26. package/contracts/endpoint-v2/src/endpoint_v2.rs +38 -40
  27. package/contracts/endpoint-v2/src/errors.rs +4 -3
  28. package/contracts/endpoint-v2/src/events.rs +1 -1
  29. package/contracts/endpoint-v2/src/message_lib_manager.rs +18 -5
  30. package/contracts/endpoint-v2/src/messaging_channel.rs +11 -1
  31. package/contracts/endpoint-v2/src/messaging_composer.rs +11 -1
  32. package/contracts/endpoint-v2/src/storage.rs +1 -1
  33. package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +3 -3
  34. package/contracts/endpoint-v2/src/tests/endpoint_v2/quote.rs +1 -1
  35. package/contracts/endpoint-v2/src/tests/endpoint_v2/require_oapp_auth.rs +2 -2
  36. package/contracts/endpoint-v2/src/tests/endpoint_v2/send.rs +3 -3
  37. package/contracts/endpoint-v2/src/tests/endpoint_v2/set_zro.rs +4 -4
  38. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_receive_lib_for_eid.rs +3 -3
  39. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_registered.rs +1 -1
  40. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_send_lib_for_eid.rs +3 -3
  41. package/contracts/endpoint-v2/src/tests/message_lib_manager/require_supported_eid.rs +1 -1
  42. package/contracts/endpoint-v2/src/tests/messaging_channel/clear_payload.rs +4 -4
  43. package/contracts/endpoint-v2/src/tests/messaging_channel/inbound.rs +1 -1
  44. package/contracts/layerzero-views/src/layerzero_view.rs +3 -6
  45. package/contracts/macro-integration-tests/tests/runtime/ownable/mod.rs +2 -2
  46. package/contracts/macro-integration-tests/tests/runtime/ownable/{only_owner_guard.rs → only_auth_guard.rs} +1 -1
  47. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/configuration.rs +1 -1
  48. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/freeze.rs +1 -1
  49. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/mod.rs +0 -1
  50. package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.rs → only_auth_missing_env.rs} +3 -3
  51. package/contracts/macro-integration-tests/tests/ui/ownable/fail/{only_owner_missing_env.stderr → only_auth_missing_env.stderr} +4 -4
  52. package/contracts/macro-integration-tests/tests/ui/ownable/pass/namespacing_and_imports.rs +2 -3
  53. package/contracts/macro-integration-tests/tests/ui/ownable/pass/{only_owner_env_param_variants.rs → only_auth_env_param_variants.rs} +9 -9
  54. package/contracts/macro-integration-tests/tests/ui/ttl_configurable/pass/minimal_contract.rs +6 -6
  55. package/contracts/message-libs/message-lib-common/src/errors.rs +7 -2
  56. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1/decode_packet_header.rs +3 -3
  57. package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_lz_receive_option.rs +1 -2
  58. package/contracts/message-libs/message-lib-common/src/tests/worker_options/append_native_drop_option.rs +1 -2
  59. package/contracts/message-libs/message-lib-common/src/tests/worker_options/convert_legacy_options.rs +9 -9
  60. package/contracts/message-libs/message-lib-common/src/tests/worker_options/extract_type_3_options.rs +1 -1
  61. package/contracts/message-libs/message-lib-common/src/tests/worker_options/left_pad_to_bytes32.rs +1 -1
  62. package/contracts/message-libs/message-lib-common/src/tests/worker_options/split_worker_options.rs +2 -2
  63. package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +7 -9
  64. package/contracts/message-libs/treasury/src/errors.rs +2 -2
  65. package/contracts/message-libs/treasury/src/events.rs +1 -1
  66. package/contracts/message-libs/treasury/src/interfaces/zro_fee_lib.rs +2 -2
  67. package/contracts/message-libs/treasury/src/storage.rs +1 -1
  68. package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +1 -1
  69. package/contracts/message-libs/treasury/src/treasury.rs +14 -16
  70. package/contracts/message-libs/uln-302/src/receive_uln.rs +13 -2
  71. package/contracts/message-libs/uln-302/src/send_uln.rs +24 -4
  72. package/contracts/message-libs/uln-302/src/uln302.rs +6 -24
  73. package/contracts/oapps/counter/Cargo.toml +14 -1
  74. package/contracts/oapps/counter/integration_tests/mod.rs +4 -1
  75. package/contracts/oapps/counter/integration_tests/{setup.rs → setup_sml.rs} +48 -80
  76. package/contracts/oapps/counter/integration_tests/setup_uln.rs +997 -0
  77. package/contracts/oapps/counter/integration_tests/signing.rs +62 -0
  78. package/contracts/oapps/counter/integration_tests/test_with_sml.rs +24 -55
  79. package/contracts/oapps/counter/integration_tests/test_with_uln.rs +314 -0
  80. package/contracts/oapps/counter/integration_tests/utils.rs +196 -53
  81. package/contracts/oapps/counter/src/counter.rs +67 -43
  82. package/contracts/oapps/counter/src/tests/mod.rs +0 -13
  83. package/contracts/oapps/counter/src/tests/test_counter.rs +5 -7
  84. package/contracts/oapps/oapp/src/errors.rs +5 -1
  85. package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +93 -78
  86. package/contracts/oapps/oapp/src/oapp_core.rs +36 -21
  87. package/contracts/oapps/oapp/src/oapp_options_type3.rs +48 -12
  88. package/contracts/oapps/oapp/src/oapp_receiver.rs +106 -41
  89. package/contracts/oapps/oapp/src/oapp_sender.rs +26 -34
  90. package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +9 -8
  91. package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +25 -17
  92. package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +7 -7
  93. package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +14 -15
  94. package/contracts/oapps/oapp-macros/src/generators.rs +128 -0
  95. package/contracts/oapps/oapp-macros/src/lib.rs +113 -56
  96. package/contracts/oapps/oft/Cargo.toml +10 -7
  97. package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/test_oft_fee.rs +3 -4
  98. package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/test_pausable.rs +2 -3
  99. package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/test_rate_limiter.rs +1 -1
  100. package/contracts/oapps/oft/integration-tests/mod.rs +1 -1
  101. package/contracts/oapps/oft/integration-tests/setup.rs +29 -110
  102. package/contracts/oapps/oft/integration-tests/utils.rs +254 -21
  103. package/contracts/oapps/oft/src/extensions/oft_fee.rs +13 -14
  104. package/contracts/oapps/oft/src/extensions/pausable.rs +4 -4
  105. package/contracts/oapps/oft/src/extensions/rate_limiter.rs +5 -5
  106. package/contracts/oapps/oft/src/lib.rs +11 -13
  107. package/contracts/oapps/oft/src/oft.rs +147 -225
  108. package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +9 -13
  109. package/contracts/oapps/oft/src/oft_types/mint_burn.rs +31 -14
  110. package/contracts/oapps/oft/src/oft_types/mod.rs +13 -0
  111. package/contracts/oapps/{oft-std → oft-core}/Cargo.toml +6 -4
  112. package/contracts/oapps/{oft-std → oft-core}/integration-tests/mod.rs +1 -1
  113. package/contracts/oapps/{oft-std → oft-core}/integration-tests/setup.rs +129 -30
  114. package/contracts/oapps/{oft → oft-core}/integration-tests/test_with_sml.rs +3 -3
  115. package/contracts/oapps/oft-core/integration-tests/utils.rs +201 -0
  116. package/contracts/oapps/oft-core/src/errors.rs +13 -0
  117. package/contracts/oapps/oft-core/src/lib.rs +18 -0
  118. package/contracts/oapps/oft-core/src/oft_core.rs +439 -0
  119. package/contracts/oapps/{oft → oft-core}/src/storage.rs +2 -0
  120. package/contracts/oapps/{oft → oft-core}/src/tests/mod.rs +0 -2
  121. package/contracts/oapps/{oft → oft-core}/src/tests/test_decimals.rs +2 -2
  122. package/contracts/oapps/{oft → oft-core}/src/tests/test_lz_receive.rs +7 -7
  123. package/contracts/oapps/{oft → oft-core}/src/tests/test_oft_msg_codec.rs +4 -5
  124. package/contracts/oapps/{oft → oft-core}/src/tests/test_resolve_address.rs +3 -3
  125. package/contracts/oapps/{oft → oft-core}/src/tests/test_utils.rs +78 -37
  126. package/contracts/oapps/oft-core/src/types.rs +58 -0
  127. package/contracts/oapps/{oft → oft-core}/src/utils.rs +1 -1
  128. package/contracts/upgrader/src/lib.rs +4 -4
  129. package/contracts/utils/src/auth.rs +44 -0
  130. package/contracts/utils/src/errors.rs +31 -5
  131. package/contracts/utils/src/lib.rs +3 -0
  132. package/contracts/utils/src/multisig.rs +211 -0
  133. package/contracts/utils/src/ownable.rs +137 -13
  134. package/contracts/utils/src/tests/buffer_reader.rs +6 -6
  135. package/contracts/utils/src/tests/buffer_writer.rs +6 -6
  136. package/contracts/utils/src/tests/bytes_ext.rs +2 -4
  137. package/contracts/utils/src/tests/mod.rs +1 -0
  138. package/contracts/utils/src/tests/multisig.rs +731 -0
  139. package/contracts/utils/src/tests/option_ext.rs +2 -5
  140. package/contracts/utils/src/tests/ownable.rs +456 -7
  141. package/contracts/utils/src/tests/ttl_configurable.rs +27 -16
  142. package/contracts/utils/src/tests/upgradeable.rs +4 -2
  143. package/contracts/utils/src/ttl_configurable.rs +23 -8
  144. package/contracts/utils/src/ttl_extendable.rs +27 -0
  145. package/contracts/utils/src/upgradeable.rs +2 -0
  146. package/contracts/workers/dvn/Cargo.toml +1 -1
  147. package/contracts/workers/dvn/src/auth.rs +7 -7
  148. package/contracts/workers/dvn/src/dvn.rs +10 -38
  149. package/contracts/workers/dvn/src/errors.rs +0 -7
  150. package/contracts/workers/dvn/src/events.rs +1 -14
  151. package/contracts/workers/dvn/src/interfaces/dvn.rs +2 -2
  152. package/contracts/workers/dvn/src/interfaces/mod.rs +0 -2
  153. package/contracts/workers/dvn/src/storage.rs +3 -13
  154. package/contracts/workers/dvn/src/tests/auth.rs +4 -4
  155. package/contracts/workers/dvn/src/tests/dvn.rs +1 -2
  156. package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +7 -8
  157. package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +11 -8
  158. package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +11 -12
  159. package/contracts/workers/dvn/src/tests/setup.rs +5 -5
  160. package/contracts/workers/dvn-fee-lib/Cargo.toml +1 -1
  161. package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +3 -6
  162. package/contracts/workers/executor/src/auth.rs +80 -16
  163. package/contracts/workers/executor/src/executor.rs +5 -31
  164. package/contracts/workers/executor/src/storage.rs +2 -9
  165. package/contracts/workers/executor-fee-lib/Cargo.toml +1 -1
  166. package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +3 -6
  167. package/contracts/workers/executor-helper/Cargo.toml +1 -1
  168. package/contracts/workers/executor-helper/src/executor_helper.rs +53 -73
  169. package/contracts/workers/price-feed/Cargo.toml +1 -1
  170. package/contracts/workers/price-feed/src/price_feed.rs +7 -10
  171. package/contracts/workers/worker/src/errors.rs +4 -0
  172. package/contracts/workers/worker/src/tests/worker.rs +7 -6
  173. package/contracts/workers/worker/src/worker.rs +20 -16
  174. package/package.json +7 -5
  175. package/sdk/.turbo/turbo-build.log +1 -0
  176. package/sdk/.turbo/turbo-test.log +1019 -0
  177. package/sdk/dist/generated/bml.d.ts +95 -8
  178. package/sdk/dist/generated/bml.js +95 -36
  179. package/sdk/dist/generated/counter.d.ts +289 -44
  180. package/sdk/dist/generated/counter.js +119 -49
  181. package/sdk/dist/generated/dvn.d.ts +312 -229
  182. package/sdk/dist/generated/dvn.js +144 -83
  183. package/sdk/dist/generated/dvn_fee_lib.d.ts +258 -63
  184. package/sdk/dist/generated/dvn_fee_lib.js +95 -26
  185. package/sdk/dist/generated/endpoint.d.ts +219 -24
  186. package/sdk/dist/generated/endpoint.js +108 -41
  187. package/sdk/dist/generated/executor.d.ts +239 -87
  188. package/sdk/dist/generated/executor.js +135 -63
  189. package/sdk/dist/generated/executor_fee_lib.d.ts +278 -74
  190. package/sdk/dist/generated/executor_fee_lib.js +135 -59
  191. package/sdk/dist/generated/executor_helper.d.ts +163 -21
  192. package/sdk/dist/generated/executor_helper.js +124 -52
  193. package/sdk/dist/generated/oft.d.ts +1842 -0
  194. package/sdk/dist/generated/oft.js +345 -0
  195. package/sdk/dist/generated/price_feed.d.ts +258 -63
  196. package/sdk/dist/generated/price_feed.js +95 -26
  197. package/sdk/dist/generated/sml.d.ts +235 -34
  198. package/sdk/dist/generated/sml.js +126 -53
  199. package/sdk/dist/generated/treasury.d.ts +1016 -0
  200. package/sdk/dist/generated/treasury.js +248 -0
  201. package/sdk/dist/generated/uln302.d.ts +235 -34
  202. package/sdk/dist/generated/uln302.js +126 -53
  203. package/sdk/dist/generated/upgrader.d.ts +17 -2
  204. package/sdk/dist/generated/upgrader.js +19 -1
  205. package/sdk/dist/index.d.ts +2 -1
  206. package/sdk/dist/index.js +2 -1
  207. package/sdk/package.json +6 -3
  208. package/sdk/src/index.ts +2 -1
  209. package/sdk/test/counter-sml.test.ts +376 -0
  210. package/sdk/test/counter-uln.test.ts +493 -0
  211. package/sdk/test/{oft.test.ts → oft-sml.test.ts} +196 -321
  212. package/sdk/test/suites/constants.ts +22 -2
  213. package/sdk/test/suites/globalSetup.ts +450 -0
  214. package/sdk/test/suites/localnet.ts +23 -6
  215. package/sdk/test/upgrader.test.ts +7 -16
  216. package/sdk/test/utils.ts +558 -85
  217. package/sdk/turbo.json +8 -0
  218. package/sdk/vitest.config.ts +21 -0
  219. package/tools/ts-bindings-gen/Cargo.toml +2 -0
  220. package/tools/ts-bindings-gen/src/main.rs +52 -4
  221. package/contracts/common-macros/src/contract_impl.rs +0 -52
  222. package/contracts/common-macros/src/ownable.rs +0 -41
  223. package/contracts/common-macros/src/tests/contract_impl.rs +0 -386
  224. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +0 -12
  225. package/contracts/macro-integration-tests/tests/runtime/ttl_configurable/extend_instance_ttl.rs +0 -50
  226. package/contracts/oapps/oapp-macros/src/oapp_core.rs +0 -41
  227. package/contracts/oapps/oapp-macros/src/oapp_full.rs +0 -21
  228. package/contracts/oapps/oapp-macros/src/oapp_options_type3.rs +0 -31
  229. package/contracts/oapps/oapp-macros/src/oapp_receiver.rs +0 -48
  230. package/contracts/oapps/oapp-macros/src/oapp_sender.rs +0 -21
  231. package/contracts/oapps/oapp-macros/src/util.rs +0 -107
  232. package/contracts/oapps/oft/src/constants.rs +0 -5
  233. package/contracts/oapps/oft/src/default_oft_impl.rs +0 -152
  234. package/contracts/oapps/oft/src/errors.rs +0 -8
  235. package/contracts/oapps/oft/src/interfaces/mint_burn_token.rs +0 -23
  236. package/contracts/oapps/oft/src/interfaces/mod.rs +0 -3
  237. package/contracts/oapps/oft/src/tests/extensions/mod.rs +0 -11
  238. package/contracts/oapps/oft/src/tests/extensions/setup.rs +0 -903
  239. package/contracts/oapps/oft/src/tests/extensions/test_oft_fee.rs +0 -749
  240. package/contracts/oapps/oft/src/tests/extensions/test_pausable.rs +0 -432
  241. package/contracts/oapps/oft/src/tests/extensions/test_rate_limiter.rs +0 -1078
  242. package/contracts/oapps/oft/src/types.rs +0 -38
  243. package/contracts/oapps/oft-std/integration-tests/utils.rs +0 -427
  244. package/contracts/oapps/oft-std/src/lib.rs +0 -16
  245. package/contracts/oapps/oft-std/src/oft.rs +0 -156
  246. package/contracts/workers/dvn/src/interfaces/multisig.rs +0 -56
  247. package/contracts/workers/dvn/src/multisig.rs +0 -157
  248. package/sdk/dist/generated/oft_std.d.ts +0 -1544
  249. package/sdk/dist/generated/oft_std.js +0 -271
  250. package/sdk/test/index.test.ts +0 -375
  251. /package/contracts/oapps/{oft-std → oft}/integration-tests/extensions/mod.rs +0 -0
  252. /package/contracts/oapps/{oft → oft-core}/src/codec/mod.rs +0 -0
  253. /package/contracts/oapps/{oft → oft-core}/src/codec/oft_compose_msg_codec.rs +0 -0
  254. /package/contracts/oapps/{oft → oft-core}/src/codec/oft_msg_codec.rs +0 -0
  255. /package/contracts/oapps/{oft → oft-core}/src/events.rs +0 -0
  256. /package/contracts/oapps/{oft → oft-core}/src/tests/test_oft_compose_msg_codec.rs +0 -0
  257. /package/contracts/oapps/{oft → oft-core}/src/tests/test_oft_version.rs +0 -0
  258. /package/contracts/oapps/{oft → oft-core}/src/tests/test_quote_oft.rs +0 -0
  259. /package/contracts/oapps/{oft → oft-core}/src/tests/test_quote_send.rs +0 -0
  260. /package/contracts/oapps/{oft → oft-core}/src/tests/test_send.rs +0 -0
  261. /package/contracts/oapps/{oft → oft-core}/src/tests/test_token.rs +0 -0
  262. /package/sdk/test/suites/{testUpgradeable.ts → dummyContractClient.ts} +0 -0
@@ -1,251 +1,173 @@
1
- //! OFT traits - the main interface for OFT contracts.
2
- //!
3
- //! This module provides two traits:
4
- //! - `OFTInternal`: Internal methods NOT exposed as contract endpoints (`__debit`, `__credit`, etc.)
5
- //! - `OFT`: Public methods exposed as contract endpoints (using `#[contracttrait]`)
6
- //!
7
- //! ## Usage
8
- //!
9
- //! ```ignore
10
- //! use oapp_macros::{oapp, oapp_options_type3};
11
- //! use oft::oft::{oft_initialize, OFTInternal, OFT};
12
- //!
13
- //! #[oapp]
14
- //! pub struct MyOFT;
15
- //!
16
- //! #[contractimpl]
17
- //! impl MyOFT {
18
- //! pub fn __constructor(env: &Env, token: &Address, owner: &Address, endpoint: &Address, delegate: &Option<Address>) {
19
- //! oft_initialize::<Self>(env, owner, token, endpoint, delegate)
20
- //! }
21
- //! }
22
- //!
23
- //! // Public methods - exposed as contract endpoints
24
- //! #[contractimpl(contracttrait)]
25
- //! impl OFT for MyOFT {}
26
- //!
27
- //! // Internal methods - NOT exposed as contract endpoints
28
- //! // IMPORTANT: Do NOT use #[contractimpl] here to keep methods internal
29
- //! impl OFTInternal for MyOFT {
30
- //! fn __debit(env: &Env, sender: &Address, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> OFTReceipt {
31
- //! // Your debit logic (e.g., burn or lock tokens)
32
- //! oft::oft_types::mint_burn::debit::<Self>(env, sender, amount_ld, min_amount_ld, dst_eid)
33
- //! }
34
- //!
35
- //! fn __credit(env: &Env, to: &Address, amount_ld: i128, src_eid: u32) -> i128 {
36
- //! // Your credit logic (e.g., mint or unlock tokens)
37
- //! oft::oft_types::mint_burn::credit::<Self>(env, to, amount_ld, src_eid)
38
- //! }
39
- //! }
40
- //! ```
41
-
42
- // Alias for the current crate, allowing `oft::types::SendParam` paths to work both
43
- // inside this crate and in external crates implementing the OFT trait.
44
- extern crate self as oft;
45
-
46
- use crate::{errors::OFTError, storage::OFTStorage, types::OFTReceipt};
47
- use endpoint_v2::Origin;
48
- use oapp::{
49
- oapp_core::{oapp_initialize, OAppCore},
50
- oapp_options_type3::OAppOptionsType3,
51
- oapp_receiver::OAppReceiver,
52
- oapp_sender::OAppSender,
1
+ use crate::{
2
+ extensions::{
3
+ oft_fee::{OFTFee, OFTFeeInternal},
4
+ pausable::{OFTPausable, OFTPausableInternal},
5
+ rate_limiter::{Direction, RateLimiter, RateLimiterInternal},
6
+ },
7
+ oft_types::{lock_unlock, mint_burn, OftType},
53
8
  };
54
- use soroban_sdk::{assert_with_error, contracttrait, token::TokenClient, Address, Bytes, BytesN, Env};
55
- use utils::ownable::OwnableInitializer;
56
-
57
- // =====================================================
58
- // OFT Initialization
59
- // =====================================================
60
-
61
- /// Initializes the OFT contract with token, endpoint, and decimal configuration.
62
- /// The `shared_decimals` must be <= token's local decimals.
63
- pub fn oft_initialize<T: OFT + OwnableInitializer>(
64
- env: &Env,
65
- owner: &Address,
66
- token: &Address,
67
- endpoint: &Address,
68
- delegate: &Option<Address>,
69
- shared_decimals: u32,
70
- ) {
71
- // Initialize OApp (includes owner initialization)
72
- oapp_initialize::<T>(env, owner, endpoint, delegate);
73
-
74
- let local_decimals = TokenClient::new(env, token).decimals();
75
- assert_with_error!(env, local_decimals >= shared_decimals, OFTError::InvalidLocalDecimals);
76
-
77
- // Initialize OFT storage
78
- OFTStorage::set_token(env, token);
79
- OFTStorage::set_decimal_conversion_rate(env, &10_i128.pow(local_decimals - shared_decimals));
9
+ use common_macros::{contract_impl, storage};
10
+ use endpoint_v2::{MessagingFee, Origin};
11
+ use oapp::oapp_receiver::LzReceiveInternal;
12
+ use oapp_macros::oapp;
13
+ use oft_core::{
14
+ errors::OFTError,
15
+ types::{OFTFeeDetail, OFTLimit, OFTReceipt, SendParam},
16
+ utils as oft_utils, OFTCore, OFTInternal,
17
+ };
18
+ use soroban_sdk::{assert_with_error, vec, Address, Bytes, BytesN, Env, Vec};
19
+
20
+ #[storage]
21
+ enum OFTStorage {
22
+ #[instance(OftType)]
23
+ OftType,
80
24
  }
81
25
 
82
- // =====================================================
83
- // OFTInternal Trait (NOT exposed as contract endpoints)
84
- // =====================================================
85
-
86
- /// Internal OFT trait containing methods that should NOT be exposed as contract endpoints.
87
- ///
88
- /// **IMPORTANT**: Implement this trait WITHOUT the `#[contractimpl]` macro to keep
89
- /// `__debit`, `__credit`, and other internal methods private to the contract.
90
- ///
91
- /// ```ignore
92
- /// // Correct - methods stay internal
93
- /// impl OFTInternal for MyOFT { ... }
94
- ///
95
- /// // WRONG - would expose methods as endpoints
96
- /// #[contractimpl]
97
- /// impl OFTInternal for MyOFT { ... }
98
- /// ```
99
- ///
100
- /// Internal OFT trait for token debit/credit operations.
101
- ///
102
- /// This trait contains only the internal token operations. The OApp supertraits
103
- /// are on `OFT` instead, keeping this trait focused on token logic.
104
- pub trait OFTInternal: OAppCore {
105
- // =========================================================================
106
- // Required Methods (no defaults - user MUST implement)
107
- // =========================================================================
108
-
109
- /// Debits tokens from sender for cross-chain transfer.
110
- ///
111
- /// # Arguments
112
- /// * `sender` - The address sending tokens
113
- /// * `amount_ld` - Amount in local decimals to debit
114
- /// * `min_amount_ld` - Minimum amount acceptable (slippage protection)
115
- /// * `dst_eid` - Destination endpoint ID
116
- ///
117
- /// # Returns
118
- /// Receipt with amounts sent and received (after fees/dust removal)
119
- fn __debit(env: &Env, sender: &Address, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> OFTReceipt;
120
-
121
- /// Credits tokens to recipient after receiving cross-chain transfer.
122
- ///
123
- /// # Arguments
124
- /// * `to` - The address to credit tokens to
125
- /// * `amount_ld` - Amount in local decimals to credit
126
- /// * `src_eid` - Source endpoint ID
127
- ///
128
- /// # Returns
129
- /// The amount actually credited
130
- fn __credit(env: &Env, to: &Address, amount_ld: i128, src_eid: u32) -> i128;
131
-
132
- // =========================================================================
133
- // Optional Methods (have defaults - override as needed)
134
- // =========================================================================
135
-
136
- /// Calculates debit amounts without executing (view function).
137
- fn __debit_view(env: &Env, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> OFTReceipt {
138
- crate::default_oft_impl::default_debit_view(env, amount_ld, min_amount_ld, dst_eid)
139
- }
26
+ #[oapp]
27
+ pub struct OFT;
140
28
 
141
- /// Builds OFT message and combines options for cross-chain transfer.
142
- fn __build_msg_and_options(
29
+ #[contract_impl]
30
+ impl OFT {
31
+ pub fn __constructor(
143
32
  env: &Env,
144
- sender: &Address,
145
- send_param: &oft::types::SendParam,
146
- amount_ld: i128,
147
- ) -> (Bytes, Bytes)
148
- where
149
- Self: OAppOptionsType3,
150
- {
151
- crate::default_oft_impl::default_build_msg_and_options::<Self>(env, sender, send_param, amount_ld)
33
+ token: &Address,
34
+ owner: &Address,
35
+ endpoint: &Address,
36
+ delegate: &Option<Address>,
37
+ shared_decimals: u32,
38
+ oft_type: OftType,
39
+ ) {
40
+ oft_core::initialize_oft::<Self>(env, owner, token, endpoint, delegate, shared_decimals);
41
+ OFTStorage::set_oft_type(env, &oft_type);
152
42
  }
153
43
 
154
- /// Handles OFT receive logic.
155
- fn __lz_receive(
156
- env: &Env,
157
- _executor: &Address,
158
- origin: &Origin,
159
- guid: &BytesN<32>,
160
- message: &Bytes,
161
- _extra_data: &Bytes,
162
- _value: i128,
163
- ) {
164
- crate::default_oft_impl::default_lz_receive::<Self>(env, _executor, origin, guid, message, _extra_data, _value)
44
+ /// Returns the type of operation for this OFT (LockUnlock or MintBurn)
45
+ pub fn oft_type(env: &Env) -> OftType {
46
+ OFTStorage::oft_type(env).unwrap()
165
47
  }
166
48
  }
167
49
 
168
- // =====================================================
169
- // OFT Trait (exposed as contract endpoints)
170
- // =====================================================
171
-
172
- /// The public OFT trait defining the cross-chain token transfer interface.
173
- ///
174
- /// This trait is marked with `#[contracttrait]` so all its methods are exposed as
175
- /// contract endpoints. Users implement this with `#[contractimpl(contracttrait)]`.
176
- ///
177
- /// Internal methods like `__debit`, `__credit`, `__debit_view`, and `__build_msg_and_options`
178
- /// are in the `OFTInternal` trait and are NOT exposed as contract endpoints.
179
- #[contracttrait(client_name = "OFTClient")]
180
- pub trait OFT: OFTInternal + OAppReceiver + OAppSender + OAppOptionsType3 {
181
- /// Retrieves the token address associated with this OFT.
182
- fn token(env: &Env) -> Address {
183
- OFTStorage::token(env).unwrap()
50
+ /// OFTCore trait implementation for standard OFT with extensions
51
+ #[contract_impl(contracttrait)]
52
+ impl OFTCore for OFT {
53
+ fn quote_oft(env: &Env, send_param: &SendParam) -> (OFTLimit, Vec<OFTFeeDetail>, OFTReceipt) {
54
+ Self::__assert_not_paused(env);
55
+
56
+ let oft_receipt = Self::__debit_view(env, send_param.amount_ld, send_param.min_amount_ld, send_param.dst_eid);
57
+
58
+ // fee details (only include if there's an actual fee)
59
+ let fee_amount_ld = oft_receipt.amount_sent_ld - oft_receipt.amount_received_ld;
60
+ let fee_details = if fee_amount_ld > 0 {
61
+ vec![env, OFTFeeDetail { fee_amount_ld, description: Bytes::from_slice(env, b"OFT Fee") }]
62
+ } else {
63
+ vec![env]
64
+ };
65
+
66
+ // rate limit capacity
67
+ let capacity = Self::rate_limit_capacity(env, &Direction::Outbound, send_param.dst_eid);
68
+ let oft_limit = OFTLimit { min_amount_ld: 0, max_amount_ld: capacity };
69
+
70
+ (oft_limit, fee_details, oft_receipt)
184
71
  }
185
72
 
186
- /// Returns OFT version as (major, minor).
187
- fn oft_version(_env: &Env) -> (u64, u64) {
188
- (1, 1)
73
+ fn quote_send(env: &Env, sender: &Address, send_param: &SendParam, pay_in_zro: bool) -> MessagingFee {
74
+ Self::__assert_not_paused(env);
75
+ oft_core::quote_send::<Self>(env, sender, send_param, pay_in_zro)
189
76
  }
77
+ }
190
78
 
191
- /// Retrieves the shared decimals used for cross-chain normalization.
192
- fn shared_decimals(env: &Env) -> u32 {
193
- let token = Self::token(env);
194
- let local_decimals = soroban_sdk::token::TokenClient::new(env, &token).decimals();
79
+ /// OFT behavior for standard OFT with extension hooks
80
+ impl OFTInternal for OFT {
81
+ fn __debit_view(env: &Env, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> OFTReceipt {
195
82
  let conversion_rate = Self::decimal_conversion_rate(env);
196
- local_decimals - conversion_rate.ilog10()
197
- }
198
83
 
199
- /// Retrieves the decimal conversion rate used for cross-chain normalization.
200
- fn decimal_conversion_rate(env: &Env) -> i128 {
201
- OFTStorage::decimal_conversion_rate(env).unwrap()
202
- }
84
+ // Apply the fee before dust removal to ensure the fee is calculated on the full amount and dust is not transferred
85
+ let fee = Self::__fee_view(env, dst_eid, amount_ld);
86
+ let amount_after_fee = amount_ld - fee;
87
+ let amount_received_ld = oft_utils::remove_dust(amount_after_fee, conversion_rate);
88
+
89
+ // amount_sent_ld = what recipient receives + fee charged
90
+ // Dust is excluded (stays with sender)
91
+ let amount_sent_ld = amount_received_ld + fee;
203
92
 
204
- /// Whether a separate token approval is required before sending.
205
- ///
206
- /// Helps wallet implementers determine integration requirements.
207
- ///
208
- /// # Returns
209
- /// - `true` if a separate token approval step is required
210
- /// - `false` if no separate approval is needed
211
- fn approval_required(_env: &Env) -> bool {
212
- false
93
+ assert_with_error!(env, amount_received_ld >= min_amount_ld, OFTError::SlippageExceeded);
94
+
95
+ OFTReceipt { amount_sent_ld, amount_received_ld }
213
96
  }
214
97
 
215
- /// Quotes an OFT transfer without executing.
216
- ///
217
- /// # Returns
218
- /// (OFTLimit, fee details, receipt with estimated amounts)
219
- fn quote_oft(
220
- env: &Env,
221
- send_param: &oft::types::SendParam,
222
- ) -> (oft::types::OFTLimit, soroban_sdk::Vec<oft::types::OFTFeeDetail>, oft::types::OFTReceipt) {
223
- crate::default_oft_impl::default_quote_oft::<Self>(env, send_param)
98
+ fn __debit(env: &Env, sender: &Address, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> OFTReceipt {
99
+ // 1. Pausable check
100
+ Self::__assert_not_paused(env);
101
+
102
+ // 2. Core debit logic (based on oft_type)
103
+ let oft_receipt = match Self::oft_type(env) {
104
+ OftType::LockUnlock => lock_unlock::debit::<Self>(env, sender, amount_ld, min_amount_ld, dst_eid),
105
+ OftType::MintBurn => mint_burn::debit::<Self>(env, sender, amount_ld, min_amount_ld, dst_eid),
106
+ };
107
+
108
+ // 3. Rate limit checks (using amount_received_ld - the actual cross-chain amount)
109
+ Self::__consume_rate_limit_capacity(env, &Direction::Outbound, dst_eid, oft_receipt.amount_received_ld);
110
+ Self::__release_rate_limit_capacity(env, &Direction::Inbound, dst_eid, oft_receipt.amount_received_ld);
111
+
112
+ // 4. Charge fee
113
+ let fee = oft_receipt.amount_sent_ld - oft_receipt.amount_received_ld;
114
+ Self::__charge_fee(env, &Self::token(env), sender, fee);
115
+
116
+ oft_receipt
224
117
  }
225
118
 
226
- /// Quotes a send operation including LayerZero messaging fees.
227
- fn quote_send(
228
- env: &Env,
229
- sender: &Address,
230
- send_param: &oft::types::SendParam,
231
- pay_in_zro: bool,
232
- ) -> endpoint_v2::MessagingFee {
233
- crate::default_oft_impl::default_quote_send::<Self>(env, sender, send_param, pay_in_zro)
119
+ fn __credit(env: &Env, to: &Address, amount_ld: i128, src_eid: u32) -> i128 {
120
+ // 1. Pausable check
121
+ Self::__assert_not_paused(env);
122
+
123
+ // 2. Core credit logic (based on mode)
124
+ let amount_credited = match Self::oft_type(env) {
125
+ OftType::LockUnlock => lock_unlock::credit::<Self>(env, to, amount_ld, src_eid),
126
+ OftType::MintBurn => mint_burn::credit::<Self>(env, to, amount_ld, src_eid),
127
+ };
128
+
129
+ // 3. Rate limit checks (using amount_credited - the actual credited amount)
130
+ Self::__consume_rate_limit_capacity(env, &Direction::Inbound, src_eid, amount_credited);
131
+ Self::__release_rate_limit_capacity(env, &Direction::Outbound, src_eid, amount_credited);
132
+
133
+ amount_credited
234
134
  }
135
+ }
235
136
 
236
- /// Sends tokens cross-chain to another endpoint.
237
- ///
238
- /// Sender must be authenticated.
239
- ///
240
- /// # Returns
241
- /// (MessagingReceipt, OFTReceipt)
242
- fn send(
137
+ /// LzReceiveInternal implementation using default OFT receive logic
138
+ impl LzReceiveInternal for OFT {
139
+ fn __lz_receive(
243
140
  env: &Env,
244
- sender: &Address,
245
- send_param: &oft::types::SendParam,
246
- fee: &endpoint_v2::MessagingFee,
247
- refund_address: &Address,
248
- ) -> (endpoint_v2::MessagingReceipt, oft::types::OFTReceipt) {
249
- crate::default_oft_impl::default_send::<Self>(env, sender, send_param, fee, refund_address)
141
+ origin: &Origin,
142
+ guid: &BytesN<32>,
143
+ message: &Bytes,
144
+ extra_data: &Bytes,
145
+ executor: &Address,
146
+ value: i128,
147
+ ) {
148
+ oft_core::lz_receive::<Self>(env, executor, origin, guid, message, extra_data, value)
250
149
  }
251
150
  }
151
+
152
+ // ==================== Extension Trait Implementations ====================
153
+
154
+ /// Pausable extension - allows pausing/unpausing the OFT
155
+ /// Default state: unpaused (all operations allowed)
156
+ #[contract_impl(contracttrait)]
157
+ impl OFTPausable for OFT {}
158
+
159
+ impl OFTPausableInternal for OFT {}
160
+
161
+ /// OFT Fee extension - allows collecting fees on transfers
162
+ /// Default state: 0 BPS (no fee collected)
163
+ #[contract_impl(contracttrait)]
164
+ impl OFTFee for OFT {}
165
+
166
+ impl OFTFeeInternal for OFT {}
167
+
168
+ /// Rate Limiter extension - allows rate limiting transfers
169
+ /// Default state: not set (rate_limit_capacity returns i128::MAX)
170
+ #[contract_impl(contracttrait)]
171
+ impl RateLimiter for OFT {}
172
+
173
+ impl RateLimiterInternal for OFT {}
@@ -4,11 +4,9 @@
4
4
  //! tokens from the contract on credit (receive).
5
5
  //! Used for OFT adapters that wrap existing tokens.
6
6
 
7
+ use oft_core::{oft_core::OFTCore, types::OFTReceipt};
7
8
  use soroban_sdk::{token::TokenClient, Address, Env};
8
9
 
9
- use crate::oft::OFT;
10
- use crate::types::OFTReceipt;
11
-
12
10
  /// Debit tokens using LockUnlock OFT type (locks tokens in contract).
13
11
  ///
14
12
  /// # Parameters
@@ -20,7 +18,13 @@ use crate::types::OFTReceipt;
20
18
  ///
21
19
  /// # Returns
22
20
  /// `OFTReceipt` containing the amount sent and amount received
23
- pub fn debit<T: OFT>(env: &Env, sender: &Address, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> OFTReceipt {
21
+ pub fn debit<T: OFTCore>(
22
+ env: &Env,
23
+ sender: &Address,
24
+ amount_ld: i128,
25
+ min_amount_ld: i128,
26
+ dst_eid: u32,
27
+ ) -> OFTReceipt {
24
28
  let receipt: OFTReceipt = T::__debit_view(env, amount_ld, min_amount_ld, dst_eid);
25
29
  TokenClient::new(env, &T::token(env)).transfer(sender, env.current_contract_address(), &receipt.amount_received_ld);
26
30
  receipt
@@ -36,15 +40,7 @@ pub fn debit<T: OFT>(env: &Env, sender: &Address, amount_ld: i128, min_amount_ld
36
40
  ///
37
41
  /// # Returns
38
42
  /// The amount credited
39
- pub fn credit<T: OFT>(env: &Env, to: &Address, amount_ld: i128, _src_eid: u32) -> i128 {
43
+ pub fn credit<T: OFTCore>(env: &Env, to: &Address, amount_ld: i128, _src_eid: u32) -> i128 {
40
44
  TokenClient::new(env, &T::token(env)).transfer(&env.current_contract_address(), to, &amount_ld);
41
45
  amount_ld
42
46
  }
43
-
44
- /// Returns whether approval is required for LockUnlock OFT type.
45
- ///
46
- /// # Returns
47
- /// Always `false` - approval not needed for transfer operations
48
- pub fn approval_required() -> bool {
49
- false
50
- }
@@ -3,11 +3,30 @@
3
3
  //! This OFT type burns tokens on debit (send) and mints tokens on credit (receive).
4
4
  //! Used when the OFT contract has mint/burn authority over the token.
5
5
 
6
- use soroban_sdk::{Address, Env};
6
+ use oft_core::{oft_core::OFTCore, types::OFTReceipt};
7
+ use soroban_sdk::{contractclient, Address, Env};
7
8
 
8
- use crate::interfaces::MintBurnTokenClient;
9
- use crate::oft::OFT;
10
- use crate::types::OFTReceipt;
9
+ /// Contract interface for mint and burn token operations.
10
+ ///
11
+ /// This interface abstracts the token mint/burn functionality, allowing different
12
+ /// token implementations (e.g., StellarAssetContract, custom tokens) to be used
13
+ /// with the MintBurn OFT.
14
+ #[contractclient(name = "MintBurnTokenClient")]
15
+ pub trait MintBurnToken {
16
+ /// Mints tokens to the specified address.
17
+ ///
18
+ /// # Parameters
19
+ /// * `to` - The address to mint tokens to
20
+ /// * `amount` - The amount of tokens to mint (must be non-negative)
21
+ fn mint(env: Env, to: Address, amount: i128);
22
+
23
+ /// Burns tokens from the specified address.
24
+ ///
25
+ /// # Parameters
26
+ /// * `from` - The address to burn tokens from
27
+ /// * `amount` - The amount of tokens to burn (must be non-negative)
28
+ fn burn(env: Env, from: Address, amount: i128);
29
+ }
11
30
 
12
31
  /// Debit tokens using MintBurn OFT type (burns tokens from sender).
13
32
  ///
@@ -20,7 +39,13 @@ use crate::types::OFTReceipt;
20
39
  ///
21
40
  /// # Returns
22
41
  /// `OFTReceipt` containing the amount sent and amount received
23
- pub fn debit<T: OFT>(env: &Env, sender: &Address, amount_ld: i128, min_amount_ld: i128, dst_eid: u32) -> OFTReceipt {
42
+ pub fn debit<T: OFTCore>(
43
+ env: &Env,
44
+ sender: &Address,
45
+ amount_ld: i128,
46
+ min_amount_ld: i128,
47
+ dst_eid: u32,
48
+ ) -> OFTReceipt {
24
49
  let receipt = T::__debit_view(env, amount_ld, min_amount_ld, dst_eid);
25
50
  MintBurnTokenClient::new(env, &T::token(env)).burn(sender, &receipt.amount_received_ld);
26
51
  receipt
@@ -36,15 +61,7 @@ pub fn debit<T: OFT>(env: &Env, sender: &Address, amount_ld: i128, min_amount_ld
36
61
  ///
37
62
  /// # Returns
38
63
  /// The amount credited
39
- pub fn credit<T: OFT>(env: &Env, to: &Address, amount_ld: i128, _src_eid: u32) -> i128 {
64
+ pub fn credit<T: OFTCore>(env: &Env, to: &Address, amount_ld: i128, _src_eid: u32) -> i128 {
40
65
  MintBurnTokenClient::new(env, &T::token(env)).mint(to, &amount_ld);
41
66
  amount_ld
42
67
  }
43
-
44
- /// Returns whether approval is required for MintBurn OFT type.
45
- ///
46
- /// # Returns
47
- /// Always `false` - approval not needed for mint/burn operations.
48
- pub fn approval_required() -> bool {
49
- false
50
- }
@@ -6,5 +6,18 @@
6
6
  //! - **LockUnlock**: Locks tokens on send, unlocks on receive. Approval not required.
7
7
  //!
8
8
 
9
+ use soroban_sdk::contracttype;
10
+
9
11
  pub mod lock_unlock;
10
12
  pub mod mint_burn;
13
+
14
+ /// The type of OFT operation mode
15
+ #[contracttype]
16
+ #[derive(Clone, Copy, Debug, Eq, PartialEq)]
17
+ #[repr(u8)]
18
+ pub enum OftType {
19
+ /// Lock tokens on send, unlock on receive
20
+ LockUnlock = 0,
21
+ /// Burn tokens on send, mint on receive
22
+ MintBurn = 1,
23
+ }
@@ -1,11 +1,11 @@
1
1
  [package]
2
- name = "oft-std"
2
+ name = "oft-core"
3
3
  version.workspace = true
4
4
  edition.workspace = true
5
5
  license.workspace = true
6
6
 
7
7
  [lib]
8
- crate-type = ["cdylib"]
8
+ crate-type = ["rlib"]
9
9
  doctest = false
10
10
 
11
11
  [dependencies]
@@ -14,8 +14,6 @@ endpoint-v2 = { workspace = true, features = ["library"] }
14
14
  utils = { workspace = true }
15
15
  oapp = { workspace = true }
16
16
  common-macros = { workspace = true }
17
- oapp-macros = { workspace = true }
18
- oft = { workspace = true }
19
17
 
20
18
  [dev-dependencies]
21
19
  soroban-sdk = { workspace = true, features = ["testutils"] }
@@ -23,3 +21,7 @@ simple-message-lib = { workspace = true }
23
21
  message-lib-common = { workspace = true, features = ["testutils"] }
24
22
  endpoint-v2 = { workspace = true, features = ["testutils"] }
25
23
  utils = { workspace = true, features = ["testutils"] }
24
+ insta = { workspace = true }
25
+ oapp-macros = { workspace = true }
26
+ stellar-macros = { workspace = true }
27
+ stellar-tokens = { workspace = true }
@@ -1,3 +1,3 @@
1
- pub mod extensions;
2
1
  pub mod setup;
2
+ pub mod test_with_sml;
3
3
  pub mod utils;