-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.js
More file actions
164 lines (129 loc) · 5.31 KB
/
deploy.js
File metadata and controls
164 lines (129 loc) · 5.31 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
const { ethers } = require("hardhat");
const TGEN_ADDRESS_TESTNET = "0xa9e37D0DC17C8B8Ed457Ab7cCC40b5785d4d11C0";
const TGEN_ADDRESS_MAINNET = "";
const FEE_POOL_ADDRESS_TESTNET = "0xa78211CbB829F10C7bca4D2BB83C61F30F70c3e9";
const FEE_POOL_ADDRESS_MAINNET = "";
const CANDLESTICK_DATA_FEED_REGISTRY_ADDRESS_TESTNET = "0x1f19A758382F51811C5D429F30Ad78192C377383";
const CANDLESTICK_DATA_FEED_REGISTRY_ADDRESS_MAINNET = "";
const ORACLE_ADDRESS_TESTNET = "0xFD174a7467db999B34A8AA7aB3EAd47020091385";
const ORACLE_ADDRESS_MAINNET = "";
const FACTORY_ADDRESS_TESTNET = "0x32bEA7eEe68fdA9a0d4e7FA8d63b13d6011e32A7";
const FACTORY_ADDRESS_MAINNET = "";
const VTE_DATA_FEED_REGISTRY_ADDRESS_TESTNET = "0xD5ac9fBe8Ae711bf228Ed9a9B9B76D6731808dD5";
const VTE_DATA_FEED_REGISTRY_ADDRESS_MAINNET = "";
const UTILS_LIBRARY_ADDRESS_TESTNET = "0xc151f6658738E875cEc2E59dd6a3064181FE4d7D";
const UTILS_LIBRARY_ADDRESS_MAINNET = "";
async function deployCandlestickDataFeedRegistry() {
const signers = await ethers.getSigners();
deployer = signers[0];
let CandlestickDataFeedRegistryFactory = await ethers.getContractFactory('CandlestickDataFeedRegistry');
let candlestickDataFeedRegistry = await CandlestickDataFeedRegistryFactory.deploy();
await candlestickDataFeedRegistry.deployed();
let candlestickDataFeedRegistryAddress = candlestickDataFeedRegistry.address;
console.log("CandlestickDataFeedRegistry: " + candlestickDataFeedRegistryAddress);
}
async function deployFeePool() {
const signers = await ethers.getSigners();
deployer = signers[0];
let FeePoolFactory = await ethers.getContractFactory('FeePool');
let feePool = await FeePoolFactory.deploy(deployer.address, TGEN_ADDRESS_TESTNET);
await feePool.deployed();
let feePoolAddress = feePool.address;
console.log("FeePool: " + feePoolAddress);
}
async function deployBotPerformanceDataFeedRegistry() {
const signers = await ethers.getSigners();
deployer = signers[0];
let BotPerformanceDataFeedRegistryFactory = await ethers.getContractFactory('BotPerformanceDataFeedRegistry');
let botPerformanceDataFeedRegistry = await BotPerformanceDataFeedRegistryFactory.deploy(FEE_POOL_ADDRESS_TESTNET, CANDLESTICK_DATA_FEED_REGISTRY_ADDRESS_TESTNET, TGEN_ADDRESS_TESTNET);
await botPerformanceDataFeedRegistry.deployed();
let botPerformanceDataFeedRegistryAddress = botPerformanceDataFeedRegistry.address;
console.log("BotPerformanceDataFeedRegistry: " + botPerformanceDataFeedRegistryAddress);
}
async function deployUtilsLibrary() {
const signers = await ethers.getSigners();
deployer = signers[0];
let UtilsFactory = await ethers.getContractFactory('Utils');
utils = await UtilsFactory.deploy();
await utils.deployed();
console.log("Utils Library: " + utils.address);
}
async function deployVTEDataFeedFactory() {
const signers = await ethers.getSigners();
deployer = signers[0];
let VTEDataFeedFactoryFactory = await ethers.getContractFactory('VTEDataFeedFactory', {
libraries: {
Utils: UTILS_LIBRARY_ADDRESS_TESTNET,
},
});
let VTEDataFeedFactory = await VTEDataFeedFactoryFactory.deploy(ORACLE_ADDRESS_TESTNET, FEE_POOL_ADDRESS_TESTNET, TGEN_ADDRESS_TESTNET);
await VTEDataFeedFactory.deployed();
let VTEDataFeedFactoryAddress = VTEDataFeedFactory.address;
console.log("VTEDataFeedFactory: " + VTEDataFeedFactoryAddress);
}
async function deployVTEDataFeedRegistry() {
const signers = await ethers.getSigners();
deployer = signers[0];
let VTEDataFeedRegistryFactory = await ethers.getContractFactory('VTEDataFeedRegistry');
let VTEDataFeedRegistry = await VTEDataFeedRegistryFactory.deploy(FEE_POOL_ADDRESS_TESTNET, TGEN_ADDRESS_TESTNET, ORACLE_ADDRESS_TESTNET, FACTORY_ADDRESS_TESTNET);
await VTEDataFeedRegistry.deployed();
let VTEDataFeedRegistryAddress = VTEDataFeedRegistry.address;
console.log("VTEDataFeedRegistry: " + VTEDataFeedRegistryAddress);
}
async function setRegistry() {
const signers = await ethers.getSigners();
deployer = signers[0];
let VTEDataFeedFactoryFactory = await ethers.getContractFactory('VTEDataFeedFactory', {
libraries: {
Utils: UTILS_LIBRARY_ADDRESS_TESTNET,
},
});
let factory = VTEDataFeedFactoryFactory.attach(FACTORY_ADDRESS_TESTNET);
let tx = await factory.initializeContract(VTE_DATA_FEED_REGISTRY_ADDRESS_TESTNET);
await tx.wait();
let registry = await factory.VTEDataFeedRegistry();
console.log(registry);
}
/*
deployCandlestickDataFeedRegistry()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
deployFeePool()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
deployBotPerformanceDataFeedRegistry()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
deployUtilsLibrary()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
deployVTEDataFeedFactory()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
deployVTEDataFeedRegistry()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})*/
setRegistry()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})