@t-rex-network/t-rex 5.0.0-beta2 → 5.0.0-beta3

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 (386) hide show
  1. package/NOTICE.md +78 -0
  2. package/README.md +19 -22
  3. package/contracts/{roles/AgentRole.sol → ERC-3643/ERC3643ErrorsLib.sol} +60 -33
  4. package/contracts/ERC-3643/IERC3643.sol +61 -5
  5. package/contracts/ERC-3643/IERC3643ClaimTopicsRegistry.sol +11 -2
  6. package/contracts/ERC-3643/IERC3643Compliance.sol +21 -8
  7. package/contracts/ERC-3643/IERC3643IdentityRegistry.sol +33 -0
  8. package/contracts/ERC-3643/IERC3643IdentityRegistryStorage.sol +62 -7
  9. package/contracts/ERC-3643/IERC3643TrustedIssuersRegistry.sol +29 -12
  10. package/contracts/ERC-3643/base/ERC3643ClaimTopicsRegistry.sol +140 -0
  11. package/contracts/ERC-3643/base/ERC3643Compliance.sol +223 -0
  12. package/contracts/ERC-3643/base/ERC3643IdentityRegistry.sol +382 -0
  13. package/contracts/ERC-3643/base/ERC3643IdentityRegistryStorage.sol +290 -0
  14. package/contracts/ERC-3643/base/ERC3643Token.sol +601 -0
  15. package/contracts/ERC-3643/base/ERC3643TrustedIssuersRegistry.sol +237 -0
  16. package/contracts/compliance/modular/ComplianceLedger.sol +175 -0
  17. package/contracts/compliance/modular/ComplianceLedgerLib.sol +120 -0
  18. package/contracts/compliance/modular/IComplianceLedger.sol +104 -0
  19. package/contracts/compliance/modular/IModularCompliance.sol +119 -28
  20. package/contracts/compliance/modular/ITransferValidation.sol +308 -0
  21. package/contracts/compliance/modular/ModularCompliance.sol +399 -240
  22. package/contracts/compliance/modular/ModuleSetLib.sol +182 -0
  23. package/contracts/compliance/modular/MovementKindLib.sol +97 -0
  24. package/contracts/compliance/modular/TransferContextLib.sol +140 -0
  25. package/contracts/compliance/modular/TransferValidation.sol +822 -0
  26. package/contracts/compliance/modular/TransferValidationLib.sol +183 -0
  27. package/contracts/compliance/modular/modules/AbstractModuleUpgradeable.sol +87 -56
  28. package/contracts/compliance/modular/modules/IModule.sol +142 -58
  29. package/contracts/compliance/modular/modules/MaxBalancePerIdentityModule.sol +175 -0
  30. package/contracts/compliance/modular/modules/ModuleProxy.sol +24 -24
  31. package/contracts/compliance/modular/modules/SpenderVerificationModule.sol +149 -0
  32. package/contracts/compliance/modular/modules/SpenderWhitelistModule.sol +215 -0
  33. package/contracts/factory/ITREXFactory.sol +94 -44
  34. package/contracts/factory/TREXFactory.sol +408 -201
  35. package/contracts/interop/ISettlementHandler.sol +101 -0
  36. package/contracts/interop/ITREXMessaging.sol +166 -0
  37. package/contracts/{proxy/ModularComplianceProxy.sol → interop/ITrustedGatewayRegistry.sol} +48 -43
  38. package/contracts/interop/TREXMessaging.sol +189 -0
  39. package/contracts/interop/TREXMessagingLib.sol +425 -0
  40. package/contracts/{proxy/TrustedIssuersRegistryProxy.sol → interop/TrustedGatewayRegistry.sol} +46 -37
  41. package/contracts/libraries/AccessManagerSetupLib.sol +484 -0
  42. package/contracts/libraries/ErrorsLib.sol +172 -65
  43. package/contracts/libraries/EventsLib.sol +168 -66
  44. package/contracts/libraries/MessageTypesLib.sol +259 -0
  45. package/contracts/libraries/RolesLib.sol +146 -0
  46. package/contracts/{roles/Roles.sol → libraries/VersionLib.sol} +46 -49
  47. package/contracts/libraries/WalletKeyLib.sol +156 -0
  48. package/contracts/proxy/beacon/ITREXImplementationAuthority.sol +157 -0
  49. package/contracts/proxy/beacon/TREXImplementationAuthority.sol +188 -0
  50. package/contracts/registry/implementation/IdentityRegistryStorage.sol +215 -163
  51. package/contracts/registry/implementation/TREXRegistry.sol +475 -0
  52. package/contracts/registry/interface/IIdentityRegistryStorage.sol +30 -25
  53. package/contracts/registry/interface/ITREXRegistry.sol +180 -0
  54. package/contracts/token/IToken.sol +210 -49
  55. package/contracts/token/Token.sol +411 -476
  56. package/contracts/token/TokenDelegationLib.sol +339 -0
  57. package/contracts/token/TokenGuardsLib.sol +123 -0
  58. package/contracts/token/TokenLedgerLib.sol +316 -0
  59. package/contracts/token/TokenRecoveryLib.sol +130 -0
  60. package/contracts/{roles/AgentRoleUpgradeable.sol → utils/AccessManagedOwnable.sol} +31 -31
  61. package/contracts/{proxy/IdentityRegistryStorageProxy.sol → utils/AccessManagedOwnableBase.sol} +56 -34
  62. package/contracts/utils/AccessManagedOwnableUpgradeable.sol +116 -0
  63. package/contracts/utils/IUtilityChecker.sol +32 -26
  64. package/contracts/{roles/AbstractAgentRole.sol → utils/TREXAccessManager.sol} +54 -57
  65. package/contracts/utils/UtilityChecker.sol +175 -52
  66. package/contracts/utils/UtilityCheckerProxy.sol +24 -24
  67. package/contracts/{proxy/interface/IProxy.sol → vendor/IERC173.sol} +15 -28
  68. package/out/AbstractModuleUpgradeable.sol/AbstractModuleUpgradeable.json +1 -1
  69. package/out/AbstractSigner.sol/AbstractSigner.json +1 -0
  70. package/out/AccessManaged.sol/AccessManaged.json +1 -0
  71. package/out/AccessManagedOwnable.sol/AccessManagedOwnable.json +1 -0
  72. package/out/AccessManagedOwnableBase.sol/AccessManagedOwnableBase.json +1 -0
  73. package/out/AccessManagedOwnableUpgradeable.sol/AccessManagedOwnableUpgradeable.json +1 -0
  74. package/out/AccessManagedUpgradeable.sol/AccessManagedUpgradeable.json +1 -0
  75. package/out/AccessManager.sol/AccessManager.json +1 -0
  76. package/out/AccessManagerHelper.sol/AccessManagerHelper.json +1 -0
  77. package/out/AccessManagerSetupLib.sol/AccessManagerSetupLib.json +1 -0
  78. package/out/AccessManagerUpgradeable.sol/AccessManagerUpgradeable.json +1 -0
  79. package/out/Account.sol/Account.json +1 -0
  80. package/out/Address.sol/Address.json +1 -1
  81. package/out/Arrays.sol/Arrays.json +1 -1
  82. package/out/AuthorityUtils.sol/AuthorityUtils.json +1 -0
  83. package/out/Base.sol/CommonBase.json +1 -1
  84. package/out/Base.sol/ScriptBase.json +1 -1
  85. package/out/Base.sol/TestBase.json +1 -1
  86. package/out/Base64.sol/Base64.json +1 -0
  87. package/out/BeaconProxy.sol/BeaconProxy.json +1 -0
  88. package/out/BeaconProxyDeployer.sol/BeaconProxyDeployer.json +1 -0
  89. package/out/Bytes.sol/Bytes.json +1 -1
  90. package/out/Calldata.sol/Calldata.json +1 -0
  91. package/out/CapabilityModules.sol/AllTypesModule.json +1 -0
  92. package/out/CapabilityModules.sol/CappedRecipientModule.json +1 -0
  93. package/out/CapabilityModules.sol/DelegatedCapRuleModule.json +1 -0
  94. package/out/CapabilityModules.sol/DuplicateTypeModule.json +1 -0
  95. package/out/CapabilityModules.sol/LockedSenderModule.json +1 -0
  96. package/out/CapabilityModules.sol/NoTypeModule.json +1 -0
  97. package/out/CapabilityModules.sol/RecordingModule.json +1 -0
  98. package/out/CapabilityModules.sol/RuleAndMintTrackerModule.json +1 -0
  99. package/out/CapabilityModules.sol/RuleAndTrackerModule.json +1 -0
  100. package/out/CapabilityModules.sol/RuleOnlyModule.json +1 -0
  101. package/out/CapabilityModules.sol/SpenderOnlyModule.json +1 -0
  102. package/out/CapabilityModules.sol/TrackerOnlyModule.json +1 -0
  103. package/out/CapabilityModules.sol/UndeclaredRuleModule.json +1 -0
  104. package/out/CapabilityModules.sol/WritingRuleModule.json +1 -0
  105. package/out/ClaimIssuerAlwaysReverts.sol/ClaimIssuerAlwaysReverts.json +1 -0
  106. package/out/ClaimIssuerTrick.sol/ClaimIssuerTrick.json +1 -1
  107. package/out/Comparators.sol/Comparators.json +1 -1
  108. package/out/ComplianceLedger.sol/ComplianceLedger.json +1 -0
  109. package/out/ComplianceLedgerLib.sol/ComplianceLedgerLib.json +1 -0
  110. package/out/Context.sol/Context.json +1 -1
  111. package/out/ContextUpgradeable.sol/ContextUpgradeable.json +1 -1
  112. package/out/Countries.sol/Countries.json +1 -1
  113. package/out/Create2.sol/Create2.json +1 -1
  114. package/out/Create3.sol/Create3.json +1 -1
  115. package/out/DeployComplianceModules.s.sol/DeployComplianceModules.json +1 -0
  116. package/out/DeployComplianceModules.s.sol/ITokenCompliance.json +1 -0
  117. package/out/DeployUtilityChecker.s.sol/DeployUtilityChecker.json +1 -0
  118. package/out/ECDSA.sol/ECDSA.json +1 -1
  119. package/out/EIP712.sol/EIP712.json +1 -1
  120. package/out/EIP712Upgradeable.sol/EIP712Upgradeable.json +1 -1
  121. package/out/ERC165.sol/ERC165.json +1 -0
  122. package/out/ERC165Checker.sol/ERC165Checker.json +1 -0
  123. package/out/ERC165Upgradeable.sol/ERC165Upgradeable.json +1 -0
  124. package/out/ERC1967Proxy.sol/ERC1967Proxy.json +1 -1
  125. package/out/ERC1967Utils.sol/ERC1967Utils.json +1 -1
  126. package/out/ERC20.sol/ERC20.json +1 -1
  127. package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -1
  128. package/out/ERC20PermitUpgradeable.sol/ERC20PermitUpgradeable.json +1 -1
  129. package/out/ERC20Upgradeable.sol/ERC20Upgradeable.json +1 -1
  130. package/out/ERC3643ClaimTopicsRegistry.sol/ERC3643ClaimTopicsRegistry.json +1 -0
  131. package/out/ERC3643Compliance.sol/ERC3643Compliance.json +1 -0
  132. package/out/ERC3643ErrorsLib.sol/ERC3643ErrorsLib.json +1 -0
  133. package/out/ERC3643IdentityRegistry.sol/ERC3643IdentityRegistry.json +1 -0
  134. package/out/ERC3643IdentityRegistryStorage.sol/ERC3643IdentityRegistryStorage.json +1 -0
  135. package/out/ERC3643Token.sol/ERC3643Token.json +1 -0
  136. package/out/ERC3643TrustedIssuersRegistry.sol/ERC3643TrustedIssuersRegistry.json +1 -0
  137. package/out/ERC4337Utils.sol/ERC4337Utils.json +1 -0
  138. package/out/ERC4337Utils.sol/IEntryPointExtra.json +1 -0
  139. package/out/ERC734Validator.sol/ERC734Validator.json +1 -0
  140. package/out/ERC7579Validator.sol/ERC7579Validator.json +1 -0
  141. package/out/ERC7786GatewayMock.sol/ERC7786GatewayMock.json +1 -0
  142. package/out/ERC7786Recipient.sol/ERC7786Recipient.json +1 -0
  143. package/out/ERC7913WebAuthnVerifier.sol/ERC7913WebAuthnVerifier.json +1 -0
  144. package/out/EnumerableSet.sol/EnumerableSet.json +1 -1
  145. package/out/Errors.sol/Errors.json +1 -1
  146. package/out/ErrorsLib.sol/ErrorsLib.json +1 -1
  147. package/out/EventsLib.sol/EventsLib.json +1 -1
  148. package/out/Hashes.sol/Hashes.json +1 -0
  149. package/out/HostileModules.sol/RevertEverywhereModule.json +1 -0
  150. package/out/HostileModules.sol/UnbindRevertingModule.json +1 -0
  151. package/out/IAccessManaged.sol/IAccessManaged.json +1 -0
  152. package/out/IAccessManager.sol/IAccessManager.json +1 -0
  153. package/out/IAuthority.sol/IAuthority.json +1 -0
  154. package/out/IBeacon.sol/IBeacon.json +1 -1
  155. package/out/IClaimIssuer.sol/IClaimIssuer.json +1 -1
  156. package/out/IComplianceLedger.sol/IComplianceLedger.json +1 -0
  157. package/out/IERC1271.sol/IERC1271.json +1 -0
  158. package/out/IERC165.sol/IERC165.json +1 -1
  159. package/out/IERC173.sol/IERC173.json +1 -1
  160. package/out/IERC1967.sol/IERC1967.json +1 -1
  161. package/out/IERC20.sol/IERC20.json +1 -1
  162. package/out/IERC20Metadata.sol/IERC20Metadata.json +1 -1
  163. package/out/IERC20Permit.sol/IERC20Permit.json +1 -1
  164. package/out/IERC3643.sol/IERC3643.json +1 -1
  165. package/out/IERC3643ClaimTopicsRegistry.sol/IERC3643ClaimTopicsRegistry.json +1 -1
  166. package/out/IERC3643Compliance.sol/IERC3643Compliance.json +1 -1
  167. package/out/IERC3643IdentityRegistry.sol/IERC3643IdentityRegistry.json +1 -1
  168. package/out/IERC3643IdentityRegistryStorage.sol/IERC3643IdentityRegistryStorage.json +1 -1
  169. package/out/IERC3643TrustedIssuersRegistry.sol/IERC3643TrustedIssuersRegistry.json +1 -1
  170. package/out/IERC4337.sol/IAccount.json +1 -0
  171. package/out/IERC4337.sol/IAccountExecute.json +1 -0
  172. package/out/IERC4337.sol/IAggregator.json +1 -0
  173. package/out/IERC4337.sol/IEntryPoint.json +1 -0
  174. package/out/IERC4337.sol/IEntryPointNonces.json +1 -0
  175. package/out/IERC4337.sol/IEntryPointStake.json +1 -0
  176. package/out/IERC4337.sol/IPaymaster.json +1 -0
  177. package/out/IERC5267.sol/IERC5267.json +1 -1
  178. package/out/IERC734.sol/IERC734.json +1 -1
  179. package/out/IERC735.sol/IERC735.json +1 -1
  180. package/out/IERC7913.sol/IERC7913SignatureVerifier.json +1 -0
  181. package/out/IIdentity.sol/IIdentity.json +1 -1
  182. package/out/IIdentityFactory.sol/IIdentityFactory.json +1 -0
  183. package/out/IIdentityRegistryStorage.sol/IIdentityRegistryStorage.json +1 -1
  184. package/out/IKeyExecutor.sol/IKeyExecutor.json +1 -0
  185. package/out/IModularCompliance.sol/IModularCompliance.json +1 -1
  186. package/out/IModule.sol/IModule.json +1 -1
  187. package/out/IMulticall3.sol/IMulticall3.json +1 -1
  188. package/out/IReputationRegistry.sol/IReputationRegistry.json +1 -0
  189. package/out/ISettlementHandler.sol/ISettlementHandler.json +1 -0
  190. package/out/ITREXFactory.sol/ITREXFactory.json +1 -1
  191. package/out/ITREXImplementationAuthority.sol/ITREXImplementationAuthority.json +1 -1
  192. package/out/ITREXMessaging.sol/ITREXMessaging.json +1 -0
  193. package/out/ITREXRegistry.sol/ITREXRegistry.json +1 -0
  194. package/out/IToken.sol/IToken.json +1 -1
  195. package/out/ITransferValidation.sol/ITransferValidation.json +1 -0
  196. package/out/ITrustedGatewayRegistry.sol/ITrustedGatewayRegistry.json +1 -0
  197. package/out/IUtilityChecker.sol/IUtilityChecker.json +1 -1
  198. package/out/Identity.sol/Identity.json +1 -1
  199. package/out/IdentityFactory.sol/IdentityFactory.json +1 -0
  200. package/out/IdentityModulesHelper.sol/IdentityModulesHelper.json +1 -0
  201. package/out/IdentityRegistryStorage.sol/IdentityRegistryStorage.json +1 -1
  202. package/out/IdentityTypes.sol/IdentityTypes.json +1 -0
  203. package/out/Initializable.sol/Initializable.json +1 -1
  204. package/out/InteropSuiteTest.sol/InteropSuiteTest.json +1 -0
  205. package/out/KeyApprovalModule.sol/IIdentityAccount.json +1 -0
  206. package/out/KeyApprovalModule.sol/KeyApprovalModule.json +1 -0
  207. package/out/KeyManager.sol/KeyManager.json +1 -0
  208. package/out/KeyPurposes.sol/KeyPurposes.json +1 -1
  209. package/out/KeyTypes.sol/KeyTypes.json +1 -1
  210. package/out/LowLevelCall.sol/LowLevelCall.json +1 -1
  211. package/out/Math.sol/Math.json +1 -1
  212. package/out/MaxBalancePerIdentityModule.sol/MaxBalancePerIdentityModule.json +1 -0
  213. package/out/MessageHashUtils.sol/MessageHashUtils.json +1 -1
  214. package/out/MessageTypesLib.sol/MessageTypesLib.json +1 -0
  215. package/out/MockTREXAccessManagerV2.sol/MockTREXAccessManagerV2.json +1 -0
  216. package/out/MockTokenV2.sol/MockTokenV2.json +1 -0
  217. package/out/Mocks.sol/ClaimTopicsRegistryMock.json +1 -0
  218. package/out/Mocks.sol/ComplianceMock.json +1 -0
  219. package/out/Mocks.sol/IdentityRegistryMock.json +1 -0
  220. package/out/Mocks.sol/IdentityRegistryStorageMock.json +1 -0
  221. package/out/Mocks.sol/TokenMock.json +1 -0
  222. package/out/Mocks.sol/TrustedIssuersRegistryMock.json +1 -0
  223. package/out/ModularCompliance.sol/ModularCompliance.json +1 -1
  224. package/out/ModuleNotPnP.sol/ModuleNotPnP.json +1 -1
  225. package/out/ModuleProxy.sol/ModuleProxy.json +1 -1
  226. package/out/ModuleSetLib.sol/ModuleSetLib.json +1 -0
  227. package/out/MovementKindLib.sol/MovementKindLib.json +1 -0
  228. package/out/Multicall.sol/Multicall.json +1 -0
  229. package/out/MulticallUpgradeable.sol/MulticallUpgradeable.json +1 -1
  230. package/out/Nonces.sol/Nonces.json +1 -1
  231. package/out/NoncesUpgradeable.sol/NoncesUpgradeable.json +1 -1
  232. package/out/Ownable.sol/Ownable.json +1 -1
  233. package/out/OwnableUpgradeable.sol/OwnableUpgradeable.json +1 -1
  234. package/out/P256.sol/P256.json +1 -0
  235. package/out/Packing.sol/Packing.json +1 -0
  236. package/out/Panic.sol/Panic.json +1 -1
  237. package/out/Pausable.sol/Pausable.json +1 -1
  238. package/out/PausableUpgradeable.sol/PausableUpgradeable.json +1 -1
  239. package/out/Proxy.sol/Proxy.json +1 -1
  240. package/out/ReentrancyGuardTransient.sol/ReentrancyGuardTransient.json +1 -0
  241. package/out/ReentrantModule.sol/ReentrantModule.json +1 -0
  242. package/out/ReputationRegistry.sol/ReputationRegistry.json +1 -0
  243. package/out/RolesLib.sol/RolesLib.json +1 -0
  244. package/out/SafeCalldataBatch.sol/SafeCalldataBatch.json +1 -0
  245. package/out/SafeCast.sol/SafeCast.json +1 -1
  246. package/out/SatelliteLiteMock.sol/SatelliteLiteMock.json +1 -0
  247. package/out/Script.sol/Script.json +1 -0
  248. package/out/ShortStrings.sol/ShortStrings.json +1 -1
  249. package/out/SignatureChecker.sol/SignatureChecker.json +1 -0
  250. package/out/SignedMath.sol/SignedMath.json +1 -1
  251. package/out/SlotDerivation.sol/SlotDerivation.json +1 -1
  252. package/out/SmartAccount.sol/SmartAccount.json +1 -0
  253. package/out/SpenderVerificationModule.sol/SpenderVerificationModule.json +1 -0
  254. package/out/SpenderWhitelistModule.sol/SpenderWhitelistModule.json +1 -0
  255. package/out/StdAssertions.sol/StdAssertions.json +1 -1
  256. package/out/StdChains.sol/StdChains.json +1 -1
  257. package/out/StdCheats.sol/StdCheats.json +1 -1
  258. package/out/StdCheats.sol/StdCheatsSafe.json +1 -1
  259. package/out/StdConstants.sol/StdConstants.json +1 -1
  260. package/out/StdError.sol/stdError.json +1 -1
  261. package/out/StdInvariant.sol/StdInvariant.json +1 -1
  262. package/out/StdJson.sol/stdJson.json +1 -1
  263. package/out/StdMath.sol/stdMath.json +1 -1
  264. package/out/StdStorage.sol/stdStorage.json +1 -1
  265. package/out/StdStorage.sol/stdStorageSafe.json +1 -1
  266. package/out/StdStyle.sol/StdStyle.json +1 -1
  267. package/out/StdToml.sol/stdToml.json +1 -1
  268. package/out/StdUtils.sol/StdUtils.json +1 -1
  269. package/out/StorageSlot.sol/StorageSlot.json +1 -1
  270. package/out/Strings.sol/Strings.json +1 -1
  271. package/out/Structs.sol/Structs.json +1 -1
  272. package/out/TREXAccessManager.sol/TREXAccessManager.json +1 -0
  273. package/out/TREXFactory.sol/TREXFactory.json +1 -1
  274. package/out/TREXImplementationAuthority.sol/TREXImplementationAuthority.json +1 -1
  275. package/out/TREXMessaging.sol/TREXMessaging.json +1 -0
  276. package/out/TREXMessagingLib.sol/TREXMessagingLib.json +1 -0
  277. package/out/TREXRegistry.sol/TREXRegistry.json +1 -0
  278. package/out/TestERC20.sol/TestERC20.json +1 -1
  279. package/out/TestModule.sol/TestModule.json +1 -1
  280. package/out/TestTREXFactory.sol/TestTREXFactory.json +1 -1
  281. package/out/Time.sol/Time.json +1 -0
  282. package/out/Token.sol/Token.json +1 -1
  283. package/out/TokenDelegationLib.sol/TokenDelegationLib.json +1 -0
  284. package/out/TokenGuardsLib.sol/TokenGuardsLib.json +1 -0
  285. package/out/TokenHandler.sol/TokenHandler.json +1 -0
  286. package/out/TokenLedgerHarness.sol/TokenLedgerHarness.json +1 -0
  287. package/out/TokenLedgerLib.sol/TokenLedgerLib.json +1 -0
  288. package/out/TokenRecoveryLib.sol/TokenRecoveryLib.json +1 -0
  289. package/out/TokenReservationStub.sol/TokenReservationStub.json +1 -0
  290. package/out/TransferContextLib.sol/TransferContextLib.json +1 -0
  291. package/out/TransferValidation.sol/TransferValidation.json +1 -0
  292. package/out/TransferValidationHarness.sol/TransferValidationHarness.json +1 -0
  293. package/out/TransferValidationLib.sol/TransferValidationLib.json +1 -0
  294. package/out/TransientSlot.sol/TransientSlot.json +1 -0
  295. package/out/TrustedGatewayRegistry.sol/TrustedGatewayRegistry.json +1 -0
  296. package/out/UUPSUpgradeable.sol/UUPSUpgradeable.json +1 -1
  297. package/out/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -0
  298. package/out/UtilityChecker.sol/UtilityChecker.json +1 -1
  299. package/out/UtilityCheckerProxy.sol/UtilityCheckerProxy.json +1 -1
  300. package/out/Utils.sol/Utils.json +1 -1
  301. package/out/VersionLib.sol/VersionLib.json +1 -0
  302. package/out/Vm.sol/Vm.json +1 -1
  303. package/out/Vm.sol/VmSafe.json +1 -1
  304. package/out/WalletKeyLib.sol/WalletKeyLib.json +1 -0
  305. package/out/WebAuthn.sol/WebAuthn.json +1 -0
  306. package/out/console.sol/console.json +1 -1
  307. package/out/draft-AccountERC7579Upgradeable.sol/AccountERC7579Upgradeable.json +1 -0
  308. package/out/draft-ERC7579Utils.sol/ERC7579Utils.json +1 -0
  309. package/out/draft-IERC1822.sol/IERC1822Proxiable.json +1 -1
  310. package/out/draft-IERC6093.sol/IERC1155Errors.json +1 -1
  311. package/out/draft-IERC6093.sol/IERC20Errors.json +1 -1
  312. package/out/draft-IERC6093.sol/IERC721Errors.json +1 -1
  313. package/out/draft-IERC7579.sol/IERC7579AccountConfig.json +1 -0
  314. package/out/draft-IERC7579.sol/IERC7579Execution.json +1 -0
  315. package/out/draft-IERC7579.sol/IERC7579Hook.json +1 -0
  316. package/out/draft-IERC7579.sol/IERC7579Module.json +1 -0
  317. package/out/draft-IERC7579.sol/IERC7579ModuleConfig.json +1 -0
  318. package/out/draft-IERC7579.sol/IERC7579Validator.json +1 -0
  319. package/out/draft-IERC7786.sol/IERC7786GatewaySource.json +1 -0
  320. package/out/draft-IERC7786.sol/IERC7786Recipient.json +1 -0
  321. package/out/draft-InteroperableAddress.sol/InteroperableAddress.json +1 -0
  322. package/out/libraries/Errors.sol/Errors.json +1 -1
  323. package/out/safeconsole.sol/safeconsole.json +1 -1
  324. package/package.json +11 -7
  325. package/contracts/ERC-3643/ERC3643EventsLib.sol +0 -150
  326. package/contracts/factory/ITREXGateway.sol +0 -234
  327. package/contracts/factory/TREXGateway.sol +0 -274
  328. package/contracts/proxy/AbstractProxy.sol +0 -146
  329. package/contracts/proxy/ClaimTopicsRegistryProxy.sol +0 -83
  330. package/contracts/proxy/IdentityRegistryProxy.sol +0 -95
  331. package/contracts/proxy/TokenProxy.sol +0 -97
  332. package/contracts/proxy/authority/IAFactory.sol +0 -122
  333. package/contracts/proxy/authority/IIAFactory.sol +0 -87
  334. package/contracts/proxy/authority/ITREXImplementationAuthority.sol +0 -239
  335. package/contracts/proxy/authority/TREXImplementationAuthority.sol +0 -350
  336. package/contracts/registry/implementation/ClaimTopicsRegistry.sol +0 -152
  337. package/contracts/registry/implementation/IdentityRegistry.sol +0 -352
  338. package/contracts/registry/implementation/TrustedIssuersRegistry.sol +0 -272
  339. package/contracts/registry/interface/IClaimTopicsRegistry.sol +0 -70
  340. package/contracts/registry/interface/IIdentityRegistry.sol +0 -102
  341. package/contracts/registry/interface/ITrustedIssuersRegistry.sol +0 -70
  342. package/contracts/roles/IERC173.sol +0 -21
  343. package/contracts/token/TokenStructs.sol +0 -74
  344. package/contracts/utils/InterfaceIdCalculator.sol +0 -223
  345. package/contracts/vendor/openzeppelin/Create3.sol +0 -143
  346. package/out/AbstractAgentRole.sol/AbstractAgentRole.json +0 -1
  347. package/out/AbstractProxy.sol/AbstractProxy.json +0 -1
  348. package/out/AgentRole.sol/AgentRole.json +0 -1
  349. package/out/AgentRoleUpgradeable.sol/AgentRoleUpgradeable.json +0 -1
  350. package/out/ClaimIssuer.sol/ClaimIssuer.json +0 -1
  351. package/out/ClaimTopicsRegistry.sol/ClaimTopicsRegistry.json +0 -1
  352. package/out/ClaimTopicsRegistryProxy.sol/ClaimTopicsRegistryProxy.json +0 -1
  353. package/out/ERC2771Context.sol/ERC2771Context.json +0 -1
  354. package/out/ERC2771ContextUpgradeable.sol/ERC2771ContextUpgradeable.json +0 -1
  355. package/out/ERC2771Forwarder.sol/ERC2771Forwarder.json +0 -1
  356. package/out/ERC3643EventsLib.sol/ERC3643EventsLib.json +0 -1
  357. package/out/IAFactory.sol/IAFactory.json +0 -1
  358. package/out/IClaimTopicsRegistry.sol/IClaimTopicsRegistry.json +0 -1
  359. package/out/IERC1363.sol/IERC1363.json +0 -1
  360. package/out/IIAFactory.sol/IIAFactory.json +0 -1
  361. package/out/IIdFactory.sol/IIdFactory.json +0 -1
  362. package/out/IIdentityRegistry.sol/IIdentityRegistry.json +0 -1
  363. package/out/IImplementationAuthority.sol/IImplementationAuthority.json +0 -1
  364. package/out/IProxy.sol/IProxy.json +0 -1
  365. package/out/ITREXGateway.sol/ITREXGateway.json +0 -1
  366. package/out/ITrustedIssuersRegistry.sol/ITrustedIssuersRegistry.json +0 -1
  367. package/out/IdFactory.sol/IdFactory.json +0 -1
  368. package/out/IdentityProxy.sol/IdentityProxy.json +0 -1
  369. package/out/IdentityRegistry.sol/IdentityRegistry.json +0 -1
  370. package/out/IdentityRegistryProxy.sol/IdentityRegistryProxy.json +0 -1
  371. package/out/IdentityRegistryStorageProxy.sol/IdentityRegistryStorageProxy.json +0 -1
  372. package/out/ImplementationAuthority.sol/ImplementationAuthority.json +0 -1
  373. package/out/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +0 -1
  374. package/out/ModularComplianceProxy.sol/ModularComplianceProxy.json +0 -1
  375. package/out/Ownable2Step.sol/Ownable2Step.json +0 -1
  376. package/out/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.json +0 -1
  377. package/out/Roles.sol/Roles.json +0 -1
  378. package/out/SafeERC20.sol/SafeERC20.json +0 -1
  379. package/out/Storage.sol/Storage.json +0 -1
  380. package/out/TREXGateway.sol/TREXGateway.json +0 -1
  381. package/out/TestAgentRole.sol/TestAgentRole.json +0 -1
  382. package/out/TestAgentRoleUpgradeable.sol/TestAgentRoleUpgradeable.json +0 -1
  383. package/out/TokenProxy.sol/TokenProxy.json +0 -1
  384. package/out/TrustedIssuersRegistry.sol/TrustedIssuersRegistry.json +0 -1
  385. package/out/TrustedIssuersRegistryProxy.sol/TrustedIssuersRegistryProxy.json +0 -1
  386. package/out/Version.sol/Version.json +0 -1
