Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Commit f450444

Browse files
authored
Merge pull request #72 from base-org/jack/paymaster
Add Paymaster implementation for destination chain ERC-4337 UserOp support
2 parents bd020da + b80dbc8 commit f450444

28 files changed

Lines changed: 1218 additions & 100 deletions

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@
77
[submodule "contracts/lib/optimism"]
88
path = contracts/lib/optimism
99
url = https://github.com/ethereum-optimism/optimism
10+
[submodule "contracts/lib/account-abstraction"]
11+
path = contracts/lib/account-abstraction
12+
url = https://github.com/eth-infinitism/account-abstraction
13+
[submodule "contracts/lib/solady"]
14+
path = contracts/lib/solady
15+
url = https://github.com/Vectorized/solady

contracts/lib/account-abstraction

Submodule account-abstraction added at 7af70c8

contracts/lib/solady

Submodule solady added at 5ea5d9f

contracts/script/DeployRIP7755Inbox.s.sol

Lines changed: 0 additions & 16 deletions
This file was deleted.

contracts/script/DeployRIP7755OutboxToArbitrum.s.sol

Lines changed: 0 additions & 16 deletions
This file was deleted.

contracts/script/DeployRIP7755OutboxToHashi.s.sol

Lines changed: 0 additions & 16 deletions
This file was deleted.

contracts/script/DeployRIP7755OutboxToOPStack.s.sol

Lines changed: 0 additions & 16 deletions
This file was deleted.

contracts/script/HelperConfig.s.sol

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ pragma solidity 0.8.24;
33

44
import {Script} from "forge-std/Script.sol";
55

6+
import {EntryPoint} from "account-abstraction/core/EntryPoint.sol";
7+
68
contract HelperConfig is Script {
79
struct NetworkConfig {
810
uint256 chainId;
@@ -13,21 +15,25 @@ contract HelperConfig is Script {
1315
address l2Oracle;
1416
address shoyuBashi;
1517
uint256 deployerKey;
18+
address entryPoint;
1619
}
1720

1821
uint256 public DEFAULT_ANVIL_PRIVATE_KEY = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80;
1922

2023
uint256 public constant ARBITRUM_SEPOLIA_CHAIN_ID = 421614;
2124
uint256 public constant BASE_SEPOLIA_CHAIN_ID = 84532;
2225
uint256 public constant OPTIMISM_SEPOLIA_CHAIN_ID = 11155420;
26+
uint256 public constant LOCAL_CHAIN_ID = 31337;
2327

24-
function getConfig(uint256 chainId) public view returns (NetworkConfig memory config) {
28+
function getConfig(uint256 chainId) public returns (NetworkConfig memory config) {
2529
if (chainId == ARBITRUM_SEPOLIA_CHAIN_ID) {
2630
return getArbitrumSepoliaConfig();
2731
} else if (chainId == BASE_SEPOLIA_CHAIN_ID) {
2832
return getBaseSepoliaConfig();
2933
} else if (chainId == OPTIMISM_SEPOLIA_CHAIN_ID) {
3034
return getOptimismSepoliaConfig();
35+
} else if (chainId == LOCAL_CHAIN_ID) {
36+
return getLocalConfig();
3137
}
3238

3339
require(false, "Unsupported chain");
@@ -42,7 +48,8 @@ contract HelperConfig is Script {
4248
inbox: 0x3925cA932720B63ccD2C359DF27fD4146b123628,
4349
l2Oracle: 0x042B2E6C5E99d4c521bd49beeD5E99651D9B0Cf4,
4450
shoyuBashi: 0xce8b068D4F7F2eb3bDAFa72eC3C4feE78CF9Ccf7,
45-
deployerKey: vm.envUint("PRIVATE_KEY")
51+
deployerKey: vm.envUint("PRIVATE_KEY"),
52+
entryPoint: address(0)
4653
});
4754
}
4855

@@ -55,7 +62,8 @@ contract HelperConfig is Script {
5562
inbox: 0x0D595D4d3dC06548D536e74528C5B8ecc2171B31,
5663
l2Oracle: 0x4C8BA32A5DAC2A720bb35CeDB51D6B067D104205,
5764
shoyuBashi: 0x6602dc9b6bd964C2a11BBdA9B2275308D1Bbc14f,
58-
deployerKey: vm.envUint("PRIVATE_KEY")
65+
deployerKey: vm.envUint("PRIVATE_KEY"),
66+
entryPoint: address(0)
5967
});
6068
}
6169

@@ -68,7 +76,27 @@ contract HelperConfig is Script {
6876
inbox: 0x27B9e81C31eab9fdB8Ed1280680b23299FBa4cd8,
6977
l2Oracle: 0x218CD9489199F321E1177b56385d333c5B598629,
7078
shoyuBashi: 0x7237bb8d1d38DF8b473b5A38eD90088AF162ad8e,
71-
deployerKey: vm.envUint("PRIVATE_KEY")
79+
deployerKey: vm.envUint("PRIVATE_KEY"),
80+
entryPoint: address(0)
81+
});
82+
}
83+
84+
function getLocalConfig() public returns (NetworkConfig memory) {
85+
EntryPoint entryPoint = new EntryPoint();
86+
87+
return NetworkConfig({
88+
chainId: LOCAL_CHAIN_ID,
89+
opStackOutbox: address(0),
90+
arbitrumOutbox: address(0),
91+
hashiOutbox: address(0),
92+
inbox: address(0),
93+
l2Oracle: address(0),
94+
shoyuBashi: address(0),
95+
deployerKey: 0,
96+
entryPoint: address(entryPoint)
7297
});
7398
}
99+
100+
// Including to block from coverage report
101+
function test() external {}
74102
}

contracts/script/actions/SubmitRequest.s.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ contract SubmitRequest is Script, ERC7786Base {
3939

4040
function _initMessage(uint256 destinationChainId, uint256 duration)
4141
private
42-
view
4342
returns (string memory, Message[] memory, bytes[] memory)
4443
{
4544
HelperConfig.NetworkConfig memory dstConfig = helperConfig.getConfig(destinationChainId);
@@ -64,4 +63,7 @@ contract SubmitRequest is Script, ERC7786Base {
6463

6564
return (destinationChain, calls, attributes);
6665
}
66+
67+
// Including to block from coverage report
68+
function test() external {}
6769
}

contracts/script/actions/SubmitToInbox.s.sol

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {RIP7755Inbox} from "../../src/RIP7755Inbox.sol";
1010
contract SubmitToInbox is Script, ERC7786Base {
1111
function run() external {
1212
uint256 pk = vm.envUint("PRIVATE_KEY");
13-
RIP7755Inbox inbox = RIP7755Inbox(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512);
13+
RIP7755Inbox inbox = RIP7755Inbox(payable(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512));
1414

1515
(string memory sourceChain, string memory sender, Message[] memory messages, bytes[] memory attributes) =
1616
_initMessage();
@@ -44,4 +44,7 @@ contract SubmitToInbox is Script, ERC7786Base {
4444

4545
return (sourceChain, sender, calls, attributes);
4646
}
47+
48+
// Including to block from coverage report
49+
function test() external {}
4750
}

0 commit comments

Comments
 (0)