Skip to content

Commit

Permalink
fix:accounting
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises committed Nov 6, 2024
1 parent d4345eb commit c562f6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ contract BiconomyTokenPaymaster is
// so we don't refund it at postOp
// other way to do it is not adding it to the tokenAmount and just charge
// tokenAmount + maxPenalty on line 492
context = abi.encode(userOp.sender, tokenAddress, tokenAmount-maxPenalty, tokenPrice, externalPriceMarkup, userOpHash);
context = abi.encode(userOp.sender, tokenAddress, tokenAmount-((maxPenalty*tokenPrice)/1e18), tokenPrice, externalPriceMarkup, userOpHash);
validationData = _packValidationData(false, validUntil, validAfter);
} else if (mode == PaymasterMode.INDEPENDENT) {
// Use only oracles for the token specified in modeSpecificData
Expand All @@ -520,7 +520,7 @@ contract BiconomyTokenPaymaster is
SafeTransferLib.safeTransferFrom(tokenAddress, userOp.sender, address(this), tokenAmount);

context =
abi.encode(userOp.sender, tokenAddress, tokenAmount, tokenPrice, independentPriceMarkup, userOpHash);
abi.encode(userOp.sender, tokenAddress, tokenAmount-((maxPenalty*tokenPrice)/1e18), tokenPrice, independentPriceMarkup, userOpHash);
validationData = 0; // Validation success and price is valid indefinetly
}
}
Expand Down
1 change: 0 additions & 1 deletion test/base/TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ abstract contract TestBase is CheatCodes, TestHelper, BaseEventsAndErrors {
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
assertGt(gasPaidBySAInERC20 * 1e18 / tokenPrice, BUNDLER.addr.balance - initialBundlerBalance);

Expand Down

0 comments on commit c562f6e

Please sign in to comment.