{"sources":{"ControlledToken.sol":{"content":"pragma solidity ^0.5.0;\r\n\r\n// openzeppelin-solidity@2.3.0 from NPM\r\n\r\n/**\r\n * @title Roles\r\n * @dev Library for managing addresses assigned to a Role.\r\n */\r\nlibrary Roles {\r\n    struct Role {\r\n        mapping (address => bool) bearer;\r\n    }\r\n\r\n    /**\r\n     * @dev Give an account access to this role.\r\n     */\r\n    function add(Role storage role, address account) internal {\r\n        require(!has(role, account), \"Roles: account already has role\");\r\n        role.bearer[account] = true;\r\n    }\r\n\r\n    /**\r\n     * @dev Remove an account's access to this role.\r\n     */\r\n    function remove(Role storage role, address account) internal {\r\n        require(has(role, account), \"Roles: account does not have role\");\r\n        role.bearer[account] = false;\r\n    }\r\n\r\n    /**\r\n     * @dev Check if an account has this role.\r\n     * @return bool\r\n     */\r\n    function has(Role storage role, address account) internal view returns (bool) {\r\n        require(account != address(0), \"Roles: account is the zero address\");\r\n        return role.bearer[account];\r\n    }\r\n}\r\n\r\ncontract OperatorRole {\r\n    using Roles for Roles.Role;\r\n\r\n    event OperatorAdded(address indexed account);\r\n    event OperatorRemoved(address indexed account);\r\n\r\n    Roles.Role private _operators;\r\n\r\n    constructor () internal {\r\n        _addOperator(msg.sender);\r\n    }\r\n\r\n    modifier onlyOperator() {\r\n        require(isOperator(msg.sender), \"OperatorRole: caller does not have the Operator role\");\r\n        _;\r\n    }\r\n\r\n    function isOperator(address account) public view returns (bool) {\r\n        return _operators.has(account);\r\n    }\r\n\r\n    function addOperator(address account) public onlyOperator {\r\n        _addOperator(account);\r\n    }\r\n\r\n    function renounceOperator() public onlyOperator {\r\n        _removeOperator(msg.sender);\r\n    }\r\n\r\n    function _addOperator(address account) internal {\r\n        _operators.add(account);\r\n        emit OperatorAdded(account);\r\n    }\r\n\r\n    function _removeOperator(address account) internal {\r\n        _operators.remove(account);\r\n        emit OperatorRemoved(account);\r\n    }\r\n}\r\n\r\ncontract MinterRole {\r\n    using Roles for Roles.Role;\r\n\r\n    event MinterAdded(address indexed account);\r\n    event MinterRemoved(address indexed account);\r\n\r\n    Roles.Role private _minters;\r\n\r\n    constructor () internal {\r\n        _addMinter(msg.sender);\r\n    }\r\n\r\n    modifier onlyMinter() {\r\n        require(isMinter(msg.sender), \"MinterRole: caller does not have the Minter role\");\r\n        _;\r\n    }\r\n\r\n    function isMinter(address account) public view returns (bool) {\r\n        return _minters.has(account);\r\n    }\r\n\r\n    function addMinter(address account) public onlyMinter {\r\n        _addMinter(account);\r\n    }\r\n\r\n    function renounceMinter() public {\r\n        _removeMinter(msg.sender);\r\n    }\r\n\r\n    function _addMinter(address account) internal {\r\n        _minters.add(account);\r\n        emit MinterAdded(account);\r\n    }\r\n\r\n    function _removeMinter(address account) internal {\r\n        _minters.remove(account);\r\n        emit MinterRemoved(account);\r\n    }\r\n}\r\n\r\ncontract CreatorRole {\r\n    using Roles for Roles.Role;\r\n\r\n    event CreatorAdded(address indexed account);\r\n    event CreatorRemoved(address indexed account);\r\n\r\n    Roles.Role private _creators;\r\n\r\n    constructor () internal {\r\n        _addCreator(msg.sender);\r\n    }\r\n\r\n    modifier onlyCreator() {\r\n        require(isCreator(msg.sender), \"CreatorRole: caller does not have the Creator role\");\r\n        _;\r\n    }\r\n\r\n    function isCreator(address account) public view returns (bool) {\r\n        return _creators.has(account);\r\n    }\r\n\r\n    function _addCreator(address account) internal {\r\n        _creators.add(account);\r\n        emit CreatorAdded(account);\r\n    }\r\n\r\n    function _removeCreator(address account) internal {\r\n        _creators.remove(account);\r\n        emit CreatorRemoved(account);\r\n    }\r\n}\r\n\r\ncontract PauserRole {\r\n    using Roles for Roles.Role;\r\n\r\n    event PauserAdded(address indexed account);\r\n    event PauserRemoved(address indexed account);\r\n\r\n    Roles.Role private _pausers;\r\n\r\n    constructor () internal {\r\n        _addPauser(msg.sender);\r\n    }\r\n\r\n    modifier onlyPauser() {\r\n        require(isPauser(msg.sender), \"PauserRole: caller does not have the Pauser role\");\r\n        _;\r\n    }\r\n\r\n    function isPauser(address account) public view returns (bool) {\r\n        return _pausers.has(account);\r\n    }\r\n\r\n    function addPauser(address account) public onlyPauser {\r\n        _addPauser(account);\r\n    }\r\n\r\n    function renouncePauser() public {\r\n        _removePauser(msg.sender);\r\n    }\r\n\r\n    function _addPauser(address account) internal {\r\n        _pausers.add(account);\r\n        emit PauserAdded(account);\r\n    }\r\n\r\n    function _removePauser(address account) internal {\r\n        _pausers.remove(account);\r\n        emit PauserRemoved(account);\r\n    }\r\n}\r\n\r\n/**\r\n * @dev Contract module which allows children to implement an emergency stop\r\n * mechanism that can be triggered by an authorized account.\r\n *\r\n * This module is used through inheritance. It will make available the\r\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\r\n * the functions of your contract. Note that they will not be pausable by\r\n * simply including this module, only once the modifiers are put in place.\r\n */\r\ncontract Pausable is PauserRole {\r\n    /**\r\n     * @dev Emitted when the pause is triggered by a pauser (`account`).\r\n     */\r\n    event Paused(address account);\r\n\r\n    /**\r\n     * @dev Emitted when the pause is lifted by a pauser (`account`).\r\n     */\r\n    event Unpaused(address account);\r\n\r\n    bool private _paused;\r\n\r\n    /**\r\n     * @dev Initializes the contract in unpaused state. Assigns the Pauser role\r\n     * to the deployer.\r\n     */\r\n    constructor () internal {\r\n        _paused = false;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns true if the contract is paused, and false otherwise.\r\n     */\r\n    function paused() public view returns (bool) {\r\n        return _paused;\r\n    }\r\n\r\n    /**\r\n     * @dev Modifier to make a function callable only when the contract is not paused.\r\n     */\r\n    modifier whenNotPaused() {\r\n        require(!_paused, \"Pausable: paused\");\r\n        _;\r\n    }\r\n\r\n    /**\r\n     * @dev Modifier to make a function callable only when the contract is paused.\r\n     */\r\n    modifier whenPaused() {\r\n        require(_paused, \"Pausable: not paused\");\r\n        _;\r\n    }\r\n\r\n    /**\r\n     * @dev Called by a pauser to pause, triggers stopped state.\r\n     */\r\n    function pause() public onlyPauser whenNotPaused {\r\n        _paused = true;\r\n        emit Paused(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev Called by a pauser to unpause, returns to normal state.\r\n     */\r\n    function unpause() public onlyPauser whenPaused {\r\n        _paused = false;\r\n        emit Unpaused(msg.sender);\r\n    }\r\n}\r\n\r\ncontract BurnerRole {\r\n    using Roles for Roles.Role;\r\n\r\n    event BurnerAdded(address indexed account);\r\n    event BurnerRemoved(address indexed account);\r\n\r\n    Roles.Role private _burners;\r\n\r\n    constructor () internal {\r\n        _addBurner(msg.sender);\r\n    }\r\n\r\n    modifier onlyBurner() {\r\n        require(isBurner(msg.sender), \"BurnerRole: caller does not have the Burner role\");\r\n        _;\r\n    }\r\n\r\n    function isBurner(address account) public view returns (bool) {\r\n        return _burners.has(account);\r\n    }\r\n\r\n    function addBurner(address account) public onlyBurner {\r\n        _addBurner(account);\r\n    }\r\n\r\n    function renounceBurner() public onlyBurner {\r\n        _removeBurner(msg.sender);\r\n    }\r\n\r\n    function _addBurner(address account) internal {\r\n        _burners.add(account);\r\n        emit BurnerAdded(account);\r\n    }\r\n\r\n    function _removeBurner(address account) internal {\r\n        _burners.remove(account);\r\n        emit BurnerRemoved(account);\r\n    }\r\n}\r\n\r\n/**\r\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\r\n * checks.\r\n *\r\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\r\n * in bugs, because programmers usually assume that an overflow raises an\r\n * error, which is the standard behavior in high level programming languages.\r\n * `SafeMath` restores this intuition by reverting the transaction when an\r\n * operation overflows.\r\n *\r\n * Using this library instead of the unchecked operations eliminates an entire\r\n * class of bugs, so it's recommended to use it always.\r\n */\r\nlibrary SafeMath {\r\n    /**\r\n     * @dev Returns the addition of two unsigned integers, reverting on\r\n     * overflow.\r\n     *\r\n     * Counterpart to Solidity's `+` operator.\r\n     *\r\n     * Requirements:\r\n     * - Addition cannot overflow.\r\n     */\r\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\r\n        uint256 c = a + b;\r\n        require(c >= a, \"SafeMath: addition overflow\");\r\n\r\n        return c;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the subtraction of two unsigned integers, reverting on\r\n     * overflow (when the result is negative).\r\n     *\r\n     * Counterpart to Solidity's `-` operator.\r\n     *\r\n     * Requirements:\r\n     * - Subtraction cannot overflow.\r\n     */\r\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\r\n        require(b <= a, \"SafeMath: subtraction overflow\");\r\n        uint256 c = a - b;\r\n\r\n        return c;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the multiplication of two unsigned integers, reverting on\r\n     * overflow.\r\n     *\r\n     * Counterpart to Solidity's `*` operator.\r\n     *\r\n     * Requirements:\r\n     * - Multiplication cannot overflow.\r\n     */\r\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\r\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\r\n        // benefit is lost if 'b' is also tested.\r\n        // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\r\n        if (a == 0) {\r\n            return 0;\r\n        }\r\n\r\n        uint256 c = a * b;\r\n        require(c / a == b, \"SafeMath: multiplication overflow\");\r\n\r\n        return c;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the integer division of two unsigned integers. Reverts on\r\n     * division by zero. The result is rounded towards zero.\r\n     *\r\n     * Counterpart to Solidity's `/` operator. Note: this function uses a\r\n     * `revert` opcode (which leaves remaining gas untouched) while Solidity\r\n     * uses an invalid opcode to revert (consuming all remaining gas).\r\n     *\r\n     * Requirements:\r\n     * - The divisor cannot be zero.\r\n     */\r\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\r\n        // Solidity only automatically asserts when dividing by 0\r\n        require(b > 0, \"SafeMath: division by zero\");\r\n        uint256 c = a / b;\r\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\r\n\r\n        return c;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\r\n     * Reverts when dividing by zero.\r\n     *\r\n     * Counterpart to Solidity's `%` operator. This function uses a `revert`\r\n     * opcode (which leaves remaining gas untouched) while Solidity uses an\r\n     * invalid opcode to revert (consuming all remaining gas).\r\n     *\r\n     * Requirements:\r\n     * - The divisor cannot be zero.\r\n     */\r\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\r\n        require(b != 0, \"SafeMath: modulo by zero\");\r\n        return a % b;\r\n    }\r\n}\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be aplied to your functions to restrict their use to\r\n * the owner.\r\n */\r\ncontract Ownable {\r\n    address private _owner;\r\n\r\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n    /**\r\n     * @dev Initializes the contract setting the deployer as the initial owner.\r\n     */\r\n    constructor () internal {\r\n        _owner = msg.sender;\r\n        emit OwnershipTransferred(address(0), _owner);\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the address of the current owner.\r\n     */\r\n    function owner() public view returns (address) {\r\n        return _owner;\r\n    }\r\n\r\n    /**\r\n     * @dev Throws if called by any account other than the owner.\r\n     */\r\n    modifier onlyOwner() {\r\n        require(isOwner(), \"Ownable: caller is not the owner\");\r\n        _;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns true if the caller is the current owner.\r\n     */\r\n    function isOwner() public view returns (bool) {\r\n        return msg.sender == _owner;\r\n    }\r\n\r\n    /**\r\n     * @dev Leaves the contract without owner. It will not be possible to call\r\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\r\n     *\r\n     * > Note: Renouncing ownership will leave the contract without an owner,\r\n     * thereby removing any functionality that is only available to the owner.\r\n     */\r\n    function renounceOwnership() public onlyOwner {\r\n        emit OwnershipTransferred(_owner, address(0));\r\n        _owner = address(0);\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     * Can only be called by the current owner.\r\n     */\r\n    function transferOwnership(address newOwner) public onlyOwner {\r\n        _transferOwnership(newOwner);\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     */\r\n    function _transferOwnership(address newOwner) internal {\r\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n        emit OwnershipTransferred(_owner, newOwner);\r\n        _owner = newOwner;\r\n    }\r\n}\r\n\r\ncontract TokenAccessList is Ownable {\r\n\r\n    string public identifier;\r\n    mapping(address => bool) private accessList;\r\n\r\n    event WalletEnabled(address indexed wallet);\r\n    event WalletDisabled(address indexed wallet);\r\n\r\n    constructor(string memory _identifier) public {\r\n        identifier = _identifier;\r\n    }\r\n\r\n    function enableWallet(address _wallet)\r\n        public\r\n        onlyOwner\r\n        {\r\n            require(_wallet != address(0), \"Invalid wallet\");\r\n            accessList[_wallet] = true;\r\n            emit WalletEnabled(_wallet);\r\n    }\r\n\r\n    function disableWallet(address _wallet)\r\n        public\r\n        onlyOwner\r\n        {\r\n            accessList[_wallet] = false;\r\n            emit WalletDisabled(_wallet);\r\n    }\r\n\r\n    function enableWalletList(address[] calldata _walletList)\r\n        external\r\n        onlyOwner {\r\n            for(uint i = 0; i < _walletList.length; i++) {\r\n                enableWallet(_walletList[i]);\r\n            }\r\n    }\r\n\r\n    function disableWalletList(address[] calldata _walletList)\r\n        external\r\n        onlyOwner {\r\n            for(uint i = 0; i < _walletList.length; i++) {\r\n                disableWallet(_walletList[i]);\r\n            }\r\n    }\r\n\r\n    function checkEnabled(address _wallet)\r\n        public\r\n        view\r\n        returns (bool) {\r\n            return _wallet == address(0) || accessList[_wallet];\r\n    }\r\n\r\n    function checkEnabledList(address _w1, address _w2, address _w3)\r\n        external\r\n        view\r\n        returns (bool) {\r\n            return checkEnabled(_w1)\r\n                && checkEnabled(_w2)\r\n                && checkEnabled(_w3);\r\n    }\r\n\r\n}\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP. Does not include\r\n * the optional functions; to access them see `ERC20Detailed`.\r\n */\r\ninterface IERC20 {\r\n    /**\r\n     * @dev Returns the amount of tokens in existence.\r\n     */\r\n    function totalSupply() external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Returns the amount of tokens owned by `account`.\r\n     */\r\n    function balanceOf(address account) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * Emits a `Transfer` event.\r\n     */\r\n    function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Returns the remaining number of tokens that `spender` will be\r\n     * allowed to spend on behalf of `owner` through `transferFrom`. This is\r\n     * zero by default.\r\n     *\r\n     * This value changes when `approve` or `transferFrom` are called.\r\n     */\r\n    function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * > Beware that changing an allowance with this method brings the risk\r\n     * that someone may use both the old and the new allowance by unfortunate\r\n     * transaction ordering. One possible solution to mitigate this race\r\n     * condition is to first reduce the spender's allowance to 0 and set the\r\n     * desired value afterwards:\r\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n     *\r\n     * Emits an `Approval` event.\r\n     */\r\n    function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n     * allowance mechanism. `amount` is then deducted from the caller's\r\n     * allowance.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * Emits a `Transfer` event.\r\n     */\r\n    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n     * another (`to`).\r\n     *\r\n     * Note that `value` may be zero.\r\n     */\r\n    event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n    /**\r\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n     * a call to `approve`. `value` is the new allowance.\r\n     */\r\n    event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}\r\n\r\n/**\r\n * @dev Implementation of the `IERC20` interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using `_mint`.\r\n * For a generic mechanism see `ERC20Mintable`.\r\n *\r\n * *For a detailed writeup see our guide [How to implement supply\r\n * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).*\r\n *\r\n * We have followed general OpenZeppelin guidelines: functions revert instead\r\n * of returning `false` on failure. This behavior is nonetheless conventional\r\n * and does not conflict with the expectations of ERC20 applications.\r\n *\r\n * Additionally, an `Approval` event is emitted on calls to `transferFrom`.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn't required by the specification.\r\n *\r\n * Finally, the non-standard `decreaseAllowance` and `increaseAllowance`\r\n * functions have been added to mitigate the well-known issues around setting\r\n * allowances. See `IERC20.approve`.\r\n */\r\ncontract ERC20 is IERC20 {\r\n    using SafeMath for uint256;\r\n\r\n    mapping (address => uint256) private _balances;\r\n\r\n    mapping (address => mapping (address => uint256)) private _allowances;\r\n\r\n    uint256 private _totalSupply;\r\n\r\n    /**\r\n     * @dev See `IERC20.totalSupply`.\r\n     */\r\n    function totalSupply() public view returns (uint256) {\r\n        return _totalSupply;\r\n    }\r\n\r\n    /**\r\n     * @dev See `IERC20.balanceOf`.\r\n     */\r\n    function balanceOf(address account) public view returns (uint256) {\r\n        return _balances[account];\r\n    }\r\n\r\n    /**\r\n     * @dev See `IERC20.transfer`.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `recipient` cannot be the zero address.\r\n     * - the caller must have a balance of at least `amount`.\r\n     */\r\n    function transfer(address recipient, uint256 amount) public returns (bool) {\r\n        _transfer(msg.sender, recipient, amount);\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev See `IERC20.allowance`.\r\n     */\r\n    function allowance(address owner, address spender) public view returns (uint256) {\r\n        return _allowances[owner][spender];\r\n    }\r\n\r\n    /**\r\n     * @dev See `IERC20.approve`.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `spender` cannot be the zero address.\r\n     */\r\n    function approve(address spender, uint256 value) public returns (bool) {\r\n        _approve(msg.sender, spender, value);\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev See `IERC20.transferFrom`.\r\n     *\r\n     * Emits an `Approval` event indicating the updated allowance. This is not\r\n     * required by the EIP. See the note at the beginning of `ERC20`;\r\n     *\r\n     * Requirements:\r\n     * - `sender` and `recipient` cannot be the zero address.\r\n     * - `sender` must have a balance of at least `value`.\r\n     * - the caller must have allowance for `sender`'s tokens of at least\r\n     * `amount`.\r\n     */\r\n    function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {\r\n        _transfer(sender, recipient, amount);\r\n        _approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\r\n     *\r\n     * This is an alternative to `approve` that can be used as a mitigation for\r\n     * problems described in `IERC20.approve`.\r\n     *\r\n     * Emits an `Approval` event indicating the updated allowance.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `spender` cannot be the zero address.\r\n     */\r\n    function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {\r\n        _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\r\n     *\r\n     * This is an alternative to `approve` that can be used as a mitigation for\r\n     * problems described in `IERC20.approve`.\r\n     *\r\n     * Emits an `Approval` event indicating the updated allowance.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `spender` cannot be the zero address.\r\n     * - `spender` must have allowance for the caller of at least\r\n     * `subtractedValue`.\r\n     */\r\n    function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {\r\n        _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev Moves tokens `amount` from `sender` to `recipient`.\r\n     *\r\n     * This is internal function is equivalent to `transfer`, and can be used to\r\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n     *\r\n     * Emits a `Transfer` event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `sender` cannot be the zero address.\r\n     * - `recipient` cannot be the zero address.\r\n     * - `sender` must have a balance of at least `amount`.\r\n     */\r\n    function _transfer(address sender, address recipient, uint256 amount) internal {\r\n        require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n        require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n\r\n        _balances[sender] = _balances[sender].sub(amount);\r\n        _balances[recipient] = _balances[recipient].add(amount);\r\n        emit Transfer(sender, recipient, amount);\r\n    }\r\n\r\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\r\n     * the total supply.\r\n     *\r\n     * Emits a `Transfer` event with `from` set to the zero address.\r\n     *\r\n     * Requirements\r\n     *\r\n     * - `to` cannot be the zero address.\r\n     */\r\n    function _mint(address account, uint256 amount) internal {\r\n        require(account != address(0), \"ERC20: mint to the zero address\");\r\n\r\n        _totalSupply = _totalSupply.add(amount);\r\n        _balances[account] = _balances[account].add(amount);\r\n        emit Transfer(address(0), account, amount);\r\n    }\r\n\r\n     /**\r\n     * @dev Destoys `amount` tokens from `account`, reducing the\r\n     * total supply.\r\n     *\r\n     * Emits a `Transfer` event with `to` set to the zero address.\r\n     *\r\n     * Requirements\r\n     *\r\n     * - `account` cannot be the zero address.\r\n     * - `account` must have at least `amount` tokens.\r\n     */\r\n    function _burn(address account, uint256 value) internal {\r\n        require(account != address(0), \"ERC20: burn from the zero address\");\r\n\r\n        _totalSupply = _totalSupply.sub(value);\r\n        _balances[account] = _balances[account].sub(value);\r\n        emit Transfer(account, address(0), value);\r\n    }\r\n\r\n    /**\r\n     * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.\r\n     *\r\n     * This is internal function is equivalent to `approve`, and can be used to\r\n     * e.g. set automatic allowances for certain subsystems, etc.\r\n     *\r\n     * Emits an `Approval` event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `owner` cannot be the zero address.\r\n     * - `spender` cannot be the zero address.\r\n     */\r\n    function _approve(address owner, address spender, uint256 value) internal {\r\n        require(owner != address(0), \"ERC20: approve from the zero address\");\r\n        require(spender != address(0), \"ERC20: approve to the zero address\");\r\n\r\n        _allowances[owner][spender] = value;\r\n        emit Approval(owner, spender, value);\r\n    }\r\n\r\n    /**\r\n     * @dev Destoys `amount` tokens from `account`.`amount` is then deducted\r\n     * from the caller's allowance.\r\n     *\r\n     * See `_burn` and `_approve`.\r\n     */\r\n    function _burnFrom(address account, uint256 amount) internal {\r\n        _burn(account, amount);\r\n        _approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));\r\n    }\r\n}\r\n\r\n/**\r\n * @dev Extension of `ERC20` allows a centralized owner to burn users' tokens\r\n *\r\n * At construction time, the deployer of the contract is the only burner.\r\n */\r\ncontract ERC20Operator is ERC20, OperatorRole {\r\n\r\n    event ForcedTransfer(address requester, address from, address to, uint256 value);\r\n\r\n    /**\r\n     * @dev new function to burn tokens from a centralized owner\r\n     * @param _from address The address which the operator wants to send tokens from\r\n     * @param _to address The address which the operator wants to transfer to\r\n     * @param _value uint256 the amount of tokens to be transferred\r\n     * @return A boolean that indicates if the operation was successful.\r\n     */\r\n    function forcedTransfer(address _from, address _to, uint256 _value)\r\n        public\r\n        onlyOperator\r\n        returns (bool) {\r\n            _transfer(_from, _to, _value);\r\n            emit ForcedTransfer(msg.sender, _from, _to, _value);\r\n            return true;\r\n    }\r\n}\r\n\r\n/**\r\n * @dev Extension of `ERC20` that adds a set of accounts with the `MinterRole`,\r\n * which have permission to mint (create) new tokens as they see fit.\r\n *\r\n * At construction, the deployer of the contract is the only minter.\r\n */\r\ncontract ERC20Mintable is ERC20, MinterRole {\r\n    /**\r\n     * @dev See `ERC20._mint`.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must have the `MinterRole`.\r\n     */\r\n    function mint(address account, uint256 amount) public onlyMinter returns (bool) {\r\n        _mint(account, amount);\r\n        return true;\r\n    }\r\n}\r\n\r\n/**\r\n * @dev Modification of OpenZeppelin's ERC20Capped. Implements a mechanism\r\n * to enable and disable cap control, as well as cap modification.\r\n */\r\ncontract ERC20CapEnabler is ERC20Mintable, CreatorRole {\r\n\r\n    uint256 public cap;\r\n    bool public capEnabled;\r\n\r\n    event CapEnabled(address sender);\r\n    event CapDisabled(address sender);\r\n    event CapSet(address sender, uint256 amount);\r\n\r\n    /**\r\n     * @dev Enable cap control on minting.\r\n     */\r\n    function enableCap()\r\n        external\r\n        onlyCreator {\r\n            capEnabled = true;\r\n            emit CapEnabled(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev Disable cap control on minting and set cap back to 0.\r\n     */\r\n    function disableCap()\r\n        external\r\n        onlyCreator {\r\n            capEnabled = false;\r\n            // set cap to 0\r\n            cap = 0;\r\n            emit CapDisabled(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev Set a new cap.\r\n     */\r\n    function setCap(uint256 _newCap)\r\n        external\r\n        onlyCreator {\r\n            cap = _newCap;\r\n            emit CapSet(msg.sender, _newCap);\r\n    }\r\n\r\n    /**\r\n     * @dev Overrides mint by checking whether cap control is enabled and\r\n     * reverting if the token addition to supply will exceed the cap.\r\n     */\r\n    function mint(address account, uint256 value)\r\n        public\r\n        onlyMinter\r\n        returns (bool) {\r\n            if (capEnabled) require(totalSupply().add(value) <= cap, \"ERC20CapEnabler: cap exceeded\");\r\n            return super.mint(account, value);\r\n    }\r\n\r\n}\r\n\r\n/**\r\n * @title Pausable token\r\n * @dev ERC20 modified with pausable transfers.\r\n */\r\ncontract ERC20Pausable is ERC20, Pausable {\r\n    function transfer(address to, uint256 value) public whenNotPaused returns (bool) {\r\n        return super.transfer(to, value);\r\n    }\r\n\r\n    function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {\r\n        return super.transferFrom(from, to, value);\r\n    }\r\n\r\n    function approve(address spender, uint256 value) public whenNotPaused returns (bool) {\r\n        return super.approve(spender, value);\r\n    }\r\n\r\n    function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool) {\r\n        return super.increaseAllowance(spender, addedValue);\r\n    }\r\n\r\n    function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool) {\r\n        return super.decreaseAllowance(spender, subtractedValue);\r\n    }\r\n}\r\n\r\n/**\r\n * ERC20 implementation that optionally allows the setup of a access list,\r\n * which may or may not be required by regulators. If a access list is\r\n * configured, then the contract starts validating parties.\r\n * Only the token creator, represented by the CreatorRole, is allowed\r\n * to add and remove the access list\r\n */\r\ncontract ERC20AccessList is ERC20Pausable, ERC20CapEnabler, ERC20Operator {\r\n\r\n    TokenAccessList public accessList;\r\n    bool public checkingAccessList;\r\n    address constant private EMPTY_ADDRESS = address(0);\r\n\r\n    /**\r\n     * Admin events\r\n     */\r\n\r\n    event AccessListSet(address accessList);\r\n    event AccessListUnset();\r\n\r\n    modifier hasAccess(address _w1, address _w2, address _w3) {\r\n        if (checkingAccessList) {\r\n            require(accessList.checkEnabledList(_w1, _w2, _w3), \"AccessList: address not authorized\");\r\n        }\r\n        _;\r\n    }\r\n\r\n    /**\r\n    * Admin functions\r\n    */\r\n\r\n    /**\r\n    * @dev Sets up the centralized accessList contract\r\n    * @param _accessList the address of accessList contract.\r\n    * @return A boolean that indicates if the operation was successful.\r\n    */\r\n    function setupAccessList(address _accessList)\r\n        public\r\n        onlyCreator {\r\n            require(_accessList != address(0), \"Invalid access list address\");\r\n            accessList = TokenAccessList(_accessList);\r\n            checkingAccessList = true;\r\n            emit AccessListSet(_accessList);\r\n    }\r\n\r\n    /**\r\n    * @dev Removes the accessList\r\n    * @return A boolean that indicates if the operation was successful.\r\n    */\r\n    function removeAccessList()\r\n        public\r\n        onlyCreator {\r\n            checkingAccessList = false;\r\n            accessList = TokenAccessList(0x0);\r\n            emit AccessListUnset();\r\n    }\r\n\r\n    /**\r\n    * @dev Overrides MintableToken mint() adding the accessList validation\r\n    * @param _to The address that will receive the minted tokens.\r\n    * @param _amount The amount of tokens to mint.\r\n    * @return A boolean that indicates if the operation was successful.\r\n    */\r\n    function mint(address _to, uint256 _amount)\r\n        public\r\n        onlyMinter\r\n        hasAccess(_to, EMPTY_ADDRESS, EMPTY_ADDRESS)\r\n        returns (bool) {\r\n            return super.mint(_to, _amount);\r\n    }\r\n\r\n    /**\r\n    * User functions\r\n    */\r\n\r\n    /**\r\n    * @dev Overrides BasicToken transfer() adding the accessList validation\r\n    * @param _to The address to transfer to.\r\n    * @param _value The amount to be transferred.\r\n    * @return A boolean that indicates if the operation was successful.\r\n    */\r\n    function transfer(address _to, uint256 _value)\r\n        public\r\n        whenNotPaused\r\n        hasAccess(msg.sender, _to, EMPTY_ADDRESS)\r\n        returns (bool) {\r\n            return super.transfer(_to, _value);\r\n    }\r\n\r\n    /**\r\n    * @dev Overrides BasicToken transfer() adding the accessList validation\r\n    * @param _to The address to transfer from.\r\n    * @param _to The address to transfer to.\r\n    * @param _value The amount to be transferred.\r\n    * @return A boolean that indicates if the operation was successful.\r\n    */\r\n    function forcedTransfer(address _from, address _to, uint256 _value)\r\n        public\r\n        whenNotPaused\r\n        hasAccess(_from, _to, EMPTY_ADDRESS)\r\n        returns (bool) {\r\n            return super.forcedTransfer(_from, _to, _value);\r\n    }\r\n\r\n    /**\r\n     * @dev Overrides StandardToken transferFrom() adding the accessList validation\r\n     * @param _from address The address which you want to send tokens from\r\n     * @param _to address The address which you want to transfer to\r\n     * @param _value uint256 the amount of tokens to be transferred\r\n     */\r\n    function transferFrom(address _from, address _to, uint256 _value)\r\n        public\r\n        whenNotPaused\r\n        hasAccess(msg.sender, _from, _to)\r\n        returns (bool) {\r\n            return super.transferFrom(_from, _to, _value);\r\n    }\r\n\r\n    /**\r\n     * @dev Overrides StandardToken approve() adding the accessList validation\r\n     * @param _spender The address which will spend the funds.\r\n     * @param _value The amount of tokens to be spent.\r\n     * @return A boolean that indicates if the operation was successful.\r\n     */\r\n    function approve(address _spender, uint256 _value)\r\n        public\r\n        whenNotPaused\r\n        hasAccess(msg.sender, _spender, EMPTY_ADDRESS)\r\n        returns (bool) {\r\n            return super.approve(_spender, _value);\r\n    }\r\n\r\n    /**\r\n     * @dev Overrides StandardToken increaseApproval() adding the accessList validation\r\n     * @param _spender The address which will spend the funds.\r\n     * @param _addedValue The amount of tokens to increase the allowance by.\r\n     * @return A boolean that indicates if the operation was successful.\r\n     */\r\n    function increaseAllowance(address _spender, uint _addedValue)\r\n        public\r\n        whenNotPaused\r\n        hasAccess(msg.sender, _spender, EMPTY_ADDRESS)\r\n        returns (bool) {\r\n            return super.increaseAllowance(_spender, _addedValue);\r\n    }\r\n\r\n    /**\r\n     * @dev Overrides StandardToken decreaseApproval() adding the accessList validation\r\n     * @param _spender The address which will spend the funds.\r\n     * @param _subtractedValue The amount of tokens to decrease the allowance by.\r\n     * @return A boolean that indicates if the operation was successful.\r\n     */\r\n    function decreaseAllowance(address _spender, uint _subtractedValue)\r\n        public\r\n        whenNotPaused\r\n        hasAccess(msg.sender, _spender, EMPTY_ADDRESS)\r\n        returns (bool) {\r\n            return super.decreaseAllowance(_spender, _subtractedValue);\r\n    }\r\n\r\n}\r\n\r\n/**\r\n * @dev Extension of `ERC20` allows a centralized owner to burn users' tokens\r\n *\r\n * At construction time, the deployer of the contract is the only burner.\r\n */\r\ncontract ERC20BurnableAdmin is ERC20, BurnerRole {\r\n\r\n    event ForcedBurn(address requester, address wallet, uint256 value);\r\n\r\n    /**\r\n     * @dev new function to burn tokens from a centralized owner\r\n     * @param _who The address which will be burned.\r\n     * @param _value The amount of tokens to burn.\r\n     * @return A boolean that indicates if the operation was successful.\r\n     */\r\n    function forcedBurn(address _who, uint256 _value)\r\n        public\r\n        onlyBurner\r\n        returns (bool) {\r\n            _burn(_who, _value);\r\n            emit ForcedBurn(msg.sender, _who, _value);\r\n            return true;\r\n    }\r\n}\r\n\r\n/**\r\n * @dev Optional functions from the ERC20 standard.\r\n */\r\ncontract ERC20Detailed is IERC20 {\r\n    string private _name;\r\n    string private _symbol;\r\n    uint8 private _decimals;\r\n\r\n    /**\r\n     * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of\r\n     * these values are immutable: they can only be set once during\r\n     * construction.\r\n     */\r\n    constructor (string memory name, string memory symbol, uint8 decimals) public {\r\n        _name = name;\r\n        _symbol = symbol;\r\n        _decimals = decimals;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the name of the token.\r\n     */\r\n    function name() public view returns (string memory) {\r\n        return _name;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the symbol of the token, usually a shorter version of the\r\n     * name.\r\n     */\r\n    function symbol() public view returns (string memory) {\r\n        return _symbol;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the number of decimals used to get its user representation.\r\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n     * be displayed to a user as `5,05` (`505 / 10 ** 2`).\r\n     *\r\n     * Tokens usually opt for a value of 18, imitating the relationship between\r\n     * Ether and Wei.\r\n     *\r\n     * > Note that this information is only used for _display_ purposes: it in\r\n     * no way affects any of the arithmetic of the contract, including\r\n     * `IERC20.balanceOf` and `IERC20.transfer`.\r\n     */\r\n    function decimals() public view returns (uint8) {\r\n        return _decimals;\r\n    }\r\n}\r\n\r\n/**\r\n * This implementation adds a control layer over the ERC20. There are four roles\r\n * (creator, pauser, minter and burner) and the token ownership. Token creator\r\n * has powers to add and remove pausers, minters and burners. Creator role is assigned\r\n * in the constructor and can only be reassigned by the owner.\r\n * The owner has the power to claim roles, as an emergency stop mechanism.\r\n */\r\n\r\ncontract ControlledToken is Ownable, ERC20Detailed, ERC20BurnableAdmin, ERC20AccessList {\r\n\r\n    string public info;\r\n\r\n    constructor(string memory _name, string memory _symbol, uint8 _decimals, string memory _info, address _creator)\r\n        public\r\n        ERC20Detailed(_name, _symbol, _decimals) {\r\n            info = _info;\r\n            // adds all roles to creator\r\n            _addCreator(_creator);\r\n            _addPauser(_creator);\r\n            _addMinter(_creator);\r\n            _addBurner(_creator);\r\n            _addOperator(_creator);\r\n            // remove all roles from token factory\r\n            _removeCreator(msg.sender);\r\n            _removePauser(msg.sender);\r\n            _removeMinter(msg.sender);\r\n            _removeBurner(msg.sender);\r\n            _removeOperator(msg.sender);\r\n        }\r\n\r\n    /**\r\n    * Platform owner functions\r\n    */\r\n\r\n    /**\r\n     * @dev claims creator role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function claimCreator(address _address)\r\n        public\r\n        onlyOwner {\r\n            _removeCreator(_address);\r\n            _addCreator(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev claims operator role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function claimOperator(address _address)\r\n        public\r\n        onlyOwner {\r\n            _removeOperator(_address);\r\n            _addOperator(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev claims minter role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function claimMinter(address _address)\r\n        public\r\n        onlyOwner {\r\n            _removeMinter(_address);\r\n            _addMinter(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev claims burner role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function claimBurner(address _address)\r\n        public\r\n        onlyOwner {\r\n            _removeBurner(_address);\r\n            _addBurner(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev claims pauser role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function claimPauser(address _address)\r\n        public\r\n        onlyOwner {\r\n            _removePauser(_address);\r\n            _addPauser(msg.sender);\r\n    }\r\n\r\n    /**\r\n     * @dev adds new creator.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function addCreator(address _address)\r\n        public\r\n        onlyOwner {\r\n            _addCreator(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev renounces to creator role\r\n     */\r\n    function renounceCreator()\r\n        public\r\n        onlyOwner {\r\n            _removeCreator(msg.sender);\r\n    }\r\n\r\n    /**\r\n    * Creator functions\r\n    */\r\n\r\n    /**\r\n     * @dev adds minter role to and address.\r\n     * @param _address The address will be added.\r\n     * Needed in case the last minter renounces the role\r\n     */\r\n    function adminAddMinter(address _address)\r\n        public\r\n        onlyCreator {\r\n            _addMinter(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev removes minter role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function removeMinter(address _address)\r\n        public\r\n        onlyCreator {\r\n            _removeMinter(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev adds pauser role to and address.\r\n     * @param _address The address will be added.\r\n     * Needed in case the last pauser renounces the role\r\n     */\r\n    function adminAddPauser(address _address)\r\n        public\r\n        onlyCreator {\r\n            _addPauser(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev removes pauser role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function removePauser(address _address)\r\n        public\r\n        onlyCreator {\r\n            _removePauser(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev adds pauser role to and address.\r\n     * @param _address The address will be added.\r\n     * Needed in case the last pauser renounces the role\r\n     */\r\n    function adminAddOperator(address _address)\r\n        public\r\n        onlyCreator {\r\n            _addOperator(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev removes operator role from an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function removeOperator(address _address)\r\n        public\r\n        onlyCreator {\r\n            _removeOperator(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev adds burner role to and address.\r\n     * @param _address The address will be added.\r\n     * Needed in case the last burner renounces the role\r\n     */\r\n    function adminAddBurner(address _address)\r\n        public\r\n        onlyCreator {\r\n            _addBurner(_address);\r\n    }\r\n\r\n    /**\r\n     * @dev removes burner role fom an address.\r\n     * @param _address The address will be removed.\r\n     */\r\n    function removeBurner(address _address)\r\n        public\r\n        onlyCreator {\r\n            _removeBurner(_address);\r\n    }\r\n\r\n}"}},"matchId":"2740356","creationMatch":"match","runtimeMatch":"match","verifiedAt":"2024-08-08T16:21:13Z","match":"match","chainId":"1","address":"0xfC98e825A2264D890F9a1e68ed50E1526abCcacD"}