forked from dystopia-exchange/dystopia-contracts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
02_DeployDex.ts
36 lines (29 loc) · 1.11 KB
/
02_DeployDex.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
30
31
32
33
34
35
36
import { Deploy } from "../Deploy";
import { ethers } from "hardhat";
import { Misc } from "../../Misc";
import { Verify } from "../../Verify";
import { readFileSync } from "fs";
async function main() {
const [deployer] = await ethers.getSigners();
const chainId = await deployer.getChainId();
const path = `./scripts/Addresses/${chainId}/`;
const file = 'WMTR.json';
const WMTR_TOKEN = JSON.parse(readFileSync(path + file).toString());
const [factory, router] = await Deploy.deployDex(deployer, WMTR_TOKEN.address);
const lib = await Deploy.deployLibrary(deployer, router.address)
const data = ''
+ 'factory: ' + factory.address + '\n'
+ 'router: ' + router.address + '\n'
+ 'SolidlyLibrary: ' + lib.address + '\n'
console.log(data);
Misc.saveFile(await deployer.getChainId(), "Factory", factory.address);
Misc.saveFile(await deployer.getChainId(), "Router", router.address);
Misc.saveFile(await deployer.getChainId(), "SolidlyLibrary", lib.address);
await Verify.sourcify();
}
main()
.then(() => process.exit(0))
.catch(error => {
console.error(error);
process.exit(1);
});