7.1 pull payment safe math

pull/169/head
Manuel Araoz 8 years ago
parent ab9eecb104
commit 582166d378
  1. 7
      contracts/payment/PullPayment.sol

@ -1,17 +1,20 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.8;
import '../SafeMath.sol'
/* /*
* PullPayment * PullPayment
* Base contract supporting async send for pull payments. * Base contract supporting async send for pull payments.
* Inherit from this contract and use asyncSend instead of send. * Inherit from this contract and use asyncSend instead of send.
*/ */
contract PullPayment { contract PullPayment is SafeMath {
mapping(address => uint) public payments; mapping(address => uint) public payments;
// store sent amount as credit to be pulled, called by payer // store sent amount as credit to be pulled, called by payer
function asyncSend(address dest, uint amount) internal { function asyncSend(address dest, uint amount) internal {
payments[dest] += amount; payments[dest] = safeAdd(payments[dest], amount);
} }
// withdraw accumulated balance, called by payee // withdraw accumulated balance, called by payee

Loading…
Cancel
Save