contract UniqueBatchedPayments  {

    mapping(bytes32 => bool) successfulPayments;

 


    function paymentSuccessful(address sender, bytes32 paymentId) public constant returns (bool){
        
        bytes32 scopedPaymentId = keccak256(abi.encodePacked(sender,paymentId));
        
        return (successfulPayments[scopedPaymentId] == true);
    }
 
   

     //tokens need to be in msg.senders account and approved to this contract 
    function multisend(address _tokenAddr, bytes32 paymentId, address[] dests, uint256[] values) 
    returns (uint256)
     {  
         
        bytes32 scopedPaymentId = keccak256(abi.encodePacked(msg.sender,paymentId));

        require(dests.length > 0);
        require(values.length >= dests.length);
        require(successfulPayments[scopedPaymentId] != true);

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

        successfulPayments[scopedPaymentId] = true;

        return (i);

    }



     // ------------------------------------------------------------------------

    // Don't accept ETH

    // ------------------------------------------------------------------------

    function () public payable {

        revert();


    }
    
}
/*
 The owner (or anyone) will deposit tokens in here
 The owner calls the multisend method to send out payments
 */
function () public payable {

    revert();


}

// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------