Sitelet https://github.com/robertodf99/account/commit/4ea456a6456275e029080d5a356178c116f706ed
Skip to content

Commit 4ea456a

Browse files
committed
chore: remove ownable from entrypoint
1 parent c998035 commit 4ea456a

7 files changed

Lines changed: 12 additions & 39 deletions

File tree

‎script/DeployAll.s.sol‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ contract DeployAllScript is Script {
99
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
1010
address deployer = vm.createWallet(deployerPrivateKey).addr;
1111
vm.startBroadcast(deployerPrivateKey);
12-
new DeployAll(deployer);
12+
new DeployAll();
1313
vm.stopBroadcast();
1414
}
1515
}

‎src/DeployAll.sol‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ contract DeployAll {
1515
address public immutable accountRegistry;
1616
address public immutable simulator;
1717

18-
constructor(address deployer) payable {
19-
entryPoint = address(new EntryPoint(deployer));
18+
constructor() payable {
19+
entryPoint = address(new EntryPoint());
2020
delegationImplementation = address(new Delegation(address(entryPoint)));
2121
delegationProxy = LibEIP7702.deployProxy(delegationImplementation, address(0));
2222
accountRegistry = address(new AccountRegistry());

‎src/EntryPoint.sol‎

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {AccountRegistry} from "./AccountRegistry.sol";
55
import {LibBitmap} from "solady/utils/LibBitmap.sol";
66
import {LibERC7579} from "solady/accounts/LibERC7579.sol";
77
import {LibEIP7702} from "solady/accounts/LibEIP7702.sol";
8-
import {Ownable} from "solady/auth/Ownable.sol";
98
import {EfficientHashLib} from "solady/utils/EfficientHashLib.sol";
109
import {ReentrancyGuardTransient} from "solady/utils/ReentrancyGuardTransient.sol";
1110
import {EIP712} from "solady/utils/EIP712.sol";
@@ -38,13 +37,7 @@ import {IEntryPoint} from "./interfaces/IEntryPoint.sol";
3837
/// - Minimize chance of censorship.
3938
/// This means once an UserOp is signed, it is infeasible to
4039
/// alter or rearrange it to force it to fail.
41-
contract EntryPoint is
42-
IEntryPoint,
43-
EIP712,
44-
Ownable,
45-
CallContextChecker,
46-
ReentrancyGuardTransient
47-
{
40+
contract EntryPoint is IEntryPoint, EIP712, CallContextChecker, ReentrancyGuardTransient {
4841
using LibERC7579 for bytes32[];
4942
using EfficientHashLib for bytes32[];
5043
using LibBitmap for LibBitmap.Bitmap;
@@ -141,17 +134,15 @@ contract EntryPoint is
141134
uint256 internal constant _REFUND_GAS = 50000;
142135

143136
////////////////////////////////////////////////////////////////////////
144-
// Constructor
137+
// Main
145138
////////////////////////////////////////////////////////////////////////
146139

147-
constructor(address initialOwner) payable {
148-
_initializeOwner(initialOwner);
140+
/// @dev Allows anyone to sweep tokens from the entry point.
141+
/// If `token` is `address(0)`, withdraws the native gas token.
142+
function withdrawTokens(address token, address recipient, uint256 amount) public virtual {
143+
TokenTransferLib.safeTransfer(token, recipient, amount);
149144
}
150145

151-
////////////////////////////////////////////////////////////////////////
152-
// Main
153-
////////////////////////////////////////////////////////////////////////
154-
155146
/// @dev Executes a single encoded user operation.
156147
/// `encodedUserOp` is given by `abi.encode(userOp)`, where `userOp` is a struct of type `UserOp`.
157148
/// If sufficient gas is provided, returns an error selector that is non-zero
@@ -790,20 +781,6 @@ contract EntryPoint is
790781

791782
receive() external payable virtual {}
792783

793-
////////////////////////////////////////////////////////////////////////
794-
// Only Owner Functions
795-
////////////////////////////////////////////////////////////////////////
796-
797-
/// @dev Allows the entry point owner to withdraw tokens.
798-
/// If `token` is `address(0)`, withdraws the native gas token.
799-
function withdrawTokens(address token, address recipient, uint256 amount)
800-
public
801-
virtual
802-
onlyOwner
803-
{
804-
TokenTransferLib.safeTransfer(token, recipient, amount);
805-
}
806-
807784
////////////////////////////////////////////////////////////////////////
808785
// EIP712
809786
////////////////////////////////////////////////////////////////////////

‎test/Delegation.t.sol‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ contract DelegationTest is BaseTest {
306306
}
307307

308308
function testAddDisallowedSuperAdminKeyTypeReverts() public {
309-
address entryPoint = address(new EntryPoint(address(this)));
309+
address entryPoint = address(new EntryPoint());
310310
address delegationImplementation = address(new Delegation(address(entryPoint)));
311311
address delegationProxy = address(new EIP7702Proxy(delegationImplementation, address(0)));
312312
delegation = MockDelegation(payable(delegationProxy));

‎test/DeployAll.t.sol‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import "../src/DeployAll.sol";
77

88
contract LibPREPTest is SoladyTest {
99
function testDeployAll() public {
10-
DeployAll deployAll = new DeployAll(address(this));
10+
DeployAll deployAll = new DeployAll();
1111

1212
address entryPoint = deployAll.entryPoint();
13-
assertEq(EntryPoint(payable(entryPoint)).owner(), address(this));
1413

1514
assertEq(
1615
Delegation(payable(deployAll.delegationImplementation())).ENTRY_POINT(), entryPoint

‎test/EntryPoint.t.sol‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,11 @@ contract EntryPointTest is BaseTest {
281281
}
282282

283283
function testWithdrawTokens() public {
284-
vm.startPrank(ep.owner());
284+
// Anyone can withdraw tokens from the entry point.
285285
vm.deal(address(ep), 1 ether);
286286
paymentToken.mint(address(ep), 10 ether);
287287
ep.withdrawTokens(address(0), address(0xabcd), 1 ether);
288288
ep.withdrawTokens(address(paymentToken), address(0xabcd), 10 ether);
289-
vm.stopPrank();
290289
}
291290

292291
function testExceuteGasUsed() public {

‎test/utils/mocks/MockEntryPoint.sol‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import {Brutalizer} from "../Brutalizer.sol";
99
contract MockEntryPoint is EntryPoint, Brutalizer {
1010
error NoRevertEncountered();
1111

12-
constructor() payable EntryPoint(msg.sender) {}
13-
1412
function computeDigest(PreOp calldata preOp) public view returns (bytes32) {
1513
return _computeDigest(preOp);
1614
}

0 commit comments

Comments
 (0)