@t-rex-network/t-rex 4.2.0-beta1

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 (208) hide show
  1. package/LICENSE.md +674 -0
  2. package/README.md +137 -0
  3. package/contracts/ERC-3643/ERC3643EventsLib.sol +150 -0
  4. package/contracts/ERC-3643/IERC3643.sol +408 -0
  5. package/contracts/ERC-3643/IERC3643ClaimTopicsRegistry.sol +66 -0
  6. package/contracts/ERC-3643/IERC3643Compliance.sol +127 -0
  7. package/contracts/ERC-3643/IERC3643IdentityRegistry.sol +180 -0
  8. package/contracts/ERC-3643/IERC3643IdentityRegistryStorage.sol +120 -0
  9. package/contracts/ERC-3643/IERC3643TrustedIssuersRegistry.sol +120 -0
  10. package/contracts/compliance/modular/IModularCompliance.sol +143 -0
  11. package/contracts/compliance/modular/ModularCompliance.sol +381 -0
  12. package/contracts/compliance/modular/modules/AbstractModuleUpgradeable.sol +193 -0
  13. package/contracts/compliance/modular/modules/IModule.sol +158 -0
  14. package/contracts/compliance/modular/modules/ModuleProxy.sol +72 -0
  15. package/contracts/factory/ITREXFactory.sol +180 -0
  16. package/contracts/factory/ITREXGateway.sol +234 -0
  17. package/contracts/factory/TREXFactory.sol +358 -0
  18. package/contracts/factory/TREXGateway.sol +274 -0
  19. package/contracts/libraries/ErrorsLib.sol +168 -0
  20. package/contracts/libraries/EventsLib.sol +147 -0
  21. package/contracts/proxy/AbstractProxy.sol +146 -0
  22. package/contracts/proxy/ClaimTopicsRegistryProxy.sol +83 -0
  23. package/contracts/proxy/IdentityRegistryProxy.sol +95 -0
  24. package/contracts/proxy/IdentityRegistryStorageProxy.sol +83 -0
  25. package/contracts/proxy/ModularComplianceProxy.sol +88 -0
  26. package/contracts/proxy/TokenProxy.sol +97 -0
  27. package/contracts/proxy/TrustedIssuersRegistryProxy.sol +88 -0
  28. package/contracts/proxy/authority/IAFactory.sol +122 -0
  29. package/contracts/proxy/authority/IIAFactory.sol +87 -0
  30. package/contracts/proxy/authority/ITREXImplementationAuthority.sol +239 -0
  31. package/contracts/proxy/authority/TREXImplementationAuthority.sol +350 -0
  32. package/contracts/proxy/interface/IProxy.sol +72 -0
  33. package/contracts/registry/implementation/ClaimTopicsRegistry.sol +152 -0
  34. package/contracts/registry/implementation/IdentityRegistry.sol +352 -0
  35. package/contracts/registry/implementation/IdentityRegistryStorage.sol +227 -0
  36. package/contracts/registry/implementation/TrustedIssuersRegistry.sol +272 -0
  37. package/contracts/registry/interface/IClaimTopicsRegistry.sol +70 -0
  38. package/contracts/registry/interface/IIdentityRegistry.sol +102 -0
  39. package/contracts/registry/interface/IIdentityRegistryStorage.sol +70 -0
  40. package/contracts/registry/interface/ITrustedIssuersRegistry.sol +70 -0
  41. package/contracts/roles/AbstractAgentRole.sol +122 -0
  42. package/contracts/roles/AgentRole.sol +82 -0
  43. package/contracts/roles/AgentRoleUpgradeable.sol +82 -0
  44. package/contracts/roles/IERC173.sol +21 -0
  45. package/contracts/roles/Roles.sol +102 -0
  46. package/contracts/token/IToken.sol +97 -0
  47. package/contracts/token/Token.sol +664 -0
  48. package/contracts/token/TokenStructs.sol +74 -0
  49. package/contracts/utils/IUtilityChecker.sol +135 -0
  50. package/contracts/utils/InterfaceIdCalculator.sol +223 -0
  51. package/contracts/utils/UtilityChecker.sol +210 -0
  52. package/contracts/utils/UtilityCheckerProxy.sol +72 -0
  53. package/contracts/vendor/openzeppelin/Create3.sol +143 -0
  54. package/out/AbstractAgentRole.sol/AbstractAgentRole.json +1 -0
  55. package/out/AbstractModuleUpgradeable.sol/AbstractModuleUpgradeable.json +1 -0
  56. package/out/AbstractProxy.sol/AbstractProxy.json +1 -0
  57. package/out/Address.sol/Address.json +1 -0
  58. package/out/AgentRole.sol/AgentRole.json +1 -0
  59. package/out/AgentRoleUpgradeable.sol/AgentRoleUpgradeable.json +1 -0
  60. package/out/Arrays.sol/Arrays.json +1 -0
  61. package/out/Base.sol/CommonBase.json +1 -0
  62. package/out/Base.sol/ScriptBase.json +1 -0
  63. package/out/Base.sol/TestBase.json +1 -0
  64. package/out/Bytes.sol/Bytes.json +1 -0
  65. package/out/ClaimIssuer.sol/ClaimIssuer.json +1 -0
  66. package/out/ClaimIssuerTrick.sol/ClaimIssuerTrick.json +1 -0
  67. package/out/ClaimTopicsRegistry.sol/ClaimTopicsRegistry.json +1 -0
  68. package/out/ClaimTopicsRegistryProxy.sol/ClaimTopicsRegistryProxy.json +1 -0
  69. package/out/Comparators.sol/Comparators.json +1 -0
  70. package/out/Context.sol/Context.json +1 -0
  71. package/out/ContextUpgradeable.sol/ContextUpgradeable.json +1 -0
  72. package/out/Countries.sol/Countries.json +1 -0
  73. package/out/Create2.sol/Create2.json +1 -0
  74. package/out/Create3.sol/Create3.json +1 -0
  75. package/out/ECDSA.sol/ECDSA.json +1 -0
  76. package/out/EIP712.sol/EIP712.json +1 -0
  77. package/out/EIP712Upgradeable.sol/EIP712Upgradeable.json +1 -0
  78. package/out/ERC1967Proxy.sol/ERC1967Proxy.json +1 -0
  79. package/out/ERC1967Utils.sol/ERC1967Utils.json +1 -0
  80. package/out/ERC20.sol/ERC20.json +1 -0
  81. package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -0
  82. package/out/ERC20PermitUpgradeable.sol/ERC20PermitUpgradeable.json +1 -0
  83. package/out/ERC20Upgradeable.sol/ERC20Upgradeable.json +1 -0
  84. package/out/ERC2771Context.sol/ERC2771Context.json +1 -0
  85. package/out/ERC2771ContextUpgradeable.sol/ERC2771ContextUpgradeable.json +1 -0
  86. package/out/ERC2771Forwarder.sol/ERC2771Forwarder.json +1 -0
  87. package/out/ERC3643EventsLib.sol/ERC3643EventsLib.json +1 -0
  88. package/out/EnumerableSet.sol/EnumerableSet.json +1 -0
  89. package/out/Errors.sol/Errors.json +1 -0
  90. package/out/ErrorsLib.sol/ErrorsLib.json +1 -0
  91. package/out/EventsLib.sol/EventsLib.json +1 -0
  92. package/out/IAFactory.sol/IAFactory.json +1 -0
  93. package/out/IBeacon.sol/IBeacon.json +1 -0
  94. package/out/IClaimIssuer.sol/IClaimIssuer.json +1 -0
  95. package/out/IClaimTopicsRegistry.sol/IClaimTopicsRegistry.json +1 -0
  96. package/out/IERC1363.sol/IERC1363.json +1 -0
  97. package/out/IERC165.sol/IERC165.json +1 -0
  98. package/out/IERC173.sol/IERC173.json +1 -0
  99. package/out/IERC1967.sol/IERC1967.json +1 -0
  100. package/out/IERC20.sol/IERC20.json +1 -0
  101. package/out/IERC20Metadata.sol/IERC20Metadata.json +1 -0
  102. package/out/IERC20Permit.sol/IERC20Permit.json +1 -0
  103. package/out/IERC3643.sol/IERC3643.json +1 -0
  104. package/out/IERC3643ClaimTopicsRegistry.sol/IERC3643ClaimTopicsRegistry.json +1 -0
  105. package/out/IERC3643Compliance.sol/IERC3643Compliance.json +1 -0
  106. package/out/IERC3643IdentityRegistry.sol/IERC3643IdentityRegistry.json +1 -0
  107. package/out/IERC3643IdentityRegistryStorage.sol/IERC3643IdentityRegistryStorage.json +1 -0
  108. package/out/IERC3643TrustedIssuersRegistry.sol/IERC3643TrustedIssuersRegistry.json +1 -0
  109. package/out/IERC5267.sol/IERC5267.json +1 -0
  110. package/out/IERC734.sol/IERC734.json +1 -0
  111. package/out/IERC735.sol/IERC735.json +1 -0
  112. package/out/IIAFactory.sol/IIAFactory.json +1 -0
  113. package/out/IIdFactory.sol/IIdFactory.json +1 -0
  114. package/out/IIdentity.sol/IIdentity.json +1 -0
  115. package/out/IIdentityRegistry.sol/IIdentityRegistry.json +1 -0
  116. package/out/IIdentityRegistryStorage.sol/IIdentityRegistryStorage.json +1 -0
  117. package/out/IImplementationAuthority.sol/IImplementationAuthority.json +1 -0
  118. package/out/IModularCompliance.sol/IModularCompliance.json +1 -0
  119. package/out/IModule.sol/IModule.json +1 -0
  120. package/out/IMulticall3.sol/IMulticall3.json +1 -0
  121. package/out/IProxy.sol/IProxy.json +1 -0
  122. package/out/ITREXFactory.sol/ITREXFactory.json +1 -0
  123. package/out/ITREXGateway.sol/ITREXGateway.json +1 -0
  124. package/out/ITREXImplementationAuthority.sol/ITREXImplementationAuthority.json +1 -0
  125. package/out/IToken.sol/IToken.json +1 -0
  126. package/out/ITrustedIssuersRegistry.sol/ITrustedIssuersRegistry.json +1 -0
  127. package/out/IUtilityChecker.sol/IUtilityChecker.json +1 -0
  128. package/out/IdFactory.sol/IdFactory.json +1 -0
  129. package/out/Identity.sol/Identity.json +1 -0
  130. package/out/IdentityProxy.sol/IdentityProxy.json +1 -0
  131. package/out/IdentityRegistry.sol/IdentityRegistry.json +1 -0
  132. package/out/IdentityRegistryProxy.sol/IdentityRegistryProxy.json +1 -0
  133. package/out/IdentityRegistryStorage.sol/IdentityRegistryStorage.json +1 -0
  134. package/out/IdentityRegistryStorageProxy.sol/IdentityRegistryStorageProxy.json +1 -0
  135. package/out/ImplementationAuthority.sol/ImplementationAuthority.json +1 -0
  136. package/out/Initializable.sol/Initializable.json +1 -0
  137. package/out/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +1 -0
  138. package/out/KeyPurposes.sol/KeyPurposes.json +1 -0
  139. package/out/KeyTypes.sol/KeyTypes.json +1 -0
  140. package/out/LowLevelCall.sol/LowLevelCall.json +1 -0
  141. package/out/Math.sol/Math.json +1 -0
  142. package/out/MessageHashUtils.sol/MessageHashUtils.json +1 -0
  143. package/out/ModularCompliance.sol/ModularCompliance.json +1 -0
  144. package/out/ModularComplianceProxy.sol/ModularComplianceProxy.json +1 -0
  145. package/out/ModuleNotPnP.sol/ModuleNotPnP.json +1 -0
  146. package/out/ModuleProxy.sol/ModuleProxy.json +1 -0
  147. package/out/MulticallUpgradeable.sol/MulticallUpgradeable.json +1 -0
  148. package/out/Nonces.sol/Nonces.json +1 -0
  149. package/out/NoncesUpgradeable.sol/NoncesUpgradeable.json +1 -0
  150. package/out/Ownable.sol/Ownable.json +1 -0
  151. package/out/Ownable2Step.sol/Ownable2Step.json +1 -0
  152. package/out/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.json +1 -0
  153. package/out/OwnableUpgradeable.sol/OwnableUpgradeable.json +1 -0
  154. package/out/Panic.sol/Panic.json +1 -0
  155. package/out/Pausable.sol/Pausable.json +1 -0
  156. package/out/PausableUpgradeable.sol/PausableUpgradeable.json +1 -0
  157. package/out/Proxy.sol/Proxy.json +1 -0
  158. package/out/Roles.sol/Roles.json +1 -0
  159. package/out/SafeCast.sol/SafeCast.json +1 -0
  160. package/out/SafeERC20.sol/SafeERC20.json +1 -0
  161. package/out/ShortStrings.sol/ShortStrings.json +1 -0
  162. package/out/SignedMath.sol/SignedMath.json +1 -0
  163. package/out/SlotDerivation.sol/SlotDerivation.json +1 -0
  164. package/out/StdAssertions.sol/StdAssertions.json +1 -0
  165. package/out/StdChains.sol/StdChains.json +1 -0
  166. package/out/StdCheats.sol/StdCheats.json +1 -0
  167. package/out/StdCheats.sol/StdCheatsSafe.json +1 -0
  168. package/out/StdConstants.sol/StdConstants.json +1 -0
  169. package/out/StdError.sol/stdError.json +1 -0
  170. package/out/StdInvariant.sol/StdInvariant.json +1 -0
  171. package/out/StdJson.sol/stdJson.json +1 -0
  172. package/out/StdMath.sol/stdMath.json +1 -0
  173. package/out/StdStorage.sol/stdStorage.json +1 -0
  174. package/out/StdStorage.sol/stdStorageSafe.json +1 -0
  175. package/out/StdStyle.sol/StdStyle.json +1 -0
  176. package/out/StdToml.sol/stdToml.json +1 -0
  177. package/out/StdUtils.sol/StdUtils.json +1 -0
  178. package/out/Storage.sol/Storage.json +1 -0
  179. package/out/StorageSlot.sol/StorageSlot.json +1 -0
  180. package/out/Strings.sol/Strings.json +1 -0
  181. package/out/Structs.sol/Structs.json +1 -0
  182. package/out/TREXFactory.sol/TREXFactory.json +1 -0
  183. package/out/TREXGateway.sol/TREXGateway.json +1 -0
  184. package/out/TREXImplementationAuthority.sol/TREXImplementationAuthority.json +1 -0
  185. package/out/TestAgentRole.sol/TestAgentRole.json +1 -0
  186. package/out/TestAgentRoleUpgradeable.sol/TestAgentRoleUpgradeable.json +1 -0
  187. package/out/TestERC20.sol/TestERC20.json +1 -0
  188. package/out/TestModule.sol/TestModule.json +1 -0
  189. package/out/TestTREXFactory.sol/TestTREXFactory.json +1 -0
  190. package/out/Token.sol/Token.json +1 -0
  191. package/out/TokenProxy.sol/TokenProxy.json +1 -0
  192. package/out/TrustedIssuersRegistry.sol/TrustedIssuersRegistry.json +1 -0
  193. package/out/TrustedIssuersRegistryProxy.sol/TrustedIssuersRegistryProxy.json +1 -0
  194. package/out/UUPSUpgradeable.sol/UUPSUpgradeable.json +1 -0
  195. package/out/UtilityChecker.sol/UtilityChecker.json +1 -0
  196. package/out/UtilityCheckerProxy.sol/UtilityCheckerProxy.json +1 -0
  197. package/out/Utils.sol/Utils.json +1 -0
  198. package/out/Version.sol/Version.json +1 -0
  199. package/out/Vm.sol/Vm.json +1 -0
  200. package/out/Vm.sol/VmSafe.json +1 -0
  201. package/out/console.sol/console.json +1 -0
  202. package/out/draft-IERC1822.sol/IERC1822Proxiable.json +1 -0
  203. package/out/draft-IERC6093.sol/IERC1155Errors.json +1 -0
  204. package/out/draft-IERC6093.sol/IERC20Errors.json +1 -0
  205. package/out/draft-IERC6093.sol/IERC721Errors.json +1 -0
  206. package/out/libraries/Errors.sol/Errors.json +1 -0
  207. package/out/safeconsole.sol/safeconsole.json +1 -0
  208. package/package.json +47 -0
