Skip to content

Commit

Permalink
revert event modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
livingrockrises committed Dec 4, 2023
1 parent ab671ec commit e5a9491
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
27 changes: 14 additions & 13 deletions contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,24 @@ contract BiconomyTokenPaymaster is
* Designed to enable tracking how much fees were charged from the sender and in which ERC20 token
* More information can be emitted like exchangeRate used, what was the source of exchangeRate etc*/
// priceMarkup = Multiplier value to calculate markup, 1e6 means 1x multiplier = No markup
/*event TokenPaymasterOperation(
event TokenPaymasterOperation(
address indexed sender,
address indexed token,
uint256 indexed totalCharge,
uint32 priceMarkup,
bytes32 userOpHash,
uint256 exchangeRate,
ExchangeRateSource priceSource
);*/
);

// Review can add exchangeRate
event UserOperationSponsored(
// Review can replace with this event // can add exchangeRate
// saves 1000 gas
/*event UserOperationSponsored(
address indexed sender,
address indexed token,
uint256 indexed totalCharge,
uint256 actualGasCost
);
);*/

/**
* Notify in case paymaster failed to withdraw tokens from sender
Expand Down Expand Up @@ -495,8 +496,8 @@ contract BiconomyTokenPaymaster is
feeToken,
priceSource,
exchangeRate,
priceMarkup //,
// userOpHash
priceMarkup,
userOpHash
);

return (
Expand All @@ -521,7 +522,7 @@ contract BiconomyTokenPaymaster is
ExchangeRateSource priceSource;
uint256 exchangeRate;
uint32 priceMarkup;
// bytes32 userOpHash;
bytes32 userOpHash;
assembly ("memory-safe") {
let offset := context.offset

Expand All @@ -538,9 +539,9 @@ contract BiconomyTokenPaymaster is
offset := add(offset, 0x20)

priceMarkup := calldataload(offset)
// offset := add(offset, 0x20)
offset := add(offset, 0x20)

// userOpHash := calldataload(offset)
userOpHash := calldataload(offset)
}

uint256 effectiveExchangeRate = exchangeRate;
Expand Down Expand Up @@ -570,16 +571,16 @@ contract BiconomyTokenPaymaster is
feeReceiver,
charge
);
/*emit TokenPaymasterOperation(
emit TokenPaymasterOperation(
account,
address(feeToken),
charge,
priceMarkup,
userOpHash,
effectiveExchangeRate,
priceSource
);*/
emit UserOperationSponsored(account, address(feeToken), charge, actualGasCost);
);
// emit UserOperationSponsored(account, address(feeToken), charge, actualGasCost);
} else {
// In case transferFrom failed in first handlePostOp call, attempt to charge the tokens again
bytes memory _data = abi.encodeWithSelector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ describe("Biconomy Token Paymaster (With Bundler)", function () {
);

const eventLogs = BiconomyTokenPaymaster.interface.decodeEventLog(
"UserOperationSponsored",
"TokenPaymasterOperation",
receipt.logs[3].data
);

// Confirming that it's using backup (external) exchange rate in case oracle aggregator / price feed is stale / anything goes wrong
// expect(eventLogs.exchangeRate).to.be.equal(rate1);
expect(eventLogs.exchangeRate).to.be.equal(rate1);

await expect(
entryPoint.handleOps([userOp], await offchainSigner.getAddress())
Expand Down
4 changes: 2 additions & 2 deletions test/token-paymaster/oracle-aggregator-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,12 @@ describe("Biconomy Token Paymaster", function () {
);

const eventLogs = BiconomyTokenPaymaster.interface.decodeEventLog(
"UserOperationSponsored",
"TokenPaymasterOperation",
receipt.logs[3].data
);

// Confirming that it's using backup (external) exchange rate in case oracle aggregator / price feed is stale / anything goes wrong
// expect(eventLogs.exchangeRate).to.be.equal(rate1);
expect(eventLogs.exchangeRate).to.be.equal(rate1);

await expect(
entryPoint.handleOps([userOp], await offchainSigner.getAddress())
Expand Down

0 comments on commit e5a9491

Please sign in to comment.