{"sources":{"EURSToken.sol":{"content":"/**\r\n * EURS Token Smart Contract: EIP-20 compatible token smart contract that\r\n * manages EURS tokens.\r\n */\r\n\r\n/*\r\n * Safe Math Smart Contract.\r\n * Copyright (c) 2018 by STSS (Malta) Limited.\r\n * Contact: <tech@stasis.net>\r\n */\r\npragma solidity ^0.4.20;\r\n\r\n/**\r\n * Provides methods to safely add, subtract and multiply uint256 numbers.\r\n */\r\ncontract SafeMath {\r\n  uint256 constant private MAX_UINT256 =\r\n    0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;\r\n\r\n  /**\r\n   * Add two uint256 values, throw in case of overflow.\r\n   *\r\n   * @param x first value to add\r\n   * @param y second value to add\r\n   * @return x + y\r\n   */\r\n  function safeAdd (uint256 x, uint256 y)\r\n  pure internal\r\n  returns (uint256 z) {\r\n    assert (x <= MAX_UINT256 - y);\r\n    return x + y;\r\n  }\r\n\r\n  /**\r\n   * Subtract one uint256 value from another, throw in case of underflow.\r\n   *\r\n   * @param x value to subtract from\r\n   * @param y value to subtract\r\n   * @return x - y\r\n   */\r\n  function safeSub (uint256 x, uint256 y)\r\n  pure internal\r\n  returns (uint256 z) {\r\n    assert (x >= y);\r\n    return x - y;\r\n  }\r\n\r\n  /**\r\n   * Multiply two uint256 values, throw in case of overflow.\r\n   *\r\n   * @param x first value to multiply\r\n   * @param y second value to multiply\r\n   * @return x * y\r\n   */\r\n  function safeMul (uint256 x, uint256 y)\r\n  pure internal\r\n  returns (uint256 z) {\r\n    if (y == 0) return 0; // Prevent division by zero at the next line\r\n    assert (x <= MAX_UINT256 / y);\r\n    return x * y;\r\n  }\r\n}\r\n/*\r\n * EIP-20 Standard Token Smart Contract Interface.\r\n * Copyright (c) 2018 by STSS (Malta) Limited.\r\n * Contact: <tech@stasis.net>\r\n\r\n * ERC-20 standard token interface, as defined\r\n * <a href=\"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md\">here</a>.\r\n */\r\ncontract Token {\r\n  /**\r\n   * Get total number of tokens in circulation.\r\n   *\r\n   * @return total number of tokens in circulation\r\n   */\r\n  function totalSupply () public view returns (uint256 supply);\r\n\r\n  /**\r\n   * Get number of tokens currently belonging to given owner.\r\n   *\r\n   * @param _owner address to get number of tokens currently belonging to the\r\n   *        owner of\r\n   * @return number of tokens currently belonging to the owner of given address\r\n   */\r\n  function balanceOf (address _owner) public view returns (uint256 balance);\r\n\r\n  /**\r\n   * Transfer given number of tokens from message sender to given recipient.\r\n   *\r\n   * @param _to address to transfer tokens to the owner of\r\n   * @param _value number of tokens to transfer to the owner of given address\r\n   * @return true if tokens were transferred successfully, false otherwise\r\n   */\r\n  function transfer (address _to, uint256 _value)\r\n  public payable returns (bool success);\r\n\r\n  /**\r\n   * Transfer given number of tokens from given owner to given recipient.\r\n   *\r\n   * @param _from address to transfer tokens from the owner of\r\n   * @param _to address to transfer tokens to the owner of\r\n   * @param _value number of tokens to transfer from given owner to given\r\n   *        recipient\r\n   * @return true if tokens were transferred successfully, false otherwise\r\n   */\r\n  function transferFrom (address _from, address _to, uint256 _value)\r\n  public payable returns (bool success);\r\n\r\n  /**\r\n   * Allow given spender to transfer given number of tokens from message sender.\r\n   *\r\n   * @param _spender address to allow the owner of to transfer tokens from\r\n   *        message sender\r\n   * @param _value number of tokens to allow to transfer\r\n   * @return true if token transfer was successfully approved, false otherwise\r\n   */\r\n  function approve (address _spender, uint256 _value)\r\n  public payable returns (bool success);\r\n\r\n  /**\r\n   * Tell how many tokens given spender is currently allowed to transfer from\r\n   * given owner.\r\n   *\r\n   * @param _owner address to get number of tokens allowed to be transferred\r\n   *        from the owner of\r\n   * @param _spender address to get number of tokens allowed to be transferred\r\n   *        by the owner of\r\n   * @return number of tokens given spender is currently allowed to transfer\r\n   *         from given owner\r\n   */\r\n  function allowance (address _owner, address _spender)\r\n  public view returns (uint256 remaining);\r\n\r\n  /**\r\n   * Logged when tokens were transferred from one owner to another.\r\n   *\r\n   * @param _from address of the owner, tokens were transferred from\r\n   * @param _to address of the owner, tokens were transferred to\r\n   * @param _value number of tokens transferred\r\n   */\r\n  event Transfer (address indexed _from, address indexed _to, uint256 _value);\r\n\r\n  /**\r\n   * Logged when owner approved his tokens to be transferred by some spender.\r\n   *\r\n   * @param _owner owner who approved his tokens to be transferred\r\n   * @param _spender spender who were allowed to transfer the tokens belonging\r\n   *        to the owner\r\n   * @param _value number of tokens belonging to the owner, approved to be\r\n   *        transferred by the spender\r\n   */\r\n  event Approval (\r\n    address indexed _owner, address indexed _spender, uint256 _value);\r\n}\r\n/*\r\n * Abstract Token Smart Contract.\r\n * Copyright (c) 2018 by STSS (Malta) Limited.\r\n * Contact: <tech@stasis.net>\r\n\r\n * Abstract Token Smart Contract that could be used as a base contract for\r\n * ERC-20 token contracts.\r\n */\r\ncontract AbstractToken is Token, SafeMath {\r\n  /**\r\n   * Create new Abstract Token contract.\r\n   */\r\n  function AbstractToken () public {\r\n    // Do nothing\r\n  }\r\n\r\n  /**\r\n   * Get number of tokens currently belonging to given owner.\r\n   *\r\n   * @param _owner address to get number of tokens currently belonging to the\r\n   *        owner of\r\n   * @return number of tokens currently belonging to the owner of given address\r\n   */\r\n  function balanceOf (address _owner) public view returns (uint256 balance) {\r\n    return accounts [_owner];\r\n  }\r\n\r\n  /**\r\n   * Transfer given number of tokens from message sender to given recipient.\r\n   *\r\n   * @param _to address to transfer tokens to the owner of\r\n   * @param _value number of tokens to transfer to the owner of given address\r\n   * @return true if tokens were transferred successfully, false otherwise\r\n   */\r\n  function transfer (address _to, uint256 _value)\r\n  public payable returns (bool success) {\r\n    uint256 fromBalance = accounts [msg.sender];\r\n    if (fromBalance < _value) return false;\r\n    if (_value > 0 && msg.sender != _to) {\r\n      accounts [msg.sender] = safeSub (fromBalance, _value);\r\n      accounts [_to] = safeAdd (accounts [_to], _value);\r\n    }\r\n    Transfer (msg.sender, _to, _value);\r\n    return true;\r\n  }\r\n\r\n  /**\r\n   * Transfer given number of tokens from given owner to given recipient.\r\n   *\r\n   * @param _from address to transfer tokens from the owner of\r\n   * @param _to address to transfer tokens to the owner of\r\n   * @param _value number of tokens to transfer from given owner to given\r\n   *        recipient\r\n   * @return true if tokens were transferred successfully, false otherwise\r\n   */\r\n  function transferFrom (address _from, address _to, uint256 _value)\r\n  public payable returns (bool success) {\r\n    uint256 spenderAllowance = allowances [_from][msg.sender];\r\n    if (spenderAllowance < _value) return false;\r\n    uint256 fromBalance = accounts [_from];\r\n    if (fromBalance < _value) return false;\r\n\r\n    allowances [_from][msg.sender] =\r\n      safeSub (spenderAllowance, _value);\r\n\r\n    if (_value > 0 && _from != _to) {\r\n      accounts [_from] = safeSub (fromBalance, _value);\r\n      accounts [_to] = safeAdd (accounts [_to], _value);\r\n    }\r\n    Transfer (_from, _to, _value);\r\n    return true;\r\n  }\r\n\r\n  /**\r\n   * Allow given spender to transfer given number of tokens from message sender.\r\n   *\r\n   * @param _spender address to allow the owner of to transfer tokens from\r\n   *        message sender\r\n   * @param _value number of tokens to allow to transfer\r\n   * @return true if token transfer was successfully approved, false otherwise\r\n   */\r\n  function approve (address _spender, uint256 _value)\r\n  public payable returns (bool success) {\r\n    allowances [msg.sender][_spender] = _value;\r\n    Approval (msg.sender, _spender, _value);\r\n\r\n    return true;\r\n  }\r\n\r\n  /**\r\n   * Tell how many tokens given spender is currently allowed to transfer from\r\n   * given owner.\r\n   *\r\n   * @param _owner address to get number of tokens allowed to be transferred\r\n   *        from the owner of\r\n   * @param _spender address to get number of tokens allowed to be transferred\r\n   *        by the owner of\r\n   * @return number of tokens given spender is currently allowed to transfer\r\n   *         from given owner\r\n   */\r\n  function allowance (address _owner, address _spender)\r\n  public view returns (uint256 remaining) {\r\n    return allowances [_owner][_spender];\r\n  }\r\n\r\n  /**\r\n   * Mapping from addresses of token holders to the numbers of tokens belonging\r\n   * to these token holders.\r\n   */\r\n  mapping (address => uint256) internal accounts;\r\n\r\n  /**\r\n   * Mapping from addresses of token holders to the mapping of addresses of\r\n   * spenders to the allowances set by these token holders to these spenders.\r\n   */\r\n  mapping (address => mapping (address => uint256)) internal allowances;\r\n}\r\n\r\n/*\r\n * EURS Token Smart Contract.\r\n * Copyright (c) 2018 by STSS (Malta) Limited.\r\n * Contact: <tech@stasis.net>\r\n */\r\n\r\ncontract EURSToken is AbstractToken {\r\n  /**\r\n   * Fee denominator (0.001%).\r\n   */\r\n  uint256 constant internal FEE_DENOMINATOR = 100000;\r\n\r\n  /**\r\n   * Maximum fee numerator (100%).\r\n   */\r\n  uint256 constant internal MAX_FEE_NUMERATOR = FEE_DENOMINATOR;\r\n\r\n  /**\r\n   * Minimum fee numerator (0%).\r\n   */\r\n  uint256 constant internal MIN_FEE_NUMERATIOR = 0;\r\n\r\n  /**\r\n   * Maximum allowed number of tokens in circulation.\r\n   */\r\n  uint256 constant internal MAX_TOKENS_COUNT =\r\n    0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff /\r\n    MAX_FEE_NUMERATOR;\r\n\r\n  /**\r\n   * Default transfer fee.\r\n   */\r\n  uint256 constant internal DEFAULT_FEE = 5e2;\r\n\r\n  /**\r\n   * Address flag that marks black listed addresses.\r\n   */\r\n  uint256 constant internal BLACK_LIST_FLAG = 0x01;\r\n\r\n  /**\r\n   * Address flag that marks zero fee addresses.\r\n   */\r\n  uint256 constant internal ZERO_FEE_FLAG = 0x02;\r\n\r\n  modifier delegatable {\r\n    if (delegate == address (0)) {\r\n      require (msg.value == 0); // Non payable if not delegated\r\n      _;\r\n    } else {\r\n      assembly {\r\n        // Save owner\r\n        let oldOwner := sload (owner_slot)\r\n\r\n        // Save delegate\r\n        let oldDelegate := sload (delegate_slot)\r\n\r\n        // Solidity stores address of the beginning of free memory at 0x40\r\n        let buffer := mload (0x40)\r\n\r\n        // Copy message call data into buffer\r\n        calldatacopy (buffer, 0, calldatasize)\r\n\r\n        // Lets call our delegate\r\n        let result := delegatecall (gas, oldDelegate, buffer, calldatasize, buffer, 0)\r\n\r\n        // Check, whether owner was changed\r\n        switch eq (oldOwner, sload (owner_slot))\r\n        case 1 {} // Owner was not changed, fine\r\n        default {revert (0, 0) } // Owner was changed, revert!\r\n\r\n        // Check, whether delegate was changed\r\n        switch eq (oldDelegate, sload (delegate_slot))\r\n        case 1 {} // Delegate was not changed, fine\r\n        default {revert (0, 0) } // Delegate was changed, revert!\r\n\r\n        // Copy returned value into buffer\r\n        returndatacopy (buffer, 0, returndatasize)\r\n\r\n        // Check call status\r\n        switch result\r\n        case 0 { revert (buffer, returndatasize) } // Call failed, revert!\r\n        default { return (buffer, returndatasize) } // Call succeeded, return\r\n      }\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Create EURS Token smart contract with message sender as an owner.\r\n   *\r\n   * @param _feeCollector address fees are sent to\r\n   */\r\n  function EURSToken (address _feeCollector) public {\r\n    fixedFee = DEFAULT_FEE;\r\n    minVariableFee = 0;\r\n    maxVariableFee = 0;\r\n    variableFeeNumerator = 0;\r\n\r\n    owner = msg.sender;\r\n    feeCollector = _feeCollector;\r\n  }\r\n\r\n  /**\r\n   * Delegate unrecognized functions.\r\n   */\r\n  function () public delegatable payable {\r\n    revert (); // Revert if not delegated\r\n  }\r\n\r\n  /**\r\n   * Get name of the token.\r\n   *\r\n   * @return name of the token\r\n   */\r\n  function name () public delegatable view returns (string) {\r\n    return \"STASIS EURS Token\";\r\n  }\r\n\r\n  /**\r\n   * Get symbol of the token.\r\n   *\r\n   * @return symbol of the token\r\n   */\r\n  function symbol () public delegatable view returns (string) {\r\n    return \"EURS\";\r\n  }\r\n\r\n  /**\r\n   * Get number of decimals for the token.\r\n   *\r\n   * @return number of decimals for the token\r\n   */\r\n  function decimals () public delegatable view returns (uint8) {\r\n    return 2;\r\n  }\r\n\r\n  /**\r\n   * Get total number of tokens in circulation.\r\n   *\r\n   * @return total number of tokens in circulation\r\n   */\r\n  function totalSupply () public delegatable view returns (uint256) {\r\n    return tokensCount;\r\n  }\r\n\r\n  /**\r\n   * Get number of tokens currently belonging to given owner.\r\n   *\r\n   * @param _owner address to get number of tokens currently belonging to the\r\n   *        owner of\r\n   * @return number of tokens currently belonging to the owner of given address\r\n   */\r\n  function balanceOf (address _owner)\r\n    public delegatable view returns (uint256 balance) {\r\n    return AbstractToken.balanceOf (_owner);\r\n  }\r\n\r\n  /**\r\n   * Transfer given number of tokens from message sender to given recipient.\r\n   *\r\n   * @param _to address to transfer tokens to the owner of\r\n   * @param _value number of tokens to transfer to the owner of given address\r\n   * @return true if tokens were transferred successfully, false otherwise\r\n   */\r\n  function transfer (address _to, uint256 _value)\r\n  public delegatable payable returns (bool) {\r\n    if (frozen) return false;\r\n    else if (\r\n      (addressFlags [msg.sender] | addressFlags [_to]) & BLACK_LIST_FLAG ==\r\n      BLACK_LIST_FLAG)\r\n      return false;\r\n    else {\r\n      uint256 fee =\r\n        (addressFlags [msg.sender] | addressFlags [_to]) & ZERO_FEE_FLAG == ZERO_FEE_FLAG ?\r\n          0 :\r\n          calculateFee (_value);\r\n\r\n      if (_value <= accounts [msg.sender] &&\r\n          fee <= safeSub (accounts [msg.sender], _value)) {\r\n        require (AbstractToken.transfer (_to, _value));\r\n        require (AbstractToken.transfer (feeCollector, fee));\r\n        return true;\r\n      } else return false;\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Transfer given number of tokens from given owner to given recipient.\r\n   *\r\n   * @param _from address to transfer tokens from the owner of\r\n   * @param _to address to transfer tokens to the owner of\r\n   * @param _value number of tokens to transfer from given owner to given\r\n   *        recipient\r\n   * @return true if tokens were transferred successfully, false otherwise\r\n   */\r\n  function transferFrom (address _from, address _to, uint256 _value)\r\n  public delegatable payable returns (bool) {\r\n    if (frozen) return false;\r\n    else if (\r\n      (addressFlags [_from] | addressFlags [_to]) & BLACK_LIST_FLAG ==\r\n      BLACK_LIST_FLAG)\r\n      return false;\r\n    else {\r\n      uint256 fee =\r\n        (addressFlags [_from] | addressFlags [_to]) & ZERO_FEE_FLAG == ZERO_FEE_FLAG ?\r\n          0 :\r\n          calculateFee (_value);\r\n\r\n      if (_value <= allowances [_from][msg.sender] &&\r\n          fee <= safeSub (allowances [_from][msg.sender], _value) &&\r\n          _value <= accounts [_from] &&\r\n          fee <= safeSub (accounts [_from], _value)) {\r\n        require (AbstractToken.transferFrom (_from, _to, _value));\r\n        require (AbstractToken.transferFrom (_from, feeCollector, fee));\r\n        return true;\r\n      } else return false;\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Allow given spender to transfer given number of tokens from message sender.\r\n   *\r\n   * @param _spender address to allow the owner of to transfer tokens from\r\n   *        message sender\r\n   * @param _value number of tokens to allow to transfer\r\n   * @return true if token transfer was successfully approved, false otherwise\r\n   */\r\n  function approve (address _spender, uint256 _value)\r\n  public delegatable payable returns (bool success) {\r\n    return AbstractToken.approve (_spender, _value);\r\n  }\r\n\r\n  /**\r\n   * Tell how many tokens given spender is currently allowed to transfer from\r\n   * given owner.\r\n   *\r\n   * @param _owner address to get number of tokens allowed to be transferred\r\n   *        from the owner of\r\n   * @param _spender address to get number of tokens allowed to be transferred\r\n   *        by the owner of\r\n   * @return number of tokens given spender is currently allowed to transfer\r\n   *         from given owner\r\n   */\r\n  function allowance (address _owner, address _spender)\r\n  public delegatable view returns (uint256 remaining) {\r\n    return AbstractToken.allowance (_owner, _spender);\r\n  }\r\n\r\n  /**\r\n   * Transfer given number of token from the signed defined by digital signature\r\n   * to given recipient.\r\n   *\r\n   * @param _to address to transfer token to the owner of\r\n   * @param _value number of tokens to transfer\r\n   * @param _fee number of tokens to give to message sender\r\n   * @param _nonce nonce of the transfer\r\n   * @param _v parameter V of digital signature\r\n   * @param _r parameter R of digital signature\r\n   * @param _s parameter S of digital signature\r\n   */\r\n  function delegatedTransfer (\r\n    address _to, uint256 _value, uint256 _fee,\r\n    uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s)\r\n  public delegatable payable returns (bool) {\r\n    if (frozen) return false;\r\n    else {\r\n      address _from = ecrecover (\r\n        keccak256 (\r\n          thisAddress (), messageSenderAddress (), _to, _value, _fee, _nonce),\r\n        _v, _r, _s);\r\n\r\n      if (_nonce != nonces [_from]) return false;\r\n\r\n      if (\r\n        (addressFlags [_from] | addressFlags [_to]) & BLACK_LIST_FLAG ==\r\n        BLACK_LIST_FLAG)\r\n        return false;\r\n\r\n      uint256 fee =\r\n        (addressFlags [_from] | addressFlags [_to]) & ZERO_FEE_FLAG == ZERO_FEE_FLAG ?\r\n          0 :\r\n          calculateFee (_value);\r\n\r\n      uint256 balance = accounts [_from];\r\n      if (_value > balance) return false;\r\n      balance = safeSub (balance, _value);\r\n      if (fee > balance) return false;\r\n      balance = safeSub (balance, fee);\r\n      if (_fee > balance) return false;\r\n      balance = safeSub (balance, _fee);\r\n\r\n      nonces [_from] = _nonce + 1;\r\n\r\n      accounts [_from] = balance;\r\n      accounts [_to] = safeAdd (accounts [_to], _value);\r\n      accounts [feeCollector] = safeAdd (accounts [feeCollector], fee);\r\n      accounts [msg.sender] = safeAdd (accounts [msg.sender], _fee);\r\n\r\n      Transfer (_from, _to, _value);\r\n      Transfer (_from, feeCollector, fee);\r\n      Transfer (_from, msg.sender, _fee);\r\n\r\n      return true;\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Create tokens.\r\n   *\r\n   * @param _value number of tokens to be created.\r\n   */\r\n  function createTokens (uint256 _value)\r\n  public delegatable payable returns (bool) {\r\n    require (msg.sender == owner);\r\n\r\n    if (_value > 0) {\r\n      if (_value <= safeSub (MAX_TOKENS_COUNT, tokensCount)) {\r\n        accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);\r\n        tokensCount = safeAdd (tokensCount, _value);\r\n\r\n        Transfer (address (0), msg.sender, _value);\r\n\r\n        return true;\r\n      } else return false;\r\n    } else return true;\r\n  }\r\n\r\n  /**\r\n   * Burn tokens.\r\n   *\r\n   * @param _value number of tokens to burn\r\n   */\r\n  function burnTokens (uint256 _value)\r\n  public delegatable payable returns (bool) {\r\n    require (msg.sender == owner);\r\n\r\n    if (_value > 0) {\r\n      if (_value <= accounts [msg.sender]) {\r\n        accounts [msg.sender] = safeSub (accounts [msg.sender], _value);\r\n        tokensCount = safeSub (tokensCount, _value);\r\n\r\n        Transfer (msg.sender, address (0), _value);\r\n\r\n        return true;\r\n      } else return false;\r\n    } else return true;\r\n  }\r\n\r\n  /**\r\n   * Freeze token transfers.\r\n   */\r\n  function freezeTransfers () public delegatable payable {\r\n    require (msg.sender == owner);\r\n\r\n    if (!frozen) {\r\n      frozen = true;\r\n\r\n      Freeze ();\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Unfreeze token transfers.\r\n   */\r\n  function unfreezeTransfers () public delegatable payable {\r\n    require (msg.sender == owner);\r\n\r\n    if (frozen) {\r\n      frozen = false;\r\n\r\n      Unfreeze ();\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Set smart contract owner.\r\n   *\r\n   * @param _newOwner address of the new owner\r\n   */\r\n  function setOwner (address _newOwner) public {\r\n    require (msg.sender == owner);\r\n\r\n    owner = _newOwner;\r\n  }\r\n\r\n  /**\r\n   * Set fee collector.\r\n   *\r\n   * @param _newFeeCollector address of the new fee collector\r\n   */\r\n  function setFeeCollector (address _newFeeCollector)\r\n  public delegatable payable {\r\n    require (msg.sender == owner);\r\n\r\n    feeCollector = _newFeeCollector;\r\n  }\r\n\r\n  /**\r\n   * Get current nonce for token holder with given address, i.e. nonce this\r\n   * token holder should use for next delegated transfer.\r\n   *\r\n   * @param _owner address of the token holder to get nonce for\r\n   * @return current nonce for token holder with give address\r\n   */\r\n  function nonce (address _owner) public view delegatable returns (uint256) {\r\n    return nonces [_owner];\r\n  }\r\n\r\n  /**\r\n   * Set fee parameters.\r\n   *\r\n   * @param _fixedFee fixed fee in token units\r\n   * @param _minVariableFee minimum variable fee in token units\r\n   * @param _maxVariableFee maximum variable fee in token units\r\n   * @param _variableFeeNumerator variable fee numerator\r\n   */\r\n  function setFeeParameters (\r\n    uint256 _fixedFee,\r\n    uint256 _minVariableFee,\r\n    uint256 _maxVariableFee,\r\n    uint256 _variableFeeNumerator) public delegatable payable {\r\n    require (msg.sender == owner);\r\n\r\n    require (_minVariableFee <= _maxVariableFee);\r\n    require (_variableFeeNumerator <= MAX_FEE_NUMERATOR);\r\n\r\n    fixedFee = _fixedFee;\r\n    minVariableFee = _minVariableFee;\r\n    maxVariableFee = _maxVariableFee;\r\n    variableFeeNumerator = _variableFeeNumerator;\r\n\r\n    FeeChange (\r\n      _fixedFee, _minVariableFee, _maxVariableFee, _variableFeeNumerator);\r\n  }\r\n\r\n  /**\r\n   * Get fee parameters.\r\n   *\r\n   * @return fee parameters\r\n   */\r\n  function getFeeParameters () public delegatable view returns (\r\n    uint256 _fixedFee,\r\n    uint256 _minVariableFee,\r\n    uint256 _maxVariableFee,\r\n    uint256 _variableFeeNumnerator) {\r\n    _fixedFee = fixedFee;\r\n    _minVariableFee = minVariableFee;\r\n    _maxVariableFee = maxVariableFee;\r\n    _variableFeeNumnerator = variableFeeNumerator;\r\n  }\r\n\r\n  /**\r\n   * Calculate fee for transfer of given number of tokens.\r\n   *\r\n   * @param _amount transfer amount to calculate fee for\r\n   * @return fee for transfer of given amount\r\n   */\r\n  function calculateFee (uint256 _amount)\r\n    public delegatable view returns (uint256 _fee) {\r\n    require (_amount <= MAX_TOKENS_COUNT);\r\n\r\n    _fee = safeMul (_amount, variableFeeNumerator) / FEE_DENOMINATOR;\r\n    if (_fee < minVariableFee) _fee = minVariableFee;\r\n    if (_fee > maxVariableFee) _fee = maxVariableFee;\r\n    _fee = safeAdd (_fee, fixedFee);\r\n  }\r\n\r\n  /**\r\n   * Set flags for given address.\r\n   *\r\n   * @param _address address to set flags for\r\n   * @param _flags flags to set\r\n   */\r\n  function setFlags (address _address, uint256 _flags)\r\n  public delegatable payable {\r\n    require (msg.sender == owner);\r\n\r\n    addressFlags [_address] = _flags;\r\n  }\r\n\r\n  /**\r\n   * Get flags for given address.\r\n   *\r\n   * @param _address address to get flags for\r\n   * @return flags for given address\r\n   */\r\n  function flags (address _address) public delegatable view returns (uint256) {\r\n    return addressFlags [_address];\r\n  }\r\n\r\n  /**\r\n   * Set address of smart contract to delegate execution of delegatable methods\r\n   * to.\r\n   *\r\n   * @param _delegate address of smart contract to delegate execution of\r\n   * delegatable methods to, or zero to not delegate delegatable methods\r\n   * execution.\r\n   */\r\n  function setDelegate (address _delegate) public {\r\n    require (msg.sender == owner);\r\n\r\n    if (delegate != _delegate) {\r\n      delegate = _delegate;\r\n      Delegation (delegate);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Get address of this smart contract.\r\n   *\r\n   * @return address of this smart contract\r\n   */\r\n  function thisAddress () internal view returns (address) {\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Get address of message sender.\r\n   *\r\n   * @return address of this smart contract\r\n   */\r\n  function messageSenderAddress () internal view returns (address) {\r\n    return msg.sender;\r\n  }\r\n\r\n  /**\r\n   * Owner of the smart contract.\r\n   */\r\n  address internal owner;\r\n\r\n  /**\r\n   * Address where fees are sent to.\r\n   */\r\n  address internal feeCollector;\r\n\r\n  /**\r\n   * Number of tokens in circulation.\r\n   */\r\n  uint256 internal tokensCount;\r\n\r\n  /**\r\n   * Whether token transfers are currently frozen.\r\n   */\r\n  bool internal frozen;\r\n\r\n  /**\r\n   * Mapping from sender's address to the next delegated transfer nonce.\r\n   */\r\n  mapping (address => uint256) internal nonces;\r\n\r\n  /**\r\n   * Fixed fee amount in token units.\r\n   */\r\n  uint256 internal fixedFee;\r\n\r\n  /**\r\n   * Minimum variable fee in token units.\r\n   */\r\n  uint256 internal minVariableFee;\r\n\r\n  /**\r\n   * Maximum variable fee in token units.\r\n   */\r\n  uint256 internal maxVariableFee;\r\n\r\n  /**\r\n   * Variable fee numerator.\r\n   */\r\n  uint256 internal variableFeeNumerator;\r\n\r\n  /**\r\n   * Maps address to its flags.\r\n   */\r\n  mapping (address => uint256) internal addressFlags;\r\n\r\n  /**\r\n   * Address of smart contract to delegate execution of delegatable methods to,\r\n   * or zero to not delegate delegatable methods execution.\r\n   */\r\n  address internal delegate;\r\n\r\n  /**\r\n   * Logged when token transfers were frozen.\r\n   */\r\n  event Freeze ();\r\n\r\n  /**\r\n   * Logged when token transfers were unfrozen.\r\n   */\r\n  event Unfreeze ();\r\n\r\n  /**\r\n   * Logged when fee parameters were changed.\r\n   *\r\n   * @param fixedFee fixed fee in token units\r\n   * @param minVariableFee minimum variable fee in token units\r\n   * @param maxVariableFee maximum variable fee in token units\r\n   * @param variableFeeNumerator variable fee numerator\r\n   */\r\n  event FeeChange (\r\n    uint256 fixedFee,\r\n    uint256 minVariableFee,\r\n    uint256 maxVariableFee,\r\n    uint256 variableFeeNumerator);\r\n\r\n  /**\r\n   * Logged when address of smart contract execution of delegatable methods is\r\n   * delegated to was changed.\r\n   *\r\n   * @param delegate new address of smart contract execution of delegatable\r\n   * methods is delegated to or zero if execution of delegatable methods is\r\n   * oot delegated.\r\n   */\r\n  event Delegation (address delegate);\r\n}"}},"matchId":"1817698","creationMatch":"match","runtimeMatch":"match","verifiedAt":"2024-08-08T13:56:27Z","match":"match","chainId":"1","address":"0xdB25f211AB05b1c97D595516F45794528a807ad8"}