|
| 1 | +const { providers, Wallet } = require('ethers') |
1 | 2 | const hre = require('hardhat')
|
2 | 3 | const {
|
3 | 4 | ArbAddressTable__factory,
|
4 | 5 | } = require('@arbitrum/sdk/dist/lib/abi/factories/ArbAddressTable__factory')
|
5 |
| -const { addDefaultLocalNetwork } = require('@arbitrum/sdk') |
6 | 6 | const { arbLog, requireEnvVariables } = require('arb-shared-dependencies')
|
7 |
| -requireEnvVariables(['DEVNET_PRIVKEY', 'L2RPC']) |
| 7 | +const { |
| 8 | + ARB_ADDRESS_TABLE_ADDRESS, |
| 9 | +} = require('@arbitrum/sdk/dist/lib/dataEntities/constants') |
| 10 | +requireEnvVariables(['PRIVATE_KEY', 'CHAIN_RPC']) |
8 | 11 | require('dotenv').config()
|
9 | 12 |
|
| 13 | +/** |
| 14 | + * Set up: instantiate wallets connected to providers |
| 15 | + */ |
| 16 | +const walletPrivateKey = process.env.PRIVATE_KEY |
| 17 | +const provider = new providers.JsonRpcProvider(process.env.CHAIN_RPC) |
| 18 | +const wallet = new Wallet(walletPrivateKey, provider) |
| 19 | + |
10 | 20 | async function main() {
|
11 | 21 | await arbLog('Using the Address Table')
|
12 | 22 |
|
13 | 23 | /**
|
14 |
| - * Add the default local network configuration to the SDK |
15 |
| - * to allow this script to run on a local node |
| 24 | + * Deploy ArbitrumVIP contract |
16 | 25 | */
|
17 |
| - addDefaultLocalNetwork() |
18 |
| - |
19 |
| - /** |
20 |
| - * Deploy ArbitrumVIP contract to L2 |
21 |
| - */ |
22 |
| - const ArbitrumVIP = await hre.ethers.getContractFactory('ArbitrumVIP') |
23 |
| - const arbitrumVIP = await ArbitrumVIP.deploy() |
24 |
| - |
| 26 | + const ArbitrumVIPContract = await ( |
| 27 | + await hre.ethers.getContractFactory('ArbitrumVIP') |
| 28 | + ).connect(wallet) |
| 29 | + console.log('Deploying ArbitrumVIP contract...') |
| 30 | + const arbitrumVIP = await ArbitrumVIPContract.deploy() |
25 | 31 | await arbitrumVIP.deployed()
|
26 |
| - |
27 | 32 | console.log('ArbitrumVIP deployed to:', arbitrumVIP.address)
|
28 | 33 |
|
29 |
| - const signers = await hre.ethers.getSigners() |
30 |
| - const myAddress = signers[0].address |
| 34 | + const myAddress = wallet.address |
31 | 35 |
|
32 | 36 | /**
|
33 | 37 | * Connect to the Arbitrum Address table pre-compile contract
|
34 | 38 | */
|
35 | 39 | const arbAddressTable = ArbAddressTable__factory.connect(
|
36 |
| - '0x0000000000000000000000000000000000000066', |
37 |
| - signers[0] |
| 40 | + ARB_ADDRESS_TABLE_ADDRESS, |
| 41 | + wallet |
38 | 42 | )
|
39 | 43 |
|
40 | 44 | //**
|
|
0 commit comments