Skip to content

Commit 8dfca07

Browse files
committed
deploy AccessLists on known networks
1 parent 4fecb8c commit 8dfca07

File tree

2 files changed

+176
-5
lines changed

2 files changed

+176
-5
lines changed

addresses/address.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@
145145
"VestingWalletC": "0x29F74B853C4B8D36273666FB63a3b71c754424Ed",
146146
"OceanNodesBooster": "0x73558Ef3bb6543A8107ac032C5a98Da03ceb0eEf",
147147
"OPFCommunityFeeCollectorCompute": "0x1705CaF86B86e85804e20FE342f39B17322Ff592",
148-
"Escrow": "0x5D7a9F0c8E9E9af5674DEE832Cc97FC425b655Bc"
148+
"Escrow": "0x5D7a9F0c8E9E9af5674DEE832Cc97FC425b655Bc",
149+
"AccessListFactory": "0x7ed6ac4243472adA55408fEE45c5Dff379f7aBE0"
149150
},
150151
"goerli": {
151152
"chainId": 5,
@@ -303,7 +304,8 @@
303304
"OPFCommunityFeeCollectorCompute": "0x0Ee8b03Dafc868a0899ebE1c12d734D53A957250",
304305
"Escrow": "0x86F2BB9F8f18B5a836b342199a3eC89F282E4018",
305306
"EnterpriseFeeCollector": "0x4D49eEedFac8Ea03328c0E4871b680C06d892092",
306-
"FixedPriceEnterprise": "0xEcD0C3519a081e3924D6F3197f86980eA7dfCf71"
307+
"FixedPriceEnterprise": "0xEcD0C3519a081e3924D6F3197f86980eA7dfCf71",
308+
"AccessListFactory": "0x43eC0a34E1b70C7f8E579ab866F37642777727E7"
307309
},
308310
"oasis_sapphire": {
309311
"chainId": 23294,
@@ -349,7 +351,9 @@
349351
"Dispenser": "0x30E4CC2C7A9c6aA2b2Ce93586E3Df24a3A00bcDD",
350352
"ERC721Factory": "0xDEfD0018969cd2d4E648209F876ADe184815f038",
351353
"OPFCommunityFeeCollectorCompute": "0xe47991939632757DEe324E8ec9A3268c62C0DB76",
352-
"Escrow": "0x4D49eEedFac8Ea03328c0E4871b680C06d892092"
354+
"Escrow": "0x4D49eEedFac8Ea03328c0E4871b680C06d892092",
355+
"AccessListFactory": "0xEcD0C3519a081e3924D6F3197f86980eA7dfCf71"
356+
353357
},
354358
"optimism": {
355359
"chainId": 10,
@@ -368,7 +372,8 @@
368372
"Dispenser": "0x2112Eb973af1DBf83a4f11eda82f7a7527D7Fde5",
369373
"ERC721Factory": "0x80E63f73cAc60c1662f27D2DFd2EA834acddBaa8",
370374
"OPFCommunityFeeCollectorCompute": "0xc37F8341Ac6e4a94538302bCd4d49Cf0852D30C0",
371-
"Escrow": "0x3c21a90599b5B7f37014cA5Bf30d3f1b73d7e391"
375+
"Escrow": "0x3c21a90599b5B7f37014cA5Bf30d3f1b73d7e391",
376+
"AccessListFactory": "0x4E6058dC00e90C0DCA47A5d0D3346F409939A5ab"
372377
},
373378
"pontus-x-devnet": {
374379
"chainId": 32456,
@@ -404,6 +409,7 @@
404409
"ERC721Factory": "0x159924ca0F47D6F704B97E29099b89e518A17B5E",
405410
"BatchPayments": "0xFe7967A5176fDAFa8DE109b3507016B885a82D6e",
406411
"OPFCommunityFeeCollectorCompute": "0x7b0576CF01E868bce46cca91b2a8E674141b0355",
407-
"Escrow": "0x8389bC1306208488D665F939AFB4079adf6f5a06"
412+
"Escrow": "0x8389bC1306208488D665F939AFB4079adf6f5a06",
413+
"AccessListFactory": "0xE5aa2C9B551aFcA4C0A98BB3B37D7A43084d0a66"
408414
}
409415
}

