@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.
- package/NOTICE.md +78 -0
- package/README.md +19 -22
- package/contracts/{roles/AgentRole.sol → ERC-3643/ERC3643ErrorsLib.sol} +60 -33
- package/contracts/ERC-3643/IERC3643.sol +61 -5
- package/contracts/ERC-3643/IERC3643ClaimTopicsRegistry.sol +11 -2
- package/contracts/ERC-3643/IERC3643Compliance.sol +21 -8
- package/contracts/ERC-3643/IERC3643IdentityRegistry.sol +33 -0
- package/contracts/ERC-3643/IERC3643IdentityRegistryStorage.sol +62 -7
- package/contracts/ERC-3643/IERC3643TrustedIssuersRegistry.sol +29 -12
- package/contracts/ERC-3643/base/ERC3643ClaimTopicsRegistry.sol +140 -0
- package/contracts/ERC-3643/base/ERC3643Compliance.sol +223 -0
- package/contracts/ERC-3643/base/ERC3643IdentityRegistry.sol +382 -0
- package/contracts/ERC-3643/base/ERC3643IdentityRegistryStorage.sol +290 -0
- package/contracts/ERC-3643/base/ERC3643Token.sol +601 -0
- package/contracts/ERC-3643/base/ERC3643TrustedIssuersRegistry.sol +237 -0
- package/contracts/compliance/modular/ComplianceLedger.sol +175 -0
- package/contracts/compliance/modular/ComplianceLedgerLib.sol +120 -0
- package/contracts/compliance/modular/IComplianceLedger.sol +104 -0
- package/contracts/compliance/modular/IModularCompliance.sol +119 -28
- package/contracts/compliance/modular/ITransferValidation.sol +308 -0
- package/contracts/compliance/modular/ModularCompliance.sol +399 -240
- package/contracts/compliance/modular/ModuleSetLib.sol +182 -0
- package/contracts/compliance/modular/MovementKindLib.sol +97 -0
- package/contracts/compliance/modular/TransferContextLib.sol +140 -0
- package/contracts/compliance/modular/TransferValidation.sol +822 -0
- package/contracts/compliance/modular/TransferValidationLib.sol +183 -0
- package/contracts/compliance/modular/modules/AbstractModuleUpgradeable.sol +87 -56
- package/contracts/compliance/modular/modules/IModule.sol +142 -58
- package/contracts/compliance/modular/modules/MaxBalancePerIdentityModule.sol +175 -0
- package/contracts/compliance/modular/modules/ModuleProxy.sol +24 -24
- package/contracts/compliance/modular/modules/SpenderVerificationModule.sol +149 -0
- package/contracts/compliance/modular/modules/SpenderWhitelistModule.sol +215 -0
- package/contracts/factory/ITREXFactory.sol +94 -44
- package/contracts/factory/TREXFactory.sol +408 -201
- package/contracts/interop/ISettlementHandler.sol +101 -0
- package/contracts/interop/ITREXMessaging.sol +166 -0
- package/contracts/{proxy/ModularComplianceProxy.sol → interop/ITrustedGatewayRegistry.sol} +48 -43
- package/contracts/interop/TREXMessaging.sol +189 -0
- package/contracts/interop/TREXMessagingLib.sol +425 -0
- package/contracts/{proxy/TrustedIssuersRegistryProxy.sol → interop/TrustedGatewayRegistry.sol} +46 -37
- package/contracts/libraries/AccessManagerSetupLib.sol +484 -0
- package/contracts/libraries/ErrorsLib.sol +172 -65
- package/contracts/libraries/EventsLib.sol +168 -66
- package/contracts/libraries/MessageTypesLib.sol +259 -0
- package/contracts/libraries/RolesLib.sol +146 -0
- package/contracts/{roles/Roles.sol → libraries/VersionLib.sol} +46 -49
- package/contracts/libraries/WalletKeyLib.sol +156 -0
- package/contracts/proxy/beacon/ITREXImplementationAuthority.sol +157 -0
- package/contracts/proxy/beacon/TREXImplementationAuthority.sol +188 -0
- package/contracts/registry/implementation/IdentityRegistryStorage.sol +215 -163
- package/contracts/registry/implementation/TREXRegistry.sol +475 -0
- package/contracts/registry/interface/IIdentityRegistryStorage.sol +30 -25
- package/contracts/registry/interface/ITREXRegistry.sol +180 -0
- package/contracts/token/IToken.sol +210 -49
- package/contracts/token/Token.sol +411 -476
- package/contracts/token/TokenDelegationLib.sol +339 -0
- package/contracts/token/TokenGuardsLib.sol +123 -0
- package/contracts/token/TokenLedgerLib.sol +316 -0
- package/contracts/token/TokenRecoveryLib.sol +130 -0
- package/contracts/{roles/AgentRoleUpgradeable.sol → utils/AccessManagedOwnable.sol} +31 -31
- package/contracts/{proxy/IdentityRegistryStorageProxy.sol → utils/AccessManagedOwnableBase.sol} +56 -34
- package/contracts/utils/AccessManagedOwnableUpgradeable.sol +116 -0
- package/contracts/utils/IUtilityChecker.sol +32 -26
- package/contracts/{roles/AbstractAgentRole.sol → utils/TREXAccessManager.sol} +54 -57
- package/contracts/utils/UtilityChecker.sol +175 -52
- package/contracts/utils/UtilityCheckerProxy.sol +24 -24
- package/contracts/{proxy/interface/IProxy.sol → vendor/IERC173.sol} +15 -28
- package/out/AbstractModuleUpgradeable.sol/AbstractModuleUpgradeable.json +1 -1
- package/out/AbstractSigner.sol/AbstractSigner.json +1 -0
- package/out/AccessManaged.sol/AccessManaged.json +1 -0
- package/out/AccessManagedOwnable.sol/AccessManagedOwnable.json +1 -0
- package/out/AccessManagedOwnableBase.sol/AccessManagedOwnableBase.json +1 -0
- package/out/AccessManagedOwnableUpgradeable.sol/AccessManagedOwnableUpgradeable.json +1 -0
- package/out/AccessManagedUpgradeable.sol/AccessManagedUpgradeable.json +1 -0
- package/out/AccessManager.sol/AccessManager.json +1 -0
- package/out/AccessManagerHelper.sol/AccessManagerHelper.json +1 -0
- package/out/AccessManagerSetupLib.sol/AccessManagerSetupLib.json +1 -0
- package/out/AccessManagerUpgradeable.sol/AccessManagerUpgradeable.json +1 -0
- package/out/Account.sol/Account.json +1 -0
- package/out/Address.sol/Address.json +1 -1
- package/out/Arrays.sol/Arrays.json +1 -1
- package/out/AuthorityUtils.sol/AuthorityUtils.json +1 -0
- package/out/Base.sol/CommonBase.json +1 -1
- package/out/Base.sol/ScriptBase.json +1 -1
- package/out/Base.sol/TestBase.json +1 -1
- package/out/Base64.sol/Base64.json +1 -0
- package/out/BeaconProxy.sol/BeaconProxy.json +1 -0
- package/out/BeaconProxyDeployer.sol/BeaconProxyDeployer.json +1 -0
- package/out/Bytes.sol/Bytes.json +1 -1
- package/out/Calldata.sol/Calldata.json +1 -0
- package/out/CapabilityModules.sol/AllTypesModule.json +1 -0
- package/out/CapabilityModules.sol/CappedRecipientModule.json +1 -0
- package/out/CapabilityModules.sol/DelegatedCapRuleModule.json +1 -0
- package/out/CapabilityModules.sol/DuplicateTypeModule.json +1 -0
- package/out/CapabilityModules.sol/LockedSenderModule.json +1 -0
- package/out/CapabilityModules.sol/NoTypeModule.json +1 -0
- package/out/CapabilityModules.sol/RecordingModule.json +1 -0
- package/out/CapabilityModules.sol/RuleAndMintTrackerModule.json +1 -0
- package/out/CapabilityModules.sol/RuleAndTrackerModule.json +1 -0
- package/out/CapabilityModules.sol/RuleOnlyModule.json +1 -0
- package/out/CapabilityModules.sol/SpenderOnlyModule.json +1 -0
- package/out/CapabilityModules.sol/TrackerOnlyModule.json +1 -0
- package/out/CapabilityModules.sol/UndeclaredRuleModule.json +1 -0
- package/out/CapabilityModules.sol/WritingRuleModule.json +1 -0
- package/out/ClaimIssuerAlwaysReverts.sol/ClaimIssuerAlwaysReverts.json +1 -0
- package/out/ClaimIssuerTrick.sol/ClaimIssuerTrick.json +1 -1
- package/out/Comparators.sol/Comparators.json +1 -1
- package/out/ComplianceLedger.sol/ComplianceLedger.json +1 -0
- package/out/ComplianceLedgerLib.sol/ComplianceLedgerLib.json +1 -0
- package/out/Context.sol/Context.json +1 -1
- package/out/ContextUpgradeable.sol/ContextUpgradeable.json +1 -1
- package/out/Countries.sol/Countries.json +1 -1
- package/out/Create2.sol/Create2.json +1 -1
- package/out/Create3.sol/Create3.json +1 -1
- package/out/DeployComplianceModules.s.sol/DeployComplianceModules.json +1 -0
- package/out/DeployComplianceModules.s.sol/ITokenCompliance.json +1 -0
- package/out/DeployUtilityChecker.s.sol/DeployUtilityChecker.json +1 -0
- package/out/ECDSA.sol/ECDSA.json +1 -1
- package/out/EIP712.sol/EIP712.json +1 -1
- package/out/EIP712Upgradeable.sol/EIP712Upgradeable.json +1 -1
- package/out/ERC165.sol/ERC165.json +1 -0
- package/out/ERC165Checker.sol/ERC165Checker.json +1 -0
- package/out/ERC165Upgradeable.sol/ERC165Upgradeable.json +1 -0
- package/out/ERC1967Proxy.sol/ERC1967Proxy.json +1 -1
- package/out/ERC1967Utils.sol/ERC1967Utils.json +1 -1
- package/out/ERC20.sol/ERC20.json +1 -1
- package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -1
- package/out/ERC20PermitUpgradeable.sol/ERC20PermitUpgradeable.json +1 -1
- package/out/ERC20Upgradeable.sol/ERC20Upgradeable.json +1 -1
- package/out/ERC3643ClaimTopicsRegistry.sol/ERC3643ClaimTopicsRegistry.json +1 -0
- package/out/ERC3643Compliance.sol/ERC3643Compliance.json +1 -0
- package/out/ERC3643ErrorsLib.sol/ERC3643ErrorsLib.json +1 -0
- package/out/ERC3643IdentityRegistry.sol/ERC3643IdentityRegistry.json +1 -0
- package/out/ERC3643IdentityRegistryStorage.sol/ERC3643IdentityRegistryStorage.json +1 -0
- package/out/ERC3643Token.sol/ERC3643Token.json +1 -0
- package/out/ERC3643TrustedIssuersRegistry.sol/ERC3643TrustedIssuersRegistry.json +1 -0
- package/out/ERC4337Utils.sol/ERC4337Utils.json +1 -0
- package/out/ERC4337Utils.sol/IEntryPointExtra.json +1 -0
- package/out/ERC734Validator.sol/ERC734Validator.json +1 -0
- package/out/ERC7579Validator.sol/ERC7579Validator.json +1 -0
- package/out/ERC7786GatewayMock.sol/ERC7786GatewayMock.json +1 -0
- package/out/ERC7786Recipient.sol/ERC7786Recipient.json +1 -0
- package/out/ERC7913WebAuthnVerifier.sol/ERC7913WebAuthnVerifier.json +1 -0
- package/out/EnumerableSet.sol/EnumerableSet.json +1 -1
- package/out/Errors.sol/Errors.json +1 -1
- package/out/ErrorsLib.sol/ErrorsLib.json +1 -1
- package/out/EventsLib.sol/EventsLib.json +1 -1
- package/out/Hashes.sol/Hashes.json +1 -0
- package/out/HostileModules.sol/RevertEverywhereModule.json +1 -0
- package/out/HostileModules.sol/UnbindRevertingModule.json +1 -0
- package/out/IAccessManaged.sol/IAccessManaged.json +1 -0
- package/out/IAccessManager.sol/IAccessManager.json +1 -0
- package/out/IAuthority.sol/IAuthority.json +1 -0
- package/out/IBeacon.sol/IBeacon.json +1 -1
- package/out/IClaimIssuer.sol/IClaimIssuer.json +1 -1
- package/out/IComplianceLedger.sol/IComplianceLedger.json +1 -0
- package/out/IERC1271.sol/IERC1271.json +1 -0
- package/out/IERC165.sol/IERC165.json +1 -1
- package/out/IERC173.sol/IERC173.json +1 -1
- package/out/IERC1967.sol/IERC1967.json +1 -1
- package/out/IERC20.sol/IERC20.json +1 -1
- package/out/IERC20Metadata.sol/IERC20Metadata.json +1 -1
- package/out/IERC20Permit.sol/IERC20Permit.json +1 -1
- package/out/IERC3643.sol/IERC3643.json +1 -1
- package/out/IERC3643ClaimTopicsRegistry.sol/IERC3643ClaimTopicsRegistry.json +1 -1
- package/out/IERC3643Compliance.sol/IERC3643Compliance.json +1 -1
- package/out/IERC3643IdentityRegistry.sol/IERC3643IdentityRegistry.json +1 -1
- package/out/IERC3643IdentityRegistryStorage.sol/IERC3643IdentityRegistryStorage.json +1 -1
- package/out/IERC3643TrustedIssuersRegistry.sol/IERC3643TrustedIssuersRegistry.json +1 -1
- package/out/IERC4337.sol/IAccount.json +1 -0
- package/out/IERC4337.sol/IAccountExecute.json +1 -0
- package/out/IERC4337.sol/IAggregator.json +1 -0
- package/out/IERC4337.sol/IEntryPoint.json +1 -0
- package/out/IERC4337.sol/IEntryPointNonces.json +1 -0
- package/out/IERC4337.sol/IEntryPointStake.json +1 -0
- package/out/IERC4337.sol/IPaymaster.json +1 -0
- package/out/IERC5267.sol/IERC5267.json +1 -1
- package/out/IERC734.sol/IERC734.json +1 -1
- package/out/IERC735.sol/IERC735.json +1 -1
- package/out/IERC7913.sol/IERC7913SignatureVerifier.json +1 -0
- package/out/IIdentity.sol/IIdentity.json +1 -1
- package/out/IIdentityFactory.sol/IIdentityFactory.json +1 -0
- package/out/IIdentityRegistryStorage.sol/IIdentityRegistryStorage.json +1 -1
- package/out/IKeyExecutor.sol/IKeyExecutor.json +1 -0
- package/out/IModularCompliance.sol/IModularCompliance.json +1 -1
- package/out/IModule.sol/IModule.json +1 -1
- package/out/IMulticall3.sol/IMulticall3.json +1 -1
- package/out/IReputationRegistry.sol/IReputationRegistry.json +1 -0
- package/out/ISettlementHandler.sol/ISettlementHandler.json +1 -0
- package/out/ITREXFactory.sol/ITREXFactory.json +1 -1
- package/out/ITREXImplementationAuthority.sol/ITREXImplementationAuthority.json +1 -1
- package/out/ITREXMessaging.sol/ITREXMessaging.json +1 -0
- package/out/ITREXRegistry.sol/ITREXRegistry.json +1 -0
- package/out/IToken.sol/IToken.json +1 -1
- package/out/ITransferValidation.sol/ITransferValidation.json +1 -0
- package/out/ITrustedGatewayRegistry.sol/ITrustedGatewayRegistry.json +1 -0
- package/out/IUtilityChecker.sol/IUtilityChecker.json +1 -1
- package/out/Identity.sol/Identity.json +1 -1
- package/out/IdentityFactory.sol/IdentityFactory.json +1 -0
- package/out/IdentityModulesHelper.sol/IdentityModulesHelper.json +1 -0
- package/out/IdentityRegistryStorage.sol/IdentityRegistryStorage.json +1 -1
- package/out/IdentityTypes.sol/IdentityTypes.json +1 -0
- package/out/Initializable.sol/Initializable.json +1 -1
- package/out/InteropSuiteTest.sol/InteropSuiteTest.json +1 -0
- package/out/KeyApprovalModule.sol/IIdentityAccount.json +1 -0
- package/out/KeyApprovalModule.sol/KeyApprovalModule.json +1 -0
- package/out/KeyManager.sol/KeyManager.json +1 -0
- package/out/KeyPurposes.sol/KeyPurposes.json +1 -1
- package/out/KeyTypes.sol/KeyTypes.json +1 -1
- package/out/LowLevelCall.sol/LowLevelCall.json +1 -1
- package/out/Math.sol/Math.json +1 -1
- package/out/MaxBalancePerIdentityModule.sol/MaxBalancePerIdentityModule.json +1 -0
- package/out/MessageHashUtils.sol/MessageHashUtils.json +1 -1
- package/out/MessageTypesLib.sol/MessageTypesLib.json +1 -0
- package/out/MockTREXAccessManagerV2.sol/MockTREXAccessManagerV2.json +1 -0
- package/out/MockTokenV2.sol/MockTokenV2.json +1 -0
- package/out/Mocks.sol/ClaimTopicsRegistryMock.json +1 -0
- package/out/Mocks.sol/ComplianceMock.json +1 -0
- package/out/Mocks.sol/IdentityRegistryMock.json +1 -0
- package/out/Mocks.sol/IdentityRegistryStorageMock.json +1 -0
- package/out/Mocks.sol/TokenMock.json +1 -0
- package/out/Mocks.sol/TrustedIssuersRegistryMock.json +1 -0
- package/out/ModularCompliance.sol/ModularCompliance.json +1 -1
- package/out/ModuleNotPnP.sol/ModuleNotPnP.json +1 -1
- package/out/ModuleProxy.sol/ModuleProxy.json +1 -1
- package/out/ModuleSetLib.sol/ModuleSetLib.json +1 -0
- package/out/MovementKindLib.sol/MovementKindLib.json +1 -0
- package/out/Multicall.sol/Multicall.json +1 -0
- package/out/MulticallUpgradeable.sol/MulticallUpgradeable.json +1 -1
- package/out/Nonces.sol/Nonces.json +1 -1
- package/out/NoncesUpgradeable.sol/NoncesUpgradeable.json +1 -1
- package/out/Ownable.sol/Ownable.json +1 -1
- package/out/OwnableUpgradeable.sol/OwnableUpgradeable.json +1 -1
- package/out/P256.sol/P256.json +1 -0
- package/out/Packing.sol/Packing.json +1 -0
- package/out/Panic.sol/Panic.json +1 -1
- package/out/Pausable.sol/Pausable.json +1 -1
- package/out/PausableUpgradeable.sol/PausableUpgradeable.json +1 -1
- package/out/Proxy.sol/Proxy.json +1 -1
- package/out/ReentrancyGuardTransient.sol/ReentrancyGuardTransient.json +1 -0
- package/out/ReentrantModule.sol/ReentrantModule.json +1 -0
- package/out/ReputationRegistry.sol/ReputationRegistry.json +1 -0
- package/out/RolesLib.sol/RolesLib.json +1 -0
- package/out/SafeCalldataBatch.sol/SafeCalldataBatch.json +1 -0
- package/out/SafeCast.sol/SafeCast.json +1 -1
- package/out/SatelliteLiteMock.sol/SatelliteLiteMock.json +1 -0
- package/out/Script.sol/Script.json +1 -0
- package/out/ShortStrings.sol/ShortStrings.json +1 -1
- package/out/SignatureChecker.sol/SignatureChecker.json +1 -0
- package/out/SignedMath.sol/SignedMath.json +1 -1
- package/out/SlotDerivation.sol/SlotDerivation.json +1 -1
- package/out/SmartAccount.sol/SmartAccount.json +1 -0
- package/out/SpenderVerificationModule.sol/SpenderVerificationModule.json +1 -0
- package/out/SpenderWhitelistModule.sol/SpenderWhitelistModule.json +1 -0
- package/out/StdAssertions.sol/StdAssertions.json +1 -1
- package/out/StdChains.sol/StdChains.json +1 -1
- package/out/StdCheats.sol/StdCheats.json +1 -1
- package/out/StdCheats.sol/StdCheatsSafe.json +1 -1
- package/out/StdConstants.sol/StdConstants.json +1 -1
- package/out/StdError.sol/stdError.json +1 -1
- package/out/StdInvariant.sol/StdInvariant.json +1 -1
- package/out/StdJson.sol/stdJson.json +1 -1
- package/out/StdMath.sol/stdMath.json +1 -1
- package/out/StdStorage.sol/stdStorage.json +1 -1
- package/out/StdStorage.sol/stdStorageSafe.json +1 -1
- package/out/StdStyle.sol/StdStyle.json +1 -1
- package/out/StdToml.sol/stdToml.json +1 -1
- package/out/StdUtils.sol/StdUtils.json +1 -1
- package/out/StorageSlot.sol/StorageSlot.json +1 -1
- package/out/Strings.sol/Strings.json +1 -1
- package/out/Structs.sol/Structs.json +1 -1
- package/out/TREXAccessManager.sol/TREXAccessManager.json +1 -0
- package/out/TREXFactory.sol/TREXFactory.json +1 -1
- package/out/TREXImplementationAuthority.sol/TREXImplementationAuthority.json +1 -1
- package/out/TREXMessaging.sol/TREXMessaging.json +1 -0
- package/out/TREXMessagingLib.sol/TREXMessagingLib.json +1 -0
- package/out/TREXRegistry.sol/TREXRegistry.json +1 -0
- package/out/TestERC20.sol/TestERC20.json +1 -1
- package/out/TestModule.sol/TestModule.json +1 -1
- package/out/TestTREXFactory.sol/TestTREXFactory.json +1 -1
- package/out/Time.sol/Time.json +1 -0
- package/out/Token.sol/Token.json +1 -1
- package/out/TokenDelegationLib.sol/TokenDelegationLib.json +1 -0
- package/out/TokenGuardsLib.sol/TokenGuardsLib.json +1 -0
- package/out/TokenHandler.sol/TokenHandler.json +1 -0
- package/out/TokenLedgerHarness.sol/TokenLedgerHarness.json +1 -0
- package/out/TokenLedgerLib.sol/TokenLedgerLib.json +1 -0
- package/out/TokenRecoveryLib.sol/TokenRecoveryLib.json +1 -0
- package/out/TokenReservationStub.sol/TokenReservationStub.json +1 -0
- package/out/TransferContextLib.sol/TransferContextLib.json +1 -0
- package/out/TransferValidation.sol/TransferValidation.json +1 -0
- package/out/TransferValidationHarness.sol/TransferValidationHarness.json +1 -0
- package/out/TransferValidationLib.sol/TransferValidationLib.json +1 -0
- package/out/TransientSlot.sol/TransientSlot.json +1 -0
- package/out/TrustedGatewayRegistry.sol/TrustedGatewayRegistry.json +1 -0
- package/out/UUPSUpgradeable.sol/UUPSUpgradeable.json +1 -1
- package/out/UpgradeableBeacon.sol/UpgradeableBeacon.json +1 -0
- package/out/UtilityChecker.sol/UtilityChecker.json +1 -1
- package/out/UtilityCheckerProxy.sol/UtilityCheckerProxy.json +1 -1
- package/out/Utils.sol/Utils.json +1 -1
- package/out/VersionLib.sol/VersionLib.json +1 -0
- package/out/Vm.sol/Vm.json +1 -1
- package/out/Vm.sol/VmSafe.json +1 -1
- package/out/WalletKeyLib.sol/WalletKeyLib.json +1 -0
- package/out/WebAuthn.sol/WebAuthn.json +1 -0
- package/out/console.sol/console.json +1 -1
- package/out/draft-AccountERC7579Upgradeable.sol/AccountERC7579Upgradeable.json +1 -0
- package/out/draft-ERC7579Utils.sol/ERC7579Utils.json +1 -0
- package/out/draft-IERC1822.sol/IERC1822Proxiable.json +1 -1
- package/out/draft-IERC6093.sol/IERC1155Errors.json +1 -1
- package/out/draft-IERC6093.sol/IERC20Errors.json +1 -1
- package/out/draft-IERC6093.sol/IERC721Errors.json +1 -1
- package/out/draft-IERC7579.sol/IERC7579AccountConfig.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Execution.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Hook.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Module.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579ModuleConfig.json +1 -0
- package/out/draft-IERC7579.sol/IERC7579Validator.json +1 -0
- package/out/draft-IERC7786.sol/IERC7786GatewaySource.json +1 -0
- package/out/draft-IERC7786.sol/IERC7786Recipient.json +1 -0
- package/out/draft-InteroperableAddress.sol/InteroperableAddress.json +1 -0
- package/out/libraries/Errors.sol/Errors.json +1 -1
- package/out/safeconsole.sol/safeconsole.json +1 -1
- package/package.json +11 -7
- package/contracts/ERC-3643/ERC3643EventsLib.sol +0 -150
- package/contracts/factory/ITREXGateway.sol +0 -234
- package/contracts/factory/TREXGateway.sol +0 -274
- package/contracts/proxy/AbstractProxy.sol +0 -146
- package/contracts/proxy/ClaimTopicsRegistryProxy.sol +0 -83
- package/contracts/proxy/IdentityRegistryProxy.sol +0 -95
- package/contracts/proxy/TokenProxy.sol +0 -97
- package/contracts/proxy/authority/IAFactory.sol +0 -122
- package/contracts/proxy/authority/IIAFactory.sol +0 -87
- package/contracts/proxy/authority/ITREXImplementationAuthority.sol +0 -239
- package/contracts/proxy/authority/TREXImplementationAuthority.sol +0 -350
- package/contracts/registry/implementation/ClaimTopicsRegistry.sol +0 -152
- package/contracts/registry/implementation/IdentityRegistry.sol +0 -352
- package/contracts/registry/implementation/TrustedIssuersRegistry.sol +0 -272
- package/contracts/registry/interface/IClaimTopicsRegistry.sol +0 -70
- package/contracts/registry/interface/IIdentityRegistry.sol +0 -102
- package/contracts/registry/interface/ITrustedIssuersRegistry.sol +0 -70
- package/contracts/roles/IERC173.sol +0 -21
- package/contracts/token/TokenStructs.sol +0 -74
- package/contracts/utils/InterfaceIdCalculator.sol +0 -223
- package/contracts/vendor/openzeppelin/Create3.sol +0 -143
- package/out/AbstractAgentRole.sol/AbstractAgentRole.json +0 -1
- package/out/AbstractProxy.sol/AbstractProxy.json +0 -1
- package/out/AgentRole.sol/AgentRole.json +0 -1
- package/out/AgentRoleUpgradeable.sol/AgentRoleUpgradeable.json +0 -1
- package/out/ClaimIssuer.sol/ClaimIssuer.json +0 -1
- package/out/ClaimTopicsRegistry.sol/ClaimTopicsRegistry.json +0 -1
- package/out/ClaimTopicsRegistryProxy.sol/ClaimTopicsRegistryProxy.json +0 -1
- package/out/ERC2771Context.sol/ERC2771Context.json +0 -1
- package/out/ERC2771ContextUpgradeable.sol/ERC2771ContextUpgradeable.json +0 -1
- package/out/ERC2771Forwarder.sol/ERC2771Forwarder.json +0 -1
- package/out/ERC3643EventsLib.sol/ERC3643EventsLib.json +0 -1
- package/out/IAFactory.sol/IAFactory.json +0 -1
- package/out/IClaimTopicsRegistry.sol/IClaimTopicsRegistry.json +0 -1
- package/out/IERC1363.sol/IERC1363.json +0 -1
- package/out/IIAFactory.sol/IIAFactory.json +0 -1
- package/out/IIdFactory.sol/IIdFactory.json +0 -1
- package/out/IIdentityRegistry.sol/IIdentityRegistry.json +0 -1
- package/out/IImplementationAuthority.sol/IImplementationAuthority.json +0 -1
- package/out/IProxy.sol/IProxy.json +0 -1
- package/out/ITREXGateway.sol/ITREXGateway.json +0 -1
- package/out/ITrustedIssuersRegistry.sol/ITrustedIssuersRegistry.json +0 -1
- package/out/IdFactory.sol/IdFactory.json +0 -1
- package/out/IdentityProxy.sol/IdentityProxy.json +0 -1
- package/out/IdentityRegistry.sol/IdentityRegistry.json +0 -1
- package/out/IdentityRegistryProxy.sol/IdentityRegistryProxy.json +0 -1
- package/out/IdentityRegistryStorageProxy.sol/IdentityRegistryStorageProxy.json +0 -1
- package/out/ImplementationAuthority.sol/ImplementationAuthority.json +0 -1
- package/out/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +0 -1
- package/out/ModularComplianceProxy.sol/ModularComplianceProxy.json +0 -1
- package/out/Ownable2Step.sol/Ownable2Step.json +0 -1
- package/out/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.json +0 -1
- package/out/Roles.sol/Roles.json +0 -1
- package/out/SafeERC20.sol/SafeERC20.json +0 -1
- package/out/Storage.sol/Storage.json +0 -1
- package/out/TREXGateway.sol/TREXGateway.json +0 -1
- package/out/TestAgentRole.sol/TestAgentRole.json +0 -1
- package/out/TestAgentRoleUpgradeable.sol/TestAgentRoleUpgradeable.json +0 -1
- package/out/TokenProxy.sol/TokenProxy.json +0 -1
- package/out/TrustedIssuersRegistry.sol/TrustedIssuersRegistry.json +0 -1
- package/out/TrustedIssuersRegistryProxy.sol/TrustedIssuersRegistryProxy.json +0 -1
- package/out/Version.sol/Version.json +0 -1
|
@@ -36,11 +36,40 @@
|
|
|
36
36
|
// +@@@@%-
|
|
37
37
|
// :#%%=
|
|
38
38
|
//
|
|
39
|
+
|
|
39
40
|
pragma solidity 0.8.30;
|
|
40
41
|
import { IIdentity } from "@onchain-id/solidity/contracts/interface/IIdentity.sol";
|
|
41
42
|
|
|
42
43
|
interface IERC3643IdentityRegistryStorage {
|
|
43
44
|
|
|
45
|
+
/// @dev Emitted when an identity is registered into the storage contract.
|
|
46
|
+
/// @param _investorAddress The address of the investor's wallet.
|
|
47
|
+
/// @param _identity The address of the investor's ONCHAINID.
|
|
48
|
+
event IdentityStored(address indexed _investorAddress, IIdentity indexed _identity);
|
|
49
|
+
|
|
50
|
+
/// @dev Emitted when an identity is removed from the storage contract.
|
|
51
|
+
/// @param _investorAddress The address of the investor's wallet.
|
|
52
|
+
/// @param _identity The address of the investor's ONCHAINID.
|
|
53
|
+
event IdentityUnstored(address indexed _investorAddress, IIdentity indexed _identity);
|
|
54
|
+
|
|
55
|
+
/// @dev Emitted when an identity contract is replaced in the storage contract.
|
|
56
|
+
/// @param _oldIdentity The old ONCHAINID address.
|
|
57
|
+
/// @param _newIdentity The new ONCHAINID address.
|
|
58
|
+
event IdentityModified(IIdentity indexed _oldIdentity, IIdentity indexed _newIdentity);
|
|
59
|
+
|
|
60
|
+
/// @dev Emitted when an investor's country is updated in the storage contract.
|
|
61
|
+
/// @param _investorAddress The address of the investor's wallet.
|
|
62
|
+
/// @param _country The investor's new country code (ISO-3166).
|
|
63
|
+
event CountryModified(address indexed _investorAddress, uint16 indexed _country);
|
|
64
|
+
|
|
65
|
+
/// @dev Emitted when an Identity Registry is bound to the storage contract.
|
|
66
|
+
/// @param _identityRegistry The address of the bound Identity Registry.
|
|
67
|
+
event IdentityRegistryBound(address indexed _identityRegistry);
|
|
68
|
+
|
|
69
|
+
/// @dev Emitted when an Identity Registry is unbound from the storage contract.
|
|
70
|
+
/// @param _identityRegistry The address of the unbound Identity Registry.
|
|
71
|
+
event IdentityRegistryUnbound(address indexed _identityRegistry);
|
|
72
|
+
|
|
44
73
|
/// functions
|
|
45
74
|
/**
|
|
46
75
|
* @dev adds an identity contract corresponding to a user address in the storage.
|
|
@@ -84,18 +113,25 @@ interface IERC3643IdentityRegistryStorage {
|
|
|
84
113
|
function modifyStoredIdentity(address _userAddress, IIdentity _identity) external;
|
|
85
114
|
|
|
86
115
|
/**
|
|
87
|
-
* @notice Adds an identity registry
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
116
|
+
* @notice Adds an identity registry to the list of identityRegistries linked to the storage contract.
|
|
117
|
+
* Gated by the IRS_BINDER role (see AccessManagerSetupLib), held by the issuer's accounts that attach
|
|
118
|
+
* a registry onto a reused storage; the TREXFactory never holds it.
|
|
119
|
+
* The number of bound registries is capped (see `MAX_BOUND_REGISTRIES` on the implementation).
|
|
120
|
+
*
|
|
121
|
+
* @dev The bound set (`linkedIdentityRegistries`) is not authorization. Write access to the IRS
|
|
122
|
+
* (addIdentityToStorage / modify* / remove*) is gated by the IRS_WRITER role on the AccessManager, so
|
|
123
|
+
* an IR holding IRS_WRITER may write without being bound, and an unbound IR keeps IRS_WRITER until the
|
|
124
|
+
* AccessManager revokes it. Bind/unbind carry no grantRole/revokeRole of IRS_WRITER. Every write is
|
|
125
|
+
* still checked against the storage's IdentityFactory, set at init, whoever the writer is.
|
|
91
126
|
* @param _identityRegistry The identity registry address to add.
|
|
92
127
|
*/
|
|
93
128
|
function bindIdentityRegistry(address _identityRegistry) external;
|
|
94
129
|
|
|
95
130
|
/**
|
|
96
|
-
* @notice Removes an identity registry from
|
|
97
|
-
*
|
|
98
|
-
*
|
|
131
|
+
* @notice Removes an identity registry from the list of identityRegistries linked to the storage contract.
|
|
132
|
+
* Gated by the OWNER role: unbinding is a governance operation, not a deploy-time action.
|
|
133
|
+
* @dev See {bindIdentityRegistry}: unbinding does not revoke the IRS_WRITER role the IR may hold on the
|
|
134
|
+
* AccessManager.
|
|
99
135
|
* @param _identityRegistry The identity registry address to remove.
|
|
100
136
|
*/
|
|
101
137
|
function unbindIdentityRegistry(address _identityRegistry) external;
|
|
@@ -105,6 +141,25 @@ interface IERC3643IdentityRegistryStorage {
|
|
|
105
141
|
*/
|
|
106
142
|
function linkedIdentityRegistries() external view returns (address[] memory);
|
|
107
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @dev Returns the number of identity registries linked to the storage contract, without copying
|
|
146
|
+
* the set. Equivalent to `linkedIdentityRegistries().length`.
|
|
147
|
+
*/
|
|
148
|
+
function linkedIdentityRegistryCount() external view returns (uint256);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @notice Returns a slice of the bound set, for reading it in pages instead of in one copy.
|
|
152
|
+
* @dev Both bounds are clamped to the set size and `_start` is clamped to `_end`, so an out-of-range
|
|
153
|
+
* page returns an empty array rather than reverting. Paginate against `linkedIdentityRegistryCount`.
|
|
154
|
+
*
|
|
155
|
+
* Set order is NOT stable: removing a registry moves the last element into the freed slot. A caller
|
|
156
|
+
* paging across several calls may therefore miss or repeat an entry if a bind or unbind lands between
|
|
157
|
+
* them. Read the whole set in one call where a consistent snapshot matters.
|
|
158
|
+
* @param _start Index of the first entry to return, inclusive.
|
|
159
|
+
* @param _end Index to stop at, exclusive.
|
|
160
|
+
*/
|
|
161
|
+
function linkedIdentityRegistries(uint256 _start, uint256 _end) external view returns (address[] memory);
|
|
162
|
+
|
|
108
163
|
/**
|
|
109
164
|
* @dev Returns the onchainID of an investor.
|
|
110
165
|
* @param _userAddress The wallet of the investor
|
|
@@ -36,11 +36,25 @@
|
|
|
36
36
|
// +@@@@%-
|
|
37
37
|
// :#%%=
|
|
38
38
|
//
|
|
39
|
+
|
|
39
40
|
pragma solidity 0.8.30;
|
|
40
|
-
import { IClaimIssuer } from "@onchain-id/solidity/contracts/interface/IClaimIssuer.sol";
|
|
41
41
|
|
|
42
42
|
interface IERC3643TrustedIssuersRegistry {
|
|
43
43
|
|
|
44
|
+
/// @dev Emitted when a trusted issuer is registered, together with the claim topics it is trusted for.
|
|
45
|
+
/// @param _trustedIssuer The address of the trusted issuer's ClaimIssuer contract.
|
|
46
|
+
/// @param _claimTopics The claim topics the issuer is trusted for.
|
|
47
|
+
event TrustedIssuerAdded(address indexed _trustedIssuer, uint256[] _claimTopics);
|
|
48
|
+
|
|
49
|
+
/// @dev Emitted when a trusted issuer is removed from the registry.
|
|
50
|
+
/// @param _trustedIssuer The address of the trusted issuer's ClaimIssuer contract.
|
|
51
|
+
event TrustedIssuerRemoved(address indexed _trustedIssuer);
|
|
52
|
+
|
|
53
|
+
/// @dev Emitted when the set of claim topics a trusted issuer is trusted for changes.
|
|
54
|
+
/// @param _trustedIssuer The address of the trusted issuer's ClaimIssuer contract.
|
|
55
|
+
/// @param _claimTopics The new claim topics the issuer is trusted for.
|
|
56
|
+
event ClaimTopicsUpdated(address indexed _trustedIssuer, uint256[] _claimTopics);
|
|
57
|
+
|
|
44
58
|
// Functions
|
|
45
59
|
|
|
46
60
|
// Setters
|
|
@@ -52,31 +66,34 @@ interface IERC3643TrustedIssuersRegistry {
|
|
|
52
66
|
* Requires that there is no more than 50 Trusted issuers
|
|
53
67
|
* @param _trustedIssuer The ClaimIssuer contract address of the trusted claim issuer.
|
|
54
68
|
* @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit
|
|
55
|
-
*
|
|
69
|
+
* Restricted to the configured AccessManager role (OWNER).
|
|
56
70
|
* emits a `TrustedIssuerAdded` event
|
|
57
71
|
*/
|
|
58
|
-
function addTrustedIssuer(
|
|
72
|
+
function addTrustedIssuer(address _trustedIssuer, uint256[] calldata _claimTopics) external;
|
|
59
73
|
|
|
60
74
|
/**
|
|
61
75
|
* @dev Removes the ClaimIssuer contract of a trusted claim issuer.
|
|
62
76
|
* Requires that the claim issuer contract to be registered first
|
|
63
77
|
* @param _trustedIssuer the claim issuer to remove.
|
|
64
|
-
*
|
|
78
|
+
* Restricted to the configured AccessManager role (OWNER).
|
|
65
79
|
* emits a `TrustedIssuerRemoved` event
|
|
66
80
|
*/
|
|
67
|
-
function removeTrustedIssuer(
|
|
81
|
+
function removeTrustedIssuer(address _trustedIssuer) external;
|
|
68
82
|
|
|
69
83
|
/**
|
|
70
84
|
* @dev Updates the set of claim topics that a trusted issuer is allowed to emit.
|
|
85
|
+
* The provided set replaces the issuer's current set in full.
|
|
71
86
|
* Requires that this ClaimIssuer contract already exists in the registry
|
|
72
87
|
* Requires that the provided claimTopics set is not empty
|
|
73
88
|
* Requires that there is no more than 15 claimTopics
|
|
89
|
+
* An empty set is rejected, so this function cannot clear an issuer's topics. Stripping an issuer
|
|
90
|
+
* of every topic is done with `removeTrustedIssuer`, which drops the issuer and unbinds all of its topics.
|
|
74
91
|
* @param _trustedIssuer the claim issuer to update.
|
|
75
92
|
* @param _claimTopics the set of claim topics that the trusted issuer is allowed to emit
|
|
76
|
-
*
|
|
93
|
+
* Restricted to the configured AccessManager role (OWNER).
|
|
77
94
|
* emits a `ClaimTopicsUpdated` event
|
|
78
95
|
*/
|
|
79
|
-
function updateIssuerClaimTopics(
|
|
96
|
+
function updateIssuerClaimTopics(address _trustedIssuer, uint256[] calldata _claimTopics) external;
|
|
80
97
|
|
|
81
98
|
/// Getters
|
|
82
99
|
|
|
@@ -84,14 +101,14 @@ interface IERC3643TrustedIssuersRegistry {
|
|
|
84
101
|
* @dev Function for getting all the trusted claim issuers stored.
|
|
85
102
|
* @return array of all claim issuers registered.
|
|
86
103
|
*/
|
|
87
|
-
function getTrustedIssuers() external view returns (
|
|
104
|
+
function getTrustedIssuers() external view returns (address[] memory);
|
|
88
105
|
|
|
89
106
|
/**
|
|
90
107
|
* @dev Function for getting all the trusted issuer allowed for a given claim topic.
|
|
91
108
|
* @param claimTopic the claim topic to get the trusted issuers for.
|
|
92
109
|
* @return array of all claim issuer addresses that are allowed for the given claim topic.
|
|
93
110
|
*/
|
|
94
|
-
function getTrustedIssuersForClaimTopic(uint256 claimTopic) external view returns (
|
|
111
|
+
function getTrustedIssuersForClaimTopic(uint256 claimTopic) external view returns (address[] memory);
|
|
95
112
|
|
|
96
113
|
/**
|
|
97
114
|
* @dev Checks if the ClaimIssuer contract is trusted
|
|
@@ -102,11 +119,11 @@ interface IERC3643TrustedIssuersRegistry {
|
|
|
102
119
|
|
|
103
120
|
/**
|
|
104
121
|
* @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
122
|
* @param _trustedIssuer the trusted issuer concerned.
|
|
107
|
-
* @return The set of claim topics that the trusted issuer is allowed to emit
|
|
123
|
+
* @return The set of claim topics that the trusted issuer is allowed to emit,
|
|
124
|
+
* empty if the provided ClaimIssuer contract is not registered.
|
|
108
125
|
*/
|
|
109
|
-
function getTrustedIssuerClaimTopics(
|
|
126
|
+
function getTrustedIssuerClaimTopics(address _trustedIssuer) external view returns (uint256[] memory);
|
|
110
127
|
|
|
111
128
|
/**
|
|
112
129
|
* @dev Function for checking if the trusted claim issuer is allowed
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
// T-REX Smart Contracts
|
|
41
|
+
// The ERC-3643 token suite of the T-REX ecosystem.
|
|
42
|
+
//
|
|
43
|
+
// Copyright (C) 2023, Tokeny sàrl.
|
|
44
|
+
// Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
|
|
45
|
+
//
|
|
46
|
+
// This file is part of the T-REX smart contract suite. It derives from the
|
|
47
|
+
// T-REX v4 smart contracts developed by Tokeny sàrl and released under the
|
|
48
|
+
// GNU General Public License v3. All modifications made since then are the
|
|
49
|
+
// work of Digital Asset Operational Services ISAC Ltd. ("T-REX Network").
|
|
50
|
+
//
|
|
51
|
+
// This program is free software: you can redistribute it and/or modify
|
|
52
|
+
// it under the terms of the GNU General Public License as published by
|
|
53
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
54
|
+
// (at your option) any later version.
|
|
55
|
+
//
|
|
56
|
+
// This program is distributed in the hope that it will be useful,
|
|
57
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
58
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
59
|
+
// GNU General Public License for more details.
|
|
60
|
+
//
|
|
61
|
+
// You should have received a copy of the GNU General Public License
|
|
62
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
63
|
+
|
|
64
|
+
pragma solidity 0.8.30;
|
|
65
|
+
|
|
66
|
+
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
67
|
+
|
|
68
|
+
import { ERC3643ErrorsLib } from "../ERC3643ErrorsLib.sol";
|
|
69
|
+
import { IERC3643ClaimTopicsRegistry } from "../IERC3643ClaimTopicsRegistry.sol";
|
|
70
|
+
|
|
71
|
+
/// @title ERC3643ClaimTopicsRegistry
|
|
72
|
+
/// @dev The ERC-3643 Claim Topics Registry surface and nothing else, over its own ERC-7201 namespace.
|
|
73
|
+
/// Extend through the internal hooks. Authorization is left abstract: the standard specifies none.
|
|
74
|
+
abstract contract ERC3643ClaimTopicsRegistry is IERC3643ClaimTopicsRegistry {
|
|
75
|
+
|
|
76
|
+
using EnumerableSet for EnumerableSet.UintSet;
|
|
77
|
+
|
|
78
|
+
/// @custom:storage-location erc7201:erc3643.storage.ClaimTopicsRegistry
|
|
79
|
+
struct ERC3643ClaimTopicsRegistryStorage {
|
|
80
|
+
EnumerableSet.UintSet claimTopics;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// keccak256(abi.encode(uint256(keccak256("erc3643.storage.ClaimTopicsRegistry")) - 1)) & ~bytes32(uint256(0xff));
|
|
84
|
+
bytes32 private constant CLAIM_TOPICS_REGISTRY_STORAGE_LOCATION =
|
|
85
|
+
0xf733c3a0e1c477ac68147f80e659cc05e7e57f7c461b47d14f8d9811f4c72700;
|
|
86
|
+
|
|
87
|
+
/// @inheritdoc IERC3643ClaimTopicsRegistry
|
|
88
|
+
function addClaimTopic(uint256 _claimTopic) external virtual {
|
|
89
|
+
_authorizeClaimTopicsUpdate();
|
|
90
|
+
_addClaimTopic(_claimTopic);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/// @inheritdoc IERC3643ClaimTopicsRegistry
|
|
94
|
+
function removeClaimTopic(uint256 _claimTopic) external virtual {
|
|
95
|
+
_authorizeClaimTopicsUpdate();
|
|
96
|
+
_removeClaimTopic(_claimTopic);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// @inheritdoc IERC3643ClaimTopicsRegistry
|
|
100
|
+
function getClaimTopics() external view virtual returns (uint256[] memory) {
|
|
101
|
+
return _getClaimTopics();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/// @dev Authorization hook for every state-changing function of this base.
|
|
105
|
+
/// Left abstract: the standard defines no access model.
|
|
106
|
+
function _authorizeClaimTopicsUpdate() internal virtual;
|
|
107
|
+
|
|
108
|
+
/// @dev Cap on required claim topics. The standard sets none; override to bound `isVerified`.
|
|
109
|
+
function _maxClaimTopics() internal view virtual returns (uint256) {
|
|
110
|
+
return type(uint256).max;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/// @dev Adds a required claim topic. Reverts on duplicates and past the cap.
|
|
114
|
+
function _addClaimTopic(uint256 claimTopic) internal virtual {
|
|
115
|
+
EnumerableSet.UintSet storage topics = _erc3643ClaimTopicsRegistryStorage().claimTopics;
|
|
116
|
+
uint256 max = _maxClaimTopics();
|
|
117
|
+
require(topics.length() < max, ERC3643ErrorsLib.MaxClaimTopicsReached(max));
|
|
118
|
+
require(topics.add(claimTopic), ERC3643ErrorsLib.ClaimTopicAlreadyExists());
|
|
119
|
+
emit ClaimTopicAdded(claimTopic);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// @dev Removes a required claim topic. Removing an absent topic is a silent no-op.
|
|
123
|
+
function _removeClaimTopic(uint256 claimTopic) internal virtual {
|
|
124
|
+
if (_erc3643ClaimTopicsRegistryStorage().claimTopics.remove(claimTopic)) {
|
|
125
|
+
emit ClaimTopicRemoved(claimTopic);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// @dev Required claim topics.
|
|
130
|
+
function _getClaimTopics() internal view virtual returns (uint256[] memory) {
|
|
131
|
+
return _erc3643ClaimTopicsRegistryStorage().claimTopics.values();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function _erc3643ClaimTopicsRegistryStorage() internal pure returns (ERC3643ClaimTopicsRegistryStorage storage s) {
|
|
135
|
+
assembly ("memory-safe") {
|
|
136
|
+
s.slot := CLAIM_TOPICS_REGISTRY_STORAGE_LOCATION
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
2
|
+
//
|
|
3
|
+
// :+#####%%%%%%%%%%%%%%+
|
|
4
|
+
// .-*@@@%+.:+%@@@@@%%#***%@@%=
|
|
5
|
+
// :=*%@@@#=. :#@@% *@@@%=
|
|
6
|
+
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
|
|
7
|
+
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
|
|
8
|
+
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
|
|
9
|
+
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
|
|
10
|
+
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
|
|
11
|
+
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
|
|
12
|
+
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
|
|
13
|
+
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
|
|
14
|
+
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
|
|
15
|
+
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
|
|
16
|
+
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
|
|
17
|
+
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
|
|
18
|
+
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
|
|
19
|
+
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
|
|
20
|
+
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
|
|
21
|
+
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
|
|
22
|
+
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
|
|
23
|
+
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
|
|
24
|
+
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
|
|
25
|
+
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
|
|
26
|
+
// @@@@@@+. +@@*. .+@@@@@%=.
|
|
27
|
+
// -@@@@@= =@@%: -#@@@@%+.
|
|
28
|
+
// +@@@@@. =@@@= .+@@@@@*:
|
|
29
|
+
// #@@@@#:%@@#. :*@@@@#-
|
|
30
|
+
// @@@@@%@@@= :#@@@@+.
|
|
31
|
+
// :@@@@@@@#.:#@@@%-
|
|
32
|
+
// +@@@@@@-.*@@@*:
|
|
33
|
+
// #@@@@#.=@@@+.
|
|
34
|
+
// @@@@+-%@%=
|
|
35
|
+
// :@@@#%@%=
|
|
36
|
+
// +@@@@%-
|
|
37
|
+
// :#%%=
|
|
38
|
+
//
|
|
39
|
+
|
|
40
|
+
// T-REX Smart Contracts
|
|
41
|
+
// The ERC-3643 token suite of the T-REX ecosystem.
|
|
42
|
+
//
|
|
43
|
+
// Copyright (C) 2023, Tokeny sàrl.
|
|
44
|
+
// Copyright (C) 2026 Digital Asset Operational Services ISAC Ltd. ("T-REX Network")
|
|
45
|
+
//
|
|
46
|
+
// This file is part of the T-REX smart contract suite. It derives from the
|
|
47
|
+
// T-REX v4 smart contracts developed by Tokeny sàrl and released under the
|
|
48
|
+
// GNU General Public License v3. All modifications made since then are the
|
|
49
|
+
// work of Digital Asset Operational Services ISAC Ltd. ("T-REX Network").
|
|
50
|
+
//
|
|
51
|
+
// This program is free software: you can redistribute it and/or modify
|
|
52
|
+
// it under the terms of the GNU General Public License as published by
|
|
53
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
54
|
+
// (at your option) any later version.
|
|
55
|
+
//
|
|
56
|
+
// This program is distributed in the hope that it will be useful,
|
|
57
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
58
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
59
|
+
// GNU General Public License for more details.
|
|
60
|
+
//
|
|
61
|
+
// You should have received a copy of the GNU General Public License
|
|
62
|
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
63
|
+
|
|
64
|
+
pragma solidity 0.8.30;
|
|
65
|
+
|
|
66
|
+
import { ERC3643ErrorsLib } from "../ERC3643ErrorsLib.sol";
|
|
67
|
+
import { IERC3643Compliance } from "../IERC3643Compliance.sol";
|
|
68
|
+
|
|
69
|
+
/// @title ERC3643Compliance
|
|
70
|
+
/// @dev The ERC-3643 Compliance surface and nothing else, over its own ERC-7201 namespace. The base owns
|
|
71
|
+
/// the token binding and the four dispatch points but knows no rules, so `canTransfer` returns true and
|
|
72
|
+
/// the notification hooks do nothing. Extensions override `_canTransfer`, `_transferred`, `_created` and
|
|
73
|
+
/// `_destroyed`. Only the bound token may call the notification entry points.
|
|
74
|
+
abstract contract ERC3643Compliance is IERC3643Compliance {
|
|
75
|
+
|
|
76
|
+
/// @custom:storage-location erc7201:erc3643.storage.Compliance
|
|
77
|
+
struct ERC3643ComplianceStorage {
|
|
78
|
+
address tokenBound;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// keccak256(abi.encode(uint256(keccak256("erc3643.storage.Compliance")) - 1)) & ~bytes32(uint256(0xff));
|
|
82
|
+
bytes32 private constant COMPLIANCE_STORAGE_LOCATION =
|
|
83
|
+
0x9a630f7fb5b68c9ca32ffeadfd0de30d50c23b603074e205ad3eb7046278f900;
|
|
84
|
+
|
|
85
|
+
/// @dev Restricts a function to the token currently bound to this compliance.
|
|
86
|
+
modifier onlyBoundToken() {
|
|
87
|
+
require(
|
|
88
|
+
msg.sender == _erc3643ComplianceStorage().tokenBound,
|
|
89
|
+
ERC3643ErrorsLib.AddressNotATokenBoundToComplianceContract()
|
|
90
|
+
);
|
|
91
|
+
_;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/// @inheritdoc IERC3643Compliance
|
|
95
|
+
function bindToken(address _token) external virtual {
|
|
96
|
+
_authorizeTokenBinding(_token);
|
|
97
|
+
_bindToken(_token);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/// @inheritdoc IERC3643Compliance
|
|
101
|
+
function unbindToken(address _token) external virtual {
|
|
102
|
+
_authorizeTokenUnbinding(_token);
|
|
103
|
+
_unbindToken(_token);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// @inheritdoc IERC3643Compliance
|
|
107
|
+
function transferred(address _from, address _to, uint256 _amount) external virtual onlyBoundToken {
|
|
108
|
+
require(_from != address(0) && _to != address(0), ERC3643ErrorsLib.ZeroAddress());
|
|
109
|
+
_transferred(_from, _to, _amount);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// @inheritdoc IERC3643Compliance
|
|
113
|
+
function created(address _to, uint256 _amount) external virtual onlyBoundToken {
|
|
114
|
+
require(_to != address(0), ERC3643ErrorsLib.ZeroAddress());
|
|
115
|
+
_created(_to, _amount);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/// @inheritdoc IERC3643Compliance
|
|
119
|
+
function destroyed(address _from, uint256 _amount) external virtual onlyBoundToken {
|
|
120
|
+
require(_from != address(0), ERC3643ErrorsLib.ZeroAddress());
|
|
121
|
+
_destroyed(_from, _amount);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// @inheritdoc IERC3643Compliance
|
|
125
|
+
function canTransfer(address _from, address _to, uint256 _amount) external view virtual returns (bool) {
|
|
126
|
+
return _canTransfer(_from, _to, _amount);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// @inheritdoc IERC3643Compliance
|
|
130
|
+
function isTokenBound(address _token) external view virtual returns (bool) {
|
|
131
|
+
return _token == _erc3643ComplianceStorage().tokenBound;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/// @inheritdoc IERC3643Compliance
|
|
135
|
+
function getTokenBound() external view virtual returns (address) {
|
|
136
|
+
return _getTokenBound();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/// @dev Authorization hook for binding. Receives the token address so derived contracts can apply
|
|
140
|
+
/// the "an unbound compliance accepts a bind from the token itself" policy.
|
|
141
|
+
/// Left abstract: the standard defines no access model.
|
|
142
|
+
function _authorizeTokenBinding(address token) internal virtual;
|
|
143
|
+
|
|
144
|
+
/// @dev Authorization hook for unbinding. Separate from `_authorizeTokenBinding` because the two
|
|
145
|
+
/// are governed by different conditions: binding may be open to a claiming token while the
|
|
146
|
+
/// compliance is unbound, whereas unbinding concerns a token that is already bound.
|
|
147
|
+
function _authorizeTokenUnbinding(address token) internal virtual;
|
|
148
|
+
|
|
149
|
+
/// @dev Records the bound token. No caller check; `_authorizeTokenBinding` covers the public path.
|
|
150
|
+
function _bindToken(address token) internal virtual {
|
|
151
|
+
require(token != address(0), ERC3643ErrorsLib.ZeroAddress());
|
|
152
|
+
_erc3643ComplianceStorage().tokenBound = token;
|
|
153
|
+
emit TokenBound(token);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function _unbindToken(address token) internal virtual {
|
|
157
|
+
require(token != address(0), ERC3643ErrorsLib.ZeroAddress());
|
|
158
|
+
ERC3643ComplianceStorage storage s = _erc3643ComplianceStorage();
|
|
159
|
+
require(token == s.tokenBound, ERC3643ErrorsLib.TokenNotBound());
|
|
160
|
+
delete s.tokenBound;
|
|
161
|
+
emit TokenUnbound(token);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// @dev Rule state update after a transfer. A compliance with no rules has nothing to record.
|
|
165
|
+
// solhint-disable-next-line no-empty-blocks
|
|
166
|
+
function _transferred(
|
|
167
|
+
address,
|
|
168
|
+
/* from */
|
|
169
|
+
address,
|
|
170
|
+
/* to */
|
|
171
|
+
uint256 /* amount */
|
|
172
|
+
)
|
|
173
|
+
internal
|
|
174
|
+
virtual { }
|
|
175
|
+
|
|
176
|
+
/// @dev Rule state update after a mint.
|
|
177
|
+
// solhint-disable-next-line no-empty-blocks
|
|
178
|
+
function _created(
|
|
179
|
+
address,
|
|
180
|
+
/* to */
|
|
181
|
+
uint256 /* amount */
|
|
182
|
+
)
|
|
183
|
+
internal
|
|
184
|
+
virtual { }
|
|
185
|
+
|
|
186
|
+
/// @dev Rule state update after a burn.
|
|
187
|
+
// solhint-disable-next-line no-empty-blocks
|
|
188
|
+
function _destroyed(
|
|
189
|
+
address,
|
|
190
|
+
/* from */
|
|
191
|
+
uint256 /* amount */
|
|
192
|
+
)
|
|
193
|
+
internal
|
|
194
|
+
virtual { }
|
|
195
|
+
|
|
196
|
+
/// @dev Whether a transfer is allowed. A compliance with no rules allows everything; extensions
|
|
197
|
+
/// override this to consult their rules.
|
|
198
|
+
function _canTransfer(
|
|
199
|
+
address,
|
|
200
|
+
/* from */
|
|
201
|
+
address,
|
|
202
|
+
/* to */
|
|
203
|
+
uint256 /* amount */
|
|
204
|
+
)
|
|
205
|
+
internal
|
|
206
|
+
view
|
|
207
|
+
virtual
|
|
208
|
+
returns (bool)
|
|
209
|
+
{
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function _getTokenBound() internal view virtual returns (address) {
|
|
214
|
+
return _erc3643ComplianceStorage().tokenBound;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function _erc3643ComplianceStorage() internal pure returns (ERC3643ComplianceStorage storage s) {
|
|
218
|
+
assembly ("memory-safe") {
|
|
219
|
+
s.slot := COMPLIANCE_STORAGE_LOCATION
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
}
|