Files

194 lines
9.6 KiB
Solidity

// SPDX-License-Identifier: GPL-3.0
//
// :+#####%%%%%%%%%%%%%%+
// .-*@@@%+.:+%@@@@@%%#***%@@%=
// :=*%@@@#=. :#@@% *@@@%=
// .-+*%@%*-.:+%@@@@@@+. -*+: .=#. :%@@@%-
// :=*@@@@%%@@@@@@@@@%@@@- .=#@@@%@%= =@@@@#.
// -=+#%@@%#*=:. :%@@@@%. -*@@#*@@@@@@@#=:- *@@@@+
// =@@%=:. :=: *@@@@@%#- =%*%@@@@#+-. =+ :%@@@%-
// -@@%. .+@@@ =+=-. @@#- +@@@%- =@@@@%:
// :@@@. .+@@#%: : .=*=-::.-%@@@+*@@= +@@@@#.
// %@@: +@%%* =%@@@@@@@@@@@#. .*@%- +@@@@*.
// #@@= .+@@@@%:=*@@@@@- :%@%: .*@@@@+
// *@@* +@@@#-@@%-:%@@* +@@#. :%@@@@-
// -@@% .:-=++*##%%%@@@@@@@@@@@@*. :@+.@@@%: .#@@+ =@@@@#:
// .@@@*-+*#%%%@@@@@@@@@@@@@@@@%%#**@@%@@@. *@=*@@# :#@%= .#@@@@#-
// -%@@@@@@@@@@@@@@@*+==-:-@@@= *@# .#@*-=*@@@@%= -%@@@* =@@@@@%-
// -+%@@@#. %@%%= -@@:+@: -@@* *@@*-:: -%@@%=. .*@@@@@#
// *@@@* +@* *@@##@@- #@*@@+ -@@= . :+@@@#: .-+@@@%+-
// +@@@%*@@:..=@@@@* .@@@* .#@#. .=+- .=%@@@*. :+#@@@@*=:
// =@@@@%@@@@@@@@@@@@@@@@@@@@@@%- :+#*. :*@@@%=. .=#@@@@%+:
// .%@@= ..... .=#@@+. .#@@@*: -*%@@@@%+.
// +@@#+===---:::... .=%@@*- +@@@+. -*@@@@@%+.
// -@@@@@@@@@@@@@@@@@@@@@@%@@@@= -@@@+ -#@@@@@#=.
// ..:::---===+++***###%%%@@@#- .#@@+ -*@@@@@#=.
// @@@@@@+. +@@*. .+@@@@@%=.
// -@@@@@= =@@%: -#@@@@%+.
// +@@@@@. =@@@= .+@@@@@*:
// #@@@@#:%@@#. :*@@@@#-
// @@@@@%@@@= :#@@@@+.
// :@@@@@@@#.:#@@@%-
// +@@@@@@-.*@@@*:
// #@@@@#.=@@@+.
// @@@@+-%@%=
// :@@@#%@%=
// +@@@@%-
// :#%%=
//
/**
* NOTICE
*
* The T-REX software is licensed under a proprietary license or the GPL v.3.
* If you choose to receive it under the GPL v.3 license, the following applies:
* T-REX is a suite of smart contracts implementing the ERC-3643 standard and
* developed by Tokeny to manage and transfer financial assets on EVM blockchains
*
* Copyright (C) 2023, Tokeny sàrl.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
pragma solidity ^0.8.17;
interface ITREXFactory {
/// Types
struct TokenDetails {
// address of the owner of all contracts
address owner;
// name of the token
string name;
// symbol / ticker of the token
string symbol;
// decimals of the token (can be between 0 and 18)
uint8 decimals;
// identity registry storage address
// set it to ZERO address if you want to deploy a new storage
// if an address is provided, please ensure that the factory is set as owner of the contract
address irs;
// ONCHAINID of the token
// solhint-disable-next-line var-name-mixedcase
address ONCHAINID;
// list of agents of the identity registry (can be set to an AgentManager contract)
address[] irAgents;
// list of agents of the token
address[] tokenAgents;
// modules to bind to the compliance, indexes are corresponding to the settings callData indexes
// if a module doesn't require settings, it can be added at the end of the array, at index > settings.length
address[] complianceModules;
// settings calls for compliance modules
bytes[] complianceSettings;
}
struct ClaimDetails {
// claim topics required
uint256[] claimTopics;
// trusted issuers addresses
address[] issuers;
// claims that issuers are allowed to emit, by index, index corresponds to the `issuers` indexes
uint256[][] issuerClaims;
}
/// events
/// event emitted whenever a single contract is deployed by the factory
event Deployed(address indexed _addr);
/// event emitted when the Identity Factory is set
event IdFactorySet(address _idFactory);
/// event emitted when the implementation authority of the factory contract is set
event ImplementationAuthoritySet(address _implementationAuthority);
/// event emitted by the factory when a full suite of T-REX contracts is deployed
event TREXSuiteDeployed(address indexed _token, address _ir, address _irs, address _tir, address _ctr, address
_mc, string indexed _salt);
/// functions
/**
* @dev setter for implementation authority contract address
* the implementation authority contract contains the addresses of all implementation contracts
* the proxies created by the factory will use the different implementations available
* in the implementation authority contract
* Only owner can call.
* emits `ImplementationAuthoritySet` event
* @param _implementationAuthority The address of the implementation authority smart contract
*/
function setImplementationAuthority(address _implementationAuthority) external;
/**
* @dev setter for identity factory contract address
* the identity factory contract is used by the TREX Factory to deploy the ONCHAINID
* of the token in case the ONCHAINID is not specified
* Only owner can call.
* emits `IdFactorySet` event
* @param _idFactory The address of the identity factory contract
*/
function setIdFactory(address _idFactory) external;
/**
* @dev function used to deploy a new TREX token and set all the parameters as required by the issuer paperwork
* this function will deploy and set the contracts as follow :
* Token : deploy the token contract (proxy) and set the name, symbol, ONCHAINID, decimals, owner, agents,
* IR address , Compliance address
* Identity Registry : deploy the IR contract (proxy) and set the owner, agents,
* IRS address, TIR address, CTR address
* IRS : deploy IRS contract (proxy) if required (address set as 0 in the TokenDetails, bind IRS to IR, set owner
* CTR : deploy CTR contract (proxy), set required claims, set owner
* TIR : deploy TIR contract (proxy), set trusted issuers, set owner
* Compliance: deploy modular compliance, bind with token, add modules, set modules parameters, set owner
* All contracts are deployed using CREATE2 opcode, and therefore are deployed at a predetermined address
* The address can be the same on all EVM blockchains as long as the factory address is the same as well
* Only owner can call.
* emits `TREXSuiteDeployed` event
* @param _salt the salt used to make the contracts deployments with CREATE2
* @param _tokenDetails The details of the token to deploy (see struct TokenDetails for more details)
* @param _claimDetails The details of the claims and claim issuers (see struct ClaimDetails for more details)
* cannot add more than 5 agents on IR and 5 agents on Token
* cannot add more than 5 claim topics required and more than 5 trusted issuers
* cannot add more than 30 compliance settings transactions
*/
function deployTREXSuite(
string memory _salt,
TokenDetails calldata _tokenDetails,
ClaimDetails calldata _claimDetails) external;
/**
* @dev function that can be used to recover the ownership of contracts owned by the factory
* typically used for IRS contracts owned by the factory (ownership of IRS is mandatory to call bind function)
* @param _contract The smart contract address
* @param _newOwner The address to transfer ownership to
* Only owner can call.
*/
function recoverContractOwnership(address _contract, address _newOwner) external;
/**
* @dev getter for implementation authority address
*/
function getImplementationAuthority() external view returns(address);
/**
* @dev getter for identity factory address
*/
function getIdFactory() external view returns(address);
/**
* @dev getter for token address corresponding to salt string
* @param _salt The salt string that was used to deploy the token
*/
function getToken(string calldata _salt) external view returns(address);
}