Skip to content

Commit 4d0ae5d

Browse files
committed
Fix getDailyPayment calculation
- If we are at the end of the payment period and we can withdraw more than the balance, simply take the balance and not have the money stuck there forever.
1 parent dcb15dd commit 4d0ae5d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

SampleOfferWithoutReward.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ contract SampleOfferWithoutRewards {
9292
if (msg.sender != contractor)
9393
throw;
9494
uint amount = (now - dateOfSignature + 1 days) / (1 days) * dailyWithdrawLimit - paidOut;
95+
if (amount > this.balance) {
96+
amount = this.balance;
97+
}
9598
if (contractor.send(amount))
9699
paidOut += amount;
97100
}

0 commit comments

Comments
 (0)