Browse Source

7.1 pull payment safe math

Manuel Araoz 8 years ago
parent
commit
582166d378
1 changed files with 5 additions and 2 deletions
  1. 5 2
      contracts/payment/PullPayment.sol

+ 5 - 2
contracts/payment/PullPayment.sol

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