Skip to content

Commit

Permalink
πŸ‘·πŸ» Add zero cost check in postOp
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyrharper committed Jul 18, 2024
1 parent 4eba7f8 commit 165c9e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MarginPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract MarginPaymaster is IPaymaster, Zap, Ownable {
bytes32 public constant PERPS_MODIFY_COLLATERAL_PERMISSION =
"PERPS_MODIFY_COLLATERAL";
uint32 public constant TWAP_PERIOD = 300; // 5 minutes
uint256 public constant MAX_POST_OP_GAS_USEAGE = 520047; // As last calculated
uint256 public constant MAX_POST_OP_GAS_USEAGE = 520072; // As last calculated
uint256 public constant IS_AUTHORIZED = 0;
uint256 public constant IS_NOT_AUTHORIZED = 1;
uint256 public constant DEFAULT_WALLET_INDEX = 0;
Expand Down Expand Up @@ -211,6 +211,8 @@ contract MarginPaymaster is IPaymaster, Zap, Ownable {
actualGasCostInWei + postOpCostInWei
);

if (costOfGasInUSDC == 0) return;

(uint256 availableUSDCInWallet, , ) = getUSDCAvailableInWallet(sender);

// draw funds from wallet before accessing margin
Expand Down

0 comments on commit 165c9e5

Please sign in to comment.