@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,180 @@
1
+ // SPDX-License-Identifier: CC0-1.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
+ pragma solidity 0.8.30;
40
+
41
+ import { IERC3643ClaimTopicsRegistry } from "./IERC3643ClaimTopicsRegistry.sol";
42
+ import { IERC3643IdentityRegistryStorage } from "./IERC3643IdentityRegistryStorage.sol";
43
+ import { IERC3643TrustedIssuersRegistry } from "./IERC3643TrustedIssuersRegistry.sol";
44
+ import { IIdentity } from "@onchain-id/solidity/contracts/interface/IIdentity.sol";
45
+
46
+ interface IERC3643IdentityRegistry {
47
+
48
+ /// Functions
49
+ /// Identity Registry Setters
50
+ /**
51
+ * @dev Replace the actual identityRegistryStorage contract with a new one.
52
+ * This function can only be called by the wallet set as owner of the smart contract
53
+ * @param _identityRegistryStorage The address of the new Identity Registry Storage
54
+ * emits `IdentityStorageSet` event
55
+ */
56
+ function setIdentityRegistryStorage(address _identityRegistryStorage) external;
57
+
58
+ /**
59
+ * @dev Replace the actual claimTopicsRegistry contract with a new one.
60
+ * This function can only be called by the wallet set as owner of the smart contract
61
+ * @param _claimTopicsRegistry The address of the new claim Topics Registry
62
+ * emits `ClaimTopicsRegistrySet` event
63
+ */
64
+ function setClaimTopicsRegistry(address _claimTopicsRegistry) external;
65
+
66
+ /**
67
+ * @dev Replace the actual trustedIssuersRegistry contract with a new one.
68
+ * This function can only be called by the wallet set as owner of the smart contract
69
+ * @param _trustedIssuersRegistry The address of the new Trusted Issuers Registry
70
+ * emits `TrustedIssuersRegistrySet` event
71
+ */
72
+ function setTrustedIssuersRegistry(address _trustedIssuersRegistry) external;
73
+
74
+ /// Registry Actions
75
+ /**
76
+ * @dev Register an identity contract corresponding to a user address.
77
+ * Requires that the user doesn't have an identity contract already registered.
78
+ * This function can only be called by a wallet set as agent of the smart contract
79
+ * @param _userAddress The address of the user
80
+ * @param _identity The address of the user's identity contract
81
+ * @param _country The country of the investor
82
+ * emits `IdentityRegistered` event
83
+ */
84
+ function registerIdentity(address _userAddress, IIdentity _identity, uint16 _country) external;
85
+
86
+ /**
87
+ * @dev Removes an user from the identity registry.
88
+ * Requires that the user have an identity contract already deployed that will be deleted.
89
+ * This function can only be called by a wallet set as agent of the smart contract
90
+ * @param _userAddress The address of the user to be removed
91
+ * emits `IdentityRemoved` event
92
+ */
93
+ function deleteIdentity(address _userAddress) external;
94
+
95
+ /**
96
+ * @dev Updates the country corresponding to a user address.
97
+ * Requires that the user should have an identity contract already deployed that will be replaced.
98
+ * This function can only be called by a wallet set as agent of the smart contract
99
+ * @param _userAddress The address of the user
100
+ * @param _country The new country of the user
101
+ * emits `CountryUpdated` event
102
+ */
103
+ function updateCountry(address _userAddress, uint16 _country) external;
104
+
105
+ /**
106
+ * @dev Updates an identity contract corresponding to a user address.
107
+ * Requires that the user address should be the owner of the identity contract.
108
+ * Requires that the user should have an identity contract already deployed that will be replaced.
109
+ * This function can only be called by a wallet set as agent of the smart contract
110
+ * @param _userAddress The address of the user
111
+ * @param _identity The address of the user's new identity contract
112
+ * emits `IdentityUpdated` event
113
+ */
114
+ function updateIdentity(address _userAddress, IIdentity _identity) external;
115
+
116
+ /**
117
+ * @dev function allowing to register identities in batch
118
+ * This function can only be called by a wallet set as agent of the smart contract
119
+ * Requires that none of the users has an identity contract already registered.
120
+ * IMPORTANT : THIS TRANSACTION COULD EXCEED GAS LIMIT IF `_userAddresses.length` IS TOO HIGH,
121
+ * USE WITH CARE OR YOU COULD LOSE TX FEES WITH AN "OUT OF GAS" TRANSACTION
122
+ * @param _userAddresses The addresses of the users
123
+ * @param _identities The addresses of the corresponding identity contracts
124
+ * @param _countries The countries of the corresponding investors
125
+ * emits _userAddresses.length `IdentityRegistered` events
126
+ */
127
+ function batchRegisterIdentity(
128
+ address[] calldata _userAddresses,
129
+ IIdentity[] calldata _identities,
130
+ uint16[] calldata _countries
131
+ ) external;
132
+
133
+ /// Registry Consultation
134
+
135
+ /**
136
+ * @dev This functions checks whether a wallet has its Identity registered or not
137
+ * in the Identity Registry.
138
+ * @param _userAddress The address of the user to be checked.
139
+ * @return 'True' if the address is contained in the Identity Registry, 'false' if not.
140
+ */
141
+ function contains(address _userAddress) external view returns (bool);
142
+
143
+ /**
144
+ * @dev This functions checks whether an identity contract
145
+ * corresponding to the provided user address has the required claims or not based
146
+ * on the data fetched from trusted issuers registry and from the claim topics registry
147
+ * @param _userAddress The address of the user to be verified.
148
+ * @return 'True' if the address is verified, 'false' if not.
149
+ */
150
+ function isVerified(address _userAddress) external view returns (bool);
151
+
152
+ /**
153
+ * @dev Returns the onchainID of an investor.
154
+ * @param _userAddress The wallet of the investor
155
+ */
156
+ function identity(address _userAddress) external view returns (IIdentity);
157
+
158
+ /**
159
+ * @dev Returns the country code of an investor.
160
+ * @param _userAddress The wallet of the investor
161
+ */
162
+ function investorCountry(address _userAddress) external view returns (uint16);
163
+
164
+ // identity registry getters
165
+ /**
166
+ * @dev Returns the IdentityRegistryStorage linked to the current IdentityRegistry.
167
+ */
168
+ function identityStorage() external view returns (IERC3643IdentityRegistryStorage);
169
+
170
+ /**
171
+ * @dev Returns the TrustedIssuersRegistry linked to the current IdentityRegistry.
172
+ */
173
+ function issuersRegistry() external view returns (IERC3643TrustedIssuersRegistry);
174
+
175
+ /**
176
+ * @dev Returns the ClaimTopicsRegistry linked to the current IdentityRegistry.
177
+ */
178
+ function topicsRegistry() external view returns (IERC3643ClaimTopicsRegistry);
179
+
180
+ }
@@ -0,0 +1,120 @@
1
+ // SPDX-License-Identifier: CC0-1.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
+ pragma solidity 0.8.30;
40
+ import { IIdentity } from "@onchain-id/solidity/contracts/interface/IIdentity.sol";
41
+
42
+ interface IERC3643IdentityRegistryStorage {
43
+
44
+ /// functions
45
+ /**
46
+ * @dev adds an identity contract corresponding to a user address in the storage.
47
+ * Requires that the user doesn't have an identity contract already registered.
48
+ * This function can only be called by an address set as agent of the smart contract
49
+ * @param _userAddress The address of the user
50
+ * @param _identity The address of the user's identity contract
51
+ * @param _country The country of the investor
52
+ * emits `IdentityStored` event
53
+ */
54
+ function addIdentityToStorage(address _userAddress, IIdentity _identity, uint16 _country) external;
55
+
56
+ /**
57
+ * @dev Removes an user from the storage.
58
+ * Requires that the user have an identity contract already deployed that will be deleted.
59
+ * This function can only be called by an address set as agent of the smart contract
60
+ * @param _userAddress The address of the user to be removed
61
+ * emits `IdentityUnstored` event
62
+ */
63
+ function removeIdentityFromStorage(address _userAddress) external;
64
+
65
+ /**
66
+ * @dev Updates the country corresponding to a user address.
67
+ * Requires that the user should have an identity contract already deployed that will be replaced.
68
+ * This function can only be called by an address set as agent of the smart contract
69
+ * @param _userAddress The address of the user
70
+ * @param _country The new country of the user
71
+ * emits `CountryModified` event
72
+ */
73
+ function modifyStoredInvestorCountry(address _userAddress, uint16 _country) external;
74
+
75
+ /**
76
+ * @dev Updates an identity contract corresponding to a user address.
77
+ * Requires that the user address should be the owner of the identity contract.
78
+ * Requires that the user should have an identity contract already deployed that will be replaced.
79
+ * This function can only be called by an address set as agent of the smart contract
80
+ * @param _userAddress The address of the user
81
+ * @param _identity The address of the user's new identity contract
82
+ * emits `IdentityModified` event
83
+ */
84
+ function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;
85
+
86
+ /**
87
+ * @notice Adds an identity registry as agent of the Identity Registry Storage Contract.
88
+ * This function can only be called by the wallet set as owner of the smart contract
89
+ * This function adds the identity registry to the list of identityRegistries linked to the storage contract
90
+ * cannot bind more than 300 IR to 1 IRS
91
+ * @param _identityRegistry The identity registry address to add.
92
+ */
93
+ function bindIdentityRegistry(address _identityRegistry) external;
94
+
95
+ /**
96
+ * @notice Removes an identity registry from being agent of the Identity Registry Storage Contract.
97
+ * This function can only be called by the wallet set as owner of the smart contract
98
+ * This function removes the identity registry from the list of identityRegistries linked to the storage contract
99
+ * @param _identityRegistry The identity registry address to remove.
100
+ */
101
+ function unbindIdentityRegistry(address _identityRegistry) external;
102
+
103
+ /**
104
+ * @dev Returns the identity registries linked to the storage contract
105
+ */
106
+ function linkedIdentityRegistries() external view returns (address[] memory);
107
+
108
+ /**
109
+ * @dev Returns the onchainID of an investor.
110
+ * @param _userAddress The wallet of the investor
111
+ */
112
+ function storedIdentity(address _userAddress) external view returns (IIdentity);
113
+
114
+ /**
115
+ * @dev Returns the country code of an investor.
116
+ * @param _userAddress The wallet of the investor
117
+ */
118
+ function storedInvestorCountry(address _userAddress) external view returns (uint16);
119
+
120
+ }
@@ -0,0 +1,120 @@
1
+ // SPDX-License-Identifier: CC0-1.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
+ pragma solidity 0.8.30;
40
+ import { IClaimIssuer } from "@onchain-id/solidity/contracts/interface/IClaimIssuer.sol";
41
+
42
+ interface IERC3643TrustedIssuersRegistry {
43
+
44
+ // Functions
45
+
46
+ // Setters
47
+ /**
48
+ * @dev registers a ClaimIssuer contract as trusted claim issuer.
49
+ * Requires that a ClaimIssuer contract doesn't already exist
50
+ * Requires that the claimTopics set is not empty
51
+ * Requires that there is no more than 15 claimTopics
52
+ * Requires that there is no more than 50 Trusted issuers
53
+ * @param _trustedIssuer The ClaimIssuer contract address of the trusted claim issuer.
54
+ * @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit
55
+ * This function can only be called by the owner of the Trusted Issuers Registry contract
56
+ * emits a `TrustedIssuerAdded` event
57
+ */
58
+ function addTrustedIssuer(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;
59
+
60
+ /**
61
+ * @dev Removes the ClaimIssuer contract of a trusted claim issuer.
62
+ * Requires that the claim issuer contract to be registered first
63
+ * @param _trustedIssuer the claim issuer to remove.
64
+ * This function can only be called by the owner of the Trusted Issuers Registry contract
65
+ * emits a `TrustedIssuerRemoved` event
66
+ */
67
+ function removeTrustedIssuer(IClaimIssuer _trustedIssuer) external;
68
+
69
+ /**
70
+ * @dev Updates the set of claim topics that a trusted issuer is allowed to emit.
71
+ * Requires that this ClaimIssuer contract already exists in the registry
72
+ * Requires that the provided claimTopics set is not empty
73
+ * Requires that there is no more than 15 claimTopics
74
+ * @param _trustedIssuer the claim issuer to update.
75
+ * @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit
76
+ * This function can only be called by the owner of the Trusted Issuers Registry contract
77
+ * emits a `ClaimTopicsUpdated` event
78
+ */
79
+ function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics) external;
80
+
81
+ /// Getters
82
+
83
+ /**
84
+ * @dev Function for getting all the trusted claim issuers stored.
85
+ * @return array of all claim issuers registered.
86
+ */
87
+ function getTrustedIssuers() external view returns (IClaimIssuer[] memory);
88
+
89
+ /**
90
+ * @dev Function for getting all the trusted issuer allowed for a given claim topic.
91
+ * @param claimTopic the claim topic to get the trusted issuers for.
92
+ * @return array of all claim issuer addresses that are allowed for the given claim topic.
93
+ */
94
+ function getTrustedIssuersForClaimTopic(uint256 claimTopic) external view returns (IClaimIssuer[] memory);
95
+
96
+ /**
97
+ * @dev Checks if the ClaimIssuer contract is trusted
98
+ * @param _issuer the address of the ClaimIssuer contract
99
+ * @return true if the issuer is trusted, false otherwise.
100
+ */
101
+ function isTrustedIssuer(address _issuer) external view returns (bool);
102
+
103
+ /**
104
+ * @dev Function for getting all the claim topic of trusted claim issuer
105
+ * Requires the provided ClaimIssuer contract to be registered in the trusted issuers registry.
106
+ * @param _trustedIssuer the trusted issuer concerned.
107
+ * @return The set of claim topics that the trusted issuer is allowed to emit
108
+ */
109
+ function getTrustedIssuerClaimTopics(IClaimIssuer _trustedIssuer) external view returns (uint256[] memory);
110
+
111
+ /**
112
+ * @dev Function for checking if the trusted claim issuer is allowed
113
+ * to emit a certain claim topic
114
+ * @param _issuer the address of the trusted issuer's ClaimIssuer contract
115
+ * @param _claimTopic the Claim Topic that has to be checked to know if the `issuer` is allowed to emit it
116
+ * @return true if the issuer is trusted for this claim topic.
117
+ */
118
+ function hasClaimTopic(address _issuer, uint256 _claimTopic) external view returns (bool);
119
+
120
+ }
@@ -0,0 +1,143 @@
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
+ * NOTICE
41
+ *
42
+ * The T-REX software is licensed under a proprietary license or the GPL v.3.
43
+ * If you choose to receive it under the GPL v.3 license, the following applies:
44
+ * T-REX is a suite of smart contracts implementing the ERC-3643 standard and
45
+ * developed by Tokeny to manage and transfer financial assets on EVM blockchains
46
+ *
47
+ * Copyright (C) 2025, Tokeny sàrl.
48
+ *
49
+ * This program is free software: you can redistribute it and/or modify
50
+ * it under the terms of the GNU General Public License as published by
51
+ * the Free Software Foundation, either version 3 of the License, or
52
+ * (at your option) any later version.
53
+ *
54
+ * This program is distributed in the hope that it will be useful,
55
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
56
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57
+ * GNU General Public License for more details.
58
+ *
59
+ * You should have received a copy of the GNU General Public License
60
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
61
+ */
62
+
63
+ pragma solidity 0.8.30;
64
+
65
+ import { IERC3643Compliance } from "../../ERC-3643/IERC3643Compliance.sol";
66
+
67
+ interface IModularCompliance is IERC3643Compliance {
68
+
69
+ /// functions
70
+ /**
71
+ * @dev adds a module to the list of compliance modules
72
+ * @param _module address of the module to add
73
+ * there cannot be more than 25 modules bound to the modular compliance for gas cost reasons
74
+ * This function can be called ONLY by the owner of the compliance contract
75
+ * Emits a ModuleAdded event
76
+ */
77
+ function addModule(address _module) external;
78
+
79
+ /**
80
+ * @dev removes a module from the list of compliance modules
81
+ * @param _module address of the module to remove
82
+ * This function can be called ONLY by the owner of the compliance contract
83
+ * Emits a ModuleRemoved event
84
+ */
85
+ function removeModule(address _module) external;
86
+
87
+ /**
88
+ * @dev calls any function on bound modules
89
+ * can be called only on bound modules
90
+ * @param callData the bytecode for interaction with the module, abi encoded
91
+ * @param _module The address of the module
92
+ * This function can be called only by the modular compliance owner
93
+ * emits a `ModuleInteraction` event
94
+ */
95
+ function callModuleFunction(bytes calldata callData, address _module) external;
96
+
97
+ /**
98
+ * @dev Adds a module to the modular compliance contract and performs multiple interactions with it in a single transaction.
99
+ *
100
+ * This function allows the contract owner to add a new compliance module and immediately configure it by calling
101
+ * specified functions on the module. This can be useful for setting up the module with initial parameters or configurations
102
+ * right after it is added.
103
+ *
104
+ * @param _module The address of the module to add. The module must either be "plug and play"
105
+ * or be able to bind with the compliance contract.
106
+ * @param _interactions An array of bytecode representing function calls to be made on the module.
107
+ * These interactions are performed after the module is added.
108
+ *
109
+ * Requirements:
110
+ * - The caller must be the owner of the `ModularCompliance` contract.
111
+ * - The `_module` address must not be a zero address.
112
+ * - The `_module` must not already be bound to the contract.
113
+ * - The total number of modules must not exceed 25 after adding the new module.
114
+ * - The `_interactions` array must contain no more than 5 elements to prevent out-of-gas errors.
115
+ *
116
+ * Operations:
117
+ * - The function first adds the module using the `addModule` function.
118
+ * - Then, it iterates over the `_interactions` array, performing each
119
+ * interaction on the module using the `callModuleFunction`.
120
+ *
121
+ * Emits:
122
+ * - A `ModuleAdded` event upon successful addition of the module.
123
+ * - A `ModuleInteraction` event for each function call made to the module during the interaction phase.
124
+ *
125
+ * Reverts if:
126
+ * - Any of the above requirements are not met.
127
+ * - Any of the module interactions fail during execution.
128
+ */
129
+ function addAndSetModule(address _module, bytes[] calldata _interactions) external;
130
+
131
+ /**
132
+ * @dev getter for the modules bound to the compliance contract
133
+ * returns address array of module contracts bound to the compliance
134
+ */
135
+ function getModules() external view returns (address[] memory);
136
+
137
+ /**
138
+ * @dev checks if a module is bound to the compliance contract
139
+ * returns true if module is bound, false otherwise
140
+ */
141
+ function isModuleBound(address _module) external view returns (bool);
142
+
143
+ }