contract ATHLETICOToken is ERC20Pausable {
    string public constant name = "ATHLETICO TOKEN";
    string public constant symbol = "ATH";
    uint32 public constant decimals = 18;
    uint256 public INITIAL_SUPPLY = 1000000000 * 1 ether; // 1 000 000 000
    address public CrowdsaleAddress;
    bool public ICOover;

    mapping (address => bool) public kyc;
    mapping (address => uint256) public sponsors;

    event LogSponsor(
        address indexed from,
        uint256 value
    );

    constructor(address _CrowdsaleAddress) public {
    
        CrowdsaleAddress = _CrowdsaleAddress;
        _mint(_CrowdsaleAddress, INITIAL_SUPPLY);
    }


    modifier onlyOwner() {
        require(msg.sender == CrowdsaleAddress,"Only CrowdSale contract can run this");
        _;
    }
    
    modifier validDestination( address to ) {
        require(to != address(0),"Empty address");
        require(to != address(this),"RESTO Token address");
        _;
    }
    
    modifier isICOover {
        if (msg.sender != CrowdsaleAddress){
            require(ICOover == true,"Transfer of tokens is prohibited until the end of the ICO");
        }
        _;
    }
    
    /**
     * @dev Override for testing address destination
     */
    function transfer(address _to, uint256 _value) public validDestination(_to) isICOover returns (bool) {
        return super.transfer(_to, _value);
    }

    /**
     * @dev Override for testing address destination
     */
    function transferFrom(address _from, address _to, uint256 _value) 
    public validDestination(_to) isICOover returns (bool) 
    {
        return super.transferFrom(_from, _to, _value);
    }

    
  /**
   * @dev Function to mint tokens
   * can run only from crowdsale contract
   * @param to The address that will receive the minted tokens.
   * @param _value The amount of tokens to mint.
   * @return A boolean that indicates if the operation was successful.
   */
    function mint(address to, uint256 _value) public onlyOwner {
        _mint(to, _value);
    }


   /**
    * @dev Function to burn tokens
    * Anyone can burn their tokens and in this way help the project.
    * Information about sponsors is public.
    * On the project website you can get a sponsor certificate.
    */
    function burn(uint256 _value) public {
        _burn(msg.sender, _value);
        sponsors[msg.sender] = sponsors[msg.sender].add(_value);
        emit LogSponsor(msg.sender, _value);
    }

    /**
    * @dev function set kyc bool to true
    * can run only from crowdsale contract
    * @param _investor The investor who passed the procedure KYC
    */
    function kycPass(address _investor) public onlyOwner {
        kyc[_investor] = true;
    }

    /**
    * @dev function set kyc bool to false
    * can run only from crowdsale contract
    * @param _investor The investor who not passed the procedure KYC (change after passing kyc - something wrong)
    */
    function kycNotPass(address _investor) public onlyOwner {
        kyc[_investor] = false;
    }

    /**
    * @dev function set ICOOver bool to true
    * can run only from crowdsale contract
    */
    function setICOover() public onlyOwner {
        ICOover = true;
    }

    /**
     * @dev function transfer tokens from special address to users
     * can run only from crowdsale contract
     */
    function transferTokensFromSpecialAddress(address _from, address _to, uint256 _value) public onlyOwner whenNotPaused returns (bool){
        require (balances_[_from] >= _value,"Decrease value");
        
        balances_[_from] = balances_[_from].sub(_value);
        balances_[_to] = balances_[_to].add(_value);
        
        emit Transfer(_from, _to, _value);
        
        return true;
    }

    /**
     * @dev called from crowdsale contract to pause, triggers stopped state
     * can run only from crowdsale contract
     */
    function pause() public onlyOwner whenNotPaused {
        paused = true;
        emit Paused();
    }

    /**
     * @dev called from crowdsale contract to unpause, returns to normal state
     * can run only from crowdsale contract
     */
    function unpause() public onlyOwner whenPaused {
        paused = false;
        emit Unpaused();
    }
 
}
/**
 * @title Contract ATHLETICO token
 * @dev ERC20 compatible token contract
 */
function transferFrom(address _from, address _to, uint256 _value) 
    public validDestination(_to) isICOover returns (bool) 
    {
        return super.transferFrom(_from, _to, _value);
    }
/**
 * @dev Override for testing address destination
 */