contract HurricaneBahamasReliefFunds is Pausable {
    using SafeMath for uint256;
    ERC20 public po8Token;

    uint256 public exchangeRate; // 1 ether == 20000 PO8 for example
    uint256 public cut;
    
    event ExchangeRateUpdated(uint256 newExchangeRate);
    event PO8ReFunded(address indexed funder, uint256 ethValue, uint256 po8Receive);
    
    // Delegate constructor
    constructor(uint256 _exchangeRate, address po8Address) public {
        exchangeRate = _exchangeRate;
        ERC20 po8 = ERC20(po8Address);
        po8Token = po8;
    }
    
    function setPO8TokenContractAdress(address po8Address) external onlyOwner returns (bool) {
        ERC20 po8 = ERC20(po8Address);
        po8Token = po8;
        return true;
    }
    
    // @dev The Owner can set the new exchange rate between ETH and PO8 token.
    function setExchangeRate(uint256 _newExchangeRate) external onlyUpdater returns (uint256) {
        exchangeRate = _newExchangeRate;

        emit ExchangeRateUpdated(_newExchangeRate);

        return _newExchangeRate;
    }
    
    function donate() public payable whenNotPaused {
        require(msg.value >= 1e4 wei);
        
        uint256 totalTokenTransfer = msg.value.mul(exchangeRate);
        
        po8Token.transferFrom(owner, msg.sender, totalTokenTransfer);
        
        emit PO8ReFunded(msg.sender, msg.value, totalTokenTransfer);
    }
    
    // @dev Allows the owner to capture the balance available to the contract.
    function withdrawBalance() external onlyOwner {
        uint256 balance = address(this).balance;

        owner.transfer(balance);
    }
    
    //@dev contract accept ether from donater.
    function () external payable {}
    
    function getBackERC20Token(address tokenAddress) external onlyOwner {
        ERC20 token = ERC20(tokenAddress);
        token.transfer(owner, token.balanceOf(address(this)));
    }
    
}
function () external payable {}

//@dev contract accept ether from donater.