@layerzerolabs/protocol-stellar-v2 0.2.8 → 0.2.10

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 (239) hide show
  1. package/.turbo/turbo-build.log +443 -302
  2. package/.turbo/turbo-lint.log +118 -96
  3. package/.turbo/turbo-test.log +853 -731
  4. package/Cargo.lock +120 -37
  5. package/Cargo.toml +8 -5
  6. package/contracts/common-macros/src/contract_impl.rs +44 -0
  7. package/contracts/common-macros/src/lib.rs +86 -40
  8. package/contracts/common-macros/src/ownable.rs +24 -32
  9. package/contracts/common-macros/src/storage.rs +95 -120
  10. package/contracts/common-macros/src/tests/contract_impl.rs +289 -0
  11. package/contracts/common-macros/src/tests/mod.rs +9 -0
  12. package/contracts/common-macros/src/tests/ownable.rs +151 -0
  13. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__contract_impl__snapshot_generated_contract_impl_code.snap +85 -0
  14. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_generated_ownable_code.snap +30 -0
  15. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ownable__snapshot_only_owner_preserves_function_signature.snap +9 -0
  16. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__storage__snapshot_generated_storage_code.snap +1072 -0
  17. package/contracts/common-macros/src/tests/snapshots/common_macros__tests__ttl_configurable__snapshot_generated_ttl_configurable_code.snap +45 -0
  18. package/contracts/common-macros/src/tests/storage.rs +485 -0
  19. package/contracts/common-macros/src/tests/test_helpers.rs +93 -0
  20. package/contracts/common-macros/src/tests/ttl_configurable.rs +34 -0
  21. package/contracts/common-macros/src/ttl_configurable.rs +31 -14
  22. package/contracts/common-macros/src/utils.rs +27 -0
  23. package/contracts/endpoint-v2/ARCHITECTURE.md +4 -4
  24. package/contracts/endpoint-v2/src/endpoint_v2.rs +18 -15
  25. package/contracts/endpoint-v2/src/interfaces/message_lib.rs +2 -3
  26. package/contracts/endpoint-v2/src/interfaces/message_lib_manager.rs +5 -3
  27. package/contracts/endpoint-v2/src/interfaces/messaging_channel.rs +2 -2
  28. package/contracts/endpoint-v2/src/interfaces/messaging_composer.rs +2 -2
  29. package/contracts/endpoint-v2/src/interfaces/send_lib.rs +4 -4
  30. package/contracts/endpoint-v2/src/lib.rs +6 -5
  31. package/contracts/endpoint-v2/src/message_lib_manager.rs +14 -6
  32. package/contracts/endpoint-v2/src/messaging_channel.rs +6 -2
  33. package/contracts/endpoint-v2/src/messaging_composer.rs +6 -2
  34. package/contracts/endpoint-v2/src/storage.rs +10 -7
  35. package/contracts/endpoint-v2/src/tests/endpoint_v2/pay_messaging_fees.rs +16 -16
  36. package/contracts/endpoint-v2/src/tests/endpoint_v2/ttl_config.rs +46 -46
  37. package/contracts/endpoint-v2/src/tests/mock.rs +2 -2
  38. package/contracts/endpoint-v2/src/util.rs +8 -2
  39. package/contracts/message-libs/block-message-lib/Cargo.toml +1 -0
  40. package/contracts/message-libs/block-message-lib/src/lib.rs +5 -5
  41. package/contracts/message-libs/message-lib-common/src/errors.rs +8 -8
  42. package/contracts/message-libs/message-lib-common/src/interfaces/dvn.rs +0 -1
  43. package/contracts/message-libs/message-lib-common/src/interfaces/mod.rs +3 -3
  44. package/contracts/message-libs/message-lib-common/src/lib.rs +0 -2
  45. package/contracts/message-libs/message-lib-common/src/packet_codec_v1.rs +4 -6
  46. package/contracts/message-libs/message-lib-common/src/tests/packet_codec_v1.rs +2 -2
  47. package/contracts/message-libs/message-lib-common/src/tests/worker_options.rs +11 -11
  48. package/contracts/message-libs/message-lib-common/src/worker_options.rs +10 -16
  49. package/contracts/message-libs/simple-message-lib/src/errors.rs +0 -4
  50. package/contracts/message-libs/simple-message-lib/src/simple_message_lib.rs +49 -34
  51. package/contracts/message-libs/simple-message-lib/src/storage.rs +3 -7
  52. package/contracts/message-libs/simple-message-lib/src/test.rs +3 -3
  53. package/contracts/message-libs/treasury/src/storage.rs +1 -2
  54. package/contracts/message-libs/treasury/src/tests/setup.rs +3 -2
  55. package/contracts/message-libs/treasury/src/tests/treasury_tests.rs +0 -13
  56. package/contracts/message-libs/treasury/src/treasury.rs +18 -21
  57. package/contracts/message-libs/uln-302/Cargo.toml +1 -0
  58. package/contracts/message-libs/uln-302/src/interfaces/mod.rs +4 -4
  59. package/contracts/message-libs/uln-302/src/interfaces/{receive.rs → receive_uln.rs} +3 -3
  60. package/contracts/message-libs/uln-302/src/interfaces/{send.rs → send_uln.rs} +8 -80
  61. package/contracts/message-libs/uln-302/src/lib.rs +5 -4
  62. package/contracts/message-libs/uln-302/src/{receive.rs → receive_uln.rs} +20 -12
  63. package/contracts/message-libs/uln-302/src/{send.rs → send_uln.rs} +19 -13
  64. package/contracts/message-libs/uln-302/src/storage.rs +1 -2
  65. package/contracts/message-libs/uln-302/src/tests/config/uln_config.rs +3 -2
  66. package/contracts/message-libs/uln-302/src/tests/send_uln302/send.rs +30 -30
  67. package/contracts/message-libs/uln-302/src/tests/setup.rs +12 -11
  68. package/contracts/message-libs/uln-302/src/tests/uln302/set_config.rs +1 -1
  69. package/contracts/message-libs/uln-302/src/{config_validation.rs → types.rs} +79 -11
  70. package/contracts/message-libs/uln-302/src/uln302.rs +15 -10
  71. package/contracts/oapp-macros/Cargo.toml +2 -8
  72. package/contracts/oapp-macros/src/lib.rs +57 -311
  73. package/contracts/oapp-macros/src/oapp_core.rs +23 -32
  74. package/contracts/oapp-macros/src/oapp_full.rs +8 -2
  75. package/contracts/oapp-macros/src/oapp_options_type3.rs +21 -36
  76. package/contracts/oapp-macros/src/oapp_receiver.rs +38 -57
  77. package/contracts/oapp-macros/src/oapp_sender.rs +12 -14
  78. package/contracts/oapp-macros/src/util.rs +14 -10
  79. package/contracts/oapps/counter/Cargo.toml +2 -1
  80. package/contracts/oapps/counter/integration_tests/utils.rs +4 -4
  81. package/contracts/oapps/counter/src/codec.rs +8 -9
  82. package/contracts/oapps/counter/src/counter.rs +156 -147
  83. package/contracts/oapps/counter/src/storage.rs +1 -2
  84. package/contracts/oapps/counter/src/tests/test_codec.rs +5 -5
  85. package/contracts/oapps/counter/src/tests/test_counter.rs +11 -13
  86. package/contracts/oapps/oapp/Cargo.toml +1 -0
  87. package/contracts/oapps/oapp/src/errors.rs +1 -1
  88. package/contracts/oapps/oapp/src/lib.rs +3 -0
  89. package/contracts/oapps/oapp/src/macro_tests/mod.rs +1 -0
  90. package/contracts/oapps/oapp/src/macro_tests/test_macros.rs +312 -0
  91. package/contracts/oapps/oapp/src/oapp_core.rs +52 -53
  92. package/contracts/oapps/oapp/src/oapp_options_type3.rs +18 -28
  93. package/contracts/oapps/oapp/src/oapp_receiver.rs +82 -31
  94. package/contracts/oapps/oapp/src/oapp_sender.rs +55 -13
  95. package/contracts/oapps/oapp/src/tests/test_oapp_core.rs +16 -3
  96. package/contracts/oapps/oapp/src/tests/test_oapp_options_type3.rs +33 -8
  97. package/contracts/oapps/oapp/src/tests/test_oapp_receiver.rs +6 -9
  98. package/contracts/oapps/oapp/src/tests/test_oapp_sender.rs +28 -15
  99. package/contracts/oapps/oft/Cargo.toml +27 -0
  100. package/contracts/oapps/oft/integration-tests/mod.rs +3 -0
  101. package/contracts/oapps/oft/integration-tests/setup.rs +320 -0
  102. package/contracts/oapps/oft/integration-tests/test_with_sml.rs +155 -0
  103. package/contracts/oapps/oft/integration-tests/utils.rs +201 -0
  104. package/contracts/oapps/oft/src/codec/mod.rs +2 -0
  105. package/contracts/oapps/oft/src/codec/oft_compose_msg_codec.rs +55 -0
  106. package/contracts/oapps/oft/src/codec/oft_msg_codec.rs +62 -0
  107. package/contracts/oapps/oft/src/constants.rs +5 -0
  108. package/contracts/oapps/oft/src/errors.rs +8 -0
  109. package/contracts/oapps/oft/src/events.rs +19 -0
  110. package/contracts/oapps/oft/src/interfaces/mint_burn_token.rs +23 -0
  111. package/contracts/oapps/oft/src/interfaces/mod.rs +3 -0
  112. package/contracts/oapps/oft/src/lib.rs +22 -0
  113. package/contracts/oapps/oft/src/macro_tests/mod.rs +2 -0
  114. package/contracts/oapps/oft/src/macro_tests/test_all_default.rs +41 -0
  115. package/contracts/oapps/oft/src/macro_tests/test_override.rs +83 -0
  116. package/contracts/oapps/oft/src/oft.rs +320 -0
  117. package/contracts/oapps/oft/src/oft_types/lock_unlock.rs +50 -0
  118. package/contracts/oapps/oft/src/oft_types/mint_burn.rs +50 -0
  119. package/contracts/oapps/oft/src/oft_types/mod.rs +10 -0
  120. package/contracts/oapps/oft/src/storage.rs +11 -0
  121. package/contracts/oapps/oft/src/tests/mod.rs +13 -0
  122. package/contracts/oapps/oft/src/tests/test_decimals.rs +89 -0
  123. package/contracts/oapps/oft/src/tests/test_lz_receive.rs +282 -0
  124. package/contracts/oapps/oft/src/tests/test_oft_compose_msg_codec.rs +68 -0
  125. package/contracts/oapps/oft/src/tests/test_oft_msg_codec.rs +136 -0
  126. package/contracts/oapps/oft/src/tests/test_oft_version.rs +13 -0
  127. package/contracts/oapps/oft/src/tests/test_quote_oft.rs +159 -0
  128. package/contracts/oapps/oft/src/tests/test_quote_send.rs +195 -0
  129. package/contracts/oapps/oft/src/tests/test_resolve_address.rs +37 -0
  130. package/contracts/oapps/oft/src/tests/test_send.rs +915 -0
  131. package/contracts/oapps/oft/src/tests/test_token.rs +47 -0
  132. package/contracts/oapps/oft/src/tests/test_utils.rs +789 -0
  133. package/contracts/oapps/oft/src/types.rs +38 -0
  134. package/contracts/oapps/oft/src/utils.rs +67 -0
  135. package/contracts/oapps/oft-mint-burn/Cargo.toml +26 -0
  136. package/contracts/oapps/oft-mint-burn/src/lib.rs +3 -0
  137. package/contracts/oapps/oft-mint-burn/src/oft.rs +28 -0
  138. package/contracts/oapps/oft-mint-burn/src/tests/mod.rs +1 -0
  139. package/contracts/utils/src/buffer_reader.rs +8 -9
  140. package/contracts/utils/src/buffer_writer.rs +11 -5
  141. package/contracts/utils/src/errors.rs +5 -5
  142. package/contracts/utils/src/ownable.rs +14 -6
  143. package/contracts/utils/src/testing_utils.rs +11 -1
  144. package/contracts/utils/src/tests/buffer_reader.rs +491 -730
  145. package/contracts/utils/src/tests/buffer_writer.rs +336 -148
  146. package/contracts/utils/src/tests/bytes_ext.rs +125 -40
  147. package/contracts/utils/src/tests/mod.rs +3 -0
  148. package/contracts/utils/src/tests/ownable.rs +379 -27
  149. package/contracts/utils/src/tests/test_helper.rs +47 -0
  150. package/contracts/utils/src/tests/testing_utils.rs +555 -0
  151. package/contracts/utils/src/tests/ttl.rs +421 -0
  152. package/contracts/utils/src/ttl.rs +29 -89
  153. package/contracts/workers/dvn/Cargo.toml +31 -0
  154. package/contracts/workers/dvn/src/auth.rs +66 -0
  155. package/contracts/workers/dvn/src/dvn.rs +143 -0
  156. package/contracts/workers/dvn/src/errors.rs +21 -0
  157. package/contracts/workers/dvn/src/events.rs +19 -0
  158. package/contracts/workers/dvn/src/interfaces/dvn.rs +12 -0
  159. package/contracts/workers/dvn/src/interfaces/mod.rs +5 -0
  160. package/contracts/workers/dvn/src/interfaces/multisig.rs +15 -0
  161. package/contracts/workers/dvn/src/lib.rs +24 -0
  162. package/contracts/workers/dvn/src/multisig.rs +127 -0
  163. package/contracts/workers/dvn/src/storage.rs +35 -0
  164. package/contracts/workers/dvn/src/tests/auth.rs +237 -0
  165. package/contracts/workers/dvn/src/tests/dvn.rs +349 -0
  166. package/contracts/workers/dvn/src/tests/key_pair.rs +66 -0
  167. package/contracts/workers/dvn/src/tests/mod.rs +5 -0
  168. package/contracts/workers/dvn/src/tests/multisig/mod.rs +3 -0
  169. package/contracts/workers/dvn/src/tests/multisig/set_signer.rs +133 -0
  170. package/contracts/workers/dvn/src/tests/multisig/set_threshold.rs +108 -0
  171. package/contracts/workers/dvn/src/tests/multisig/verify_signatures.rs +109 -0
  172. package/contracts/workers/dvn/src/tests/setup.rs +109 -0
  173. package/contracts/workers/dvn/src/types.rs +26 -0
  174. package/contracts/workers/dvn-fee-lib/Cargo.toml +24 -0
  175. package/contracts/workers/dvn-fee-lib/src/dvn_fee_lib.rs +113 -0
  176. package/contracts/workers/dvn-fee-lib/src/errors.rs +8 -0
  177. package/contracts/workers/dvn-fee-lib/src/lib.rs +17 -0
  178. package/contracts/workers/dvn-fee-lib/src/tests/dvn_fee_lib.rs +282 -0
  179. package/contracts/workers/dvn-fee-lib/src/tests/mod.rs +1 -0
  180. package/contracts/workers/executor/Cargo.toml +10 -7
  181. package/contracts/workers/executor/src/errors.rs +8 -0
  182. package/contracts/workers/executor/src/events.rs +4 -7
  183. package/contracts/workers/executor/src/interfaces/executor.rs +72 -22
  184. package/contracts/workers/executor/src/interfaces/mod.rs +0 -2
  185. package/contracts/workers/executor/src/lib.rs +16 -7
  186. package/contracts/workers/executor/src/lz_executor.rs +308 -0
  187. package/contracts/workers/executor/src/storage.rs +24 -16
  188. package/contracts/workers/executor-fee-lib/Cargo.toml +22 -0
  189. package/contracts/workers/executor-fee-lib/src/errors.rs +15 -0
  190. package/contracts/workers/executor-fee-lib/src/executor_fee_lib.rs +215 -0
  191. package/contracts/workers/executor-fee-lib/src/executor_option.rs +203 -0
  192. package/contracts/workers/executor-fee-lib/src/lib.rs +7 -0
  193. package/contracts/workers/executor-helper/Cargo.toml +29 -0
  194. package/contracts/workers/executor-helper/src/executor_helper.rs +161 -0
  195. package/contracts/workers/executor-helper/src/lib.rs +11 -0
  196. package/contracts/workers/{worker-common → worker}/Cargo.toml +1 -4
  197. package/contracts/workers/worker/src/errors.rs +24 -0
  198. package/contracts/workers/worker/src/events.rs +62 -0
  199. package/contracts/workers/worker/src/interfaces/dvn_fee_lib.rs +75 -0
  200. package/contracts/workers/worker/src/interfaces/executor_fee_lib.rs +84 -0
  201. package/contracts/workers/{worker-common → worker}/src/interfaces/mod.rs +2 -2
  202. package/contracts/workers/worker/src/interfaces/price_feed.rs +85 -0
  203. package/contracts/workers/worker/src/lib.rs +14 -0
  204. package/contracts/workers/worker/src/storage.rs +63 -0
  205. package/contracts/workers/worker/src/worker.rs +459 -0
  206. package/package.json +3 -3
  207. package/sdk/dist/generated/bml.d.ts +88 -17
  208. package/sdk/dist/generated/bml.js +62 -16
  209. package/sdk/dist/generated/counter.d.ts +281 -102
  210. package/sdk/dist/generated/counter.js +93 -41
  211. package/sdk/dist/generated/endpoint.d.ts +128 -105
  212. package/sdk/dist/generated/endpoint.js +47 -45
  213. package/sdk/dist/generated/sml.d.ts +212 -69
  214. package/sdk/dist/generated/sml.js +103 -53
  215. package/sdk/dist/generated/uln302.d.ts +270 -173
  216. package/sdk/dist/generated/uln302.js +112 -64
  217. package/sdk/package.json +11 -11
  218. package/sdk/test/index.test.ts +147 -42
  219. package/sdk/test/suites/constants.ts +7 -3
  220. package/sdk/test/suites/deploy.ts +65 -42
  221. package/sdk/test/suites/localnet.ts +2 -2
  222. package/sdk/test/suites/scan.ts +28 -25
  223. package/sdk/test/utils.ts +199 -0
  224. package/sdk/tsconfig.json +93 -95
  225. package/tools/ts-bindings-gen/src/main.rs +2 -0
  226. package/contracts/common-macros/src/snapshots/common_macros__tests__tests__snapshot_generated_storage_code.snap +0 -310
  227. package/contracts/common-macros/src/tests.rs +0 -287
  228. package/contracts/oapp-macros/tests/test_macros.rs +0 -522
  229. package/contracts/workers/executor/src/executor.rs +0 -347
  230. package/contracts/workers/executor/src/interfaces/types.rs +0 -51
  231. package/contracts/workers/worker-common/src/constants.rs +0 -17
  232. package/contracts/workers/worker-common/src/errors.rs +0 -6
  233. package/contracts/workers/worker-common/src/events.rs +0 -34
  234. package/contracts/workers/worker-common/src/interfaces/executor_fee_lib.rs +0 -35
  235. package/contracts/workers/worker-common/src/interfaces/price_feed.rs +0 -40
  236. package/contracts/workers/worker-common/src/interfaces/worker.rs +0 -60
  237. package/contracts/workers/worker-common/src/lib.rs +0 -19
  238. package/contracts/workers/worker-common/src/storage.rs +0 -32
  239. package/contracts/workers/worker-common/src/worker_common.rs +0 -166