@@ -37,100 +37,135 @@
37
37
  // :#%%=
38
38
  //
39
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
- */
40
+ // T-REX Smart Contracts
41
+ // The ERC-3643 token suite of the T-REX ecosystem.
42
+ //
43
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
44
+ //
45
+ // This file is part of the T-REX smart contract suite.
46
+ //
47
+ // This program is free software: you can redistribute it and/or modify
48
+ // it under the terms of the GNU General Public License as published by
49
+ // the Free Software Foundation, either version 3 of the License, or
50
+ // (at your option) any later version.
51
+ //
52
+ // This program is distributed in the hope that it will be useful,
53
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
54
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55
+ // GNU General Public License for more details.
56
+ //
57
+ // You should have received a copy of the GNU General Public License
58
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
63
59
 
64
60
  pragma solidity 0.8.30;
65
61
 
62
+ import { MessageTypesLib } from "./MessageTypesLib.sol";
63
+
64
+ /// @dev Errors of the ERC-3643 standard surface are declared canonically in
65
+ /// {ERC3643ErrorsLib}, inside the standard layer, because the standard bases may not import from the
66
+ /// T-REX layer (issue #65). The names below are re-declared here for the T-REX layer and for tests.
67
+ /// Solidity identifies errors by selector, so a re-declaration with the same signature is the same
68
+ /// error on the wire; `forge lint` reporting some of them as unused only means no T-REX-layer contract
69
+ /// raises them any more, not that they are unreachable.
66
70
  library ErrorsLib {
67
71
 
68
72
  // Common Errors
69
73
  error ZeroAddress();
70
74
  error ZeroValue();
71
75
  error ArraySizeLimited(uint256 maxSize);
72
- error InitializationFailed();
76
+ error ArrayLengthMismatch();
73
77
  error InvalidImplementationAuthority();
78
+ /// @dev The ERC-173 `transferOwnership` is refused: the owner is the AccessManager, and it changes only through
79
+ /// `AccessManager.updateAuthority`, which applies the target's admin delay.
80
+ error UseUpdateAuthority();
74
81
 
75
82
  // Token Errors
76
- error AddressNotAgent(address agent);
77
- error AgentNotAuthorized(address agent, string reason);
78
83
  error AmountAboveFrozenTokens(uint256 amount, uint256 maxAmount);
79
84
  error ComplianceNotFollowed();
80
- error DefaultAllowanceOptOutAlreadySet(address user, bool optOut);
81
- error DefaultAllowanceAlreadySet(address spender, bool allowed);
82
85
  error DecimalsOutOfRange(uint256 decimals);
83
86
  error EmptyString();
84
87
  error FrozenWallet(address user);
88
+ error ComplianceAlreadyBoundToToken();
89
+ error TokenCirculating();
90
+ error ValidationsPending();
91
+ error NothingInTransit(uint256 validationId);
92
+ error ValidationNotStuck(uint256 validationId, uint8 status);
93
+ error ValidationNotYetResolvable(uint256 validationId, uint64 resolvableAt);
94
+ error InvalidCompliance();
95
+ error InvalidIdentityRegistry();
85
96
  error NoTokenToRecover();
97
+ error NotLinkedIdentity(address from, address caller);
86
98
  error RecoveryNotPossible();
99
+ error SameWalletRecovery();
100
+ error SpenderNotAllowed(address spender, address from, address to, uint256 value);
87
101
  error UnverifiedIdentity();
102
+ /// @dev Only a wallet on another chain can hold a bridged position; this envelope designates this chain.
103
+ error NotASatelliteWallet(bytes wallet);
104
+ /// @dev Only the bound compliance applies a settlement to the ledger.
105
+ error OnlyBoundCompliance();
106
+ /// @dev The bridged position on the wallet is smaller than the amount to move out of it.
107
+ error InsufficientBridgedBalance(bytes wallet, uint256 balance, uint256 needed);
108
+ /// @dev A delegation-out or a recall moves location, never ownership: the native wallet and the satellite
109
+ /// wallet must resolve to one identity, and that identity must exist.
110
+ error WalletsNotLinked(address nativeWallet, bytes wallet);
111
+ /// @dev The burn proof or the resend names another wallet, or the proof another chain, than the recall.
112
+ error RecallMismatch(uint256 recallId);
113
+ /// @dev The satellite proves it burned more than the recall instructed.
114
+ error RecallAmountExceeded(uint256 recallId, uint256 instructed, uint256 proven);
115
+ /// @dev The wallet already has a recall waiting for its proof; one at a time.
116
+ error RecallPending(bytes32 walletKey, uint256 recallId);
117
+ /// @dev The recall is not waiting for a proof: never issued, or already settled.
118
+ error RecallNotPending(uint256 recallId);
119
+ /// @dev The fields given for a resend are not the ones the delegation committed to.
120
+ error DelegationMismatch(uint256 delegationId);
121
+ /// @dev The chain's peer changed since the instruction went out; a resend never retargets.
122
+ error PeerChanged(bytes32 chainKey);
123
+ /// @dev `resend` knows two kinds: 0, a delegation, and 1, a recall.
124
+ error UnknownResendKind(uint8 kind);
125
+ /// @dev The validation already holds an amount in transit; a burn leg moves it once.
126
+ error TransitAlreadyHeld(uint256 validationId);
127
+ /// @dev The amount settled under the validation is not the one its burn leg put in transit.
128
+ error TransitAmountMismatch(uint256 validationId, uint256 held, uint256 amount);
88
129
 
89
130
  // ModularCompliance Errors
90
131
  error AddressNotATokenBoundToComplianceContract();
91
132
  error ComplianceNotSuitableForBindingToModule(address module);
92
133
  error MaxModulesReached(uint256 maxValue);
93
134
  error ModuleAlreadyBound();
135
+ /// @dev A module names no type at all, so the compliance would never call it.
136
+ error ModuleHasNoType();
137
+ /// @dev A module names the same type twice.
138
+ error DuplicateModuleType(uint8 moduleType);
94
139
  error ModuleNotBound();
95
- error OnlyOwnerOrTokenCanCall();
96
140
  error TokenNotBound();
97
141
 
98
142
  // Module Errors
99
143
  error ComplianceNotBound();
100
144
  error ComplianceAlreadyBound();
145
+ error ModuleStillBound();
101
146
  error OnlyBoundComplianceCanCall();
102
147
  error OnlyComplianceContractCanCall();
103
-
104
- // TREXGateway Errors
105
- error SenderIsNotAdmin();
106
- error PublicDeploymentAlreadyEnabled();
107
- error PublicDeploymentAlreadyDisabled();
108
- error DeploymentFeesAlreadyEnabled();
109
- error DeploymentFeesAlreadyDisabled();
110
- error DeployerAlreadyExists(address deployer);
111
- error DeployerDoesNotExist(address deployer);
112
- error PublicDeploymentsNotAllowed();
113
- error PublicCannotDeployOnBehalf();
114
- error DiscountOutOfRange();
148
+ error SpenderAlreadyAllowed(bytes spender);
149
+ error SpenderNotListed(bytes spender);
115
150
 
116
151
  // TREXFactory Errors
117
- error AddressPredictionMismatch();
152
+ error AuthorityMismatch();
153
+ error StorageAuthorityMismatch(address identityRegistryStorage, address expected, address actual);
154
+ error AccessManagerNotAContract(address accessManager);
155
+ error InvalidAccessManagerAdmin();
118
156
  error InvalidClaimPattern();
119
157
  error InvalidCompliancePattern();
120
158
  error MaxClaimIssuersReached(uint256 max);
121
- error MaxClaimTopicsReached(uint256 max);
122
- error MaxAgentsReached(uint256 max);
123
- error MaxModuleActionsReached(uint256 max);
159
+ /// @dev A supplied ONCHAINID must already be actively bound to the predicted token address in the IdentityFactory.
160
+ error TokenIdentityNotBound(address token, address suppliedIdentity);
161
+ /// @dev Only a MANAGEMENT key of a supplied ONCHAINID may deploy a suite with it.
162
+ error TokenIdentityNotManagedByCaller(address suppliedIdentity, address caller);
124
163
  error TokenAlreadyDeployed();
125
-
126
- // Roles Errors
127
- error AccountAlreadyHasRole();
128
- error AccountDoesNotHaveRole();
129
- error CallerDoesNotHaveAgentRole();
164
+ error IsolatedSuiteCannotReuseIRS();
130
165
 
131
166
  // ClaimTopicsRegistry Errors
132
167
  error ClaimTopicAlreadyExists();
133
- error MaxTopicsReached(uint256 max);
168
+ error InvalidIdentityType();
134
169
 
135
170
  // IdentityRegistry Errors
136
171
  error EligibilityChecksDisabledAlready();
@@ -141,28 +176,100 @@ library ErrorsLib {
141
176
  error AddressNotYetStored();
142
177
  error IdentityRegistryNotStored();
143
178
  error MaxIRByIRSReached(uint256 max);
179
+ /// @dev The registry resolves through another IdentityFactory than the one the storage was initialised with.
180
+ error IdentityFactoryMismatch(address expected, address actual);
181
+ // Same names as the ONCHAINID IdentityFactory errors, but keyed by address.
182
+ /// @dev The wallet is bound to another identity.
183
+ error WalletBoundToAnotherIdentity(address wallet, address boundIdentity);
184
+ /// @dev The wallet is already bound to this identity.
185
+ error WalletAlreadyLinkedToIdentity(address wallet);
186
+ /// @dev The wallet was revoked and can never be bound again.
187
+ error WalletAlreadyRevoked(address wallet);
188
+ /// @dev The wallet is not active.
189
+ error WalletNotActive(address wallet);
190
+
191
+ // AccessManagerSetupLib Errors
192
+ error NotAssigned(address target);
193
+ error SuiteDeployerCannotConfigureFactory();
194
+ error PlatformRoleCannotBePublic();
195
+ /// @dev `target`, a storage, a registry or a compliance, is already set up in `domainId`, so a suite of
196
+ /// another domain cannot use it.
197
+ error SuiteAlreadySetUp(address target, uint32 domainId);
198
+
199
+ // RolesLib Errors
200
+ error InvalidDomain();
201
+
202
+ // TREXAccessManager Errors
203
+ error DomainNotFound(uint32 domainId);
144
204
 
145
205
  // TrustedIssuersRegistry Errors
146
206
  error ClaimTopicsCannotBeEmpty();
147
- error MaxClaimTopcisReached(uint256 max);
207
+ error MaxClaimTopicsReached(uint256 max);
148
208
  error MaxTrustedIssuersReached(uint256 max);
149
209
  error NotATrustedIssuer();
150
210
  error TrustedClaimTopicsCannotBeEmpty();
151
211
  error TrustedIssuerAlreadyExists();
152
- error TrustedIssuerDoesNotExist();
153
212
 
154
213
  // TREXImplementationAuthority Errors
155
- error CallerNotOwnerOfAllImpactedContracts();
156
- error CannotCallOnReferenceContract();
157
- error NewIAIsNotAReferenceContract();
158
- error NonExistingVersion();
159
- error OnlyReferenceContractCanCall();
160
- error VersionAlreadyFetched();
161
- error VersionAlreadyExists();
162
- error VersionAlreadyInUse();
163
- error VersionOfNewIAMustBeTheSameAsCurrentIA();
164
-
165
- // AbstractProxy Errors
166
- error OnlyCurrentImplementationAuthorityCanCall();
214
+ error EmptyImplementations();
215
+ error UnknownVersion();
216
+ error VersionAlreadyPublished();
217
+ error VersionNotNewer();
218
+
219
+ // TREXRegistry Errors
220
+ error Deprecated();
221
+
222
+ // TransferValidation Errors
223
+ /// @dev A `SPENDER` module refused the spender named on the requested validation.
224
+ error ValidationSpenderRefused(bytes spender);
225
+ /// @dev A validity or reconciliation window must be positive.
226
+ error ZeroDuration();
227
+ /// @dev Issuance involving this chain is paused, by the manager or by a late reconciliation.
228
+ error ValidationIssuancePaused(bytes32 chainKey);
229
+ /// @dev Issuance needs a validity window; none was configured.
230
+ error ValidityWindowNotSet();
231
+ /// @dev Issuance toward this chain needs its reconciliation window; none was configured.
232
+ error ReconciliationWindowNotSet(bytes32 chainKey);
233
+ /// @dev The requested range is inverted.
234
+ error InvalidRequestedRange(uint256 requestedMin, uint256 requestedMax);
235
+ /// @dev The balance cap, the modules or the clamp left no amount to authorize.
236
+ error EmptyValidationRange(uint256 min, uint256 max);
237
+ /// @dev The caller is neither the identity `from` is linked to nor authorised by the AccessManager.
238
+ error NotAuthorizedForWallet(address caller, bytes wallet);
239
+ /// @dev `from` has no identity, or `to` is not eligible for new activity.
240
+ error UnverifiedWallet(bytes wallet);
241
+ /// @dev `from` lives on the reference chain: no satellite holds that position, so none can execute it.
242
+ error SenderNotOnSatellite(bytes wallet);
243
+ /// @dev The id was never issued by this compliance.
244
+ error UnknownValidation(uint256 validationId);
245
+ /// @dev Only a stored `Pending` validation can be discarded; `status` is the `ValidationStatus` found instead.
246
+ error ValidationNotDiscardable(uint256 validationId, uint8 status);
247
+ /// @dev The validation's release deadline has not passed yet.
248
+ error ValidationNotReleasable(uint256 validationId, uint64 releaseAt);
249
+ /// @dev Between `releaseAt` and the end of the second window only the keeper may discard; `publicAt` is when
250
+ /// anyone may.
251
+ error ValidationNotPubliclyDiscardable(uint256 validationId, uint64 publicAt);
252
+ /// @dev The leg's wallets, their emptiness, or its origin chain do not match the issued validation.
253
+ error SettlementLegMismatch(uint256 validationId);
254
+ /// @dev The executed amount sits outside the issued `[amountMin, amountMax]`.
255
+ error SettlementOutOfBounds(uint256 validationId, uint256 amount);
256
+ /// @dev The second leg of a cross-chain validation does not repeat the first one's amount.
257
+ error SettlementAmountMismatch(uint256 validationId, uint256 expected, uint256 amount);
258
+ // Interop Errors
259
+ error NonCanonicalInteroperableAddress(bytes envelope);
260
+ error ChainNotOpen(bytes32 chainKey);
261
+ error ChainNotRegistered(bytes32 chainKey);
262
+ error GatewayNotRouted(address gateway, bytes32 chainKey);
263
+ error GatewayNotPinned(address gateway, uint256 validationId, bytes32 chainKey);
264
+ error GatewayNotTrusted(address gateway);
265
+ error InvalidChainReference(bytes2 chainType, bytes chainReference);
266
+ error InvalidPeer(bytes peer);
267
+ error MessageAlreadyReceived(address gateway, bytes32 receiveId);
268
+ error MessageTypeNotInbound(MessageTypesLib.Message messageType);
269
+ error PeerChainMismatch(bytes32 chainKey, bytes32 peerChainKey);
270
+ error SenderNotCompliance(address sender);
271
+ error SenderNotPeer(bytes32 chainKey, bytes sender);
272
+ error UnsupportedMessageVersion(uint8 messageVersion);
273
+ error ValidationAlreadyRouted(uint256 validationId, bytes32 chainKey, address gateway);
167
274
 
168
275
  }
@@ -37,32 +37,33 @@
37
37
  // :#%%=
38
38
  //
39
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
- */
40
+ // T-REX Smart Contracts
41
+ // The ERC-3643 token suite of the T-REX ecosystem.
42
+ //
43
+ // Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
44
+ //
45
+ // This file is part of the T-REX smart contract suite.
46
+ //
47
+ // This program is free software: you can redistribute it and/or modify
48
+ // it under the terms of the GNU General Public License as published by
49
+ // the Free Software Foundation, either version 3 of the License, or
50
+ // (at your option) any later version.
51
+ //
52
+ // This program is distributed in the hope that it will be useful,
53
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
54
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55
+ // GNU General Public License for more details.
56
+ //
57
+ // You should have received a copy of the GNU General Public License
58
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
63
59
  pragma solidity 0.8.30;
64
60
 
65
- import { ITREXImplementationAuthority } from "../proxy/authority/ITREXImplementationAuthority.sol";
61
+ import { IIdentity } from "@onchain-id/solidity/contracts/interface/IIdentity.sol";
62
+
63
+ import { IModule } from "../compliance/modular/modules/IModule.sol";
64
+ import { ITREXImplementationAuthority } from "../proxy/beacon/ITREXImplementationAuthority.sol";
65
+ import { MessageTypesLib } from "./MessageTypesLib.sol";
66
+ import { Version } from "./VersionLib.sol";
66
67
 
67
68
  library EventsLib {
68
69
 
@@ -70,78 +71,179 @@ library EventsLib {
70
71
 
71
72
  event ImplementationAuthoritySet(address implementationAuthority);
72
73
 
73
- // AgentRole / AgentRoleUpgradeable Events
74
-
75
- event AgentAdded(address indexed agent);
76
- event AgentRemoved(address indexed agent);
77
-
78
74
  // Token Events
79
75
 
80
- event AgentRestrictionsSet(
81
- address indexed agent,
82
- bool disableMint,
83
- bool disableBurn,
84
- bool disableAddressFreeze,
85
- bool disableForceTransfer,
86
- bool disablePartialFreeze,
87
- bool disablePause,
88
- bool disableRecovery
76
+ /// @notice Emitted on a delegation-out. Carries the full envelope so indexers need no reverse key table, and the
77
+ /// delegation's id, which the mint instruction and any resend carry. Zero on a transition with no instruction.
78
+ event DelegatedOut(
79
+ address indexed holder, bytes32 indexed toKey, uint256 indexed delegationId, bytes toWallet, uint256 amount
80
+ );
81
+ /// @notice Emitted on a recall from a satellite wallet onto a native wallet.
82
+ event Recalled(bytes32 indexed fromKey, address indexed holder, bytes fromWallet, uint256 amount);
83
+ /// @notice Emitted when an agent orders a satellite to burn up to `amount` of `wallet`; the proof that answers
84
+ /// credits `nativeWallet`.
85
+ event RecallInstructed(
86
+ uint256 indexed recallId, bytes32 indexed walletKey, address indexed nativeWallet, bytes wallet, uint256 amount
87
+ );
88
+ /// @notice Emitted when a burn proof settles its recall. `amount` is what the satellite proved.
89
+ event RecallSettled(uint256 indexed recallId, bytes32 indexed originChainKey, uint256 amount);
90
+ /// @notice Emitted when the proof that already settled a recall is delivered again: nothing is applied.
91
+ event BurnProofDuplicate(uint256 indexed recallId, bytes32 indexed originChainKey);
92
+ /// @notice Emitted when a burn proof answers a recall never issued, or differs from the proof that settled it.
93
+ /// The token pauses itself until an agent unpauses it, as it does on a replayed settlement.
94
+ event ReplayedBurnProof(uint256 indexed recallId, bytes32 indexed originChainKey);
95
+ /// @notice Emitted when an agent resends an instruction unchanged: `kind` 0 a delegation, 1 a recall.
96
+ event InstructionResent(uint8 indexed kind, uint256 indexed id, bytes32 indexed chainKey, bytes32 sendId);
97
+ /// @notice Emitted when the burn leg of a cross-chain validation takes the amount out of the sender's
98
+ /// position and holds it in transit until the mint leg lands.
99
+ /// A validation being issued reserved part of a satellite wallet's bridged balance.
100
+ event ReservedForValidation(bytes32 indexed walletKey, bytes wallet, uint256 amount);
101
+
102
+ /// A reservation against a satellite wallet was given back, because the validation settled, was discarded,
103
+ /// or turned into an in-transit hold.
104
+ event ReleasedFromValidation(bytes32 indexed walletKey, bytes wallet, uint256 amount);
105
+
106
+ /// A held amount went back to the wallet it was burned from.
107
+ event ReturnedInTransit(bytes32 indexed walletKey, uint256 indexed validationId, bytes wallet, uint256 amount);
108
+
109
+ /// The keeper gave up on a pair whose other leg never arrived. `returnedAmount` went back to the wallet it
110
+ /// was burned from, or is zero when it was the mint leg that landed and nothing here could be returned.
111
+ event ValidationResolved(uint256 indexed validationId, uint256 returnedAmount);
112
+
113
+ event HeldInTransit(bytes32 indexed fromKey, uint256 indexed validationId, bytes fromWallet, uint256 amount);
114
+ /// @notice Emitted on a settled movement between two satellite wallets, under the validation it consumed.
115
+ event BridgedTransfer(
116
+ bytes32 indexed fromKey,
117
+ bytes32 indexed toKey,
118
+ uint256 indexed validationId,
119
+ bytes from,
120
+ bytes to,
121
+ uint256 amount
122
+ );
123
+ /// @notice Emitted on a settled movement leaving a satellite wallet for a native one, under the validation it
124
+ /// consumed. Ownership moves between identities, unlike {Recalled}.
125
+ event SettledToNative(
126
+ bytes32 indexed fromKey, address indexed to, uint256 indexed validationId, bytes fromWallet, uint256 amount
89
127
  );
90
- event DefaultAllowanceUpdated(address to, bool allowance, address updater);
91
- event DefaultAllowanceOptOutUpdated(address user, bool optOut);
92
- event TrustedForwarderSet(address indexed trustedForwarder);
93
128
 
94
129
  // ModularCompliance Events
95
130
 
96
- event ModuleInteraction(address indexed target, bytes4 selector);
131
+ event ModuleInteraction(address indexed target, bytes data);
97
132
  event ModuleAdded(address indexed module);
133
+ event ModuleTypesRecorded(address indexed module, IModule.ModuleType[] moduleTypes);
98
134
  event ModuleRemoved(address indexed module);
135
+ event ModuleForceRemoved(address indexed module);
99
136
 
100
137
  // AbstractModule / AbstractModuleUpgradeable Events
101
138
 
102
139
  event ComplianceBound(address indexed compliance);
103
140
  event ComplianceUnbound(address indexed compliance);
104
141
 
142
+ // IdentityRegistry / IdentityRegistryStorage Events
143
+ // ClaimTopicsRegistry Events
144
+
145
+ event ClaimTopicAddedForIdentityType(uint256 indexed identityType, uint256 indexed claimTopic);
146
+ event ClaimTopicRemovedForIdentityType(uint256 indexed identityType, uint256 indexed claimTopic);
147
+
105
148
  // IdentityRegistry Events
106
149
 
107
150
  event EligibilityChecksDisabled();
108
151
  event EligibilityChecksEnabled();
152
+ /// @notice A wallet's binding was revoked, like the IdentityFactory's `AccountRevoked`. The wallet keeps
153
+ /// `identity` but may no longer act, and it can never be bound again. Emitted by the storage and
154
+ /// by the registry in place of the standard `IdentityUnstored` and `IdentityRemoved`, which mean
155
+ /// the wallet left the registry.
156
+ event IdentityRevoked(address indexed investor, IIdentity indexed identity);
157
+
158
+ // Token Events
159
+ event ForcedTransfer(address indexed agent);
160
+ event IdentityTransfer(address indexed identity, address indexed from, address indexed to, uint256 amount);
109
161
 
110
162
  // TREXFactory Events
111
163
 
112
164
  event Deployed(address indexed addr);
113
165
  event IdFactorySet(address idFactory);
114
- event TREXSuiteDeployed(
115
- address indexed token, address ir, address irs, address tir, address ctr, address mc, string salt
116
- );
117
166
 
118
- // TREXGateway Events
167
+ event TREXSuiteDeployed(address indexed token, address registry, address irs, address mc, string salt);
168
+ event IsolatedSuiteDeployed(address indexed token, ITREXImplementationAuthority.SuiteBeacons beacons);
119
169
 
120
- event FactorySet(address indexed factory);
121
- event PublicDeploymentStatusSet(bool indexed publicDeploymentStatus);
122
- event DeploymentFeeSet(uint256 indexed fee, address indexed feeToken, address indexed feeCollector);
123
- event DeploymentFeeEnabled(bool indexed isEnabled);
124
- event DeployerAdded(address indexed deployer);
125
- event DeployerRemoved(address indexed deployer);
126
- event FeeDiscountApplied(address indexed deployer, uint16 discount);
127
- event GatewaySuiteDeploymentProcessed(address indexed requester, address intendedOwner, uint256 feeApplied);
170
+ // TrustedGatewayRegistry Events
128
171
 
129
- // TREXImplementationAuthority Events
172
+ event TrustedGatewaySet(address indexed gateway, bool trusted);
173
+
174
+ // TREXMessaging Events
130
175
 
131
- event TREXVersionAdded(
132
- ITREXImplementationAuthority.Version indexed version, ITREXImplementationAuthority.TREXContracts indexed trex
176
+ /// @notice Emitted by the factory when its registry pointer moves, and by a token once, at deployment.
177
+ event TrustedGatewayRegistrySet(address trustedGatewayRegistry);
178
+ /// @notice Emitted the first time a token learns the ERC-7930 prefix behind a `chainKey`.
179
+ event ChainRegistered(bytes32 indexed chainKey, bytes2 chainType, bytes chainReference);
180
+ event RouteSet(bytes32 indexed chainKey, address indexed gateway);
181
+ event PeerSet(bytes32 indexed chainKey, bytes peer);
182
+ /// @notice Emitted when a validation's leg toward `chainKey` is pinned to the gateway that carried it.
183
+ event ValidationRoutePinned(uint256 indexed validationId, bytes32 indexed chainKey, address gateway);
184
+ event ProtocolMessageSent(MessageTypesLib.Message indexed messageType, bytes32 indexed chainKey, bytes32 sendId);
185
+ event ProtocolMessageReceived(
186
+ MessageTypesLib.Message indexed messageType, bytes32 indexed chainKey, bytes32 receiveId
133
187
  );
134
- event TREXVersionFetched(
135
- ITREXImplementationAuthority.Version indexed version, ITREXImplementationAuthority.TREXContracts indexed trex
188
+ /// @notice Emitted by the token when an attributed burn proof reaches its recall path, before it is judged.
189
+ event BurnProofReceived(
190
+ bytes32 indexed originChainKey, uint256 indexed recallId, bytes burnedWallet, uint256 amount
191
+ );
192
+
193
+ // ModularCompliance Interop Events
194
+
195
+ /// @notice Emitted by the compliance when the token hands it an attributed settlement notification.
196
+ event SettlementNotified(
197
+ bytes32 indexed originChainKey, uint256 indexed validationId, bytes from, bytes to, uint256 amount
136
198
  );
137
- event VersionUpdated(ITREXImplementationAuthority.Version indexed version);
138
- event ImplementationAuthoritySetWithStatus(bool referenceStatus, address trexFactory);
139
- event TREXFactorySet(address indexed trexFactory);
140
- event IAFactorySet(address indexed iaFactory);
141
- event ImplementationAuthorityChanged(address indexed token, address indexed newImplementationAuthority);
142
199
 
143
- // IAFactory Events
200
+ // TransferValidation Events
201
+ event DefaultValidityWindowSet(uint64 duration);
202
+ event ReconciliationWindowSet(bytes32 indexed chainKey, uint64 duration);
203
+ event ValidationIssuancePaused(bytes32 indexed chainKey);
204
+ event ValidationIssuanceUnpaused(bytes32 indexed chainKey);
205
+ /// @notice Emitted on issuance with the full envelopes and the final bounds, so indexers need no reverse table.
206
+ event TransferValidationIssued(
207
+ uint256 indexed validationId,
208
+ bytes from,
209
+ bytes to,
210
+ bytes spender,
211
+ uint256 amountMin,
212
+ uint256 amountMax,
213
+ uint64 expiry,
214
+ uint64 reconciliationWindow
215
+ );
216
+ /// @notice Warning: a reconciliation of `validationId` arrived from `chainKey` after its release deadline.
217
+ /// The settlement is recorded regardless. Issuance for that chain pauses only when the recorded state
218
+ /// breaches a rule; otherwise this warning is the whole record.
219
+ event LateReconciliation(uint256 indexed validationId, bytes32 indexed chainKey);
220
+ /// @notice Emitted when the keeper discards an expired validation and its slots are released.
221
+ event ValidationDiscarded(uint256 indexed validationId);
222
+ /// @notice Emitted when the first of the two legs of a cross-chain validation was consumed, whichever it was:
223
+ /// the validation is pinned and can no longer be discarded.
224
+ event ValidationLegConfirmed(uint256 indexed validationId, bytes32 indexed chainKey, uint256 amount);
225
+
226
+ /// The registry now names another identity for an empty wallet, and the ledger took note. `amount` is what
227
+ /// moved between the two positions, zero: a wallet that holds tokens never changes identity in the ledger.
228
+ event WalletOwnerChanged(
229
+ address indexed wallet, address indexed previousIdentity, address indexed identity, uint256 amount
230
+ );
231
+
232
+ /// @notice Emitted when every expected leg of a validation was received: slots committed, ledger updated.
233
+ /// `chainKey` is the chain of the leg that completed it.
234
+ event ValidationSettled(uint256 indexed validationId, bytes32 indexed chainKey, uint256 amount);
235
+ /// @notice Emergency: a trusted gateway delivered a leg already consumed, or an id never issued. Nothing is
236
+ /// applied and the token pauses itself until an agent unpauses it.
237
+ event ReplayedSettlement(uint256 indexed validationId, bytes32 indexed chainKey);
238
+ // TREXAccessManager Events
239
+
240
+ event DomainCreated(uint32 indexed domainId, string name);
241
+ event DomainAssigned(uint32 indexed domainId, address indexed target);
242
+
243
+ // TREXImplementationAuthority Events
144
244
 
145
- event ImplementationAuthorityDeployed(address indexed ia);
245
+ event BeaconsDeployed(ITREXImplementationAuthority.SuiteBeacons beacons);
246
+ event VersionPublished(Version version, ITREXImplementationAuthority.SuiteImplementations implementations);
247
+ event SuiteUpgraded(Version version, ITREXImplementationAuthority.SuiteImplementations implementations);
146
248
 
147
249
  }