@@ -0,0 +1,74 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // :+#####%%%%%%%%%%%%%%+
4
+ // .-*@@@%+.:+%@@@@@%%#***%@@%=
5
+ // :=*%@@@#=. :#@@% *@@@%=
6
+ // .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
7
+ // :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
8
+ // -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
9
+ // =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
10
+ // -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
11
+ // :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
12
+ // %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
13
+ // #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
14
+ // *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
15
+ // -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
16
+ // .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
17
+ // -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
18
+ // -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
19
+ // *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
20
+ // +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
21
+ // =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
22
+ // .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
23
+ // +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
24
+ // -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
25
+ // ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
26
+ // @@@@@@+. +@@*. .+@@@@@%=.
27
+ // -@@@@@= =@@%: -#@@@@%+.
28
+ // +@@@@@. =@@@= .+@@@@@*:
29
+ // #@@@@#:%@@#. :*@@@@#-
30
+ // @@@@@%@@@= :#@@@@+.
31
+ // :@@@@@@@#.:#@@@%-
32
+ // +@@@@@@-.*@@@*:
33
+ // #@@@@#.=@@@+.
34
+ // @@@@+-%@%=
35
+ // :@@@#%@%=
36
+ // +@@@@%-
37
+ // :#%%=
38
+ //
39
+
40
+ /**
41
+ * NOTICE
42
+ *
43
+ * The T-REX software is licensed under a proprietary license or the GPL v.3.
44
+ * If you choose to receive it under the GPL v.3 license, the following applies:
45
+ * T-REX is a suite of smart contracts implementing the ERC-3643 standard and
46
+ * developed by Tokeny to manage and transfer financial assets on EVM blockchains
47
+ *
48
+ * Copyright (C) 2025, Tokeny sàrl.
49
+ *
50
+ * This program is free software: you can redistribute it and/or modify
51
+ * it under the terms of the GNU General Public License as published by
52
+ * the Free Software Foundation, either version 3 of the License, or
53
+ * (at your option) any later version.
54
+ *
55
+ * This program is distributed in the hope that it will be useful,
56
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
57
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58
+ * GNU General Public License for more details.
59
+ *
60
+ * You should have received a copy of the GNU General Public License
61
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
62
+ */
63
+
64
+ pragma solidity 0.8.30;
65
+
66
+ struct TokenRoles {
67
+ bool disableMint;
68
+ bool disableBurn;
69
+ bool disablePartialFreeze;
70
+ bool disableAddressFreeze;
71
+ bool disableRecovery;
72
+ bool disableForceTransfer;
73
+ bool disablePause;
74
+ }
@@ -0,0 +1,135 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // :+#####%%%%%%%%%%%%%%+
4
+ // .-*@@@%+.:+%@@@@@%%#***%@@%=
5
+ // :=*%@@@#=. :#@@% *@@@%=
6
+ // .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
7
+ // :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
8
+ // -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
9
+ // =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
10
+ // -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
11
+ // :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
12
+ // %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
13
+ // #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
14
+ // *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
15
+ // -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
16
+ // .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
17
+ // -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
18
+ // -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
19
+ // *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
20
+ // +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
21
+ // =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
22
+ // .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
23
+ // +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
24
+ // -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
25
+ // ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
26
+ // @@@@@@+. +@@*. .+@@@@@%=.
27
+ // -@@@@@= =@@%: -#@@@@%+.
28
+ // +@@@@@. =@@@= .+@@@@@*:
29
+ // #@@@@#:%@@#. :*@@@@#-
30
+ // @@@@@%@@@= :#@@@@+.
31
+ // :@@@@@@@#.:#@@@%-
32
+ // +@@@@@@-.*@@@*:
33
+ // #@@@@#.=@@@+.
34
+ // @@@@+-%@%=
35
+ // :@@@#%@%=
36
+ // +@@@@%-
37
+ // :#%%=
38
+ //
39
+
40
+ /**
41
+ * NOTICE
42
+ *
43
+ * The T-REX software is licensed under a proprietary license or the GPL v.3.
44
+ * If you choose to receive it under the GPL v.3 license, the following applies:
45
+ * T-REX is a suite of smart contracts implementing the ERC-3643 standard and
46
+ * developed by Tokeny to manage and transfer financial assets on EVM blockchains
47
+ *
48
+ * Copyright (C) 2025, Tokeny sàrl.
49
+ *
50
+ * This program is free software: you can redistribute it and/or modify
51
+ * it under the terms of the GNU General Public License as published by
52
+ * the Free Software Foundation, either version 3 of the License, or
53
+ * (at your option) any later version.
54
+ *
55
+ * This program is distributed in the hope that it will be useful,
56
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
57
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58
+ * GNU General Public License for more details.
59
+ *
60
+ * You should have received a copy of the GNU General Public License
61
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
62
+ */
63
+
64
+ pragma solidity 0.8.30;
65
+
66
+ import { IClaimIssuer } from "@onchain-id/solidity/contracts/interface/IClaimIssuer.sol";
67
+
68
+ interface IUtilityChecker {
69
+
70
+ struct ComplianceCheckDetails {
71
+ string moduleName;
72
+ bool pass;
73
+ }
74
+
75
+ struct EligibilityCheckDetails {
76
+ IClaimIssuer issuer;
77
+ uint256 topic;
78
+ bool pass;
79
+ }
80
+
81
+ /// @dev This function verifies if the transfer is restricted due to frozen addresses or tokens.
82
+ /// @param _token The address of the token contract.
83
+ /// @param _from The address of the sender.
84
+ /// @param _to The address of the recipient.
85
+ /// @param _amount The amount of tokens to be transferred.
86
+ /// @return _frozen bool Returns true if the transfer is affected by freeze conditions, false otherwise.
87
+ /// @return _availableBalance uint256 Available unfreezed balance.
88
+ function getFreezeStatus(address _token, address _from, address _to, uint256 _amount)
89
+ external
90
+ view
91
+ returns (bool _frozen, uint256 _availableBalance);
92
+
93
+ /// @dev This function performs a comprehensive check on whether a transfer would succeed:
94
+ /// - check if token is paused,
95
+ /// - check freeze conditions,
96
+ /// - check eligibilty,
97
+ /// - check compliance.
98
+ /// @param _token The address of the token contract.
99
+ /// @param _from The address of the sender.
100
+ /// @param _to The address of the recipient.
101
+ /// @param _amount The amount of tokens to be transferred.
102
+ /// @return _freezeStatus bool
103
+ /// Returns true if the transfer would be successful according to pause/freeze conditions, false otherwise.
104
+ /// @return _eligibilityStatus bool
105
+ /// Returns true if the transfer would be successful according to eligibilty conditions, false otherwise.
106
+ /// @return _complianceStatus bool
107
+ /// Returns true if the transfer would be successful according to compliance conditions, false otherwise.
108
+ function getTransferStatus(address _token, address _from, address _to, uint256 _amount)
109
+ external
110
+ view
111
+ returns (bool _freezeStatus, bool _eligibilityStatus, bool _complianceStatus);
112
+
113
+ /// @dev Check trade validity and return the status of each module for this transfer.
114
+ /// @param _token The address of the token contract.
115
+ /// @param _from Address of the sender.
116
+ /// @param _to Address of the receiver.
117
+ /// @param _value Amount of tokens to transfer.
118
+ /// @return _details Array of struct with module name and result of the `moduleCheck` call.
119
+ function getTransferDetails(address _token, address _from, address _to, uint256 _value)
120
+ external
121
+ view
122
+ returns (ComplianceCheckDetails[] memory _details);
123
+
124
+ /// @dev This functions checks whether an identity contract corresponding to the provided user address has the required
125
+ /// claims or not based on the data fetched from trusted issuers registry and from the claim topics registry. It
126
+ /// returns the details of each (issuer, topic).
127
+ /// @param _token Address of the token contract.
128
+ /// @param _userAddress Address of the user to be verified.
129
+ /// @return _details Array of struct with issuer, topic, and the verified status.
130
+ function getVerifiedDetails(address _token, address _userAddress)
131
+ external
132
+ view
133
+ returns (EligibilityCheckDetails[] memory _details);
134
+
135
+ }
@@ -0,0 +1,223 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // :+#####%%%%%%%%%%%%%%+
4
+ // .-*@@@%+.:+%@@@@@%%#***%@@%=
5
+ // :=*%@@@#=. :#@@% *@@@%=
6
+ // .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
7
+ // :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
8
+ // -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
9
+ // =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
10
+ // -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
11
+ // :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
12
+ // %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
13
+ // #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
14
+ // *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
15
+ // -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
16
+ // .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
17
+ // -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
18
+ // -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
19
+ // *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
20
+ // +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
21
+ // =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
22
+ // .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
23
+ // +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
24
+ // -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
25
+ // ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
26
+ // @@@@@@+. +@@*. .+@@@@@%=.
27
+ // -@@@@@= =@@%: -#@@@@%+.
28
+ // +@@@@@. =@@@= .+@@@@@*:
29
+ // #@@@@#:%@@#. :*@@@@#-
30
+ // @@@@@%@@@= :#@@@@+.
31
+ // :@@@@@@@#.:#@@@%-
32
+ // +@@@@@@-.*@@@*:
33
+ // #@@@@#.=@@@+.
34
+ // @@@@+-%@%=
35
+ // :@@@#%@%=
36
+ // +@@@@%-
37
+ // :#%%=
38
+ //
39
+
40
+ /**
41
+ * NOTICE
42
+ *
43
+ * The T-REX software is licensed under a proprietary license or the GPL v.3.
44
+ * If you choose to receive it under the GPL v.3 license, the following applies:
45
+ * T-REX is a suite of smart contracts implementing the ERC-3643 standard and
46
+ * developed by Tokeny to manage and transfer financial assets on EVM blockchains
47
+ *
48
+ * Copyright (C) 2025, Tokeny sàrl.
49
+ *
50
+ * This program is free software: you can redistribute it and/or modify
51
+ * it under the terms of the GNU General Public License as published by
52
+ * the Free Software Foundation, either version 3 of the License, or
53
+ * (at your option) any later version.
54
+ *
55
+ * This program is distributed in the hope that it will be useful,
56
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
57
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58
+ * GNU General Public License for more details.
59
+ *
60
+ * You should have received a copy of the GNU General Public License
61
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
62
+ */
63
+
64
+ pragma solidity 0.8.30;
65
+
66
+ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
67
+ import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
68
+ import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
69
+
70
+ import { IERC3643 } from "contracts/ERC-3643/IERC3643.sol";
71
+ import { IERC3643ClaimTopicsRegistry } from "contracts/ERC-3643/IERC3643ClaimTopicsRegistry.sol";
72
+ import { IERC3643Compliance } from "contracts/ERC-3643/IERC3643Compliance.sol";
73
+ import { IERC3643IdentityRegistry } from "contracts/ERC-3643/IERC3643IdentityRegistry.sol";
74
+ import { IERC3643IdentityRegistryStorage } from "contracts/ERC-3643/IERC3643IdentityRegistryStorage.sol";
75
+ import { IERC3643TrustedIssuersRegistry } from "contracts/ERC-3643/IERC3643TrustedIssuersRegistry.sol";
76
+ import { IModularCompliance } from "contracts/compliance/modular/IModularCompliance.sol";
77
+ import { IModule } from "contracts/compliance/modular/modules/IModule.sol";
78
+ import { ITREXGateway } from "contracts/factory/ITREXGateway.sol";
79
+ import { IIAFactory } from "contracts/proxy/authority/IIAFactory.sol";
80
+ import { ITREXImplementationAuthority } from "contracts/proxy/authority/ITREXImplementationAuthority.sol";
81
+ import { IIdentityRegistry } from "contracts/registry/interface/IIdentityRegistry.sol";
82
+ import { IERC173 } from "contracts/roles/IERC173.sol";
83
+ import { IToken } from "contracts/token/IToken.sol";
84
+
85
+ contract InterfaceIdCalculator {
86
+
87
+ /**
88
+ * @dev Returns the interface ID for the IERC20 interface.
89
+ * IERC20 interface ID is 0x36372b07
90
+ */
91
+ function getIERC20InterfaceId() external pure returns (bytes4) {
92
+ return type(IERC20).interfaceId;
93
+ }
94
+
95
+ /**
96
+ * @dev Returns the interface ID for the IERC20Permit interface.
97
+ * IERC20Permit interface ID is 0x0b4c7e4d
98
+ */
99
+ function getIERC20PermitInterfaceId() external pure returns (bytes4) {
100
+ return type(IERC20Permit).interfaceId;
101
+ }
102
+
103
+ /**
104
+ * @dev Returns the interface ID for the IERC3643 interface.
105
+ * IERC3643 interface ID is 0xb97d944c
106
+ */
107
+ function getIERC3643InterfaceId() external pure returns (bytes4) {
108
+ return type(IERC3643).interfaceId;
109
+ }
110
+
111
+ /**
112
+ * @dev Returns the interface ID for the IToken interface.
113
+ * IToken interface ID is 0x5c0cda7e
114
+ */
115
+ function getITokenInterfaceId() external pure returns (bytes4) {
116
+ return type(IToken).interfaceId;
117
+ }
118
+
119
+ /**
120
+ * @dev Returns the interface ID for the IERC173 interface.
121
+ * IERC173 interface ID is 0x7f5828d0
122
+ */
123
+ function getIERC173InterfaceId() external pure returns (bytes4) {
124
+ return type(IERC173).interfaceId;
125
+ }
126
+
127
+ /**
128
+ * @dev Returns the interface ID for the IERC165 interface.
129
+ * IERC165 interface ID is 0x01ffc9a7
130
+ */
131
+ function getIERC165InterfaceId() external pure returns (bytes4) {
132
+ return type(IERC165).interfaceId;
133
+ }
134
+
135
+ /**
136
+ * @dev Returns the interface ID for the IERC3643ClaimTopicsRegistry interface.
137
+ * IERC3643ClaimTopicsRegistry interface ID is 0x10928b13
138
+ */
139
+ function getIERC3643ClaimTopicsRegistryInterfaceId() external pure returns (bytes4) {
140
+ return type(IERC3643ClaimTopicsRegistry).interfaceId;
141
+ }
142
+
143
+ /**
144
+ * @dev Returns the interface ID for the IIdentityRegistry interface.
145
+ * IIdentityRegistry interface ID is 0xacb7b4db
146
+ */
147
+ function getIIdentityRegistryInterfaceId() external pure returns (bytes4) {
148
+ return type(IIdentityRegistry).interfaceId;
149
+ }
150
+
151
+ /**
152
+ * @dev Returns the interface ID for the IERC3643IdentityRegistry interface.
153
+ * IERC3643IdentityRegistry interface ID is 0x8ff89f73
154
+ */
155
+ function getIERC3643IdentityRegistryInterfaceId() external pure returns (bytes4) {
156
+ return type(IERC3643IdentityRegistry).interfaceId;
157
+ }
158
+
159
+ /**
160
+ * @dev Returns the interface ID for the IERC3643IdentityRegistryStorage interface.
161
+ * IERC3643IdentityRegistryStorage interface ID is 0x57defe0d
162
+ */
163
+ function getIERC3643IdentityRegistryStorageInterfaceId() external pure returns (bytes4) {
164
+ return type(IERC3643IdentityRegistryStorage).interfaceId;
165
+ }
166
+
167
+ /**
168
+ * @dev Returns the interface ID for the IERC3643TrustedIssuersRegistry interface.
169
+ * IERC3643TrustedIssuersRegistry interface ID is 0xb0f773b8
170
+ */
171
+ function getIERC3643TrustedIssuersRegistryInterfaceId() external pure returns (bytes4) {
172
+ return type(IERC3643TrustedIssuersRegistry).interfaceId;
173
+ }
174
+
175
+ /**
176
+ * @dev Returns the interface ID for the ITREXImplementationAuthority interface.
177
+ * ITREXImplementationAuthority interface ID is 0x62dd69be
178
+ */
179
+ function getITREXImplementationAuthorityInterfaceId() external pure returns (bytes4) {
180
+ return type(ITREXImplementationAuthority).interfaceId;
181
+ }
182
+
183
+ /**
184
+ * @dev Returns the interface ID for the IIAFactory interface.
185
+ * IIAFactory interface ID is 0x8c76edf0
186
+ */
187
+ function getIIAFactoryInterfaceId() external pure returns (bytes4) {
188
+ return type(IIAFactory).interfaceId;
189
+ }
190
+
191
+ /**
192
+ * @dev Returns the interface ID for the ITREXGateway interface.
193
+ * ITREXGateway interface ID is 0x80e89461
194
+ */
195
+ function getITREXGatewayInterfaceId() external pure returns (bytes4) {
196
+ return type(ITREXGateway).interfaceId;
197
+ }
198
+
199
+ /**
200
+ * @dev Returns the interface ID for the IModularCompliance interface.
201
+ * IModularCompliance interface ID is 0x4d6b83d6
202
+ */
203
+ function getIModularComplianceInterfaceId() external pure returns (bytes4) {
204
+ return type(IModularCompliance).interfaceId;
205
+ }
206
+
207
+ /**
208
+ * @dev Returns the interface ID for the IERC3643Compliance interface.
209
+ * IERC3643Compliance interface ID is 0x3144991c
210
+ */
211
+ function getIERC3643ComplianceInterfaceId() external pure returns (bytes4) {
212
+ return type(IERC3643Compliance).interfaceId;
213
+ }
214
+
215
+ /**
216
+ * @dev Returns the interface ID for the IModule interface.
217
+ * IModule interface ID is 0xb795d01e
218
+ */
219
+ function getIModuleInterfaceId() external pure returns (bytes4) {
220
+ return type(IModule).interfaceId;
221
+ }
222
+
223
+ }
@@ -0,0 +1,210 @@
1
+ // SPDX-License-Identifier: GPL-3.0
2
+ //
3
+ // :+#####%%%%%%%%%%%%%%+
4
+ // .-*@@@%+.:+%@@@@@%%#***%@@%=
5
+ // :=*%@@@#=. :#@@% *@@@%=
6
+ // .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
7
+ // :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
8
+ // -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
9
+ // =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
10
+ // -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
11
+ // :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
12
+ // %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
13
+ // #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
14
+ // *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
15
+ // -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
16
+ // .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
17
+ // -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
18
+ // -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
19
+ // *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
20
+ // +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
21
+ // =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
22
+ // .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
23
+ // +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
24
+ // -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
25
+ // ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
26
+ // @@@@@@+. +@@*. .+@@@@@%=.
27
+ // -@@@@@= =@@%: -#@@@@%+.
28
+ // +@@@@@. =@@@= .+@@@@@*:
29
+ // #@@@@#:%@@#. :*@@@@#-
30
+ // @@@@@%@@@= :#@@@@+.
31
+ // :@@@@@@@#.:#@@@%-
32
+ // +@@@@@@-.*@@@*:
33
+ // #@@@@#.=@@@+.
34
+ // @@@@+-%@%=
35
+ // :@@@#%@%=
36
+ // +@@@@%-
37
+ // :#%%=
38
+ //
39
+
40
+ /**
41
+ * NOTICE
42
+ *
43
+ * The T-REX software is licensed under a proprietary license or the GPL v.3.
44
+ * If you choose to receive it under the GPL v.3 license, the following applies:
45
+ * T-REX is a suite of smart contracts implementing the ERC-3643 standard and
46
+ * developed by Tokeny to manage and transfer financial assets on EVM blockchains
47
+ *
48
+ * Copyright (C) 2025, Tokeny sàrl.
49
+ *
50
+ * This program is free software: you can redistribute it and/or modify
51
+ * it under the terms of the GNU General Public License as published by
52
+ * the Free Software Foundation, either version 3 of the License, or
53
+ * (at your option) any later version.
54
+ *
55
+ * This program is distributed in the hope that it will be useful,
56
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
57
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58
+ * GNU General Public License for more details.
59
+ *
60
+ * You should have received a copy of the GNU General Public License
61
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
62
+ */
63
+
64
+ pragma solidity 0.8.30;
65
+
66
+ import { IClaimIssuer, IIdentity } from "@onchain-id/solidity/contracts/interface/IClaimIssuer.sol";
67
+
68
+ import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
69
+ import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
70
+
71
+ import { IERC3643IdentityRegistry } from "../ERC-3643/IERC3643IdentityRegistry.sol";
72
+ import { IERC3643TrustedIssuersRegistry } from "../ERC-3643/IERC3643TrustedIssuersRegistry.sol";
73
+ import { IModularCompliance } from "../compliance/modular/IModularCompliance.sol";
74
+ import { IModule } from "../compliance/modular/modules/IModule.sol";
75
+ import { IToken } from "../token/IToken.sol";
76
+ import { IUtilityChecker } from "./IUtilityChecker.sol";
77
+
78
+ contract UtilityChecker is IUtilityChecker, OwnableUpgradeable, UUPSUpgradeable {
79
+
80
+ constructor() {
81
+ _disableInitializers();
82
+ }
83
+
84
+ function initialize() external initializer {
85
+ __Ownable_init(msg.sender);
86
+ }
87
+
88
+ /// @inheritdoc IUtilityChecker
89
+ /// @dev This function is not gas optimized and should be called only OFF chain.
90
+ function getTransferStatus(address _token, address _from, address _to, uint256 _amount)
91
+ external
92
+ view
93
+ override
94
+ returns (bool _freezeStatus, bool _eligibilityStatus, bool _complianceStatus)
95
+ {
96
+ IToken token = IToken(_token);
97
+
98
+ _freezeStatus = !token.paused();
99
+
100
+ (bool frozen,) = getFreezeStatus(_token, _from, _to, _amount);
101
+ _freezeStatus = _freezeStatus && !frozen;
102
+
103
+ IERC3643IdentityRegistry ir = token.identityRegistry();
104
+ _eligibilityStatus = ir.isVerified(_to);
105
+
106
+ ComplianceCheckDetails[] memory details = getTransferDetails(_token, _from, _to, _amount);
107
+ _complianceStatus = true;
108
+ for (uint256 i; i < details.length; i++) {
109
+ if (!details[i].pass) {
110
+ _complianceStatus = false;
111
+ break;
112
+ }
113
+ }
114
+ }
115
+
116
+ /// @inheritdoc IUtilityChecker
117
+ function getVerifiedDetails(address _token, address _userAddress)
118
+ public
119
+ view
120
+ override
121
+ returns (EligibilityCheckDetails[] memory _details)
122
+ {
123
+ IERC3643IdentityRegistry identityRegistry = IToken(_token).identityRegistry();
124
+ IERC3643TrustedIssuersRegistry tokenIssuersRegistry = identityRegistry.issuersRegistry();
125
+ IIdentity identity = identityRegistry.identity(_userAddress);
126
+
127
+ uint256[] memory requiredClaimTopics = identityRegistry.topicsRegistry().getClaimTopics();
128
+ uint256 topicsCount = requiredClaimTopics.length;
129
+ _details = new EligibilityCheckDetails[](topicsCount);
130
+ for (uint256 claimTopic; claimTopic < topicsCount; claimTopic++) {
131
+ uint256 topic = requiredClaimTopics[claimTopic];
132
+ IClaimIssuer[] memory trustedIssuers = tokenIssuersRegistry.getTrustedIssuersForClaimTopic(topic);
133
+
134
+ for (uint256 i; i < trustedIssuers.length; i++) {
135
+ (bool topicMatch, bool pass) = _getEligibility(trustedIssuers[i], topic, identity);
136
+ if (topicMatch) {
137
+ _details[claimTopic] =
138
+ EligibilityCheckDetails({ issuer: trustedIssuers[i], topic: topic, pass: pass });
139
+ }
140
+ }
141
+ }
142
+ }
143
+
144
+ /// @dev Function splitted to avoid stack too deep error
145
+ function _getEligibility(IClaimIssuer trustedIssuer, uint256 topic, IIdentity identity)
146
+ internal
147
+ view
148
+ returns (bool topicMatch, bool pass)
149
+ {
150
+ /// forge-lint: disable-next-line(asm-keccak256)
151
+ bytes32 claimId = keccak256(abi.encode(trustedIssuer, topic));
152
+ (uint256 foundClaimTopic,, address issuer, bytes memory sig, bytes memory data,) = identity.getClaim(claimId);
153
+ if (foundClaimTopic != topic) return (false, false);
154
+ topicMatch = true;
155
+
156
+ try IClaimIssuer(issuer).isClaimValid(identity, topic, sig, data) returns (bool validity) {
157
+ pass = validity;
158
+ } catch {
159
+ pass = false;
160
+ }
161
+ }
162
+
163
+ /// @inheritdoc IUtilityChecker
164
+ function getFreezeStatus(address _token, address _from, address _to, uint256 _amount)
165
+ public
166
+ view
167
+ override
168
+ returns (bool _frozen, uint256 _availableBalance)
169
+ {
170
+ IToken token = IToken(_token);
171
+
172
+ if (token.isFrozen(_from) || token.isFrozen(_to)) {
173
+ _availableBalance = 0;
174
+ _frozen = true;
175
+ } else {
176
+ _availableBalance = token.balanceOf(_from) - token.getFrozenTokens(_from);
177
+ _frozen = _amount > _availableBalance;
178
+ }
179
+ }
180
+
181
+ /// @inheritdoc IUtilityChecker
182
+ function getTransferDetails(address _token, address _from, address _to, uint256 _value)
183
+ public
184
+ view
185
+ override
186
+ returns (ComplianceCheckDetails[] memory _details)
187
+ {
188
+ IModularCompliance compliance = IModularCompliance(address(IToken(_token).compliance()));
189
+ address[] memory modules = compliance.getModules();
190
+ uint256 length = modules.length;
191
+ _details = new ComplianceCheckDetails[](length);
192
+ for (uint256 i; i < length; i++) {
193
+ IModule module = IModule(modules[i]);
194
+ _details[i] = ComplianceCheckDetails({
195
+ moduleName: module.name(), pass: module.moduleCheck(_from, _to, _value, address(compliance))
196
+ });
197
+ }
198
+ }
199
+
200
+ // solhint-disable-next-line no-empty-blocks
201
+ function _authorizeUpgrade(
202
+ address /*newImplementation*/
203
+ )
204
+ internal
205
+ view
206
+ override
207
+ onlyOwner
208
+ { }
209
+
210
+ }