Skip to content

Commit

Permalink
πŸ‘·πŸ» Add entry point is caller checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyrharper committed Jul 9, 2024
1 parent d25f036 commit 5998d12
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/MarginPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ contract MarginPaymaster is IPaymaster {
address public immutable entryPoint;
address public immutable smartMarginV3;

error InvalidEntryPoint();

constructor(address _entryPoint, address _smartMarginV3) {
entryPoint = _entryPoint;
smartMarginV3 = _smartMarginV3;
Expand All @@ -21,16 +23,15 @@ contract MarginPaymaster is IPaymaster {
bytes32,
uint256
) external returns (bytes memory context, uint256 validationData) {
// todo:
// assert(msg.sender == entryPoint)
if (msg.sender != entryPoint) revert InvalidEntryPoint();
console.log("validatePaymasterUserOp");
// context = new bytes(0); // passed to the postOp method
context = "yo"; // passed to the postOp method
validationData = 0; // special value means no validation
}

function postOp(PostOpMode, bytes calldata, uint256) external {
// assert(msg.sender == entryPoint)
if (msg.sender != entryPoint) revert InvalidEntryPoint();
console.log("postOp");
}
}

0 comments on commit 5998d12

Please sign in to comment.