Files

174 lines
8.8 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 IModule {
/// events
/**
* this event is emitted when the compliance contract is bound to the module.
* the event is emitted by the bindCompliance function
* `_compliance` is the address of the compliance contract being bound
*/
event ComplianceBound(address indexed _compliance);
/**
* this event is emitted when the compliance contract is unbound from the module.
* the event is emitted by the unbindCompliance function
* `_compliance` is the address of the compliance contract being unbound
*/
event ComplianceUnbound(address indexed _compliance);
/// functions
/**
* @dev binds the module to a compliance contract
* once the module is bound, the compliance contract can interact with the module
* this function can be called ONLY by the compliance contract itself (_compliance), through the
* addModule function, which calls bindCompliance
* the module cannot be already bound to the compliance
* @param _compliance address of the compliance contract
* Emits a ComplianceBound event
*/
function bindCompliance(address _compliance) external;
/**
* @dev unbinds the module from a compliance contract
* once the module is unbound, the compliance contract cannot interact with the module anymore
* this function can be called ONLY by the compliance contract itself (_compliance), through the
* removeModule function, which calls unbindCompliance
* @param _compliance address of the compliance contract
* Emits a ComplianceUnbound event
*/
function unbindCompliance(address _compliance) external;
/**
* @dev action performed on the module during a transfer action
* this function is used to update variables of the module upon transfer if it is required
* if the module does not require state updates in case of transfer, this function remains empty
* This function can be called ONLY by the compliance contract itself (_compliance)
* This function can be called only on a compliance contract that is bound to the module
* @param _from address of the transfer sender
* @param _to address of the transfer receiver
* @param _value amount of tokens sent
*/
function moduleTransferAction(address _from, address _to, uint256 _value) external;
/**
* @dev action performed on the module during a mint action
* this function is used to update variables of the module upon minting if it is required
* if the module does not require state updates in case of mint, this function remains empty
* This function can be called ONLY by the compliance contract itself (_compliance)
* This function can be called only on a compliance contract that is bound to the module
* @param _to address used for minting
* @param _value amount of tokens minted
*/
function moduleMintAction(address _to, uint256 _value) external;
/**
* @dev action performed on the module during a burn action
* this function is used to update variables of the module upon burning if it is required
* if the module does not require state updates in case of burn, this function remains empty
* This function can be called ONLY by the compliance contract itself (_compliance)
* This function can be called only on a compliance contract that is bound to the module
* @param _from address on which tokens are burnt
* @param _value amount of tokens burnt
*/
function moduleBurnAction(address _from, uint256 _value) external;
/**
* @dev compliance check on the module for a specific transaction on a specific compliance contract
* this function is used to check if the transfer is allowed by the module
* This function can be called only on a compliance contract that is bound to the module
* @param _from address of the transfer sender
* @param _to address of the transfer receiver
* @param _value amount of tokens sent
* @param _compliance address of the compliance contract concerned by the transfer action
* the function returns TRUE if the module allows the transfer, FALSE otherwise
*/
function moduleCheck(address _from, address _to, uint256 _value, address _compliance) external view returns (bool);
/**
* @dev getter for compliance binding status on module
* @param _compliance address of the compliance contract
*/
function isComplianceBound(address _compliance) external view returns (bool);
/**
* @dev checks whether compliance is suitable to bind to the module.
* @param _compliance address of the compliance contract
*/
function canComplianceBind(address _compliance) external view returns (bool);
/**
* @dev getter for module plug & play status
*/
function isPlugAndPlay() external pure returns (bool);
/**
* @dev getter for the name of the module
* @return _name the name of the module
*/
function name() external pure returns (string memory _name);
}