-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathscripts.ts
More file actions
56 lines (49 loc) · 1.95 KB
/
scripts.ts
File metadata and controls
56 lines (49 loc) · 1.95 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { task } from "hardhat/config"
import type { HardhatRuntimeEnvironment } from "hardhat/types"
task("deploy-e-near-proxy", "Deploys the ENearProxy contract")
.addParam("enear", "Address of eNear contract")
.addParam("prover", "Address of prover contract")
.setAction(async (taskArgs, hre: HardhatRuntimeEnvironment) => {
const { ethers, upgrades } = hre
const eNear = await ethers.getContractAt("IENear", taskArgs.enear)
const nearConnector = await eNear.nearConnector()
const eNearProxyContract = await ethers.getContractFactory("ENearProxy")
const eNearProxy = await upgrades.deployProxy(
eNearProxyContract,
[taskArgs.enear, taskArgs.prover, nearConnector, 0, taskArgs.admin],
{
initializer: "initialize",
timeout: 0,
},
)
await eNearProxy.waitForDeployment()
const proxyAddress = await eNearProxy.getAddress()
const implementationAddress = await upgrades.erc1967.getImplementationAddress(proxyAddress)
console.log(
JSON.stringify({
proxyAddress,
implementationAddress,
}),
)
})
task("e-near-set-admin", "Set the proxy as admin for eNear")
.addParam("newAdmin", "New admin address")
.addParam("enear", "Address of the eNear contract")
.setAction(async (taskArgs, hre: HardhatRuntimeEnvironment) => {
const { ethers } = hre
const eNear = await ethers.getContractAt("IENear", taskArgs.enear)
await eNear.adminSstore(9, ethers.zeroPadValue(taskArgs.newAdmin, 32))
})
task("deploy-fake-prover", "Deploy fake prover").setAction(
async (_taskArgs, hre: HardhatRuntimeEnvironment) => {
const { ethers } = hre
const FakeProverContractFactory = await ethers.getContractFactory("FakeProver")
const FakeProverContract = await FakeProverContractFactory.deploy()
await FakeProverContract.waitForDeployment()
console.log(
JSON.stringify({
fakeProverAddress: await FakeProverContract.getAddress(),
}),
)
},
)