mirror of
https://github.com/luxfi/erc-3643.git
synced 2026-10-30 16:58:28 +00:00
156 lines
6.5 KiB
Solidity
156 lines
6.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;
|
|
|
|
import "../IModularCompliance.sol";
|
|
import "../../../token/IToken.sol";
|
|
import "./AbstractModuleUpgradeable.sol";
|
|
|
|
contract TestModule is AbstractModuleUpgradeable {
|
|
|
|
/// state variables
|
|
mapping(address => uint) private _complianceData;
|
|
mapping(address => bool) private _blockedTransfers;
|
|
|
|
/// functions
|
|
|
|
/**
|
|
* @dev initializes the contract and sets the initial state.
|
|
* @notice This function should only be called once during the contract deployment.
|
|
*/
|
|
function initialize() external initializer {
|
|
__AbstractModule_init();
|
|
}
|
|
|
|
function doSomething(uint _value) external onlyComplianceCall {
|
|
_complianceData[msg.sender] = _value;
|
|
}
|
|
|
|
function blockModule(bool _blocked) external onlyComplianceCall {
|
|
_blockedTransfers[msg.sender] = _blocked;
|
|
}
|
|
|
|
/**
|
|
* @dev See {IModule-moduleTransferAction}.
|
|
* no transfer action required in this module
|
|
*/
|
|
// solhint-disable-next-line no-empty-blocks
|
|
function moduleTransferAction(address /*_from*/, address /*_to*/, uint256 /*_value*/) external override onlyComplianceCall {
|
|
// Intentionally empty - no transfer action required in this test module
|
|
}
|
|
|
|
/**
|
|
* @dev See {IModule-moduleMintAction}.
|
|
* no mint action required in this module
|
|
*/
|
|
// solhint-disable-next-line no-empty-blocks
|
|
function moduleMintAction(address /*_to*/, uint256 /*_value*/) external override onlyComplianceCall {
|
|
// Intentionally empty - no mint action required in this test module
|
|
}
|
|
|
|
/**
|
|
* @dev See {IModule-moduleBurnAction}.
|
|
* no burn action required in this module
|
|
*/
|
|
// solhint-disable-next-line no-empty-blocks
|
|
function moduleBurnAction(address /*_from*/, uint256 /*_value*/) external override onlyComplianceCall {
|
|
// Intentionally empty - no burn action required in this test module
|
|
}
|
|
|
|
/**
|
|
* @dev See {IModule-moduleCheck}.
|
|
* always returns true (just a test module)
|
|
*/
|
|
function moduleCheck(
|
|
address /*_from*/,
|
|
address /*_to*/,
|
|
uint256 /*_value*/,
|
|
address _compliance
|
|
) external view override returns (bool) {
|
|
if(_blockedTransfers[_compliance]) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @dev See {IModule-canComplianceBind}.
|
|
*/
|
|
function canComplianceBind(address /*_compliance*/) external pure returns (bool) {
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @dev See {IModule-isPlugAndPlay}.
|
|
*/
|
|
function isPlugAndPlay() external pure returns (bool) {
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @dev See {IModule-name}.
|
|
*/
|
|
function name() public pure returns (string memory _name) {
|
|
return "TestModule";
|
|
}
|
|
} |