Skip to content

Commit

Permalink
fix maxPenalty
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Nov 5, 2024
1 parent 6143d26 commit 74de3c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,9 @@ contract BiconomyTokenPaymaster is
// Transfer full amount to this address. Unused amount will be refunded in postOP
SafeTransferLib.safeTransferFrom(tokenAddress, userOp.sender, address(this), tokenAmount);

context = abi.encode(userOp.sender, tokenAddress, tokenAmount, tokenPrice, externalPriceMarkup, userOpHash);
console2.log("max pnalty in validatePaymasterUserOp", maxPenalty);

context = abi.encode(userOp.sender, tokenAddress, tokenAmount-maxPenalty, tokenPrice, externalPriceMarkup, userOpHash);
validationData = _packValidationData(false, validUntil, validAfter);
} else if (mode == PaymasterMode.INDEPENDENT) {
// Use only oracles for the token specified in modeSpecificData
Expand Down
11 changes: 11 additions & 0 deletions test/base/TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ abstract contract TestBase is CheatCodes, TestHelper, BaseEventsAndErrors {
console2.log("gasCollectedInERC20ByPaymaster", gasCollectedInERC20ByPaymaster);
console2.log("maxPenalty", maxPenalty);
console2.log("totalGasFeePaid", totalGasFeePaid);
console2.log(uint256(1226028000000) + uint256(1794876000000));

// Note: yet to figure out why we're charging too low in tokens vs bundler is paying high gas fees!
// Review we will also need to update premium numbers in below if there is premium: multiply by 1e6 / premium
Expand Down Expand Up @@ -499,3 +500,13 @@ abstract contract TestBase is CheatCodes, TestHelper, BaseEventsAndErrors {
return array;
}
}
/*
1226028000000
1794876000000
2921664000000
3020904000000
1800000000000 max penalty
*/

0 comments on commit 74de3c5

Please sign in to comment.