Skip to content
This repository was archived by the owner on Oct 10, 2024. It is now read-only.

Commit 798f2a3

Browse files
authored
Update SpendAvailable in ExecuteTransaction (#426)
Update SpendAvailable in ExecuteTransaction
2 parents 3f14915 + 594eef7 commit 798f2a3

File tree

14 files changed

+127
-20
lines changed

14 files changed

+127
-20
lines changed

build/wallet-deployer/Vault.bin

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet-deployer/Wallet.abi

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet-deployer/Wallet.bin

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet-deployer/WalletDeployer.bin

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet-deployer/combined.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet/Vault.bin

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet/Wallet.abi

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet/Wallet.bin

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/wallet/combined.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/wallet.sol

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ contract Whitelist is Controllable, Ownable {
110110
_pendingWhitelistAddition = _addresses;
111111
// Flag the operation as submitted.
112112
submittedWhitelistAddition = true;
113-
// Emit the submission eve nt.
113+
// Emit the submission event.
114114
emit SubmittedWhitelistAddition(_addresses, pendingWhitelistHash(_pendingWhitelistAddition));
115115
}
116116

@@ -295,9 +295,8 @@ contract SpendLimit is Controllable, Ownable {
295295
/// @dev Update available spend limit based on the daily reset.
296296
function _updateSpendAvailable() internal {
297297
if (now > _spendLimitDay.add(24 hours)) {
298-
// Advance the current day by how many days have passed.
299-
uint extraDays = now.sub(_spendLimitDay).div(24 hours);
300-
_spendLimitDay = _spendLimitDay.add(extraDays.mul(24 hours));
298+
// Advance the current timestamp.
299+
_spendLimitDay = now;
301300
// Set the available limit to the current spend limit.
302301
_spendAvailable = spendLimit;
303302
emit UpdatedSpendAvailable();
@@ -455,6 +454,7 @@ contract Wallet is Vault {
455454

456455
using SafeMath for uint256;
457456

457+
string constant public WALLET_VERSION = "1.5.8";
458458
uint constant private MINIMUM_TOPUP_LIMIT = 1 finney; // solium-disable-line uppercase
459459
uint constant private MAXIMUM_TOPUP_LIMIT = 500 finney; // solium-disable-line uppercase
460460

@@ -591,9 +591,8 @@ contract Wallet is Vault {
591591
/// @dev Update available top up limit based on the daily reset.
592592
function _updateTopUpAvailable() private {
593593
if (now > _topUpLimitDay.add(24 hours)) {
594-
// Advance the current day by how many days have passed.
595-
uint extraDays = now.sub(_topUpLimitDay).div(24 hours);
596-
_topUpLimitDay = _topUpLimitDay.add(extraDays.mul(24 hours));
594+
// Advance the current timestamp.
595+
_topUpLimitDay = now;
597596
// Set the available limit to the current top up limit.
598597
_topUpAvailable = topUpLimit;
599598
}
@@ -614,6 +613,9 @@ contract Wallet is Vault {
614613
require(!address(_destination).isContract(), "executeTransaction for a non-contract: call to contract");
615614
}
616615

616+
// Update the available spend limit.
617+
_updateSpendAvailable();
618+
617619
// Check if there exists at least a method signature in the transaction payload
618620
if (_data.length >= 4) {
619621
// Get method signature

0 commit comments

Comments
 (0)