Skip to content

Commit

Permalink
debugging rn
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivaanshK committed Sep 4, 2024
1 parent 7d47e18 commit c2d52d0
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 440 deletions.
11 changes: 10 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "lib/nexus"]
path = lib/nexus
url = https://github.com/bcnmy/nexus
url = https://github.com/lib/nexus
branch = dev
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
Expand All @@ -10,3 +11,11 @@
[submodule "lib/v3-core"]
path = lib/v3-core
url = https://github.com/Uniswap/v3-core
[submodule "lib/account-abstraction"]
path = lib/account-abstraction
url = https://github.com/eth-infinitism/account-abstraction
branch = releases/v0.7
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
branch = master
119 changes: 0 additions & 119 deletions contracts/references/SampleVerifyingPaymaster.sol

This file was deleted.

4 changes: 2 additions & 2 deletions contracts/sponsorship/BiconomySponsorshipPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "@account-abstraction/contracts/core/Helpers.sol";
import { SignatureCheckerLib } from "@solady/src/utils/SignatureCheckerLib.sol";
import { ECDSA as ECDSA_solady } from "@solady/src/utils/ECDSA.sol";
import { BiconomySponsorshipPaymasterErrors } from "../common/BiconomySponsorshipPaymasterErrors.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { ReentrancyGuardTransient } from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeTransferLib } from "@solady/src/utils/SafeTransferLib.sol";
import { IBiconomySponsorshipPaymaster } from "../interfaces/IBiconomySponsorshipPaymaster.sol";
Expand All @@ -31,7 +31,7 @@ import { IBiconomySponsorshipPaymaster } from "../interfaces/IBiconomySponsorshi

contract BiconomySponsorshipPaymaster is
BasePaymaster,
ReentrancyGuard,
ReentrancyGuardTransient,
BiconomySponsorshipPaymasterErrors,
IBiconomySponsorshipPaymaster
{
Expand Down
24 changes: 13 additions & 11 deletions contracts/token/BiconomyTokenPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.26;

import { ECDSA as ECDSA_solady } from "@solady/src/utils/ECDSA.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { ReentrancyGuardTransient } from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
import { IEntryPoint } from "@account-abstraction/contracts/interfaces/IEntryPoint.sol";
import { SignatureCheckerLib } from "@solady/src/utils/SignatureCheckerLib.sol";
import { PackedUserOperation, UserOperationLib } from "@account-abstraction/contracts/core/UserOperationLib.sol";
Expand All @@ -19,14 +19,14 @@ import "@account-abstraction/contracts/core/Helpers.sol";
* @author ShivaanshK<[email protected]>
* @author livingrockrises<[email protected]>
* @notice Token Paymaster for Entry Point v0.7
* @dev A paymaster that allows user to pay gas fee in ERC20 tokens. The paymaster owner chooses which tokens to
* @dev A paymaster that allows user to pay gas fees in ERC20 tokens. The paymaster owner chooses which tokens to
* accept. The payment manager (usually the owner) first deposits native gas into the EntryPoint. Then, for each
* transaction, it takes the gas fee from the user's ERC20 token balance. The exchange rate between ETH and the token is
* calculated using 1 of three methods: external price source, off-chain oracle, or a TWAP oracle.
*/
contract BiconomyTokenPaymaster is
BasePaymaster,
ReentrancyGuard,
ReentrancyGuardTransient,
BiconomyTokenPaymasterErrors,
IBiconomyTokenPaymaster
{
Expand Down Expand Up @@ -208,7 +208,7 @@ contract BiconomyTokenPaymaster is
address feeToken,
address oracleAggregator,
uint256 exchangeRate,
uint32 priceMarkup
uint32 dynamicAdjustment
)
public
view
Expand All @@ -234,7 +234,7 @@ contract BiconomyTokenPaymaster is
feeToken,
oracleAggregator,
exchangeRate,
priceMarkup
dynamicAdjustment
)
);
}
Expand All @@ -249,7 +249,7 @@ contract BiconomyTokenPaymaster is
address feeToken,
address oracleAggregator,
uint256 exchangeRate,
uint32 priceMarkup,
uint32 dynamicAdjustment,
bytes calldata signature
)
{
Expand All @@ -260,7 +260,7 @@ contract BiconomyTokenPaymaster is
feeToken = address(bytes20(paymasterAndData[PAYMASTER_DATA_OFFSET + 13:PAYMASTER_DATA_OFFSET + 33]));
oracleAggregator = address(bytes20(paymasterAndData[PAYMASTER_DATA_OFFSET + 33:PAYMASTER_DATA_OFFSET + 53]));
exchangeRate = uint256(bytes32(paymasterAndData[PAYMASTER_DATA_OFFSET + 53:PAYMASTER_DATA_OFFSET + 85]));
priceMarkup = uint32(bytes4(paymasterAndData[PAYMASTER_DATA_OFFSET + 85:PAYMASTER_DATA_OFFSET + 89]));
dynamicAdjustment = uint32(bytes4(paymasterAndData[PAYMASTER_DATA_OFFSET + 85:PAYMASTER_DATA_OFFSET + 89]));
signature = paymasterAndData[PAYMASTER_DATA_OFFSET + 89:];
}
}
Expand Down Expand Up @@ -289,7 +289,7 @@ contract BiconomyTokenPaymaster is
address feeToken,
address oracleAggregator,
uint256 exchangeRate,
uint32 priceMarkup,
uint32 dynamicAdjustment,
bytes calldata signature
) = parsePaymasterAndData(userOp.paymasterAndData);