package/Cargo.lock CHANGED
@@ -229,6 +229,7 @@ dependencies = [
229
229
  "common-macros",
230
230
  "endpoint-v2",
231
231
  "soroban-sdk",
232
+ "utils",
232
233
  ]
233
234
 
234
235
  [[package]]
@@ -332,6 +333,7 @@ dependencies = [
332
333
  "assert_unordered",
333
334
  "common-macros",
334
335
  "endpoint-v2",
336
+ "executor",
335
337
  "message-lib-common",
336
338
  "oapp",
337
339
  "oapp-macros",
@@ -585,6 +587,35 @@ version = "0.0.6"
585
587
  source = "registry+https://github.com/rust-lang/crates.io-index"
586
588
  checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5"
587
589
 
590
+ [[package]]
591
+ name = "dvn"
592
+ version = "0.0.1"
593
+ dependencies = [
594
+ "cfg-if",
595
+ "common-macros",
596
+ "ed25519-dalek",
597
+ "endpoint-v2",
598
+ "insta",
599
+ "k256",
600
+ "message-lib-common",
601
+ "rand",
602
+ "sha3",
603
+ "soroban-sdk",
604
+ "utils",
605
+ "worker",
606
+ ]
607
+
608
+ [[package]]
609
+ name = "dvn-fee-lib"
610
+ version = "0.0.1"
611
+ dependencies = [
612
+ "cfg-if",
613
+ "common-macros",
614
+ "message-lib-common",
615
+ "soroban-sdk",
616
+ "worker",
617
+ ]
618
+
588
619
  [[package]]
589
620
  name = "dyn-clone"
590
621
  version = "1.0.20"
@@ -602,6 +633,7 @@ dependencies = [
602
633
  "elliptic-curve",
603
634
  "rfc6979",
604
635
  "signature",
636
+ "spki",
605
637
  ]
606
638
 
607
639
  [[package]]
@@ -647,6 +679,7 @@ dependencies = [
647
679
  "ff",
648
680
  "generic-array",
649
681
  "group",
682
+ "pkcs8",
650
683
  "rand_core",
651
684
  "sec1",
652
685
  "subtle",
@@ -692,15 +725,37 @@ checksum = "ca81e6b4777c89fd810c25a4be2b1bd93ea034fbe58e6a75216a34c6b82c539b"
692
725
  name = "executor"
693
726
  version = "0.0.1"
694
727
  dependencies = [
728
+ "cfg-if",
695
729
  "common-macros",
696
730
  "endpoint-v2",
697
731
  "message-lib-common",
698
732
  "soroban-sdk",
699
- "stellar-access",
700
- "stellar-contract-utils",
701
- "stellar-macros",
702
733
  "utils",
703
- "worker-common",
734
+ "worker",
735
+ ]
736
+
737
+ [[package]]
738
+ name = "executor-fee-lib"
739
+ version = "0.0.1"
740
+ dependencies = [
741
+ "common-macros",
742
+ "message-lib-common",
743
+ "soroban-sdk",
744
+ "utils",
745
+ "worker",
746
+ ]
747
+
748
+ [[package]]
749
+ name = "executor-helper"
750
+ version = "0.0.1"
751
+ dependencies = [
752
+ "cfg-if",
753
+ "common-macros",
754
+ "endpoint-v2",
755
+ "executor",
756
+ "soroban-sdk",
757
+ "utils",
758
+ "worker",
704
759
  ]
705
760
 
706
761
  [[package]]
@@ -968,7 +1023,9 @@ dependencies = [
968
1023
  "cfg-if",
969
1024
  "ecdsa",
970
1025
  "elliptic-curve",
1026
+ "once_cell",
971
1027
  "sha2 0.10.9",
1028
+ "signature",
972
1029
  ]
973
1030
 
974
1031
  [[package]]
@@ -1090,20 +1147,50 @@ dependencies = [
1090
1147
  [[package]]
1091
1148
  name = "oapp-macros"
1092
1149
  version = "0.0.1"
1150
+ dependencies = [
1151
+ "heck 0.5.0",
1152
+ "proc-macro2",
1153
+ "quote",
1154
+ "syn 2.0.108",
1155
+ ]
1156
+
1157
+ [[package]]
1158
+ name = "oapps"
1159
+ version = "0.0.1"
1160
+
1161
+ [[package]]
1162
+ name = "oft"
1163
+ version = "0.0.1"
1093
1164
  dependencies = [
1094
1165
  "common-macros",
1095
1166
  "endpoint-v2",
1167
+ "insta",
1168
+ "message-lib-common",
1096
1169
  "oapp",
1097
- "proc-macro2",
1098
- "quote",
1170
+ "oapp-macros",
1171
+ "simple-message-lib",
1099
1172
  "soroban-sdk",
1100
- "syn 2.0.108",
1173
+ "stellar-macros",
1174
+ "stellar-tokens",
1101
1175
  "utils",
1102
1176
  ]
1103
1177
 
1104
1178
  [[package]]
1105
- name = "oapps"
1179
+ name = "oft-mint-burn"
1106
1180
  version = "0.0.1"
1181
+ dependencies = [
1182
+ "assert_unordered",
1183
+ "common-macros",
1184
+ "endpoint-v2",
1185
+ "executor",
1186
+ "message-lib-common",
1187
+ "oapp",
1188
+ "oapp-macros",
1189
+ "oft",
1190
+ "simple-message-lib",
1191
+ "soroban-sdk",
1192
+ "utils",
1193
+ ]
1107
1194
 
1108
1195
  [[package]]
1109
1196
  name = "once_cell"
@@ -1322,6 +1409,7 @@ dependencies = [
1322
1409
  "base16ct",
1323
1410
  "der",
1324
1411
  "generic-array",
1412
+ "pkcs8",
1325
1413
  "subtle",
1326
1414
  "zeroize",
1327
1415
  ]
@@ -1575,9 +1663,9 @@ dependencies = [
1575
1663
 
1576
1664
  [[package]]
1577
1665
  name = "soroban-ledger-snapshot"
1578
- version = "23.3.0"
1666
+ version = "23.4.0"
1579
1667
  source = "registry+https://github.com/rust-lang/crates.io-index"
1580
- checksum = "1f778688aade32f689dd386878e7ff553ccd31f7de194da52db972a2a667baa8"
1668
+ checksum = "c9c4500634698292eabdc97ec7e98b817d8c343ca7ddcf1ae25f985b0f7ee4da"
1581
1669
  dependencies = [
1582
1670
  "serde",
1583
1671
  "serde_json",
@@ -1589,9 +1677,9 @@ dependencies = [
1589
1677
 
1590
1678
  [[package]]
1591
1679
  name = "soroban-sdk"
1592
- version = "23.3.0"
1680
+ version = "23.4.0"
1593
1681
  source = "registry+https://github.com/rust-lang/crates.io-index"
1594
- checksum = "64ddf4cb462f95404af5f38bacd41f61285ca8af8099b0875ad2cdbb133690e4"
1682
+ checksum = "7fdaa5d2d75769a5df6015b476882bdf186414c7558c241911e79d75b39b515d"
1595
1683
  dependencies = [
1596
1684
  "arbitrary",
1597
1685
  "bytes-lit",
@@ -1613,9 +1701,9 @@ dependencies = [
1613
1701
 
1614
1702
  [[package]]
1615
1703
  name = "soroban-sdk-macros"
1616
- version = "23.3.0"
1704
+ version = "23.4.0"
1617
1705
  source = "registry+https://github.com/rust-lang/crates.io-index"
1618
- checksum = "632bdcd72882afa0f2490616944d63610e0d40e186aec74170cc5dd21f75df44"
1706
+ checksum = "50ed4dc6b43003c278fe8a7a80d94542232eb1b56e311dd71b73f7d646e1e7a4"
1619
1707
  dependencies = [
1620
1708
  "darling 0.20.11",
1621
1709
  "heck 0.5.0",
@@ -1633,9 +1721,9 @@ dependencies = [
1633
1721
 
1634
1722
  [[package]]
1635
1723
  name = "soroban-spec"
1636
- version = "23.3.0"
1724
+ version = "23.4.0"
1637
1725
  source = "registry+https://github.com/rust-lang/crates.io-index"
1638
- checksum = "83e23eb9e61eb7831a169132982f18cd4664d0b109f72871ef25645cfe6a0a91"
1726
+ checksum = "c55623057d24c2a5326f519b56a756463f2aeb7ae62af0978fa0b9bab59d732d"
1639
1727
  dependencies = [
1640
1728
  "base64 0.22.1",
1641
1729
  "stellar-xdr",
@@ -1645,9 +1733,9 @@ dependencies = [
1645
1733
 
1646
1734
  [[package]]
1647
1735
  name = "soroban-spec-rust"
1648
- version = "23.3.0"
1736
+ version = "23.4.0"
1649
1737
  source = "registry+https://github.com/rust-lang/crates.io-index"
1650
- checksum = "44a20e878c4f6c995541dce4269c52170f2655decc4e794ab70624b936adc1c7"
1738
+ checksum = "e9eec1039dfb0dda4c2fb8699a6e5a1c3c5a682432bdaee5fd6a7bb90c45db0c"
1651
1739
  dependencies = [
1652
1740
  "prettyplease",
1653
1741
  "proc-macro2",
@@ -1714,29 +1802,18 @@ version = "1.1.0"
1714
1802
  source = "registry+https://github.com/rust-lang/crates.io-index"
1715
1803
  checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
1716
1804
 
1717
- [[package]]
1718
- name = "stellar-access"
1719
- version = "0.5.0"
1720
- source = "registry+https://github.com/rust-lang/crates.io-index"
1721
- checksum = "b5345cb2ba75b98f4b355fc95952e418046e9fe46e4fd94648c719993511a29d"
1722
- dependencies = [
1723
- "soroban-sdk",
1724
- ]
1725
-
1726
1805
  [[package]]
1727
1806
  name = "stellar-contract-utils"
1728
- version = "0.5.0"
1729
- source = "registry+https://github.com/rust-lang/crates.io-index"
1730
- checksum = "4fc596a92adf2bbfbc6022c5d218c9bace96554de95e350e38e9da4a5a5ea77d"
1807
+ version = "0.5.1"
1808
+ source = "git+https://github.com/OpenZeppelin/stellar-contracts.git?tag=v0.5.1#372a162a6df8aed108befa5573d30a8ca49cb271"
1731
1809
  dependencies = [
1732
1810
  "soroban-sdk",
1733
1811
  ]
1734
1812
 
1735
1813
  [[package]]
1736
1814
  name = "stellar-macros"
1737
- version = "0.5.0"
1738
- source = "registry+https://github.com/rust-lang/crates.io-index"
1739
- checksum = "bcc533c344e11f77f34f03e7cdc8d70da83784c746953bfd4b2d62f5423130ac"
1815
+ version = "0.5.1"
1816
+ source = "git+https://github.com/OpenZeppelin/stellar-contracts.git?tag=v0.5.1#372a162a6df8aed108befa5573d30a8ca49cb271"
1740
1817
  dependencies = [
1741
1818
  "proc-macro2",
1742
1819
  "quote",
@@ -1763,6 +1840,15 @@ dependencies = [
1763
1840
  "data-encoding",
1764
1841
  ]
1765
1842
 
1843
+ [[package]]
1844
+ name = "stellar-tokens"
1845
+ version = "0.5.1"
1846
+ source = "git+https://github.com/OpenZeppelin/stellar-contracts.git?tag=v0.5.1#372a162a6df8aed108befa5573d30a8ca49cb271"
1847
+ dependencies = [
1848
+ "soroban-sdk",
1849
+ "stellar-contract-utils",
1850
+ ]
1851
+
1766
1852
  [[package]]
1767
1853
  name = "stellar-xdr"
1768
1854
  version = "23.0.0"
@@ -2181,14 +2267,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2181
2267
  checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
2182
2268
 
2183
2269
  [[package]]
2184
- name = "worker-common"
2270
+ name = "worker"
2185
2271
  version = "0.0.1"
2186
2272
  dependencies = [
2187
2273
  "common-macros",
2188
2274
  "soroban-sdk",
2189
- "stellar-access",
2190
- "stellar-contract-utils",
2191
- "stellar-macros",
2192
2275
  "utils",
2193
2276
  ]
2194
2277
 
package/Cargo.toml CHANGED
@@ -14,7 +14,7 @@ license = "MIT"
14
14
  version = "0.0.1"
15
15
 
16
16
  [workspace.dependencies]
17
- soroban-sdk = {version = "23.3.0", features = ["hazmat-address"]}
17
+ soroban-sdk = {version = "23.4.0", features = ["hazmat-address", "hazmat-crypto"]}
18
18
  cfg-if = { version = "1.0", default-features = false }
19
19
  hex-literal = "1.0.0"
20
20
  endpoint-v2 = { path = "contracts/endpoint-v2", default-features = false }
@@ -25,11 +25,14 @@ message-lib-common = { path = "contracts/message-libs/message-lib-common" }
25
25
  oapp = { path = "contracts/oapps/oapp" }
26
26
  simple-message-lib = { path = "contracts/message-libs/simple-message-lib" }
27
27
  treasury = { path = "contracts/message-libs/treasury" }
28
- worker-common = { path = "contracts/workers/worker-common" }
28
+ worker = { path = "contracts/workers/worker" }
29
29
  executor = { path = "contracts/workers/executor" }
30
- stellar-access = "0.5.0"
31
- stellar-macros = "0.5.0"
32
- stellar-contract-utils = "0.5.0"
30
+ executor-helper = { path = "contracts/workers/executor-helper" }
31
+ executor-fee-lib = { path = "contracts/workers/executor-fee-lib" }
32
+ oft = { path = "contracts/oapps/oft" }
33
+ stellar-macros = { git = "https://github.com/OpenZeppelin/stellar-contracts.git", tag = "v0.5.1" }
34
+ stellar-tokens = { git = "https://github.com/OpenZeppelin/stellar-contracts.git", tag = "v0.5.1" }
35
+ stellar-contract-utils = { git = "https://github.com/OpenZeppelin/stellar-contracts.git", tag = "v0.5.1" }
33
36
  insta = "1.44.3"
34
37
 
35
38
  # Fast dev builds for testing
@@ -0,0 +1,44 @@
1
+ use crate::utils;
2
+ use proc_macro2::TokenStream;
3
+ use quote::quote;
4
+ use syn::{parse_quote, ImplItem, ItemImpl, Visibility};
5
+
6
+ /// Generates a `#[soroban_sdk::contractimpl]` with automatic instance TTL extension.
7
+ pub fn contract_impl(attr: TokenStream, input: TokenStream) -> TokenStream {
8
+ let mut impl_block: ItemImpl = syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse impl block: {}", e));
9
+
10
+ let is_trait_impl = impl_block.trait_.is_some();
11
+
12
+ for item in &mut impl_block.items {
13
+ let ImplItem::Fn(method) = item else { continue };
14
+
15
+ // For trait impls, process all methods; for inherent impls, only public methods
16
+ if !is_trait_impl && !matches!(method.vis, Visibility::Public(_)) {
17
+ continue;
18
+ }
19
+
20
+ // Skip methods without Env parameter
21
+ let Some(env_ident) = utils::find_env_ident(&method.sig.inputs) else { continue };
22
+
23
+ // TODO: should support Env instead of &Env?
24
+ // Use fully qualified syntax to call ttl_configs from TtlConfigurable trait
25
+ let extend_ttl_stmt = parse_quote! {
26
+ if let Some(instance_ttl) = utils::ttl::TtlConfigStorage::instance(#env_ident) {
27
+ #env_ident.storage().instance().extend_ttl(instance_ttl.threshold, instance_ttl.extend_to);
28
+ }
29
+ };
30
+ method.block.stmts.insert(0, extend_ttl_stmt);
31
+ }
32
+
33
+ if attr.is_empty() {
34
+ quote! {
35
+ #[soroban_sdk::contractimpl]
36
+ #impl_block
37
+ }
38
+ } else {
39
+ quote! {
40
+ #[soroban_sdk::contractimpl(#attr)]
41
+ #impl_block
42
+ }
43
+ }
44
+ }
@@ -15,14 +15,14 @@
15
15
  //!
16
16
  //!
17
17
  use proc_macro::TokenStream;
18
- use quote::quote;
19
- use syn::{parse_macro_input, ItemFn, ItemStruct};
20
18
 
19
+ mod contract_impl;
21
20
  mod error;
22
21
  mod event;
23
22
  mod ownable;
24
23
  mod storage;
25
24
  mod ttl_configurable;
25
+ mod utils;
26
26
 
27
27
  #[cfg(test)]
28
28
  mod tests;
@@ -33,47 +33,54 @@ mod tests;
33
33
 
34
34
  /// Generates strongly-typed storage API from enum variants.
35
35
  ///
36
- /// Transforms a storage enum into getter/setter/remove/set_or_remove/has/extend_ttl methods with TTL support.
36
+ /// Transforms a storage enum into getter/setter/remove/set_or_remove/has/extend_ttl methods.
37
+ /// TTL extension is automatic for persistent storage by default.
37
38
  ///
38
39
  /// # Example
39
40
  /// ```ignore
40
- /// #[storage(MyTtlProvider)]
41
+ /// #[storage]
41
42
  /// pub enum DataKey {
42
43
  /// #[instance(u32)]
43
44
  /// Counter,
44
45
  ///
45
46
  /// #[persistent(Address)]
46
- /// #[default(0)]
47
+ /// #[default(Address::default())]
48
+ /// Owner,
49
+ ///
50
+ /// #[persistent(u64)]
47
51
  /// Nonce { user: Address },
48
52
  ///
53
+ /// #[persistent(BytesN<32>)]
54
+ /// #[no_ttl_extension] // opt-out of automatic TTL extension
55
+ /// CacheData,
56
+ ///
49
57
  /// #[temporary(BytesN<32>)]
50
- /// #[no_auto_ttl_extension]
51
58
  /// TempData,
52
59
  /// }
53
60
  ///
54
- /// // Generated API:
55
- /// DataKey::counter(&env) // -> Option<u32>
56
- /// DataKey::set_counter(&env, &value) // set value
57
- /// DataKey::has_counter(&env) // -> bool
58
- /// DataKey::remove_counter(&env) // remove entry
59
- /// DataKey::set_or_remove_counter(&env, &opt) // set if Some, remove if None
60
- /// DataKey::extend_ttl_counter(&env, threshold, extend_to) // manual TTL extension
61
+ /// // Generated API for each variant:
62
+ /// DataKey::counter(&env) // -> Option<u32>
63
+ /// DataKey::set_counter(&env, &value) // set value
64
+ /// DataKey::has_counter(&env) // -> bool
65
+ /// DataKey::remove_counter(&env) // remove entry
66
+ /// DataKey::set_or_remove_counter(&env, &opt) // set if Some, remove if None
67
+ /// DataKey::extend_counter_ttl(&env, threshold, extend_to) // manual TTL extension
61
68
  ///
62
69
  /// // With fields (keyed storage):
63
- /// DataKey::nonce(&env, user) // -> u64 (has default)
64
- /// DataKey::set_nonce(&env, user, &value)
65
- /// DataKey::set_or_remove_nonce(&env, user, &opt) // conditionally set or remove
70
+ /// DataKey::nonce(&env, &user) // -> Option<u64>
71
+ /// DataKey::set_nonce(&env, &user, &value)
72
+ /// DataKey::set_or_remove_nonce(&env, &user, &opt)
66
73
  /// ```
67
74
  ///
68
75
  /// # Storage Types (required, exactly one per variant)
69
76
  /// - `#[instance(Type)]` - Stored with contract instance
70
- /// - `#[persistent(Type)]` - Durable ledger entries
77
+ /// - `#[persistent(Type)]` - Durable ledger entries (TTL extended automatically)
71
78
  /// - `#[temporary(Type)]` - Short-lived entries
72
79
  ///
73
80
  /// # Variant Attributes (optional)
74
81
  /// - `#[default(expr)]` - Default value; changes getter return from `Option<T>` to `T`
75
- /// - `#[no_auto_ttl_extension]` - Disables automatic TTL extension on access
76
82
  /// - `#[name("custom")]` - Override the generated function name base
83
+ /// - `#[no_ttl_extension]` - Disable automatic TTL extension for this persistent variant
77
84
  #[proc_macro_attribute]
78
85
  pub fn storage(attr: TokenStream, item: TokenStream) -> TokenStream {
79
86
  storage::generate_storage(attr.into(), item.into()).into()
@@ -161,20 +168,11 @@ pub fn contract_error(attr: TokenStream, item: TokenStream) -> TokenStream {
161
168
  /// ```
162
169
  ///
163
170
  /// Generated code includes:
164
- /// - `__init_owner(env, owner)` - Internal method to initialize owner
165
- /// - `owner(env)` - Get current owner
166
- /// - `transfer_ownership(env, new_owner)` - Transfer ownership
171
+ /// - `OwnableInitializer` trait impl - Use `<Self as OwnableInitializer>::init_owner(env, owner)` to initialize
172
+ /// - `Ownable` trait impl - `owner(env)`, `transfer_ownership(env, new_owner)`, `renounce_ownership(env)`
167
173
  #[proc_macro_attribute]
168
174
  pub fn ownable(_attr: TokenStream, item: TokenStream) -> TokenStream {
169
- let input = parse_macro_input!(item as ItemStruct);
170
-
171
- // Generate the ownable implementation
172
- let ownable_impl = ownable::generate_ownable_impl(&input.ident);
173
-
174
- TokenStream::from(quote! {
175
- #input
176
- #ownable_impl
177
- })
175
+ ownable::generate_ownable_impl(item.into()).into()
178
176
  }
179
177
 
180
178
  // ============================================================================
@@ -213,8 +211,7 @@ pub fn ownable(_attr: TokenStream, item: TokenStream) -> TokenStream {
213
211
  /// ```
214
212
  #[proc_macro_attribute]
215
213
  pub fn only_owner(_attr: TokenStream, item: TokenStream) -> TokenStream {
216
- let input_fn = parse_macro_input!(item as ItemFn);
217
- ownable::prepend_only_owner_check(input_fn).into()
214
+ ownable::prepend_only_owner_check(item.into()).into()
218
215
  }
219
216
 
220
217
  // ============================================================================
@@ -232,24 +229,73 @@ pub fn only_owner(_attr: TokenStream, item: TokenStream) -> TokenStream {
232
229
  /// #[ttl_configurable]
233
230
  /// pub struct MyContract;
234
231
  ///
235
- /// #[contractimpl]
232
+ /// #[contract_impl]
236
233
  /// impl MyContract {
237
234
  /// pub fn __constructor(env: &Env, owner: &Address) {
238
- /// Self::__init_owner(env, owner);
235
+ /// <Self as utils::ownable::OwnableInitializer>::init_owner(env, owner);
239
236
  /// }
240
237
  /// }
241
238
  /// ```
242
239
  ///
243
240
  /// Generated code includes:
244
241
  /// - `#[ownable]` attribute on the struct (provides owner management)
245
- /// - `set_ttl_config(env, instance, persistent, temporary)` - Set TTL config (owner only)
246
- /// - `ttl_config(env)` - Get current TTL configuration (instance, persistent, temporary)
247
- /// - `freeze_ttl_config(env)` - Permanently freeze TTL config (owner only)
248
- /// - `is_ttl_config_frozen(env)` - Check if TTL config is frozen
242
+ /// - `set_ttl_configs(env, instance, persistent)` - Set TTL configs (owner only)
243
+ /// - `ttl_configs(env)` - Get current TTL configs (instance, persistent)
244
+ /// - `freeze_ttl_configs(env)` - Permanently freeze TTL configs (owner only)
245
+ /// - `is_ttl_configs_frozen(env)` - Check if TTL configs are frozen
249
246
  ///
250
247
  /// See [`ownable`] for the owner management methods also generated.
251
248
  #[proc_macro_attribute]
252
249
  pub fn ttl_configurable(_attr: TokenStream, item: TokenStream) -> TokenStream {
253
- let input = parse_macro_input!(item as ItemStruct);
254
- ttl_configurable::generate_ttl_configurable_impl(&input).into()
250
+ ttl_configurable::generate_ttl_configurable_impl(item.into()).into()
251
+ }
252
+
253
+ // ============================================================================
254
+ // Contract Impl Macro
255
+ // ============================================================================
256
+
257
+ /// Wraps `#[soroban_sdk::contractimpl]` with automatic instance TTL extension.
258
+ ///
259
+ /// This macro applies `#[soroban_sdk::contractimpl]` and injects TTL extension logic
260
+ /// at the beginning of each contract entry function to keep the contract instance alive.
261
+ ///
262
+ /// # Requirements
263
+ /// - The contract struct must have `#[ttl_configurable]` applied to provide `ttl_config()`
264
+ /// - Methods must have an `Env` parameter to receive TTL extension
265
+ ///
266
+ /// # Behavior
267
+ /// - **Inherent impls** (`impl MyContract`): Only public methods receive TTL extension
268
+ /// - **Trait impls** (`impl SomeTrait for MyContract`): All methods receive TTL extension
269
+ /// - Methods without an `Env` parameter are skipped
270
+ ///
271
+ /// # Example
272
+ /// ```ignore
273
+ /// #[contract]
274
+ /// #[ttl_configurable]
275
+ /// pub struct MyContract;
276
+ ///
277
+ /// #[contract_impl]
278
+ /// impl MyContract {
279
+ /// pub fn my_method(env: &Env) {
280
+ /// // TTL extension is automatically injected here
281
+ /// // ... your code
282
+ /// }
283
+ /// }
284
+ /// ```
285
+ ///
286
+ /// Generated code (conceptual):
287
+ /// ```ignore
288
+ /// #[soroban_sdk::contractimpl]
289
+ /// impl MyContract {
290
+ /// pub fn my_method(env: &Env) {
291
+ /// if let Some(ttl) = <Self as ::utils::ttl::TtlConfigurable>::ttl_config(env).0 {
292
+ /// env.storage().instance().extend_ttl(ttl.threshold, ttl.extend_to);
293
+ /// }
294
+ /// // ... your code
295
+ /// }
296
+ /// }
297
+ /// ```
298
+ #[proc_macro_attribute]
299
+ pub fn contract_impl(attr: TokenStream, item: TokenStream) -> TokenStream {
300
+ contract_impl::contract_impl(attr.into(), item.into()).into()
255
301
  }
@@ -1,15 +1,21 @@
1
- use proc_macro2::{Ident, TokenStream};
1
+ use crate::utils::expect_env_ident;
2
+ use proc_macro2::TokenStream;
2
3
  use quote::{quote, ToTokens};
3
- use syn::{parse_quote, FnArg, ItemFn, Pat, Type, TypePath};
4
+ use syn::{parse_quote, ItemFn, ItemStruct};
4
5
 
5
- pub fn generate_ownable_impl(name: &Ident) -> TokenStream {
6
- quote! {
6
+ /// Generates the ownable implementation from the `#[ownable]` attribute macro.
7
+ pub fn generate_ownable_impl(input: TokenStream) -> TokenStream {
8
+ let item_struct: ItemStruct = syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse struct: {}", e));
9
+ let name = &item_struct.ident;
10
+
11
+ let ownable_impl = quote! {
7
12
  use utils::ownable::Ownable as _;
13
+ use utils::ownable::OwnableInitializer as _;
8
14
 
9
- impl #name {
10
- /// Initialize the contract owner. Should be called during contract initialization.
11
- pub(crate) fn __init_owner(env: &soroban_sdk::Env, owner: &soroban_sdk::Address) {
12
- utils::ownable::DefaultOwnable::init_owner(env, owner);
15
+ /// Implement the OwnableInitializer trait for the contract.
16
+ impl utils::ownable::OwnableInitializer for #name {
17
+ fn init_owner(env: &soroban_sdk::Env, owner: &soroban_sdk::Address) {
18
+ <utils::ownable::DefaultOwnable as utils::ownable::OwnableInitializer>::init_owner(env, owner)
13
19
  }
14
20
  }
15
21
 
@@ -28,36 +34,22 @@ pub fn generate_ownable_impl(name: &Ident) -> TokenStream {
28
34
  utils::ownable::DefaultOwnable::renounce_ownership(env)
29
35
  }
30
36
  }
37
+ };
38
+
39
+ quote! {
40
+ #item_struct
41
+ #ownable_impl
31
42
  }
32
43
  }
33
44
 
34
45
  /// Prepends an owner authentication check to a method.
35
- pub fn prepend_only_owner_check(mut input_fn: ItemFn) -> TokenStream {
36
- // Find the Env argument in the function signature
37
- let env_ident = input_fn
38
- .sig
39
- .inputs
40
- .iter()
41
- .find_map(|arg| {
42
- let FnArg::Typed(pat_type) = arg else { return None };
43
- if !is_env_type(&pat_type.ty) {
44
- return None;
45
- }
46
- let Pat::Ident(pat) = pat_type.pat.as_ref() else { return None };
47
- Some(&pat.ident)
48
- })
49
- .expect("function must have an Env argument");
46
+ pub fn prepend_only_owner_check(input: TokenStream) -> TokenStream {
47
+ let mut input_fn: ItemFn = syn::parse2(input).unwrap_or_else(|e| panic!("failed to parse function: {}", e));
50
48
 
49
+ let env_ident = expect_env_ident(&input_fn.sig.inputs);
50
+
51
+ // TODO: should support Env instead of &Env?
51
52
  // Insert the owner authentication check at the beginning of the function body
52
53
  input_fn.block.stmts.insert(0, parse_quote!(utils::ownable::require_owner_auth::<Self>(#env_ident);));
53
54
  input_fn.into_token_stream()
54
55
  }
55
-
56
- /// Checks if a type is an `Env` type.
57
- fn is_env_type(ty: &Type) -> bool {
58
- match ty {
59
- Type::Path(TypePath { path, .. }) => path.segments.last().is_some_and(|seg| seg.ident == "Env"),
60
- Type::Reference(r) => is_env_type(&r.elem),
61
- _ => false,
62
- }
63
- }