-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathtimelock_deploy.ts
29 lines (25 loc) · 1.31 KB
/
timelock_deploy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* PRIVATE_KEY={private_key} ts-node scripts/timelock_deploy.ts "{network}"
*/
import { ethers, providers } from 'ethers'
import {
TrustToken__factory,
TimeLockRegistry__factory,
OwnedUpgradeabilityProxy__factory,
} from 'contracts'
async function deployTimeLockRegistry () {
const txnArgs = { gasLimit: 5_000_000, gasPrice: 16_000_000_000 }
const provider = new providers.InfuraProvider(process.argv[2], 'e33335b99d78415b82f8b9bc5fdc44c0')
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider)
const trustTokenImpl = await (await new TrustToken__factory(wallet).deploy(txnArgs)).deployed()
console.log(`TrustToken Impl at: ${trustTokenImpl.address}`)
const timeLockRegistry = await (await new TimeLockRegistry__factory(wallet).deploy(txnArgs)).deployed()
console.log(`TimeLockRegistry Impl at: ${timeLockRegistry.address}`)
const proxy = await (await new OwnedUpgradeabilityProxy__factory(wallet).deploy(txnArgs)).deployed()
console.log(`Proxy at: ${proxy.address}`)
await (await proxy.upgradeTo(timeLockRegistry.address, txnArgs)).wait()
console.log('Proxy upgrade: done')
await (await TimeLockRegistry__factory.connect(proxy.address, wallet).initialize(trustTokenImpl.address, txnArgs)).wait()
console.log('Registry initialization: done')
}
deployTimeLockRegistry().catch(console.error)