-
Notifications
You must be signed in to change notification settings - Fork 2
/
addJuneSeries.mainnet.ts
100 lines (89 loc) · 4.12 KB
/
addJuneSeries.mainnet.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
import { getOwnerOrImpersonate, propose, getName } from '../../../../../shared/helpers'
import {
Timelock__factory,
OldEmergencyBrake__factory,
NotionalMultiOracle__factory,
Cauldron__factory,
Ladle__factory,
Witch__factory,
Pool__factory,
IOracle,
} from '../../../../../typechain'
import { TIMELOCK, CLOAK, CAULDRON, LADLE, WITCH, FCASH, NOTIONAL, MULTISIG } from '../../../../../shared/constants'
import { orchestrateNotionalJoinProposal } from '../../../../fragments/other/notional/orchestrateNotionalJoinProposal'
import { updateNotionalSourcesProposal } from '../../../../fragments/oracles/updateNotionalSourcesProposal'
import { addAssetProposal } from '../../../../fragments/assetsAndSeries/addAssetProposal'
import { makeIlkProposal } from '../../../../fragments/assetsAndSeries/makeIlkProposal'
import { addSeriesProposal } from '../../../../fragments/assetsAndSeries/addSeriesProposal'
import { addIlksToSeriesProposal } from '../../../../fragments/assetsAndSeries/addIlksToSeriesProposal'
import { migrateStrategiesProposal } from '../../../../fragments/strategies/migrateStrategiesProposal'
import { orchestrateNewPoolsProposal } from '../../../../fragments/assetsAndSeries/orchestrateNewPoolsProposal'
import { orchestrateStrategiesProposal } from '../../../../fragments/strategies/orchestrateStrategiesProposal'
const {
developer,
deployer,
seriesIlks,
notionalSources,
notionalDebtLimits,
auctionLineAndLimits,
poolsInit,
migrateData,
} = require(process.env.CONF as string)
const { external, governance, protocol, joins, newJoins, newFYTokens, newPools, newStrategies } = require(process.env
.CONF as string)
/**
* @dev This script orchestrates a new series and rolls liquidity in the related strategies
*/
;(async () => {
let ownerAcc = await getOwnerOrImpersonate(developer)
const timelock = Timelock__factory.connect(governance.getOrThrow(TIMELOCK)!, ownerAcc)
const cloak = OldEmergencyBrake__factory.connect(governance.getOrThrow(CLOAK)!, ownerAcc)
const notionalOracle = NotionalMultiOracle__factory.connect(protocol.get(NOTIONAL)!, ownerAcc)
const cauldron = Cauldron__factory.connect(protocol.getOrThrow(CAULDRON)!, ownerAcc)
const ladle = Ladle__factory.connect(protocol.getOrThrow(LADLE)!, ownerAcc)
const witch = Witch__factory.connect(protocol.getOrThrow(WITCH)!, ownerAcc)
const fCashAddress = external.getOrThrow(FCASH)!
let assetsAndJoins: Array<[string, string, string]> = []
for (let [assetId, joinAddress] of newJoins) {
assetsAndJoins.push([assetId, fCashAddress, joinAddress])
console.log(`Using ${fCashAddress} as Join for ${joinAddress}`)
}
let proposal: Array<{ target: string; data: string }> = []
proposal = proposal.concat(
await orchestrateStrategiesProposal(
ownerAcc,
deployer,
governance.getOrThrow(MULTISIG)!,
timelock,
ladle,
newStrategies
)
)
for (let [seriesId, poolAddress] of newPools) {
const pool = Pool__factory.connect(poolAddress as string, ownerAcc)
console.log(`orchestrating ${getName(seriesId)} pool at address: ${poolAddress}`)
proposal = proposal.concat(await orchestrateNewPoolsProposal(deployer as string, pool, timelock, cloak))
}
proposal = proposal.concat(
await addSeriesProposal(ownerAcc, deployer, cauldron, ladle, witch, timelock, cloak, joins, newFYTokens, newPools)
)
proposal = proposal.concat(await orchestrateNotionalJoinProposal(ownerAcc, deployer, cloak, assetsAndJoins))
proposal = proposal.concat(await updateNotionalSourcesProposal(notionalOracle, notionalSources))
proposal = proposal.concat(await addAssetProposal(ownerAcc, cloak, cauldron, ladle, assetsAndJoins))
proposal = proposal.concat(
await makeIlkProposal(
ownerAcc,
notionalOracle as unknown as IOracle,
cauldron,
witch,
cloak,
newJoins,
notionalDebtLimits,
auctionLineAndLimits
)
)
proposal = proposal.concat(await addIlksToSeriesProposal(cauldron, seriesIlks))
proposal = proposal.concat(await migrateStrategiesProposal(ownerAcc, migrateData))
console.log(`Proposal with ${proposal.length} steps`)
await propose(timelock, proposal, developer)
})()