-
Notifications
You must be signed in to change notification settings - Fork 18
/
hardhat.config.ts
261 lines (234 loc) · 7.75 KB
/
hardhat.config.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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
import defaults from './config';
import { task, HardhatUserConfig } from 'hardhat/config';
import 'hardhat-gas-reporter';
import 'solidity-coverage';
import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-etherscan';
import '@nomiclabs/hardhat-web3';
import 'hardhat-typechain';
import 'hardhat-contract-sizer';
import 'hardhat-abi-exporter';
export interface IContract {
name: string,
addr: string,
args: any[],
skip: boolean,
}
const A_HOUR = 60 * 60;
const COMP = '0x61460874a7196d6a22d1ee4922473664b3e95270';
const cDAI = '0xf0d0eb522cfa50b716b3b1604c4f0fa6f04376ad';
const DAI = '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa';
const WETH = '0xd0A1E359811322d97991E03f863a0C30C2cF029C';
const cUSDC = '0x4a92e71227d294f041bd82dd8f78591b75140d63';
const USDC = '0xb7a4f3e9097c08da09517b5ab877f7a917224ede';
const dao = '0x59E2bC2E34EEeA09BfB99C2069Bfadf872D5F56f';
task('verify-testnet-compound-dai', 'verifies', async (args, hre) => {
// CONF --------
// DAO: 0x88C072c6B78a05D8Bbd8629fE7CA88287e12B211
// cDAI: 0xf0d0eb522cfa50b716b3b1604c4f0fa6f04376ad
// COMP: 0x61460874a7196d6a22d1ee4922473664b3e95270
// DAI: 0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa
// WETH: 0xd0A1E359811322d97991E03f863a0C30C2cF029C
// uniswapPath: [
// '0x61460874a7196d6a22d1ee4922473664b3e95270',
// '0xd0A1E359811322d97991E03f863a0C30C2cF029C',
// '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa'
// ]
//
// DEPLOYED ----
// bondModel: 0x30434fC4b8ff2cDeB4B09490188Bf7E6d659CC4C
// compoundProvider: 0x686b895Ff7c603cb7b5561E8e190685237a6B801
// smartYield: 0x3fc25d9e5a583E96E626D921660b5Ef6ecC8A19E
// seniorBond: 0x589B9d02Be40f67783edC1BA843A6a12A561243a
// juniorBond: 0x3AC2E598E69E323893937fD396f5668566327549
// controller: 0x7122e06a067a663B97155ccd34863D4cc7CdCD31
// oracle: 0x04061dEBddEF431d06CbBC0b767C41e0DEEcb87a
const uniswapPath = [COMP, WETH, DAI];
const _bondModel = '0x30434fC4b8ff2cDeB4B09490188Bf7E6d659CC4C';
const _compoundProvider = '0x686b895Ff7c603cb7b5561E8e190685237a6B801';
const _smartYield = '0x3fc25d9e5a583E96E626D921660b5Ef6ecC8A19E';
const _controller = '0x7122e06a067a663B97155ccd34863D4cc7CdCD31';
const seniorBondCONF = { name: 'BarnBridge cDAI sBOND', symbol: 'bb_sBOND_cDAI' };
const juniorBondCONF = { name: 'BarnBridge cDAI jBOND', symbol: 'bb_jBOND_cDAI' };
const juniorTokenCONF = { name: 'BarnBridge cDAI', symbol: 'bb_cDAI' };
const oracleCONF = { windowSize: A_HOUR, granularity: 4 };
const decimals = 18; // same as DAI
const contracts: IContract[] = [
{
name: 'bond model',
addr: _bondModel,
args: [],
skip: false,
},
{
name: 'cDAI provider',
addr: _compoundProvider,
args: [cDAI],
skip: false,
},
{
name: 'smartYield',
addr: _smartYield,
args: [juniorTokenCONF.name, juniorTokenCONF.symbol, hre.ethers.BigNumber.from(decimals)],
skip: false,
},
{
name: 'seniorBond',
addr: '0x589B9d02Be40f67783edC1BA843A6a12A561243a',
args: [ _smartYield, seniorBondCONF.name, seniorBondCONF.symbol],
skip: false,
},
{
name: 'juniorBond',
addr: '0x3AC2E598E69E323893937fD396f5668566327549',
args: [_smartYield, juniorBondCONF.name, juniorBondCONF.symbol],
skip: false,
},
{
name: 'controller',
addr: _controller,
args: [_compoundProvider, _smartYield, _bondModel, uniswapPath],
skip: false,
},
{
name: 'oracle',
addr: '0x04061dEBddEF431d06CbBC0b767C41e0DEEcb87a',
args: [_controller, oracleCONF.windowSize, oracleCONF.granularity],
skip: false,
},
];
for (const c of contracts) {
console.log('verifying', c.name, '...');
if(c.skip) {
console.log('skipping');
} else {
await hre.run('verify:verify', {
address: c.addr,
constructorArguments: c.args,
});
}
}
});
task('verify-testnet-compound-usdc', 'verifies', async (args, hre) => {
// CONF --------
// DAO: 0x88C072c6B78a05D8Bbd8629fE7CA88287e12B211
// cUSDC: 0x4a92e71227d294f041bd82dd8f78591b75140d63
// COMP: 0x61460874a7196d6a22d1ee4922473664b3e95270
// USDC: 0xb7a4f3e9097c08da09517b5ab877f7a917224ede
// WETH: 0xd0A1E359811322d97991E03f863a0C30C2cF029C
// uniswapPath: [
// '0x61460874a7196d6a22d1ee4922473664b3e95270',
// '0xd0A1E359811322d97991E03f863a0C30C2cF029C',
// '0xb7a4f3e9097c08da09517b5ab877f7a917224ede'
// ]
//
// DEPLOYED ----
// bondModel: 0xd815d5fe0f2f394Aa313441d1a9fF849e59C76c8
// compoundProvider: 0x2894fd23f5604DE8fBfC6Fb91BC7224CC93fa135
// smartYield: 0x63fD30ed07c91B7b27Da5c828c7eB752F7e4676b
// seniorBond: 0x7Baa74D3091fA1d0FE2d05046EF4C9789b4451a3
// juniorBond: 0xD0219B2B4B5C26C90C6A73D10DCeCB52BE20885b
// controller: 0x7A40EC780E57134bB0d2Ed8d54C2BD0A815B85CC
// oracle: 0xe23E7531D0431c4bcA46ac84862849f647646968
const uniswapPath = [COMP, WETH, USDC];
const _bondModel = '0xd815d5fe0f2f394Aa313441d1a9fF849e59C76c8';
const _compoundProvider = '0x2894fd23f5604DE8fBfC6Fb91BC7224CC93fa135';
const _smartYield = '0x63fD30ed07c91B7b27Da5c828c7eB752F7e4676b';
const _controller = '0x7A40EC780E57134bB0d2Ed8d54C2BD0A815B85CC';
const seniorBondCONF = { name: 'BarnBridge cUSDC sBOND', symbol: 'bbscUSDC' };
const juniorBondCONF = { name: 'BarnBridge cUSDC jBOND', symbol: 'bbjcUSDC' };
const juniorTokenCONF = { name: 'BarnBridge cUSDC', symbol: 'bbcUSDC' };
const oracleCONF = { windowSize: A_HOUR, granularity: 4 };
const decimals = 6;
const contracts: IContract[] = [
{
name: 'bond model',
addr: _bondModel,
args: [],
skip: true,
},
{
name: 'cUSDC provider',
addr: _compoundProvider,
args: [cUSDC],
skip: true,
},
{
name: 'smartYield',
addr: _smartYield,
args: [juniorTokenCONF.name, juniorTokenCONF.symbol, hre.ethers.BigNumber.from(decimals)],
skip: true,
},
{
name: 'seniorBond',
addr: '0x7Baa74D3091fA1d0FE2d05046EF4C9789b4451a3',
args: [ _smartYield, seniorBondCONF.name, seniorBondCONF.symbol],
skip: true,
},
{
name: 'juniorBond',
addr: '0xD0219B2B4B5C26C90C6A73D10DCeCB52BE20885b',
args: [_smartYield, juniorBondCONF.name, juniorBondCONF.symbol],
skip: true,
},
{
name: 'controller',
addr: _controller,
args: [_compoundProvider, _smartYield, _bondModel, uniswapPath],
skip: true,
},
{
name: 'oracle',
addr: '0xe23E7531D0431c4bcA46ac84862849f647646968',
args: [_controller, oracleCONF.windowSize, oracleCONF.granularity],
skip: true,
},
];
for (const c of contracts) {
console.log('verifying', c.name, '...');
if(c.skip) {
console.log('skipping');
} else {
await hre.run('verify:verify', {
address: c.addr,
constructorArguments: c.args,
});
}
}
});
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task('accounts', 'Prints the list of accounts', async (args, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(await account.address);
}
});
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
const config: HardhatUserConfig = {
...defaults,
solidity: {
version: '0.7.6',
settings: {
optimizer: {
enabled: true,
runs: 9999,
},
},
},
gasReporter: {
currency: 'USD',
enabled: false,
},
abiExporter: {
path: './abi',
clear: true,
flat: false,
only: [
'SmartYield', 'SeniorBond', 'JuniorBond', 'YieldOracle', 'BondModelV1',
'CompoundProvider', 'CompoundController',
],
},
};
export default config;