Expand All @@ -300,27 +300,29 @@ contract BiconomyTokenPaymaster is
bool validSig = verifyingSigner.isValidSignatureNow(
ECDSA_solady.toEthSignedMessageHash(
getHash(
userOp, priceSource, validUntil, validAfter, feeToken, oracleAggregator, exchangeRate, priceMarkup
userOp, priceSource, validUntil, validAfter, feeToken, oracleAggregator, exchangeRate, dynamicAdjustment
)
),
signature
);

// Return with SIG_VALIDATION_FAILED instead of reverting
if (!validSig) {
return ("", _packValidationData(true, validUntil, validAfter));
}


}

/**
* @dev Post-operation handler.
* This method is abstract in BasePaymaster and must be implemented in derived contracts.
* @param mode The mode of the post operation (opSucceeded, opReverted, or postOpReverted).
* @param context The context value returned by validatePaymasterUserOp.
* @param actualGasCost Actual gas used so far (excluding this postOp call).
* @param actualUserOpFeePerGas The gas price this UserOp pays.
*/
function _postOp(
PostOpMode mode,
PostOpMode,
bytes calldata context,
uint256 actualGasCost,
uint256 actualUserOpFeePerGas
Expand Down
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
auto_detect_solc = false
block_timestamp = 1_680_220_800 # March 31, 2023 at 00:00 GMT
bytecode_hash = "none"
evm_version = "paris" # See https://www.evmdiff.com/features?name=PUSH0&kind=opcode
gas_reports = ["*"]
optimizer = true
optimizer_runs = 1_000_000
Expand Down
1 change: 1 addition & 0 deletions lib/account-abstraction
Submodule account-abstraction added at 7af70c
2 changes: 1 addition & 1 deletion lib/forge-std
2 changes: 1 addition & 1 deletion lib/nexus
Submodule nexus updated from ab9616 to b8085a
1 change: 0 additions & 1 deletion lib/nexus.git
Submodule nexus.git deleted from 5d81e5
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at b73bcb
11 changes: 6 additions & 5 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
@prb/test/=node_modules/@prb/test/
@nexus/=lib/nexus/
@forge-std/=lib/forge-std/
@uniswap/v3-periphery/=lib/v3-periphery
@uniswap/v3-core/=lib/v3-core
@account-abstraction=node_modules/account-abstraction/
@uniswap/v3-periphery/=lib/v3-periphery/
@uniswap/v3-core/=lib/v3-core/
@account-abstraction=lib/account-abstraction/
account-abstraction=lib/account-abstraction/
@modulekit/=node_modules/modulekit/src/
@sentinellist/=node_modules/sentinellist/
@solady/=node_modules/solady
@solady/=node_modules/solady/
Loading

0 comments on commit c2d52d0

Please sign in to comment.