@@ -14,22 +14,22 @@ const parseEvents = (
14
14
. map ( ( log ) => contractInterface . parseLog ( log ) )
15
15
. filter ( ( log ) => log . name === eventName )
16
16
17
- task ( 'ampl: deploy' , 'Deploy ampleforth contracts' ) . setAction (
18
- async ( args , bre ) => {
17
+ task ( 'deploy:ampl ' , 'Deploy ampleforth contracts' ) . setAction (
18
+ async ( args , hre ) => {
19
19
console . log ( args )
20
20
21
21
// get signers
22
- const deployer = ( await bre . ethers . getSigners ( ) ) [ 0 ]
22
+ const deployer = ( await hre . ethers . getSigners ( ) ) [ 0 ]
23
23
console . log ( 'Deployer' , await deployer . getAddress ( ) )
24
24
25
25
// set init params
26
26
const owner = await deployer . getAddress ( )
27
- const BASE_CPI = bre . ethers . utils . parseUnits ( '1' , 20 )
27
+ const BASE_CPI = hre . ethers . utils . parseUnits ( '1' , 20 )
28
28
29
29
// deploy UFragments
30
30
const uFragments = await (
31
- await bre . upgrades . deployProxy (
32
- ( await bre . ethers . getContractFactory ( 'UFragments' ) ) . connect ( deployer ) ,
31
+ await hre . upgrades . deployProxy (
32
+ ( await hre . ethers . getContractFactory ( 'UFragments' ) ) . connect ( deployer ) ,
33
33
[ owner ] ,
34
34
{
35
35
initializer : 'initialize(address)' ,
@@ -40,8 +40,8 @@ task('ampl:deploy', 'Deploy ampleforth contracts').setAction(
40
40
41
41
// deploy Policy
42
42
const uFragmentsPolicy = await (
43
- await bre . upgrades . deployProxy (
44
- ( await bre . ethers . getContractFactory ( 'UFragmentsPolicy' ) ) . connect (
43
+ await hre . upgrades . deployProxy (
44
+ ( await hre . ethers . getContractFactory ( 'UFragmentsPolicy' ) ) . connect (
45
45
deployer ,
46
46
) ,
47
47
[ owner , uFragments . address , BASE_CPI . toString ( ) ] ,
@@ -54,21 +54,21 @@ task('ampl:deploy', 'Deploy ampleforth contracts').setAction(
54
54
55
55
// deploy Orchestrator
56
56
const orchestrator = await (
57
- await bre . ethers . getContractFactory ( 'Orchestrator' )
57
+ await hre . ethers . getContractFactory ( 'Orchestrator' )
58
58
)
59
59
. connect ( deployer )
60
60
. deploy ( uFragmentsPolicy . address )
61
61
console . log ( 'Orchestrator deployed to:' , orchestrator . address )
62
62
} ,
63
63
)
64
64
65
- task ( 'ampl: upgrade' , 'Upgrade ampleforth contracts' )
65
+ task ( 'upgrade:ampl ' , 'Upgrade ampleforth contracts' )
66
66
. addParam ( 'contract' , 'which implementation contract to use' )
67
67
. addParam ( 'address' , 'which proxy address to upgrade' )
68
68
. addOptionalParam ( 'multisig' , 'which multisig address to use for upgrade' )
69
- . setAction ( async ( args , bre ) => {
69
+ . setAction ( async ( args , hre ) => {
70
70
console . log ( args )
71
- const upgrades = bre . upgrades as any
71
+ const upgrades = hre . upgrades as any
72
72
73
73
// can only upgrade token or policy
74
74
const supported = [ 'UFragments' , 'UFragmentsPolicy' ]
@@ -79,23 +79,23 @@ task('ampl:upgrade', 'Upgrade ampleforth contracts')
79
79
}
80
80
81
81
// get signers
82
- const deployer = ( await bre . ethers . getSigners ( ) ) [ 0 ]
82
+ const deployer = ( await hre . ethers . getSigners ( ) ) [ 0 ]
83
83
console . log ( 'Deployer' , await deployer . getAddress ( ) )
84
84
85
85
if ( args . multisig ) {
86
86
// deploy new implementation
87
87
const implementation = await upgrades . prepareUpgrade (
88
88
args . address ,
89
- await bre . ethers . getContractFactory ( args . contract ) ,
89
+ await hre . ethers . getContractFactory ( args . contract ) ,
90
90
)
91
91
console . log (
92
92
`New implementation for ${ args . contract } deployed to` ,
93
93
implementation ,
94
94
)
95
95
96
96
// prepare upgrade transaction
97
- const admin = new bre . ethers . Contract (
98
- await getAdminAddress ( bre . ethers . provider , args . address ) ,
97
+ const admin = new hre . ethers . Contract (
98
+ await getAdminAddress ( hre . ethers . provider , args . address ) ,
99
99
ProxyAdmin . abi ,
100
100
deployer ,
101
101
)
@@ -106,7 +106,7 @@ task('ampl:upgrade', 'Upgrade ampleforth contracts')
106
106
console . log ( `Upgrade transaction` , upgradeTx )
107
107
108
108
// send upgrade transaction to multisig
109
- const multisig = new bre . ethers . Contract (
109
+ const multisig = new hre . ethers . Contract (
110
110
args . multisig ,
111
111
MultiSigWallet ,
112
112
deployer ,
@@ -126,8 +126,33 @@ task('ampl:upgrade', 'Upgrade ampleforth contracts')
126
126
} else {
127
127
await upgrades . upgradeProxy (
128
128
args . address ,
129
- await bre . ethers . getContractFactory ( args . contract ) ,
129
+ await hre . ethers . getContractFactory ( args . contract ) ,
130
130
)
131
131
console . log ( args . contract , 'upgraded' )
132
132
}
133
133
} )
134
+
135
+ task ( 'deploy:wampl' , 'Deploy wampl contract' )
136
+ . addParam ( 'ampl' , 'The address to the AMPL token' )
137
+ . addParam ( 'name' , 'The ERC-20 name of the wAMPL token' )
138
+ . addParam ( 'symbol' , 'The ERC-20 symbol of the wAMPL token' )
139
+ . setAction ( async ( args , hre ) => {
140
+ console . log ( args )
141
+
142
+ // get signers
143
+ const deployer = ( await hre . ethers . getSigners ( ) ) [ 0 ]
144
+ console . log ( 'Deployer' , await deployer . getAddress ( ) )
145
+
146
+ // deploy contract
147
+ const constructorArguments = [ args . ampl , args . name , args . symbol ]
148
+ const wampl = await ( await hre . ethers . getContractFactory ( 'WAMPL' ) )
149
+ . connect ( deployer )
150
+ . deploy ( ...constructorArguments )
151
+ console . log ( 'wAMPL deployed to:' , wampl . address )
152
+ await wampl . deployTransaction . wait ( )
153
+
154
+ await hre . run ( 'verify:verify' , {
155
+ address : wampl . address ,
156
+ constructorArguments,
157
+ } )
158
+ } )
0 commit comments