mirror of
https://github.com/luxfi/erc-3643.git
synced 2026-10-30 16:58:28 +00:00
231 lines
11 KiB
Solidity
231 lines
11 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 IModularCompliance {
|
|
|
|
/// events
|
|
|
|
/**
|
|
* @dev Event emitted for each executed interaction with a module contract.
|
|
* For gas efficiency, only the interaction calldata selector (first 4
|
|
* bytes) is included in the event. For interactions without calldata or
|
|
* whose calldata is shorter than 4 bytes, the selector will be `0`.
|
|
*/
|
|
event ModuleInteraction(address indexed target, bytes4 selector);
|
|
|
|
/**
|
|
* this event is emitted when a token has been bound to the compliance contract
|
|
* the event is emitted by the bindToken function
|
|
* `_token` is the address of the token to bind
|
|
*/
|
|
event TokenBound(address _token);
|
|
|
|
/**
|
|
* this event is emitted when a token has been unbound from the compliance contract
|
|
* the event is emitted by the unbindToken function
|
|
* `_token` is the address of the token to unbind
|
|
*/
|
|
event TokenUnbound(address _token);
|
|
|
|
/**
|
|
* this event is emitted when a module has been added to the list of modules bound to the compliance contract
|
|
* the event is emitted by the addModule function
|
|
* `_module` is the address of the compliance module
|
|
*/
|
|
event ModuleAdded(address indexed _module);
|
|
|
|
/**
|
|
* this event is emitted when a module has been removed from the list of modules bound to the compliance contract
|
|
* the event is emitted by the removeModule function
|
|
* `_module` is the address of the compliance module
|
|
*/
|
|
event ModuleRemoved(address indexed _module);
|
|
|
|
/// functions
|
|
|
|
/**
|
|
* @dev binds a token to the compliance contract
|
|
* @param _token address of the token to bind
|
|
* This function can be called ONLY by the owner of the compliance contract
|
|
* Emits a TokenBound event
|
|
*/
|
|
function bindToken(address _token) external;
|
|
|
|
/**
|
|
* @dev unbinds a token from the compliance contract
|
|
* @param _token address of the token to unbind
|
|
* This function can be called ONLY by the owner of the compliance contract
|
|
* Emits a TokenUnbound event
|
|
*/
|
|
function unbindToken(address _token) external;
|
|
|
|
/**
|
|
* @dev adds a module to the list of compliance modules
|
|
* @param _module address of the module to add
|
|
* there cannot be more than 25 modules bound to the modular compliance for gas cost reasons
|
|
* This function can be called ONLY by the owner of the compliance contract
|
|
* Emits a ModuleAdded event
|
|
*/
|
|
function addModule(address _module) external;
|
|
|
|
/**
|
|
* @dev removes a module from the list of compliance modules
|
|
* @param _module address of the module to remove
|
|
* This function can be called ONLY by the owner of the compliance contract
|
|
* Emits a ModuleRemoved event
|
|
*/
|
|
function removeModule(address _module) external;
|
|
|
|
/**
|
|
* @dev calls any function on bound modules
|
|
* can be called only on bound modules
|
|
* @param callData the bytecode for interaction with the module, abi encoded
|
|
* @param _module The address of the module
|
|
* This function can be called only by the modular compliance owner
|
|
* emits a `ModuleInteraction` event
|
|
*/
|
|
function callModuleFunction(bytes calldata callData, address _module) external;
|
|
|
|
/**
|
|
* @dev function called whenever tokens are transferred
|
|
* from one wallet to another
|
|
* this function can update state variables in the modules bound to the compliance
|
|
* these state variables being used by the module checks to decide if a transfer
|
|
* is compliant or not depending on the values stored in these state variables and on
|
|
* the parameters of the modules
|
|
* This function can be called ONLY by the token contract bound to the compliance
|
|
* @param _from The address of the sender
|
|
* @param _to The address of the receiver
|
|
* @param _amount The amount of tokens involved in the transfer
|
|
* This function calls moduleTransferAction() on each module bound to the compliance contract
|
|
*/
|
|
function transferred(
|
|
address _from,
|
|
address _to,
|
|
uint256 _amount
|
|
) external;
|
|
|
|
/**
|
|
* @dev function called whenever tokens are created on a wallet
|
|
* this function can update state variables in the modules bound to the compliance
|
|
* these state variables being used by the module checks to decide if a transfer
|
|
* is compliant or not depending on the values stored in these state variables and on
|
|
* the parameters of the modules
|
|
* This function can be called ONLY by the token contract bound to the compliance
|
|
* @param _to The address of the receiver
|
|
* @param _amount The amount of tokens involved in the minting
|
|
* This function calls moduleMintAction() on each module bound to the compliance contract
|
|
*/
|
|
function created(address _to, uint256 _amount) external;
|
|
|
|
/**
|
|
* @dev function called whenever tokens are destroyed from a wallet
|
|
* this function can update state variables in the modules bound to the compliance
|
|
* these state variables being used by the module checks to decide if a transfer
|
|
* is compliant or not depending on the values stored in these state variables and on
|
|
* the parameters of the modules
|
|
* This function can be called ONLY by the token contract bound to the compliance
|
|
* @param _from The address on which tokens are burnt
|
|
* @param _amount The amount of tokens involved in the burn
|
|
* This function calls moduleBurnAction() on each module bound to the compliance contract
|
|
*/
|
|
function destroyed(address _from, uint256 _amount) external;
|
|
|
|
/**
|
|
* @dev checks that the transfer is compliant.
|
|
* default compliance always returns true
|
|
* READ ONLY FUNCTION, this function cannot be used to increment
|
|
* counters, emit events, ...
|
|
* @param _from The address of the sender
|
|
* @param _to The address of the receiver
|
|
* @param _amount The amount of tokens involved in the transfer
|
|
* This function will call moduleCheck() on every module bound to the compliance
|
|
* If each of the module checks return TRUE, this function will return TRUE as well
|
|
* returns FALSE otherwise
|
|
*/
|
|
function canTransfer(
|
|
address _from,
|
|
address _to,
|
|
uint256 _amount
|
|
) external view returns (bool);
|
|
|
|
/**
|
|
* @dev getter for the modules bound to the compliance contract
|
|
* returns address array of module contracts bound to the compliance
|
|
*/
|
|
function getModules() external view returns (address[] memory);
|
|
|
|
/**
|
|
* @dev getter for the address of the token bound
|
|
* returns the address of the token
|
|
*/
|
|
function getTokenBound() external view returns (address);
|
|
|
|
/**
|
|
* @dev checks if a module is bound to the compliance contract
|
|
* returns true if module is bound, false otherwise
|
|
*/
|
|
function isModuleBound(address _module) external view returns (bool);
|
|
}
|