Files

189 lines
8.5 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 ICompliance {
/**
* this event is emitted when the Agent has been added on the allowedList of this Compliance.
* the event is emitted by the Compliance constructor and by the addTokenAgent function
* `_agentAddress` is the address of the Agent to add
*/
event TokenAgentAdded(address _agentAddress);
/**
* this event is emitted when the Agent has been removed from the agent list of this Compliance.
* the event is emitted by the Compliance constructor and by the removeTokenAgent function
* `_agentAddress` is the address of the Agent to remove
*/
event TokenAgentRemoved(address _agentAddress);
/**
* 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);
/**
* @dev adds an agent to the list of token agents
* @param _agentAddress address of the agent to be added
* Emits a TokenAgentAdded event
*/
function addTokenAgent(address _agentAddress) external;
/**
* @dev remove Agent from the list of token agents
* @param _agentAddress address of the agent to be removed (must be added first)
* Emits a TokenAgentRemoved event
*/
function removeTokenAgent(address _agentAddress) external;
/**
* @dev binds a token to the compliance contract
* @param _token address of the token to bind
* 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
* Emits a TokenUnbound event
*/
function unbindToken(address _token) external;
/**
* @dev function called whenever tokens are transferred
* from one wallet to another
* this function can update state variables in the compliance contract
* these state variables being used by `canTransfer` to decide if a transfer
* is compliant or not depending on the values stored in these state variables and on
* the parameters of the compliance smart contract
* @param _from The address of the sender
* @param _to The address of the receiver
* @param _amount The amount of tokens involved in the transfer
*/
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 compliance contract
* these state variables being used by `canTransfer` to decide if a transfer
* is compliant or not depending on the values stored in these state variables and on
* the parameters of the compliance smart contract
* @param _to The address of the receiver
* @param _amount The amount of tokens involved in the transfer
*/
function created(address _to, uint256 _amount) external;
/**
* @dev function called whenever tokens are destroyed
* this function can update state variables in the compliance contract
* these state variables being used by `canTransfer` to decide if a transfer
* is compliant or not depending on the values stored in these state variables and on
* the parameters of the compliance smart contract
* @param _from The address of the receiver
* @param _amount The amount of tokens involved in the transfer
*/
function destroyed(address _from, uint256 _amount) external;
/**
* @dev Returns true if the Address is in the list of token agents
* @param _agentAddress address of this agent
*/
function isTokenAgent(address _agentAddress) external view returns (bool);
/**
* @dev Returns true if the address given corresponds to a token that is bound with the Compliance contract
* @param _token address of the token
*/
function isTokenBound(address _token) external view returns (bool);
/**
* @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
*/
function canTransfer(
address _from,
address _to,
uint256 _amount
) external view returns (bool);
}