Commit 582166d3 by Manuel Araoz

7.1 pull payment safe math

parent ab9eecb1
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment