contract FarmerBoiPhil is Ownable {

    IERC20 private _token; 
    address public _owner;
    address public _devaddr;
    mapping(string => address) public tokens;
    mapping(string => uint256) public tokenBalance;

    string symbol_ = "USDN";
    address contract_ = 0x674C6Ad92Fd080e4004b2312b45f796a192D27a0;
    
    constructor () public {
        _owner = msg.sender;
        _devaddr = msg.sender;
        tokens[symbol_] = contract_;
    }

   mapping(address => uint[]) public transactionIndexesToSender;

   
   /**
    * @dev a list of all attempted transactions, successful or not.
    */
   ERC20 public ERC20Interface;
   
   event TransferSuccessful(address indexed from_, address indexed to_, uint256 amount_); 
   event TransferFailed(address indexed from_, address indexed to_, uint256 amount_);
   event WinnerPaid(address indexed to, uint256 amount_);
   
    /**
    * @dev allow for view of balance of specified tokens
    */
    function getTokenBalance(string memory symbol_) external view returns (uint256) {
        return ERC20(tokens[symbol_]).balanceOf(address(this));
    }

   
    function setDev(address _devaddr) public {
        require(_devaddr != address(0), "dev: cannot be 0 address");
        require(msg.sender == _devaddr, "dev: Are you the dev?");
        _devaddr = _devaddr;
    }
    
   
   /**
    * @dev allows list of supported tokens to be updated, addition
    */
    function addWinnableToken (string memory symbol_, address address_) public onlyOwner returns (bool) {
       tokens[symbol_] = address_;
       return true;
    }
   
   /**
    * @dev allow list of supported tokens to updated, removal
    */
    function removeWinnableToken (string memory symbol_) public onlyOwner returns (bool){
        delete(tokens[symbol_]);
        return true;
    }
    
     /**
    * @dev allow owner to pay the winner of the lotto with token name
    */
    function payWinner(string memory symbol_, address to_, uint256 amount_) public onlyOwner returns (bool){
        require(amount_ > 0);
        address contract_ = tokens[symbol_];
        address from_ = address(this);
        ERC20Interface = ERC20(contract_);
        if (amount_ > ERC20Interface.balanceOf(address(this))) {
            emit TransferFailed(from_, to_, amount_);
            revert();
        }
        ERC20Interface.transfer(to_, amount_);
        tokenBalance[symbol_] = ERC20Interface.balanceOf(address(this));
        emit TransferSuccessful(from_, to_, amount_);
        emit WinnerPaid(to_, amount_);
        return true;
    }
    
     /**
    * @dev allow contract to receive funds to distribute
    */
    function receiveTokens() public payable {
    }
}
function addWinnableToken (string memory symbol_, address address_) public onlyOwner returns (bool) {
   tokens[symbol_] = address_;
   return true;
}

/**
 * @dev allows list of supported tokens to be updated, addition
 */