File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,12 @@ contract Paymaster is BasePaymaster {
97
97
revert ("Paymaster: renouncing ownership is not allowed " );
98
98
}
99
99
100
+ function transferOwnership (address newOwner ) public override onlyOwner {
101
+ require (newOwner != address (0 ), "Paymaster: owner cannot be address(0) " );
102
+ require (newOwner != verifyingSigner, "Paymaster: owner cannot be the verifyingSigner " );
103
+ _transferOwnership (newOwner);
104
+ }
105
+
100
106
receive () external payable {
101
107
// use address(this).balance rather than msg.value in case of force-send
102
108
(bool callSuccess , ) = payable (address (entryPoint)).call {value: address (this ).balance}("" );
Original file line number Diff line number Diff line change @@ -61,6 +61,16 @@ contract PaymasterTest is Test {
61
61
paymaster.renounceOwnership ();
62
62
}
63
63
64
+ function test_zeroAddressTransferOwnership () public {
65
+ vm.expectRevert ("Paymaster: owner cannot be address(0) " );
66
+ paymaster.transferOwnership (address (0 ));
67
+ }
68
+
69
+ function test_verifyingSignerTransferOwnership () public {
70
+ vm.expectRevert ("Paymaster: owner cannot be the verifyingSigner " );
71
+ paymaster.transferOwnership (PAYMASTER_SIGNER);
72
+ }
73
+
64
74
function test_getHash () public {
65
75
UserOperation memory userOp = createUserOp ();
66
76
userOp.initCode = "initCode " ;
You can’t perform that action at this time.
0 commit comments