From 582166d3788d088b73c623b4db172239d01e3932 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Mon, 20 Mar 2017 18:04:31 -0300 Subject: [PATCH] 7.1 pull payment safe math --- contracts/payment/PullPayment.sol | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contracts/payment/PullPayment.sol b/contracts/payment/PullPayment.sol index 7a5ce3f48..3e03f24b8 100644 --- a/contracts/payment/PullPayment.sol +++ b/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