@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,158 @@
|
|
|
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
|
+
interface IModule {
|
|
66
|
+
|
|
67
|
+
/// functions
|
|
68
|
+
/**
|
|
69
|
+
* @dev binds the module to a compliance contract
|
|
70
|
+
* once the module is bound, the compliance contract can interact with the module
|
|
71
|
+
* this function can be called ONLY by the compliance contract itself (_compliance), through the
|
|
72
|
+
* addModule function, which calls bindCompliance
|
|
73
|
+
* the module cannot be already bound to the compliance
|
|
74
|
+
* @param _compliance address of the compliance contract
|
|
75
|
+
* Emits a ComplianceBound event
|
|
76
|
+
*/
|
|
77
|
+
function bindCompliance(address _compliance) external;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @dev unbinds the module from a compliance contract
|
|
81
|
+
* once the module is unbound, the compliance contract cannot interact with the module anymore
|
|
82
|
+
* this function can be called ONLY by the compliance contract itself (_compliance), through the
|
|
83
|
+
* removeModule function, which calls unbindCompliance
|
|
84
|
+
* @param _compliance address of the compliance contract
|
|
85
|
+
* Emits a ComplianceUnbound event
|
|
86
|
+
*/
|
|
87
|
+
function unbindCompliance(address _compliance) external;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @dev action performed on the module during a transfer action
|
|
91
|
+
* this function is used to update variables of the module upon transfer if it is required
|
|
92
|
+
* if the module does not require state updates in case of transfer, this function remains empty
|
|
93
|
+
* This function can be called ONLY by the compliance contract itself (_compliance)
|
|
94
|
+
* This function can be called only on a compliance contract that is bound to the module
|
|
95
|
+
* @param _from address of the transfer sender
|
|
96
|
+
* @param _to address of the transfer receiver
|
|
97
|
+
* @param _value amount of tokens sent
|
|
98
|
+
*/
|
|
99
|
+
function moduleTransferAction(address _from, address _to, uint256 _value) external;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @dev action performed on the module during a mint action
|
|
103
|
+
* this function is used to update variables of the module upon minting if it is required
|
|
104
|
+
* if the module does not require state updates in case of mint, this function remains empty
|
|
105
|
+
* This function can be called ONLY by the compliance contract itself (_compliance)
|
|
106
|
+
* This function can be called only on a compliance contract that is bound to the module
|
|
107
|
+
* @param _to address used for minting
|
|
108
|
+
* @param _value amount of tokens minted
|
|
109
|
+
*/
|
|
110
|
+
function moduleMintAction(address _to, uint256 _value) external;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @dev action performed on the module during a burn action
|
|
114
|
+
* this function is used to update variables of the module upon burning if it is required
|
|
115
|
+
* if the module does not require state updates in case of burn, this function remains empty
|
|
116
|
+
* This function can be called ONLY by the compliance contract itself (_compliance)
|
|
117
|
+
* This function can be called only on a compliance contract that is bound to the module
|
|
118
|
+
* @param _from address on which tokens are burnt
|
|
119
|
+
* @param _value amount of tokens burnt
|
|
120
|
+
*/
|
|
121
|
+
function moduleBurnAction(address _from, uint256 _value) external;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @dev compliance check on the module for a specific transaction on a specific compliance contract
|
|
125
|
+
* this function is used to check if the transfer is allowed by the module
|
|
126
|
+
* This function can be called only on a compliance contract that is bound to the module
|
|
127
|
+
* @param _from address of the transfer sender
|
|
128
|
+
* @param _to address of the transfer receiver
|
|
129
|
+
* @param _value amount of tokens sent
|
|
130
|
+
* @param _compliance address of the compliance contract concerned by the transfer action
|
|
131
|
+
* the function returns TRUE if the module allows the transfer, FALSE otherwise
|
|
132
|
+
*/
|
|
133
|
+
function moduleCheck(address _from, address _to, uint256 _value, address _compliance) external view returns (bool);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @dev getter for compliance binding status on module
|
|
137
|
+
* @param _compliance address of the compliance contract
|
|
138
|
+
*/
|
|
139
|
+
function isComplianceBound(address _compliance) external view returns (bool);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @dev checks whether compliance is suitable to bind to the module.
|
|
143
|
+
* @param _compliance address of the compliance contract
|
|
144
|
+
*/
|
|
145
|
+
function canComplianceBind(address _compliance) external view returns (bool);
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @dev getter for module plug & play status
|
|
149
|
+
*/
|
|
150
|
+
function isPlugAndPlay() external pure returns (bool);
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @dev getter for the name of the module
|
|
154
|
+
* @return _name the name of the module
|
|
155
|
+
*/
|
|
156
|
+
function name() external pure returns (string memory _name);
|
|
157
|
+
|
|
158
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
|
|
66
|
+
|
|
67
|
+
contract ModuleProxy is ERC1967Proxy {
|
|
68
|
+
|
|
69
|
+
// solhint-disable-next-line no-empty-blocks
|
|
70
|
+
constructor(address implementation, bytes memory _data) ERC1967Proxy(implementation, _data) { }
|
|
71
|
+
|
|
72
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
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
|
+
pragma solidity 0.8.30;
|
|
63
|
+
|
|
64
|
+
interface ITREXFactory {
|
|
65
|
+
|
|
66
|
+
/// Types
|
|
67
|
+
struct TokenDetails {
|
|
68
|
+
// address of the owner of all contracts
|
|
69
|
+
address owner;
|
|
70
|
+
// name of the token
|
|
71
|
+
string name;
|
|
72
|
+
// symbol / ticker of the token
|
|
73
|
+
string symbol;
|
|
74
|
+
// decimals of the token (can be between 0 and 18)
|
|
75
|
+
uint8 decimals;
|
|
76
|
+
// identity registry storage address
|
|
77
|
+
// set it to ZERO address if you want to deploy a new storage
|
|
78
|
+
// if an address is provided, please ensure that the factory is set as owner of the contract
|
|
79
|
+
address irs;
|
|
80
|
+
// ONCHAINID of the token
|
|
81
|
+
// solhint-disable-next-line var-name-mixedcase
|
|
82
|
+
address ONCHAINID;
|
|
83
|
+
// list of agents of the identity registry (can be set to an AgentManager contract)
|
|
84
|
+
address[] irAgents;
|
|
85
|
+
// list of agents of the token
|
|
86
|
+
address[] tokenAgents;
|
|
87
|
+
// modules to bind to the compliance, indexes are corresponding to the settings callData indexes
|
|
88
|
+
// if a module doesn't require settings, it can be added at the end of the array, at index > settings.length
|
|
89
|
+
address[] complianceModules;
|
|
90
|
+
// settings calls for compliance modules
|
|
91
|
+
bytes[] complianceSettings;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
struct ClaimDetails {
|
|
95
|
+
// claim topics required
|
|
96
|
+
uint256[] claimTopics;
|
|
97
|
+
// trusted issuers addresses
|
|
98
|
+
address[] issuers;
|
|
99
|
+
// claims that issuers are allowed to emit, by index, index corresponds to the `issuers` indexes
|
|
100
|
+
uint256[][] issuerClaims;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// functions
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @dev setter for implementation authority contract address
|
|
107
|
+
* the implementation authority contract contains the addresses of all implementation contracts
|
|
108
|
+
* the proxies created by the factory will use the different implementations available
|
|
109
|
+
* in the implementation authority contract
|
|
110
|
+
* Only owner can call.
|
|
111
|
+
* emits `ImplementationAuthoritySet` event
|
|
112
|
+
* @param _implementationAuthority The address of the implementation authority smart contract
|
|
113
|
+
*/
|
|
114
|
+
function setImplementationAuthority(address _implementationAuthority) external;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @dev setter for identity factory contract address
|
|
118
|
+
* the identity factory contract is used by the TREX Factory to deploy the ONCHAINID
|
|
119
|
+
* of the token in case the ONCHAINID is not specified
|
|
120
|
+
* Only owner can call.
|
|
121
|
+
* emits `IdFactorySet` event
|
|
122
|
+
* @param _idFactory The address of the identity factory contract
|
|
123
|
+
*/
|
|
124
|
+
function setIdFactory(address _idFactory) external;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @dev function used to deploy a new TREX token and set all the parameters as required by the issuer paperwork
|
|
128
|
+
* this function will deploy and set the contracts as follow :
|
|
129
|
+
* Token : deploy the token contract (proxy) and set the name, symbol, ONCHAINID, decimals, owner, agents,
|
|
130
|
+
* IR address , Compliance address
|
|
131
|
+
* Identity Registry : deploy the IR contract (proxy) and set the owner, agents,
|
|
132
|
+
* IRS address, TIR address, CTR address
|
|
133
|
+
* IRS : deploy IRS contract (proxy) if required (address set as 0 in the TokenDetails, bind IRS to IR, set owner
|
|
134
|
+
* CTR : deploy CTR contract (proxy), set required claims, set owner
|
|
135
|
+
* TIR : deploy TIR contract (proxy), set trusted issuers, set owner
|
|
136
|
+
* Compliance: deploy modular compliance, bind with token, add modules, set modules parameters, set owner
|
|
137
|
+
* All contracts are deployed using CREATE3, and therefore are deployed at a predetermined address
|
|
138
|
+
* The address can be the same on all EVM blockchains as long as this factory is deployed at the
|
|
139
|
+
* same address on each chain
|
|
140
|
+
* Only owner can call.
|
|
141
|
+
* emits `TREXSuiteDeployed` event
|
|
142
|
+
* @param _salt the salt used to make the contracts deployments with CREATE2
|
|
143
|
+
* @param _tokenDetails The details of the token to deploy (see struct TokenDetails for more details)
|
|
144
|
+
* @param _claimDetails The details of the claims and claim issuers (see struct ClaimDetails for more details)
|
|
145
|
+
* cannot add more than 5 agents on IR and 5 agents on Token
|
|
146
|
+
* cannot add more than 5 claim topics required and more than 5 trusted issuers
|
|
147
|
+
* cannot add more than 30 compliance settings transactions
|
|
148
|
+
*/
|
|
149
|
+
function deployTREXSuite(
|
|
150
|
+
string memory _salt,
|
|
151
|
+
TokenDetails calldata _tokenDetails,
|
|
152
|
+
ClaimDetails calldata _claimDetails
|
|
153
|
+
) external;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @dev function that can be used to recover the ownership of contracts owned by the factory
|
|
157
|
+
* typically used for IRS contracts owned by the factory (ownership of IRS is mandatory to call bind function)
|
|
158
|
+
* @param _contract The smart contract address
|
|
159
|
+
* @param _newOwner The address to transfer ownership to
|
|
160
|
+
* Only owner can call.
|
|
161
|
+
*/
|
|
162
|
+
function recoverContractOwnership(address _contract, address _newOwner) external;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @dev getter for implementation authority address
|
|
166
|
+
*/
|
|
167
|
+
function getImplementationAuthority() external view returns (address);
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @dev getter for identity factory address
|
|
171
|
+
*/
|
|
172
|
+
function getIdFactory() external view returns (address);
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @dev getter for token address corresponding to salt string
|
|
176
|
+
* @param _salt The salt string that was used to deploy the token
|
|
177
|
+
*/
|
|
178
|
+
function getToken(string calldata _salt) external view returns (address);
|
|
179
|
+
|
|
180
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
pragma solidity 0.8.30;
|
|
63
|
+
|
|
64
|
+
import { ITREXFactory } from "./ITREXFactory.sol";
|
|
65
|
+
|
|
66
|
+
interface ITREXGateway {
|
|
67
|
+
|
|
68
|
+
/// Types
|
|
69
|
+
struct Fee {
|
|
70
|
+
// amount of fee tokens to pay for 1 deployment
|
|
71
|
+
uint256 fee;
|
|
72
|
+
// address of the token used to pay fees
|
|
73
|
+
address feeToken;
|
|
74
|
+
// address collecting fees
|
|
75
|
+
address feeCollector;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// Functions
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @notice Sets the factory contract address used for deploying TREX smart contracts.
|
|
82
|
+
* @dev Only the owner can call this method. Emits a `FactorySet` event upon successful execution.
|
|
83
|
+
* Reverts if the provided factory address is zero.
|
|
84
|
+
* @param factory The address of the new factory contract.
|
|
85
|
+
* emits FactorySet When the new factory address is set.
|
|
86
|
+
*/
|
|
87
|
+
function setFactory(address factory) external;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @notice Sets the status for public deployments of TREX contracts.
|
|
91
|
+
* @dev Enables or disables public deployments. If the function call doesn't change the current status, it will revert.
|
|
92
|
+
* Only the owner can call this method. Emits a `PublicDeploymentStatusSet` event upon successful execution.
|
|
93
|
+
* Reverts with `PublicDeploymentAlreadyEnabled` if trying to enable when already enabled.
|
|
94
|
+
* Reverts with `PublicDeploymentAlreadyDisabled` if trying to disable when already disabled.
|
|
95
|
+
* @param _isEnabled Determines if public deployments are enabled (`true`) or disabled (`false`).
|
|
96
|
+
* emits PublicDeploymentStatusSet When the new public deployment status is set.
|
|
97
|
+
*/
|
|
98
|
+
function setPublicDeploymentStatus(bool _isEnabled) external;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @notice Transfers the ownership of the Factory contract.
|
|
102
|
+
* @dev Only the owner can call this method. Utilizes the `transferOwnership` function of the Ownable pattern.
|
|
103
|
+
* @param _newOwner Address of the new owner for the Factory contract.
|
|
104
|
+
*/
|
|
105
|
+
function transferFactoryOwnership(address _newOwner) external;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @notice Toggles the deployment fee status for TREX contracts.
|
|
109
|
+
* @dev Enables or disables the deployment fees. If the function call doesn't change the current status, it will revert.
|
|
110
|
+
* Only the owner can call this method. Emits a `DeploymentFeeEnabled` event upon successful execution.
|
|
111
|
+
* Reverts with `DeploymentFeesAlreadyEnabled` if trying to enable when already enabled.
|
|
112
|
+
* Reverts with `DeploymentFeesAlreadyDisabled` if trying to disable when already disabled.
|
|
113
|
+
* @param _isEnabled Determines if deployment fees are enabled (`true`) or disabled (`false`).
|
|
114
|
+
* emits DeploymentFeeEnabled When the new deployment fee status is set.
|
|
115
|
+
*/
|
|
116
|
+
function enableDeploymentFee(bool _isEnabled) external;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @notice Sets the deployment fee details for TREX contracts.
|
|
120
|
+
* @dev Only the owner can call this method. The function establishes the amount,
|
|
121
|
+
* token type, and collector address for the deployment fee.
|
|
122
|
+
* Reverts if either the provided `_feeToken` or `_feeCollector` address is zero.
|
|
123
|
+
* Emits a `DeploymentFeeSet` event upon successful execution.
|
|
124
|
+
* @param _fee The amount to be set as the deployment fee.
|
|
125
|
+
* @param _feeToken Address of the token used for the deployment fee.
|
|
126
|
+
* @param _feeCollector Address that will collect the deployment fees.
|
|
127
|
+
* emits DeploymentFeeSet Indicates that the deployment fee details have been successfully set.
|
|
128
|
+
*/
|
|
129
|
+
function setDeploymentFee(uint256 _fee, address _feeToken, address _feeCollector) external;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @notice Adds an address to the list of approved deployers.
|
|
133
|
+
* @dev Only an admin (owner or agent) can call this method. If the provided `deployer` address
|
|
134
|
+
* is already an approved deployer, the function will revert.
|
|
135
|
+
* Emits a `DeployerAdded` event upon successful addition.
|
|
136
|
+
* @param deployer Address to be added to the list of approved deployers.
|
|
137
|
+
* emits DeployerAdded Indicates that a new deployer address has been successfully added.
|
|
138
|
+
*/
|
|
139
|
+
function addDeployer(address deployer) external;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @notice Removes an address from the list of approved deployers.
|
|
143
|
+
* @dev Only an admin (owner or agent) can call this method. If the provided `deployer` address
|
|
144
|
+
* is not an approved deployer, the function will revert.
|
|
145
|
+
* Emits a `DeployerRemoved` event upon successful removal.
|
|
146
|
+
* @param deployer Address to be removed from the list of approved deployers.
|
|
147
|
+
* emits DeployerRemoved Indicates that a deployer address has been successfully removed.
|
|
148
|
+
*/
|
|
149
|
+
function removeDeployer(address deployer) external;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @notice Applies a fee discount to a specific deployer's address.
|
|
153
|
+
* @dev Only an admin (owner or agent) can call this method.
|
|
154
|
+
* The fee discount is expressed per 10,000 (10000 = 100%, 1000 = 10%, etc.).
|
|
155
|
+
* If the discount exceeds 10000, the function will revert. Emits a `FeeDiscountApplied` event upon successful application.
|
|
156
|
+
* @param deployer Address of the deployer to which the discount will be applied.
|
|
157
|
+
* @param discount The discount rate, expressed per 10,000.
|
|
158
|
+
* emits FeeDiscountApplied Indicates that a fee discount has been successfully applied to a deployer.
|
|
159
|
+
*/
|
|
160
|
+
function applyFeeDiscount(address deployer, uint16 discount) external;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @notice Deploys a TREX suite of contracts using provided token and claim details.
|
|
164
|
+
* @dev This function performs multiple checks before deploying:
|
|
165
|
+
* 1. If public deployments are disabled, only approved deployers can execute this function.
|
|
166
|
+
* 2. If public deployments are enabled, an external entity can deploy only on its
|
|
167
|
+
* behalf and not for other addresses unless it's an approved deployer.
|
|
168
|
+
*
|
|
169
|
+
* If deployment fees are enabled and applicable (after considering any discounts for the deployer),
|
|
170
|
+
* the fee is collected from the deployer's address.
|
|
171
|
+
*
|
|
172
|
+
* The actual TREX suite deployment is then triggered via the factory contract,
|
|
173
|
+
* and a unique salt is derived from the token owner's address and the token name for the deployment.
|
|
174
|
+
*
|
|
175
|
+
* @param _tokenDetails Struct containing details necessary for token deployment such as name, symbol, etc.
|
|
176
|
+
* @param _claimDetails Struct containing details related to claims for the token.
|
|
177
|
+
* emits GatewaySuiteDeploymentProcessed This event is emitted post-deployment, indicating the deployer, the token
|
|
178
|
+
* owner, and the fee applied.
|
|
179
|
+
*/
|
|
180
|
+
function deployTREXSuite(
|
|
181
|
+
ITREXFactory.TokenDetails memory _tokenDetails,
|
|
182
|
+
ITREXFactory.ClaimDetails memory _claimDetails
|
|
183
|
+
) external;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @notice Retrieves the current public deployment status.
|
|
187
|
+
* @dev Indicates whether public deployments of TREX contracts are currently allowed.
|
|
188
|
+
* @return A boolean value representing the public deployment status: `true` if
|
|
189
|
+
* public deployments are allowed, `false` otherwise.
|
|
190
|
+
*/
|
|
191
|
+
function getPublicDeploymentStatus() external view returns (bool);
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @notice Retrieves the address of the current Factory contract.
|
|
195
|
+
* @dev The Factory contract is responsible for deploying TREX contracts. This function allows querying its address.
|
|
196
|
+
* @return Address of the current Factory contract.
|
|
197
|
+
*/
|
|
198
|
+
function getFactory() external view returns (address);
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @notice Retrieves the current deployment fee details.
|
|
202
|
+
* @dev This function provides details about the deployment fee, including the amount, token type, and the collector address.
|
|
203
|
+
* @return Fee struct containing:
|
|
204
|
+
* - `fee`: The amount to be paid as the deployment fee.
|
|
205
|
+
* - `feeToken`: Address of the token used for the deployment fee.
|
|
206
|
+
* - `feeCollector`: Address that collects the deployment fees.
|
|
207
|
+
*/
|
|
208
|
+
function getDeploymentFee() external view returns (Fee memory);
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @notice Checks if the deployment fee is currently enabled.
|
|
212
|
+
* @dev Provides a way to determine if deployers are currently required to pay a fee when deploying TREX contracts.
|
|
213
|
+
* @return A boolean value indicating whether the deployment fee is enabled (`true`) or disabled (`false`).
|
|
214
|
+
*/
|
|
215
|
+
function isDeploymentFeeEnabled() external view returns (bool);
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @notice Checks if the provided address is an approved deployer.
|
|
219
|
+
* @dev Determines if a specific address has permissions to deploy TREX contracts.
|
|
220
|
+
* @param deployer Address to be checked for deployer permissions.
|
|
221
|
+
* @return A boolean value indicating whether the provided address is an approved deployer (`true`) or not (`false`).
|
|
222
|
+
*/
|
|
223
|
+
function isDeployer(address deployer) external view returns (bool);
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @notice Calculates the deployment fee for a given deployer after accounting for any discounts.
|
|
227
|
+
* @dev The fee discount, if any, is expressed per 10,000 (e.g., 10000 = 100%, 1000 = 10%, etc.).
|
|
228
|
+
* The final fee is derived by subtracting the discount amount from the original fee.
|
|
229
|
+
* @param deployer Address of the deployer for which the fee will be calculated.
|
|
230
|
+
* @return The calculated fee after accounting for potential discounts.
|
|
231
|
+
*/
|
|
232
|
+
function calculateFee(address deployer) external view returns (uint256);
|
|
233
|
+
|
|
234
|
+
}
|