@t-rex-network/t-rex 4.2.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +674 -0
- package/README.md +137 -0
- package/contracts/ERC-3643/ERC3643EventsLib.sol +150 -0
- package/contracts/ERC-3643/IERC3643.sol +408 -0
- package/contracts/ERC-3643/IERC3643ClaimTopicsRegistry.sol +66 -0
- package/contracts/ERC-3643/IERC3643Compliance.sol +127 -0
- package/contracts/ERC-3643/IERC3643IdentityRegistry.sol +180 -0
- package/contracts/ERC-3643/IERC3643IdentityRegistryStorage.sol +120 -0
- package/contracts/ERC-3643/IERC3643TrustedIssuersRegistry.sol +120 -0
- package/contracts/compliance/modular/IModularCompliance.sol +143 -0
- package/contracts/compliance/modular/ModularCompliance.sol +381 -0
- package/contracts/compliance/modular/modules/AbstractModuleUpgradeable.sol +193 -0
- package/contracts/compliance/modular/modules/IModule.sol +158 -0
- package/contracts/compliance/modular/modules/ModuleProxy.sol +72 -0
- package/contracts/factory/ITREXFactory.sol +180 -0
- package/contracts/factory/ITREXGateway.sol +234 -0
- package/contracts/factory/TREXFactory.sol +358 -0
- package/contracts/factory/TREXGateway.sol +274 -0
- package/contracts/libraries/ErrorsLib.sol +168 -0
- package/contracts/libraries/EventsLib.sol +147 -0
- package/contracts/proxy/AbstractProxy.sol +146 -0
- package/contracts/proxy/ClaimTopicsRegistryProxy.sol +83 -0
- package/contracts/proxy/IdentityRegistryProxy.sol +95 -0
- package/contracts/proxy/IdentityRegistryStorageProxy.sol +83 -0
- package/contracts/proxy/ModularComplianceProxy.sol +88 -0
- package/contracts/proxy/TokenProxy.sol +97 -0
- package/contracts/proxy/TrustedIssuersRegistryProxy.sol +88 -0
- package/contracts/proxy/authority/IAFactory.sol +122 -0
- package/contracts/proxy/authority/IIAFactory.sol +87 -0
- package/contracts/proxy/authority/ITREXImplementationAuthority.sol +239 -0
- package/contracts/proxy/authority/TREXImplementationAuthority.sol +350 -0
- package/contracts/proxy/interface/IProxy.sol +72 -0
- package/contracts/registry/implementation/ClaimTopicsRegistry.sol +152 -0
- package/contracts/registry/implementation/IdentityRegistry.sol +352 -0
- package/contracts/registry/implementation/IdentityRegistryStorage.sol +227 -0
- package/contracts/registry/implementation/TrustedIssuersRegistry.sol +272 -0
- package/contracts/registry/interface/IClaimTopicsRegistry.sol +70 -0
- package/contracts/registry/interface/IIdentityRegistry.sol +102 -0
- package/contracts/registry/interface/IIdentityRegistryStorage.sol +70 -0
- package/contracts/registry/interface/ITrustedIssuersRegistry.sol +70 -0
- package/contracts/roles/AbstractAgentRole.sol +122 -0
- package/contracts/roles/AgentRole.sol +82 -0
- package/contracts/roles/AgentRoleUpgradeable.sol +82 -0
- package/contracts/roles/IERC173.sol +21 -0
- package/contracts/roles/Roles.sol +102 -0
- package/contracts/token/IToken.sol +97 -0
- package/contracts/token/Token.sol +664 -0
- package/contracts/token/TokenStructs.sol +74 -0
- package/contracts/utils/IUtilityChecker.sol +135 -0
- package/contracts/utils/InterfaceIdCalculator.sol +223 -0
- package/contracts/utils/UtilityChecker.sol +210 -0
- package/contracts/utils/UtilityCheckerProxy.sol +72 -0
- package/contracts/vendor/openzeppelin/Create3.sol +143 -0
- package/out/AbstractAgentRole.sol/AbstractAgentRole.json +1 -0
- package/out/AbstractModuleUpgradeable.sol/AbstractModuleUpgradeable.json +1 -0
- package/out/AbstractProxy.sol/AbstractProxy.json +1 -0
- package/out/Address.sol/Address.json +1 -0
- package/out/AgentRole.sol/AgentRole.json +1 -0
- package/out/AgentRoleUpgradeable.sol/AgentRoleUpgradeable.json +1 -0
- package/out/Arrays.sol/Arrays.json +1 -0
- package/out/Base.sol/CommonBase.json +1 -0
- package/out/Base.sol/ScriptBase.json +1 -0
- package/out/Base.sol/TestBase.json +1 -0
- package/out/Bytes.sol/Bytes.json +1 -0
- package/out/ClaimIssuer.sol/ClaimIssuer.json +1 -0
- package/out/ClaimIssuerTrick.sol/ClaimIssuerTrick.json +1 -0
- package/out/ClaimTopicsRegistry.sol/ClaimTopicsRegistry.json +1 -0
- package/out/ClaimTopicsRegistryProxy.sol/ClaimTopicsRegistryProxy.json +1 -0
- package/out/Comparators.sol/Comparators.json +1 -0
- package/out/Context.sol/Context.json +1 -0
- package/out/ContextUpgradeable.sol/ContextUpgradeable.json +1 -0
- package/out/Countries.sol/Countries.json +1 -0
- package/out/Create2.sol/Create2.json +1 -0
- package/out/Create3.sol/Create3.json +1 -0
- package/out/ECDSA.sol/ECDSA.json +1 -0
- package/out/EIP712.sol/EIP712.json +1 -0
- package/out/EIP712Upgradeable.sol/EIP712Upgradeable.json +1 -0
- package/out/ERC1967Proxy.sol/ERC1967Proxy.json +1 -0
- package/out/ERC1967Utils.sol/ERC1967Utils.json +1 -0
- package/out/ERC20.sol/ERC20.json +1 -0
- package/out/ERC20Pausable.sol/ERC20Pausable.json +1 -0
- package/out/ERC20PermitUpgradeable.sol/ERC20PermitUpgradeable.json +1 -0
- package/out/ERC20Upgradeable.sol/ERC20Upgradeable.json +1 -0
- package/out/ERC2771Context.sol/ERC2771Context.json +1 -0
- package/out/ERC2771ContextUpgradeable.sol/ERC2771ContextUpgradeable.json +1 -0
- package/out/ERC2771Forwarder.sol/ERC2771Forwarder.json +1 -0
- package/out/ERC3643EventsLib.sol/ERC3643EventsLib.json +1 -0
- package/out/EnumerableSet.sol/EnumerableSet.json +1 -0
- package/out/Errors.sol/Errors.json +1 -0
- package/out/ErrorsLib.sol/ErrorsLib.json +1 -0
- package/out/EventsLib.sol/EventsLib.json +1 -0
- package/out/IAFactory.sol/IAFactory.json +1 -0
- package/out/IBeacon.sol/IBeacon.json +1 -0
- package/out/IClaimIssuer.sol/IClaimIssuer.json +1 -0
- package/out/IClaimTopicsRegistry.sol/IClaimTopicsRegistry.json +1 -0
- package/out/IERC1363.sol/IERC1363.json +1 -0
- package/out/IERC165.sol/IERC165.json +1 -0
- package/out/IERC173.sol/IERC173.json +1 -0
- package/out/IERC1967.sol/IERC1967.json +1 -0
- package/out/IERC20.sol/IERC20.json +1 -0
- package/out/IERC20Metadata.sol/IERC20Metadata.json +1 -0
- package/out/IERC20Permit.sol/IERC20Permit.json +1 -0
- package/out/IERC3643.sol/IERC3643.json +1 -0
- package/out/IERC3643ClaimTopicsRegistry.sol/IERC3643ClaimTopicsRegistry.json +1 -0
- package/out/IERC3643Compliance.sol/IERC3643Compliance.json +1 -0
- package/out/IERC3643IdentityRegistry.sol/IERC3643IdentityRegistry.json +1 -0
- package/out/IERC3643IdentityRegistryStorage.sol/IERC3643IdentityRegistryStorage.json +1 -0
- package/out/IERC3643TrustedIssuersRegistry.sol/IERC3643TrustedIssuersRegistry.json +1 -0
- package/out/IERC5267.sol/IERC5267.json +1 -0
- package/out/IERC734.sol/IERC734.json +1 -0
- package/out/IERC735.sol/IERC735.json +1 -0
- package/out/IIAFactory.sol/IIAFactory.json +1 -0
- package/out/IIdFactory.sol/IIdFactory.json +1 -0
- package/out/IIdentity.sol/IIdentity.json +1 -0
- package/out/IIdentityRegistry.sol/IIdentityRegistry.json +1 -0
- package/out/IIdentityRegistryStorage.sol/IIdentityRegistryStorage.json +1 -0
- package/out/IImplementationAuthority.sol/IImplementationAuthority.json +1 -0
- package/out/IModularCompliance.sol/IModularCompliance.json +1 -0
- package/out/IModule.sol/IModule.json +1 -0
- package/out/IMulticall3.sol/IMulticall3.json +1 -0
- package/out/IProxy.sol/IProxy.json +1 -0
- package/out/ITREXFactory.sol/ITREXFactory.json +1 -0
- package/out/ITREXGateway.sol/ITREXGateway.json +1 -0
- package/out/ITREXImplementationAuthority.sol/ITREXImplementationAuthority.json +1 -0
- package/out/IToken.sol/IToken.json +1 -0
- package/out/ITrustedIssuersRegistry.sol/ITrustedIssuersRegistry.json +1 -0
- package/out/IUtilityChecker.sol/IUtilityChecker.json +1 -0
- package/out/IdFactory.sol/IdFactory.json +1 -0
- package/out/Identity.sol/Identity.json +1 -0
- package/out/IdentityProxy.sol/IdentityProxy.json +1 -0
- package/out/IdentityRegistry.sol/IdentityRegistry.json +1 -0
- package/out/IdentityRegistryProxy.sol/IdentityRegistryProxy.json +1 -0
- package/out/IdentityRegistryStorage.sol/IdentityRegistryStorage.json +1 -0
- package/out/IdentityRegistryStorageProxy.sol/IdentityRegistryStorageProxy.json +1 -0
- package/out/ImplementationAuthority.sol/ImplementationAuthority.json +1 -0
- package/out/Initializable.sol/Initializable.json +1 -0
- package/out/InterfaceIdCalculator.sol/InterfaceIdCalculator.json +1 -0
- package/out/KeyPurposes.sol/KeyPurposes.json +1 -0
- package/out/KeyTypes.sol/KeyTypes.json +1 -0
- package/out/LowLevelCall.sol/LowLevelCall.json +1 -0
- package/out/Math.sol/Math.json +1 -0
- package/out/MessageHashUtils.sol/MessageHashUtils.json +1 -0
- package/out/ModularCompliance.sol/ModularCompliance.json +1 -0
- package/out/ModularComplianceProxy.sol/ModularComplianceProxy.json +1 -0
- package/out/ModuleNotPnP.sol/ModuleNotPnP.json +1 -0
- package/out/ModuleProxy.sol/ModuleProxy.json +1 -0
- package/out/MulticallUpgradeable.sol/MulticallUpgradeable.json +1 -0
- package/out/Nonces.sol/Nonces.json +1 -0
- package/out/NoncesUpgradeable.sol/NoncesUpgradeable.json +1 -0
- package/out/Ownable.sol/Ownable.json +1 -0
- package/out/Ownable2Step.sol/Ownable2Step.json +1 -0
- package/out/Ownable2StepUpgradeable.sol/Ownable2StepUpgradeable.json +1 -0
- package/out/OwnableUpgradeable.sol/OwnableUpgradeable.json +1 -0
- package/out/Panic.sol/Panic.json +1 -0
- package/out/Pausable.sol/Pausable.json +1 -0
- package/out/PausableUpgradeable.sol/PausableUpgradeable.json +1 -0
- package/out/Proxy.sol/Proxy.json +1 -0
- package/out/Roles.sol/Roles.json +1 -0
- package/out/SafeCast.sol/SafeCast.json +1 -0
- package/out/SafeERC20.sol/SafeERC20.json +1 -0
- package/out/ShortStrings.sol/ShortStrings.json +1 -0
- package/out/SignedMath.sol/SignedMath.json +1 -0
- package/out/SlotDerivation.sol/SlotDerivation.json +1 -0
- package/out/StdAssertions.sol/StdAssertions.json +1 -0
- package/out/StdChains.sol/StdChains.json +1 -0
- package/out/StdCheats.sol/StdCheats.json +1 -0
- package/out/StdCheats.sol/StdCheatsSafe.json +1 -0
- package/out/StdConstants.sol/StdConstants.json +1 -0
- package/out/StdError.sol/stdError.json +1 -0
- package/out/StdInvariant.sol/StdInvariant.json +1 -0
- package/out/StdJson.sol/stdJson.json +1 -0
- package/out/StdMath.sol/stdMath.json +1 -0
- package/out/StdStorage.sol/stdStorage.json +1 -0
- package/out/StdStorage.sol/stdStorageSafe.json +1 -0
- package/out/StdStyle.sol/StdStyle.json +1 -0
- package/out/StdToml.sol/stdToml.json +1 -0
- package/out/StdUtils.sol/StdUtils.json +1 -0
- package/out/Storage.sol/Storage.json +1 -0
- package/out/StorageSlot.sol/StorageSlot.json +1 -0
- package/out/Strings.sol/Strings.json +1 -0
- package/out/Structs.sol/Structs.json +1 -0
- package/out/TREXFactory.sol/TREXFactory.json +1 -0
- package/out/TREXGateway.sol/TREXGateway.json +1 -0
- package/out/TREXImplementationAuthority.sol/TREXImplementationAuthority.json +1 -0
- package/out/TestAgentRole.sol/TestAgentRole.json +1 -0
- package/out/TestAgentRoleUpgradeable.sol/TestAgentRoleUpgradeable.json +1 -0
- package/out/TestERC20.sol/TestERC20.json +1 -0
- package/out/TestModule.sol/TestModule.json +1 -0
- package/out/TestTREXFactory.sol/TestTREXFactory.json +1 -0
- package/out/Token.sol/Token.json +1 -0
- package/out/TokenProxy.sol/TokenProxy.json +1 -0
- package/out/TrustedIssuersRegistry.sol/TrustedIssuersRegistry.json +1 -0
- package/out/TrustedIssuersRegistryProxy.sol/TrustedIssuersRegistryProxy.json +1 -0
- package/out/UUPSUpgradeable.sol/UUPSUpgradeable.json +1 -0
- package/out/UtilityChecker.sol/UtilityChecker.json +1 -0
- package/out/UtilityCheckerProxy.sol/UtilityCheckerProxy.json +1 -0
- package/out/Utils.sol/Utils.json +1 -0
- package/out/Version.sol/Version.json +1 -0
- package/out/Vm.sol/Vm.json +1 -0
- package/out/Vm.sol/VmSafe.json +1 -0
- package/out/console.sol/console.json +1 -0
- package/out/draft-IERC1822.sol/IERC1822Proxiable.json +1 -0
- package/out/draft-IERC6093.sol/IERC1155Errors.json +1 -0
- package/out/draft-IERC6093.sol/IERC20Errors.json +1 -0
- package/out/draft-IERC6093.sol/IERC721Errors.json +1 -0
- package/out/libraries/Errors.sol/Errors.json +1 -0
- package/out/safeconsole.sol/safeconsole.json +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
2
|
+
//
|
|
3
|
+
// :+#####%%%%%%%%%%%%%%+
|
|
4
|
+
// .-*@@@%+.:+%@@@@@%%#***%@@%=
|
|
5
|
+
// :=*%@@@#=. :#@@% *@@@%=
|
|
6
|
+
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
|
|
7
|
+
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
|
|
8
|
+
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
|
|
9
|
+
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
|
|
10
|
+
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
|
|
11
|
+
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
|
|
12
|
+
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
|
|
13
|
+
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
|
|
14
|
+
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
|
|
15
|
+
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
|
|
16
|
+
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
|
|
17
|
+
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
|
|
18
|
+
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
|
|
19
|
+
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
|
|
20
|
+
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
|
|
21
|
+
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
|
|
22
|
+
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
|
|
23
|
+
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
|
|
24
|
+
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
|
|
25
|
+
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
|
|
26
|
+
// @@@@@@+. +@@*. .+@@@@@%=.
|
|
27
|
+
// -@@@@@= =@@%: -#@@@@%+.
|
|
28
|
+
// +@@@@@. =@@@= .+@@@@@*:
|
|
29
|
+
// #@@@@#:%@@#. :*@@@@#-
|
|
30
|
+
// @@@@@%@@@= :#@@@@+.
|
|
31
|
+
// :@@@@@@@#.:#@@@%-
|
|
32
|
+
// +@@@@@@-.*@@@*:
|
|
33
|
+
// #@@@@#.=@@@+.
|
|
34
|
+
// @@@@+-%@%=
|
|
35
|
+
// :@@@#%@%=
|
|
36
|
+
// +@@@@%-
|
|
37
|
+
// :#%%=
|
|
38
|
+
//
|
|
39
|
+
/**
|
|
40
|
+
* NOTICE
|
|
41
|
+
*
|
|
42
|
+
* The T-REX software is licensed under a proprietary license or the GPL v.3.
|
|
43
|
+
* If you choose to receive it under the GPL v.3 license, the following applies:
|
|
44
|
+
* T-REX is a suite of smart contracts implementing the ERC-3643 standard and
|
|
45
|
+
* developed by Tokeny to manage and transfer financial assets on EVM blockchains
|
|
46
|
+
*
|
|
47
|
+
* Copyright (C) 2025, Tokeny sàrl.
|
|
48
|
+
*
|
|
49
|
+
* This program is free software: you can redistribute it and/or modify
|
|
50
|
+
* it under the terms of the GNU General Public License as published by
|
|
51
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
52
|
+
* (at your option) any later version.
|
|
53
|
+
*
|
|
54
|
+
* This program is distributed in the hope that it will be useful,
|
|
55
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
56
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
57
|
+
* GNU General Public License for more details.
|
|
58
|
+
*
|
|
59
|
+
* You should have received a copy of the GNU General Public License
|
|
60
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
pragma solidity 0.8.30;
|
|
64
|
+
|
|
65
|
+
import { IIdentity } from "@onchain-id/solidity/contracts/interface/IIdentity.sol";
|
|
66
|
+
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
67
|
+
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
68
|
+
|
|
69
|
+
import { ERC3643EventsLib } from "../../ERC-3643/ERC3643EventsLib.sol";
|
|
70
|
+
import { ErrorsLib } from "../../libraries/ErrorsLib.sol";
|
|
71
|
+
import { AgentRoleUpgradeable } from "../../roles/AgentRoleUpgradeable.sol";
|
|
72
|
+
import { IERC173 } from "../../roles/IERC173.sol";
|
|
73
|
+
import { IERC3643IdentityRegistryStorage, IIdentityRegistryStorage } from "../interface/IIdentityRegistryStorage.sol";
|
|
74
|
+
|
|
75
|
+
contract IdentityRegistryStorage is IIdentityRegistryStorage, AgentRoleUpgradeable, IERC165 {
|
|
76
|
+
|
|
77
|
+
using EnumerableSet for EnumerableSet.AddressSet;
|
|
78
|
+
|
|
79
|
+
/// @dev struct containing the identity contract and the country of the user
|
|
80
|
+
struct Identity {
|
|
81
|
+
IIdentity identityContract;
|
|
82
|
+
uint16 investorCountry;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/// @custom:storage-location erc7201:ERC3643.storage.IdentityRegistryStorage
|
|
86
|
+
struct Storage {
|
|
87
|
+
/// @dev mapping between a user address and the corresponding identity
|
|
88
|
+
mapping(address user => Identity) identities;
|
|
89
|
+
|
|
90
|
+
/// @dev set of Identity Registries linked to this storage
|
|
91
|
+
EnumerableSet.AddressSet identityRegistries;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// keccak256(abi.encode(uint256(keccak256("ERC3643.storage.IdentityRegistryStorage")) - 1)) & ~bytes32(uint256(0xff));
|
|
95
|
+
bytes32 private constant STORAGE_LOCATION = 0x6d25db4721129739b3a7e96c2537b7170fb9cfd72348ce376c7a189a3ab3ba00;
|
|
96
|
+
|
|
97
|
+
constructor() {
|
|
98
|
+
_disableInitializers();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function init(address _owner, address _initialIR) external initializer {
|
|
102
|
+
__Ownable_init(_owner);
|
|
103
|
+
if (_initialIR != address(0)) {
|
|
104
|
+
_bindIdentityRegistry(_initialIR);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @dev See {IIdentityRegistryStorage-addIdentityToStorage}.
|
|
110
|
+
*/
|
|
111
|
+
function addIdentityToStorage(address _userAddress, IIdentity _identity, uint16 _country)
|
|
112
|
+
external
|
|
113
|
+
override
|
|
114
|
+
onlyAgent
|
|
115
|
+
{
|
|
116
|
+
require(_userAddress != address(0) && address(_identity) != address(0), ErrorsLib.ZeroAddress());
|
|
117
|
+
|
|
118
|
+
Storage storage s = _getStorage();
|
|
119
|
+
require(address(s.identities[_userAddress].identityContract) == address(0), ErrorsLib.AddressAlreadyStored());
|
|
120
|
+
s.identities[_userAddress].identityContract = _identity;
|
|
121
|
+
s.identities[_userAddress].investorCountry = _country;
|
|
122
|
+
emit ERC3643EventsLib.IdentityStored(_userAddress, _identity);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @dev See {IIdentityRegistryStorage-modifyStoredIdentity}.
|
|
127
|
+
*/
|
|
128
|
+
function modifyStoredIdentity(address _userAddress, IIdentity _identity) external override onlyAgent {
|
|
129
|
+
require(_userAddress != address(0) && address(_identity) != address(0), ErrorsLib.ZeroAddress());
|
|
130
|
+
Storage storage s = _getStorage();
|
|
131
|
+
require(address(s.identities[_userAddress].identityContract) != address(0), ErrorsLib.AddressNotYetStored());
|
|
132
|
+
IIdentity oldIdentity = s.identities[_userAddress].identityContract;
|
|
133
|
+
s.identities[_userAddress].identityContract = _identity;
|
|
134
|
+
emit ERC3643EventsLib.IdentityModified(oldIdentity, _identity);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @dev See {IIdentityRegistryStorage-modifyStoredInvestorCountry}.
|
|
139
|
+
*/
|
|
140
|
+
function modifyStoredInvestorCountry(address _userAddress, uint16 _country) external override onlyAgent {
|
|
141
|
+
require(_userAddress != address(0), ErrorsLib.ZeroAddress());
|
|
142
|
+
Storage storage s = _getStorage();
|
|
143
|
+
require(address(s.identities[_userAddress].identityContract) != address(0), ErrorsLib.AddressNotYetStored());
|
|
144
|
+
s.identities[_userAddress].investorCountry = _country;
|
|
145
|
+
emit ERC3643EventsLib.CountryModified(_userAddress, _country);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @dev See {IIdentityRegistryStorage-removeIdentityFromStorage}.
|
|
150
|
+
*/
|
|
151
|
+
function removeIdentityFromStorage(address _userAddress) external override onlyAgent {
|
|
152
|
+
require(_userAddress != address(0), ErrorsLib.ZeroAddress());
|
|
153
|
+
Storage storage s = _getStorage();
|
|
154
|
+
require(address(s.identities[_userAddress].identityContract) != address(0), ErrorsLib.AddressNotYetStored());
|
|
155
|
+
IIdentity oldIdentity = s.identities[_userAddress].identityContract;
|
|
156
|
+
delete s.identities[_userAddress];
|
|
157
|
+
emit ERC3643EventsLib.IdentityUnstored(_userAddress, oldIdentity);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @dev See {IIdentityRegistryStorage-bindIdentityRegistry}.
|
|
162
|
+
*/
|
|
163
|
+
function bindIdentityRegistry(address _identityRegistry) external override onlyOwner {
|
|
164
|
+
_bindIdentityRegistry(_identityRegistry);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @dev See {IIdentityRegistryStorage-unbindIdentityRegistry}.
|
|
169
|
+
*/
|
|
170
|
+
function unbindIdentityRegistry(address _identityRegistry) external override onlyOwner {
|
|
171
|
+
require(_identityRegistry != address(0), ErrorsLib.ZeroAddress());
|
|
172
|
+
Storage storage s = _getStorage();
|
|
173
|
+
require(s.identityRegistries.length() > 0, ErrorsLib.IdentityRegistryNotStored());
|
|
174
|
+
s.identityRegistries.remove(_identityRegistry);
|
|
175
|
+
|
|
176
|
+
removeAgent(_identityRegistry);
|
|
177
|
+
emit ERC3643EventsLib.IdentityRegistryUnbound(_identityRegistry);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @dev See {IIdentityRegistryStorage-linkedIdentityRegistries}.
|
|
182
|
+
*/
|
|
183
|
+
function linkedIdentityRegistries() external view override returns (address[] memory) {
|
|
184
|
+
return _getStorage().identityRegistries.values();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @dev See {IIdentityRegistryStorage-storedIdentity}.
|
|
189
|
+
*/
|
|
190
|
+
function storedIdentity(address _userAddress) external view override returns (IIdentity) {
|
|
191
|
+
return _getStorage().identities[_userAddress].identityContract;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @dev See {IIdentityRegistryStorage-storedInvestorCountry}.
|
|
196
|
+
*/
|
|
197
|
+
function storedInvestorCountry(address _userAddress) external view override returns (uint16) {
|
|
198
|
+
return _getStorage().identities[_userAddress].investorCountry;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @dev See {IERC165-supportsInterface}.
|
|
203
|
+
*/
|
|
204
|
+
function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) {
|
|
205
|
+
return interfaceId == type(IERC3643IdentityRegistryStorage).interfaceId
|
|
206
|
+
|| interfaceId == type(IERC173).interfaceId || interfaceId == type(IERC165).interfaceId;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/// @dev Internal helper shared between the public `bindIdentityRegistry` (gated by `onlyOwner`) and the
|
|
210
|
+
/// `init` flow where the factory pre-binds the identity registry it predicted via CREATE3.
|
|
211
|
+
function _bindIdentityRegistry(address _identityRegistry) internal {
|
|
212
|
+
require(_identityRegistry != address(0), ErrorsLib.ZeroAddress());
|
|
213
|
+
Storage storage s = _getStorage();
|
|
214
|
+
require(s.identityRegistries.length() < 300, ErrorsLib.MaxIRByIRSReached(300));
|
|
215
|
+
_addAgent(_identityRegistry);
|
|
216
|
+
s.identityRegistries.add(_identityRegistry);
|
|
217
|
+
emit ERC3643EventsLib.IdentityRegistryBound(_identityRegistry);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function _getStorage() internal pure returns (Storage storage s) {
|
|
221
|
+
// solhint-disable-next-line no-inline-assembly
|
|
222
|
+
assembly {
|
|
223
|
+
s.slot := STORAGE_LOCATION
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
2
|
+
//
|
|
3
|
+
// :+#####%%%%%%%%%%%%%%+
|
|
4
|
+
// .-*@@@%+.:+%@@@@@%%#***%@@%=
|
|
5
|
+
// :=*%@@@#=. :#@@% *@@@%=
|
|
6
|
+
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
|
|
7
|
+
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
|
|
8
|
+
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
|
|
9
|
+
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
|
|
10
|
+
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
|
|
11
|
+
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
|
|
12
|
+
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
|
|
13
|
+
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
|
|
14
|
+
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
|
|
15
|
+
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
|
|
16
|
+
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
|
|
17
|
+
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
|
|
18
|
+
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
|
|
19
|
+
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
|
|
20
|
+
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
|
|
21
|
+
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
|
|
22
|
+
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
|
|
23
|
+
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
|
|
24
|
+
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
|
|
25
|
+
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
|
|
26
|
+
// @@@@@@+. +@@*. .+@@@@@%=.
|
|
27
|
+
// -@@@@@= =@@%: -#@@@@%+.
|
|
28
|
+
// +@@@@@. =@@@= .+@@@@@*:
|
|
29
|
+
// #@@@@#:%@@#. :*@@@@#-
|
|
30
|
+
// @@@@@%@@@= :#@@@@+.
|
|
31
|
+
// :@@@@@@@#.:#@@@%-
|
|
32
|
+
// +@@@@@@-.*@@@*:
|
|
33
|
+
// #@@@@#.=@@@+.
|
|
34
|
+
// @@@@+-%@%=
|
|
35
|
+
// :@@@#%@%=
|
|
36
|
+
// +@@@@%-
|
|
37
|
+
// :#%%=
|
|
38
|
+
//
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* NOTICE
|
|
42
|
+
*
|
|
43
|
+
* The T-REX software is licensed under a proprietary license or the GPL v.3.
|
|
44
|
+
* If you choose to receive it under the GPL v.3 license, the following applies:
|
|
45
|
+
* T-REX is a suite of smart contracts implementing the ERC-3643 standard and
|
|
46
|
+
* developed by Tokeny to manage and transfer financial assets on EVM blockchains
|
|
47
|
+
*
|
|
48
|
+
* Copyright (C) 2025, Tokeny sàrl.
|
|
49
|
+
*
|
|
50
|
+
* This program is free software: you can redistribute it and/or modify
|
|
51
|
+
* it under the terms of the GNU General Public License as published by
|
|
52
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
53
|
+
* (at your option) any later version.
|
|
54
|
+
*
|
|
55
|
+
* This program is distributed in the hope that it will be useful,
|
|
56
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
57
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
58
|
+
* GNU General Public License for more details.
|
|
59
|
+
*
|
|
60
|
+
* You should have received a copy of the GNU General Public License
|
|
61
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
pragma solidity 0.8.30;
|
|
65
|
+
|
|
66
|
+
import { IClaimIssuer } from "@onchain-id/solidity/contracts/interface/IClaimIssuer.sol";
|
|
67
|
+
import { Ownable2StepUpgradeable } from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
|
|
68
|
+
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
69
|
+
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
70
|
+
|
|
71
|
+
import { ERC3643EventsLib } from "../../ERC-3643/ERC3643EventsLib.sol";
|
|
72
|
+
import { IERC3643TrustedIssuersRegistry } from "../../ERC-3643/IERC3643TrustedIssuersRegistry.sol";
|
|
73
|
+
import { ErrorsLib } from "../../libraries/ErrorsLib.sol";
|
|
74
|
+
import { IERC173 } from "../../roles/IERC173.sol";
|
|
75
|
+
import { ITrustedIssuersRegistry } from "../interface/ITrustedIssuersRegistry.sol";
|
|
76
|
+
|
|
77
|
+
contract TrustedIssuersRegistry is ITrustedIssuersRegistry, Ownable2StepUpgradeable, IERC165 {
|
|
78
|
+
|
|
79
|
+
using EnumerableSet for EnumerableSet.AddressSet;
|
|
80
|
+
|
|
81
|
+
/// @custom:storage-location erc7201:ERC3643.storage.TrustedIssuersRegistry
|
|
82
|
+
struct Storage {
|
|
83
|
+
/// @dev Set containing all TrustedIssuers identity contract addresses.
|
|
84
|
+
EnumerableSet.AddressSet trustedIssuers;
|
|
85
|
+
|
|
86
|
+
/// @dev Mapping between a trusted issuer address and its corresponding claimTopics.
|
|
87
|
+
mapping(address issuer => uint256[]) trustedIssuerClaimTopics;
|
|
88
|
+
|
|
89
|
+
/// @dev Mapping between a claim topic and the allowed trusted issuers for it.
|
|
90
|
+
mapping(uint256 claimTopic => IClaimIssuer[]) claimTopicsToTrustedIssuers;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// keccak256(abi.encode(uint256(keccak256("ERC3643.storage.TrustedIssuersRegistry")) - 1)) & ~bytes32(uint256(0xff));
|
|
94
|
+
bytes32 private constant STORAGE_LOCATION = 0xcf1a470b7a594e056f36cedab0ef91f3f14bce049596c7dfdd4c7c9a318d5000;
|
|
95
|
+
|
|
96
|
+
constructor() {
|
|
97
|
+
_disableInitializers();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/// Functions
|
|
101
|
+
|
|
102
|
+
function init(address _owner, address[] calldata _issuers, uint256[][] calldata _issuerClaims)
|
|
103
|
+
external
|
|
104
|
+
initializer
|
|
105
|
+
{
|
|
106
|
+
require(_issuers.length == _issuerClaims.length, ErrorsLib.InvalidClaimPattern());
|
|
107
|
+
require(_issuers.length <= 5, ErrorsLib.MaxClaimIssuersReached(5));
|
|
108
|
+
__Ownable_init(_owner);
|
|
109
|
+
for (uint256 i = 0; i < _issuers.length; i++) {
|
|
110
|
+
_addTrustedIssuer(IClaimIssuer(_issuers[i]), _issuerClaims[i]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @dev See {ITrustedIssuersRegistry-addTrustedIssuer}.
|
|
116
|
+
*/
|
|
117
|
+
function addTrustedIssuer(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics)
|
|
118
|
+
external
|
|
119
|
+
override
|
|
120
|
+
onlyOwner
|
|
121
|
+
{
|
|
122
|
+
_addTrustedIssuer(_trustedIssuer, _claimTopics);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @dev See {ITrustedIssuersRegistry-removeTrustedIssuer}.
|
|
127
|
+
*/
|
|
128
|
+
function removeTrustedIssuer(IClaimIssuer _trustedIssuer) external override onlyOwner {
|
|
129
|
+
require(address(_trustedIssuer) != address(0), ErrorsLib.ZeroAddress());
|
|
130
|
+
Storage storage s = _getStorage();
|
|
131
|
+
require(s.trustedIssuers.contains(address(_trustedIssuer)), ErrorsLib.NotATrustedIssuer());
|
|
132
|
+
s.trustedIssuers.remove(address(_trustedIssuer));
|
|
133
|
+
|
|
134
|
+
uint256[] storage claimTopics = s.trustedIssuerClaimTopics[address(_trustedIssuer)];
|
|
135
|
+
|
|
136
|
+
for (uint256 claimTopicIndex = 0; claimTopicIndex < claimTopics.length; claimTopicIndex++) {
|
|
137
|
+
uint256 claimTopic = claimTopics[claimTopicIndex];
|
|
138
|
+
uint256 topicsLength = s.claimTopicsToTrustedIssuers[claimTopic].length;
|
|
139
|
+
for (uint256 i = 0; i < topicsLength; i++) {
|
|
140
|
+
if (s.claimTopicsToTrustedIssuers[claimTopic][i] == _trustedIssuer) {
|
|
141
|
+
s.claimTopicsToTrustedIssuers[claimTopic][i] =
|
|
142
|
+
s.claimTopicsToTrustedIssuers[claimTopic][topicsLength - 1];
|
|
143
|
+
s.claimTopicsToTrustedIssuers[claimTopic].pop();
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
delete s.trustedIssuerClaimTopics[address(_trustedIssuer)];
|
|
149
|
+
emit ERC3643EventsLib.TrustedIssuerRemoved(_trustedIssuer);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @dev See {ITrustedIssuersRegistry-updateIssuerClaimTopics}.
|
|
154
|
+
*/
|
|
155
|
+
function updateIssuerClaimTopics(IClaimIssuer _trustedIssuer, uint256[] calldata _claimTopics)
|
|
156
|
+
external
|
|
157
|
+
override
|
|
158
|
+
onlyOwner
|
|
159
|
+
{
|
|
160
|
+
require(address(_trustedIssuer) != address(0), ErrorsLib.ZeroAddress());
|
|
161
|
+
Storage storage s = _getStorage();
|
|
162
|
+
require(s.trustedIssuers.contains(address(_trustedIssuer)), ErrorsLib.NotATrustedIssuer());
|
|
163
|
+
require(_claimTopics.length <= 15, ErrorsLib.MaxClaimTopcisReached(15));
|
|
164
|
+
require(_claimTopics.length > 0, ErrorsLib.ClaimTopicsCannotBeEmpty());
|
|
165
|
+
|
|
166
|
+
for (uint256 i = 0; i < s.trustedIssuerClaimTopics[address(_trustedIssuer)].length; i++) {
|
|
167
|
+
uint256 claimTopic = s.trustedIssuerClaimTopics[address(_trustedIssuer)][i];
|
|
168
|
+
uint256 topicsLength = s.claimTopicsToTrustedIssuers[claimTopic].length;
|
|
169
|
+
for (uint256 j = 0; j < topicsLength; j++) {
|
|
170
|
+
if (s.claimTopicsToTrustedIssuers[claimTopic][j] == _trustedIssuer) {
|
|
171
|
+
s.claimTopicsToTrustedIssuers[claimTopic][j] =
|
|
172
|
+
s.claimTopicsToTrustedIssuers[claimTopic][topicsLength - 1];
|
|
173
|
+
s.claimTopicsToTrustedIssuers[claimTopic].pop();
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
s.trustedIssuerClaimTopics[address(_trustedIssuer)] = _claimTopics;
|
|
179
|
+
for (uint256 i = 0; i < _claimTopics.length; i++) {
|
|
180
|
+
s.claimTopicsToTrustedIssuers[_claimTopics[i]].push(_trustedIssuer);
|
|
181
|
+
}
|
|
182
|
+
emit ERC3643EventsLib.ClaimTopicsUpdated(_trustedIssuer, _claimTopics);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @dev See {ITrustedIssuersRegistry-getTrustedIssuers}.
|
|
187
|
+
*/
|
|
188
|
+
function getTrustedIssuers() external view override returns (IClaimIssuer[] memory) {
|
|
189
|
+
Storage storage s = _getStorage();
|
|
190
|
+
uint256 length = s.trustedIssuers.length();
|
|
191
|
+
IClaimIssuer[] memory result = new IClaimIssuer[](length);
|
|
192
|
+
for (uint256 i = 0; i < length; i++) {
|
|
193
|
+
result[i] = IClaimIssuer(s.trustedIssuers.at(i));
|
|
194
|
+
}
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @dev See {ITrustedIssuersRegistry-getTrustedIssuersForClaimTopic}.
|
|
200
|
+
*/
|
|
201
|
+
function getTrustedIssuersForClaimTopic(uint256 claimTopic) external view override returns (IClaimIssuer[] memory) {
|
|
202
|
+
return _getStorage().claimTopicsToTrustedIssuers[claimTopic];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @dev See {ITrustedIssuersRegistry-isTrustedIssuer}.
|
|
207
|
+
*/
|
|
208
|
+
function isTrustedIssuer(address _issuer) external view override returns (bool) {
|
|
209
|
+
return _getStorage().trustedIssuers.contains(_issuer);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @dev See {ITrustedIssuersRegistry-getTrustedIssuerClaimTopics}.
|
|
214
|
+
*/
|
|
215
|
+
function getTrustedIssuerClaimTopics(IClaimIssuer _trustedIssuer)
|
|
216
|
+
external
|
|
217
|
+
view
|
|
218
|
+
override
|
|
219
|
+
returns (uint256[] memory)
|
|
220
|
+
{
|
|
221
|
+
Storage storage s = _getStorage();
|
|
222
|
+
require(s.trustedIssuers.contains(address(_trustedIssuer)), ErrorsLib.TrustedIssuerDoesNotExist());
|
|
223
|
+
return s.trustedIssuerClaimTopics[address(_trustedIssuer)];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @dev See {ITrustedIssuersRegistry-hasClaimTopic}.
|
|
228
|
+
*/
|
|
229
|
+
function hasClaimTopic(address _issuer, uint256 _claimTopic) external view override returns (bool) {
|
|
230
|
+
Storage storage s = _getStorage();
|
|
231
|
+
uint256 length = s.trustedIssuerClaimTopics[_issuer].length;
|
|
232
|
+
uint256[] memory claimTopics = s.trustedIssuerClaimTopics[_issuer];
|
|
233
|
+
for (uint256 i = 0; i < length; i++) {
|
|
234
|
+
if (claimTopics[i] == _claimTopic) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @dev See {IERC165-supportsInterface}.
|
|
243
|
+
*/
|
|
244
|
+
function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) {
|
|
245
|
+
return interfaceId == type(IERC3643TrustedIssuersRegistry).interfaceId
|
|
246
|
+
|| interfaceId == type(IERC173).interfaceId || interfaceId == type(IERC165).interfaceId;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function _addTrustedIssuer(IClaimIssuer _trustedIssuer, uint256[] memory _claimTopics) internal {
|
|
250
|
+
require(address(_trustedIssuer) != address(0), ErrorsLib.ZeroAddress());
|
|
251
|
+
|
|
252
|
+
Storage storage s = _getStorage();
|
|
253
|
+
require(!s.trustedIssuers.contains(address(_trustedIssuer)), ErrorsLib.TrustedIssuerAlreadyExists());
|
|
254
|
+
require(_claimTopics.length > 0, ErrorsLib.TrustedClaimTopicsCannotBeEmpty());
|
|
255
|
+
require(_claimTopics.length <= 15, ErrorsLib.MaxClaimTopcisReached(15));
|
|
256
|
+
require(s.trustedIssuers.length() < 50, ErrorsLib.MaxTrustedIssuersReached(50));
|
|
257
|
+
s.trustedIssuers.add(address(_trustedIssuer));
|
|
258
|
+
s.trustedIssuerClaimTopics[address(_trustedIssuer)] = _claimTopics;
|
|
259
|
+
for (uint256 i = 0; i < _claimTopics.length; i++) {
|
|
260
|
+
s.claimTopicsToTrustedIssuers[_claimTopics[i]].push(_trustedIssuer);
|
|
261
|
+
}
|
|
262
|
+
emit ERC3643EventsLib.TrustedIssuerAdded(_trustedIssuer, _claimTopics);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function _getStorage() internal pure returns (Storage storage s) {
|
|
266
|
+
// solhint-disable-next-line no-inline-assembly
|
|
267
|
+
assembly {
|
|
268
|
+
s.slot := STORAGE_LOCATION
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
2
|
+
//
|
|
3
|
+
// :+#####%%%%%%%%%%%%%%+
|
|
4
|
+
// .-*@@@%+.:+%@@@@@%%#***%@@%=
|
|
5
|
+
// :=*%@@@#=. :#@@% *@@@%=
|
|
6
|
+
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
|
|
7
|
+
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
|
|
8
|
+
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
|
|
9
|
+
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
|
|
10
|
+
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
|
|
11
|
+
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
|
|
12
|
+
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
|
|
13
|
+
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
|
|
14
|
+
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
|
|
15
|
+
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
|
|
16
|
+
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
|
|
17
|
+
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
|
|
18
|
+
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
|
|
19
|
+
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
|
|
20
|
+
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
|
|
21
|
+
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
|
|
22
|
+
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
|
|
23
|
+
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
|
|
24
|
+
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
|
|
25
|
+
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
|
|
26
|
+
// @@@@@@+. +@@*. .+@@@@@%=.
|
|
27
|
+
// -@@@@@= =@@%: -#@@@@%+.
|
|
28
|
+
// +@@@@@. =@@@= .+@@@@@*:
|
|
29
|
+
// #@@@@#:%@@#. :*@@@@#-
|
|
30
|
+
// @@@@@%@@@= :#@@@@+.
|
|
31
|
+
// :@@@@@@@#.:#@@@%-
|
|
32
|
+
// +@@@@@@-.*@@@*:
|
|
33
|
+
// #@@@@#.=@@@+.
|
|
34
|
+
// @@@@+-%@%=
|
|
35
|
+
// :@@@#%@%=
|
|
36
|
+
// +@@@@%-
|
|
37
|
+
// :#%%=
|
|
38
|
+
//
|
|
39
|
+
/**
|
|
40
|
+
* NOTICE
|
|
41
|
+
*
|
|
42
|
+
* The T-REX software is licensed under a proprietary license or the GPL v.3.
|
|
43
|
+
* If you choose to receive it under the GPL v.3 license, the following applies:
|
|
44
|
+
* T-REX is a suite of smart contracts implementing the ERC-3643 standard and
|
|
45
|
+
* developed by Tokeny to manage and transfer financial assets on EVM blockchains
|
|
46
|
+
*
|
|
47
|
+
* Copyright (C) 2025, Tokeny sàrl.
|
|
48
|
+
*
|
|
49
|
+
* This program is free software: you can redistribute it and/or modify
|
|
50
|
+
* it under the terms of the GNU General Public License as published by
|
|
51
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
52
|
+
* (at your option) any later version.
|
|
53
|
+
*
|
|
54
|
+
* This program is distributed in the hope that it will be useful,
|
|
55
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
56
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
57
|
+
* GNU General Public License for more details.
|
|
58
|
+
*
|
|
59
|
+
* You should have received a copy of the GNU General Public License
|
|
60
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
pragma solidity 0.8.30;
|
|
64
|
+
|
|
65
|
+
import { IERC3643ClaimTopicsRegistry } from "../../ERC-3643/IERC3643ClaimTopicsRegistry.sol";
|
|
66
|
+
|
|
67
|
+
// solhint-disable-next-line no-empty-blocks
|
|
68
|
+
interface IClaimTopicsRegistry is IERC3643ClaimTopicsRegistry {
|
|
69
|
+
// functions that are not part of the original standard can be added here in future versions
|
|
70
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
2
|
+
//
|
|
3
|
+
// :+#####%%%%%%%%%%%%%%+
|
|
4
|
+
// .-*@@@%+.:+%@@@@@%%#***%@@%=
|
|
5
|
+
// :=*%@@@#=. :#@@% *@@@%=
|
|
6
|
+
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
|
|
7
|
+
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
|
|
8
|
+
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
|
|
9
|
+
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
|
|
10
|
+
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
|
|
11
|
+
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
|
|
12
|
+
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
|
|
13
|
+
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
|
|
14
|
+
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
|
|
15
|
+
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
|
|
16
|
+
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
|
|
17
|
+
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
|
|
18
|
+
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
|
|
19
|
+
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
|
|
20
|
+
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
|
|
21
|
+
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
|
|
22
|
+
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
|
|
23
|
+
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
|
|
24
|
+
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
|
|
25
|
+
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
|
|
26
|
+
// @@@@@@+. +@@*. .+@@@@@%=.
|
|
27
|
+
// -@@@@@= =@@%: -#@@@@%+.
|
|
28
|
+
// +@@@@@. =@@@= .+@@@@@*:
|
|
29
|
+
// #@@@@#:%@@#. :*@@@@#-
|
|
30
|
+
// @@@@@%@@@= :#@@@@+.
|
|
31
|
+
// :@@@@@@@#.:#@@@%-
|
|
32
|
+
// +@@@@@@-.*@@@*:
|
|
33
|
+
// #@@@@#.=@@@+.
|
|
34
|
+
// @@@@+-%@%=
|
|
35
|
+
// :@@@#%@%=
|
|
36
|
+
// +@@@@%-
|
|
37
|
+
// :#%%=
|
|
38
|
+
//
|
|
39
|
+
/**
|
|
40
|
+
* NOTICE
|
|
41
|
+
*
|
|
42
|
+
* The T-REX software is licensed under a proprietary license or the GPL v.3.
|
|
43
|
+
* If you choose to receive it under the GPL v.3 license, the following applies:
|
|
44
|
+
* T-REX is a suite of smart contracts implementing the ERC-3643 standard and
|
|
45
|
+
* developed by Tokeny to manage and transfer financial assets on EVM blockchains
|
|
46
|
+
*
|
|
47
|
+
* Copyright (C) 2025, Tokeny sàrl.
|
|
48
|
+
*
|
|
49
|
+
* This program is free software: you can redistribute it and/or modify
|
|
50
|
+
* it under the terms of the GNU General Public License as published by
|
|
51
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
52
|
+
* (at your option) any later version.
|
|
53
|
+
*
|
|
54
|
+
* This program is distributed in the hope that it will be useful,
|
|
55
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
56
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
57
|
+
* GNU General Public License for more details.
|
|
58
|
+
*
|
|
59
|
+
* You should have received a copy of the GNU General Public License
|
|
60
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
pragma solidity 0.8.30;
|
|
64
|
+
|
|
65
|
+
import { IERC3643IdentityRegistry } from "../../ERC-3643/IERC3643IdentityRegistry.sol";
|
|
66
|
+
|
|
67
|
+
interface IIdentityRegistry is IERC3643IdentityRegistry {
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @dev Disables the eligibility checks for token transfers and other operations.
|
|
71
|
+
*
|
|
72
|
+
* This function allows the token owner to disable the eligibility checks, effectively bypassing the
|
|
73
|
+
* complex verification process normally required for token operations. Once the eligibility checks
|
|
74
|
+
* are disabled, all users will be considered verified by the `isVerified` function, allowing them
|
|
75
|
+
* to interact with the token without requiring specific claims or issuer validation.
|
|
76
|
+
*
|
|
77
|
+
* Requirements:
|
|
78
|
+
* - The caller must be the owner of the contract.
|
|
79
|
+
* - The eligibility checks must not already be disabled; otherwise, the function will revert with an
|
|
80
|
+
* `EligibilityChecksDisabledAlready` error.
|
|
81
|
+
*
|
|
82
|
+
* Emits an `EligibilityChecksDisabled` event upon successful execution.
|
|
83
|
+
*/
|
|
84
|
+
function disableEligibilityChecks() external;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @dev Enables the eligibility checks for token transfers and other operations.
|
|
88
|
+
*
|
|
89
|
+
* This function allows the token owner to re-enable the eligibility checks after they have been
|
|
90
|
+
* disabled. Once re-enabled, the `isVerified` function will resume performing the full verification
|
|
91
|
+
* process, checking for the required claims and validating them through trusted issuers.
|
|
92
|
+
*
|
|
93
|
+
* Requirements:
|
|
94
|
+
* - The caller must be the owner of the contract.
|
|
95
|
+
* - The eligibility checks must currently be disabled; otherwise, the function will revert with an
|
|
96
|
+
* `EligibilityChecksEnabledAlready` error.
|
|
97
|
+
*
|
|
98
|
+
* Emits an `EligibilityChecksEnabled` event upon successful execution.
|
|
99
|
+
*/
|
|
100
|
+
function enableEligibilityChecks() external;
|
|
101
|
+
|
|
102
|
+
}
|