scripts/deploy_accesslist.js

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
// We require the Hardhat Runtime Environment explicitly here. This is optional
2+
// but useful for running the script in a standalone fashion through `node <script>`.
3+
//
4+
// When running the script with `hardhat run <script>` you'll find the Hardhat
5+
// Runtime Environment's members available in the global scope.
6+
const hre = require("hardhat");
7+
const fs = require("fs");
8+
const { address } = require("../test/helpers/constants");
9+
const { Wallet } = require("ethers");
10+
const { UV_FS_O_FILEMAP } = require("constants");
11+
const ethers = hre.ethers;
12+
require("dotenv").config();
13+
const logging = true;
14+
const show_verify = true;
15+
const shouldDeployMock20 = false;
16+
async function main() {
17+
const url = process.env.NETWORK_RPC_URL;
18+
console.log("Using RPC: " + url);
19+
if (!url) {
20+
console.error("Missing NETWORK_RPC_URL. Aborting..");
21+
return null;
22+
}
23+
const provider = new ethers.providers.JsonRpcProvider(url);
24+
const network = provider.getNetwork();
25+
// utils
26+
const networkDetails = await network;
27+
28+
let wallet;
29+
if (process.env.MNEMONIC)
30+
wallet = new Wallet.fromMnemonic(process.env.MNEMONIC);
31+
if (process.env.PRIVATE_KEY) wallet = new Wallet(process.env.PRIVATE_KEY);
32+
if (!wallet) {
33+
console.error("Missing MNEMONIC or PRIVATE_KEY. Aborting..");
34+
return null;
35+
}
36+
owner = wallet.connect(provider);
37+
let gasLimit = 3000000;
38+
let gasPrice = null;
39+
let sleepAmount = 10;
40+
let OPFOwner = null;
41+
let RouterAddress = null;
42+
console.log("Using chain " + networkDetails.chainId);
43+
switch (networkDetails.chainId) {
44+
case 1:
45+
networkName = "mainnet";
46+
OPFOwner = "0x0d27cd67c4A3fd3Eb9C7C757582f59089F058167";
47+
RouterAddress = "0x8149276f275EEFAc110D74AFE8AFECEaeC7d1593";
48+
gasLimit = 2500000;
49+
gasPrice = ethers.utils.parseUnits("1", "gwei");
50+
break;
51+
case 10:
52+
networkName = "optimism";
53+
OPFOwner = "0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687";
54+
RouterAddress = "0xf26c6C93f9f1d725e149d95f8E7B2334a406aD10";
55+
gasPrice = ethers.utils.parseUnits("0.001", "gwei");
56+
gasLimit = 2800000;
57+
break;
58+
case 0x89:
59+
networkName = "polygon";
60+
OPFOwner = "0x6272E00741C16b9A337E29DB672d51Af09eA87dD";
61+
RouterAddress = "0x78e1317186786591912A10a7aF2490B8B4697A93";
62+
gasLimit = 19000000;
63+
gasPrice = ethers.utils.parseUnits("30", "gwei");
64+
break;
65+
case 8453:
66+
networkName = "base";
67+
OPFOwner = "0x4169e846f1524Cf0ac02Bd4B04fa33242709Cf64";
68+
RouterAddress = "0xEF62FB495266C72a5212A11Dce8baa79Ec0ABeB1";
69+
gasPrice = ethers.utils.parseUnits("0.009260", "gwei");
70+
gasLimit = 28000000;
71+
break;
72+
case 23294:
73+
networkName = "oasis_saphire";
74+
OPFOwner = "0x086E7F0588755af5AF5f8194542Fd8328238F3C1";
75+
RouterAddress = "0xd8992Ed72C445c35Cb4A2be468568Ed1079357c8";
76+
gasPrice = ethers.utils.parseUnits("100", "gwei");
77+
gasLimit = 15000000;
78+
break;
79+
case 23295:
80+
networkName = "oasis_saphire_testnet";
81+
OPFOwner = "0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687";
82+
RouterAddress = "0x5FBC2A29f7C8e4533dECD14Dc1c561A8eF0d4e31";
83+
gasPrice = ethers.utils.parseUnits("100", "gwei");
84+
gasLimit = 28000000;
85+
break;
86+
case 11155111:
87+
networkName = "sepolia";
88+
OPFOwner = "0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687";
89+
RouterAddress = "0x2112Eb973af1DBf83a4f11eda82f7a7527D7Fde5";
90+
gasPrice = ethers.utils.parseUnits("1", "gwei");
91+
gasLimit = 28000000;
92+
break;
93+
case 11155420:
94+
networkName = "optimism_sepolia";
95+
OPFOwner = "0xC7EC1970B09224B317c52d92f37F5e1E4fF6B687";
96+
RouterAddress = "0x1B083D8584dd3e6Ff37d04a6e7e82b5F622f3985";
97+
gasPrice = ethers.utils.parseUnits("5", "gwei");
98+
gasLimit = 28000000;
99+
break;
100+
default:
101+
OPFOwner = "0x0d27cd67c4A3fd3Eb9C7C757582f59089F058167";
102+
networkName = "development";
103+
routerOwner = OPFOwner;
104+
shouldDeployOceanMock = true;
105+
sleepAmount = 0;
106+
break;
107+
}
108+
109+
let options;
110+
if (gasPrice) {
111+
options = { gasLimit: gasLimit, gasPrice: gasPrice };
112+
} else {
113+
options = { gasLimit };
114+
}
115+
116+
console.log("Deployer nonce:", await owner.getTransactionCount());
117+
118+
if (logging) console.info("Deploying Accesslists");
119+
const AccessListFactory = await ethers.getContractFactory(
120+
"AccessListFactory"
121+
);
122+
const AccessList = await ethers.getContractFactory("AccessList");
123+
const accessListContract = await AccessList.connect(owner).deploy({gasLimit: 2500000});
124+
await accessListContract.deployTransaction.wait();
125+
console.log("accessListContract deployed to:", accessListContract.address);
126+
if (show_verify) {
127+
console.log("\tRun the following to verify on etherscan");
128+
console.log(
129+
"\tnpx hardhat verify --network " +
130+
networkName +
131+
" " +
132+
accessListContract.address
133+
);
134+
}
135+
const accessListFactoryContract = await AccessListFactory.connect(
136+
owner
137+
).deploy(accessListContract.address,{gasLimit: 2500000});
138+
await accessListFactoryContract.deployTransaction.wait();
139+
console.log("AccessListFactory deployed to:", accessListFactoryContract.address);
140+
if (show_verify) {
141+
console.log("\tRun the following to verify on etherscan");
142+
console.log(
143+
"\tnpx hardhat verify --network " +
144+
networkName +
145+
" " +
146+
accessListFactoryContract.address +
147+
" " +
148+
accessListContract.address
149+
);
150+
}
151+
}
152+
153+
async function sleep(s) {
154+
return new Promise((resolve) => {
155+
setTimeout(resolve, s * 1000);
156+
});
157+
}
158+
// We recommend this pattern to be able to use async/await everywhere
159+
// and properly handle errors.
160+
main()
161+
.then(() => process.exit(0))
162+
.catch((error) => {
163+
console.error(error);
164+
process.exit(1);
165+
});

0 commit comments

Comments
 (0)