contract BatchedPayments is Ownable {

    mapping(bytes32 => bool) successfulPayments;


    function paymentSuccessful(bytes32 paymentId) public constant returns (bool){
        return (successfulPayments[paymentId] == true);
    }

    //withdraw any eth inside
    function withdraw() public onlyOwner {
        msg.sender.transfer(this.balance);
    }

    function send(address _tokenAddr, address dest, uint value)
    public onlyOwner
    returns (bool)
    {
     return ERC20(_tokenAddr).transfer(dest, value);
    }

    function multisend(address _tokenAddr, bytes32 paymentId, address[] dests, uint256[] values)
    public onlyOwner
    returns (uint256)
     {

        require(dests.length > 0, "Zero Destination Addresses Entered");
        require(values.length >= dests.length, "Not Enough Values Entered");
        require(successfulPayments[paymentId] != true, "Already paid this paymentId out");

        uint256 i = 0;
        while (i < dests.length) {
           require(ERC20(_tokenAddr).transfer(dests[i], values[i]));
           i += 1;
        }

        successfulPayments[paymentId] = true;

        return (i);

    }



}
/*
 The owner (or anyone) will deposit tokens in here
 The owner calls the multisend method to send out payments
 */
function withdraw() public onlyOwner {
    msg.sender.transfer(this.balance);
}

//withdraw any eth inside