forked from ava-labs/EncryptedERC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-standalone.ts
More file actions
57 lines (50 loc) · 1.47 KB
/
deploy-standalone.ts
File metadata and controls
57 lines (50 loc) · 1.47 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
57
import { ethers } from "hardhat";
import { deployLibrary } from "../test/helpers";
import { EncryptedERC__factory } from "../typechain-types";
import { DECIMALS } from "./constants";
import { deployProductionVerifiers } from "./helpers";
const main = async () => {
// get deployer
const [deployer] = await ethers.getSigners();
// deploy verifiers
const {
registrationVerifier,
mintVerifier,
withdrawVerifier,
transferVerifier,
} = await deployProductionVerifiers(deployer);
// deploy babyjub library
const babyJubJub = await deployLibrary(deployer);
// deploy registrar contract
const registrarFactory = await ethers.getContractFactory("Registrar");
const registrar = await registrarFactory.deploy(registrationVerifier);
await registrar.waitForDeployment();
// deploy eERC20
const encryptedERCFactory = new EncryptedERC__factory({
"contracts/libraries/BabyJubJub.sol:BabyJubJub": babyJubJub,
});
const encryptedERC_ = await encryptedERCFactory.connect(deployer).deploy({
registrar: registrar.target,
isConverter: false, // This is a standalone eERC
name: "Test",
symbol: "TEST",
mintVerifier,
withdrawVerifier,
transferVerifier,
decimals: DECIMALS,
});
await encryptedERC_.waitForDeployment();
console.table({
registrationVerifier,
mintVerifier,
withdrawVerifier,
transferVerifier,
babyJubJub,
registrar: registrar.target,
encryptedERC: encryptedERC_.target,
});
};
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});