Add a SplitPullPayment contract that combines distribution of funds and delayed withdrawal from each party

This commit is contained in:
Ariel Barmat
2017-08-29 03:40:41 -03:00
parent 8336785a9b
commit 69e83e5086
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,28 @@
pragma solidity ^0.4.15;
import './PullPayment.sol';
import './SplitPayment.sol';
/**
* @title SplitPullPayment
* @dev Contract supporting the distribution of funds combined with withdrawals through PullPayment.
*/
contract SplitPullPayment is SplitPayment, PullPayment {
/**
* @dev Return the total amount of funds available for distribution.
* @dev Override from SplitPayment to take into account credited funds for pull payments.
*/
function toDistribute() internal returns (uint256) {
return this.balance.sub(totalPayments);
}
/**
* @dev Perform the payment to a payee.
* @dev Override from SplitPayment to do an asyncSend for later withdrawal.
* @param _payee The address of the payee to be paid.
* @param _amount The amount for the payment.
*/
function pay(address _payee, uint256 _amount) internal {
asyncSend(_payee, _amount);
}
}