File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/hebao_v1/contracts/modules/core Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ pragma solidity ^0.7.0;
44pragma experimental ABIEncoderV2;
55
66import "../../lib/EIP712.sol " ;
7+ import "../../lib/ERC20.sol " ;
78import "../../lib/MathUint.sol " ;
89import "../../lib/SignatureUtil.sol " ;
910import "../../thirdparty/BytesUtil.sol " ;
@@ -112,10 +113,13 @@ abstract contract ForwarderModule is BaseModule
112113 )
113114 {
114115 uint gasLeft = gasleft ();
116+ uint gasLimit = (metaTx.gasLimit.mul (64 ) / 63 ).add (GAS_OVERHEAD);
117+ require (gasLeft >= gasLimit, "OPERATOR_INSUFFICIENT_GAS " );
115118
119+ uint gasCost = gasLimit.mul (metaTx.gasPrice);
116120 require (
117- gasLeft >= (metaTx.gasLimit. mul ( 64 ) / 63 ). add (GAS_OVERHEAD) ,
118- "INSUFFICIENT_GAS "
121+ ERC20 (metaTx.gasToken). balanceOf (metaTx.from) >= gasCost ,
122+ "WALLET_INSUFFICIENT_GAS "
119123 );
120124
121125 // The trick is to append the really logical message sender and the
You can’t perform that action at this time.
0 commit comments