contract SYOController is TokenController, Ownable {

    SYO public tokenContract;   // The new token for this Campaign

    /// @param _tokenAddress Address of the token contract this contract controls

    constructor(
        address payable _tokenAddress
    ) public {
        tokenContract = SYO(_tokenAddress);         // The Deployed Token Contract
    }


/////////////////
// TokenController interface
/////////////////

    /// @notice Notifies the controller about a transfer.
    /// Transfers can only happen to whitelisted addresses
    /// @param _from The origin of the transfer
    /// @param _to The destination of the transfer
    /// @param _amount The amount of the transfer
    /// @return False if the controller does not authorize the transfer
    function onTransfer(address _from, address _to, uint _amount) public returns(bool) {
        return true;
    }

    /// @notice Notifies the controller about an approval, for this Campaign all
    ///  approvals are allowed by default and no extra notifications are needed
    /// @param _owner The address that calls `approve()`
    /// @param _spender The spender in the `approve()` call
    /// @param _amount The amount in the `approve()` call
    /// @return False if the controller does not authorize the approval
    function onApprove(address _owner, address _spender, uint _amount) public
        returns(bool)
    {
        return true;
    }

    function proxyPayment(address _owner) public payable returns(bool allowed) {
        allowed = false;
    }

    /// @notice `onlyOwner` can upgrade the controller contract
    /// @param _newControllerAddress The address that will have the token control logic
    function upgradeController(address _newControllerAddress) public onlyOwner {
        tokenContract.changeController(_newControllerAddress);
        emit UpgradedController(_newControllerAddress);
    }

    function burnTokens(uint _amount) public onlyOwner returns (bool) {
        tokenContract.destroyTokens(owner, _amount);
    }


//////////
// Safety Methods
//////////

    /// @notice This method can be used by the owner to extract mistakenly
    ///  sent tokens to this contract.
    /// @param _token The address of the token contract that you want to recover
    function claimLostTokens(address payable _token) public onlyOwner {

        SYO token = SYO(_token);
        uint balance = token.balanceOf(address(this));
        token.transfer(owner, balance);
        emit ClaimedTokens(_token, owner, balance);
    }

////////////////
// Events
////////////////
    event ClaimedTokens(address indexed _token, address indexed _controller, uint _amount);

    event UpgradedController (address newAddress);

}
function upgradeController(address _newControllerAddress) public onlyOwner {
    tokenContract.changeController(_newControllerAddress);
    emit UpgradedController(_newControllerAddress);
}

/// @notice `onlyOwner` can upgrade the controller contract
/// @param _newControllerAddress The address that will have the token control logic