Skip to content

Commit

Permalink
Merge pull request #611 from tokencard/guard-gas-top-up
Browse files Browse the repository at this point in the history
Add balance check for gas top up
  • Loading branch information
riccardopersiani committed Sep 16, 2020
2 parents b122bf7 + 47078b8 commit ea5d68f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
2 changes: 2 additions & 0 deletions contracts/wallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ contract Wallet is ENSResolvable, AddressWhitelist, SpendLimit, GasTopUpLimit, L
/// @dev Refill owner's gas balance, revert if the transaction amount is too large
/// @param _amount is the amount of ether to transfer to the owner account in wei.
function topUpGas(uint256 _amount) external isNotZero(_amount) onlyOwnerOrController {
// Check contract balance is sufficient for the operation
require(address(this).balance > _amount, "balance not sufficient");
// Check against the daily spent limit and update accordingly, require that the value is under remaining limit.
_gasTopUpLimit._enforceLimit(_amount);
// Then perform the transfer
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindings/mocks/isValidSignatureExporter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ea5d68f

Please sign in to comment.