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

Commit ea5d68f

Browse files
Merge pull request #611 from tokencard/guard-gas-top-up
Add balance check for gas top up
2 parents b122bf7 + 47078b8 commit ea5d68f

File tree

6 files changed

+43
-4
lines changed

6 files changed

+43
-4
lines changed

contracts/wallet.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ contract Wallet is ENSResolvable, AddressWhitelist, SpendLimit, GasTopUpLimit, L
662662
/// @dev Refill owner's gas balance, revert if the transaction amount is too large
663663
/// @param _amount is the amount of ether to transfer to the owner account in wei.
664664
function topUpGas(uint256 _amount) external isNotZero(_amount) onlyOwnerOrController {
665+
// Check contract balance is sufficient for the operation
666+
require(address(this).balance > _amount, "balance not sufficient");
665667
// Check against the daily spent limit and update accordingly, require that the value is under remaining limit.
666668
_gasTopUpLimit._enforceLimit(_amount);
667669
// Then perform the transfer

pkg/bindings/mocks/isValidSignatureExporter.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)