@@ -14,22 +14,22 @@ const parseEvents = (
1414 . map ( ( log ) => contractInterface . parseLog ( log ) )
1515 . filter ( ( log ) => log . name === eventName )
1616
17- task ( 'ampl: deploy' , 'Deploy ampleforth contracts' ) . setAction (
18- async ( args , bre ) => {
17+ task ( 'deploy:ampl ' , 'Deploy ampleforth contracts' ) . setAction (
18+ async ( args , hre ) => {
1919 console . log ( args )
2020
2121 // get signers
22- const deployer = ( await bre . ethers . getSigners ( ) ) [ 0 ]
22+ const deployer = ( await hre . ethers . getSigners ( ) ) [ 0 ]
2323 console . log ( 'Deployer' , await deployer . getAddress ( ) )
2424
2525 // set init params
2626 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 )
2828
2929 // deploy UFragments
3030 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 ) ,
3333 [ owner ] ,
3434 {
3535 initializer : 'initialize(address)' ,
@@ -40,8 +40,8 @@ task('ampl:deploy', 'Deploy ampleforth contracts').setAction(
4040
4141 // deploy Policy
4242 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 (
4545 deployer ,
4646 ) ,
4747 [ owner , uFragments . address , BASE_CPI . toString ( ) ] ,
@@ -54,21 +54,21 @@ task('ampl:deploy', 'Deploy ampleforth contracts').setAction(
5454
5555 // deploy Orchestrator
5656 const orchestrator = await (
57- await bre . ethers . getContractFactory ( 'Orchestrator' )
57+ await hre . ethers . getContractFactory ( 'Orchestrator' )
5858 )
5959 . connect ( deployer )
6060 . deploy ( uFragmentsPolicy . address )
6161 console . log ( 'Orchestrator deployed to:' , orchestrator . address )
6262 } ,
6363)
6464
65- task ( 'ampl: upgrade' , 'Upgrade ampleforth contracts' )
65+ task ( 'upgrade:ampl ' , 'Upgrade ampleforth contracts' )
6666 . addParam ( 'contract' , 'which implementation contract to use' )
6767 . addParam ( 'address' , 'which proxy address to upgrade' )
6868 . addOptionalParam ( 'multisig' , 'which multisig address to use for upgrade' )
69- . setAction ( async ( args , bre ) => {
69+ . setAction ( async ( args , hre ) => {
7070 console . log ( args )
71- const upgrades = bre . upgrades as any
71+ const upgrades = hre . upgrades as any
7272
7373 // can only upgrade token or policy
7474 const supported = [ 'UFragments' , 'UFragmentsPolicy' ]
@@ -79,23 +79,23 @@ task('ampl:upgrade', 'Upgrade ampleforth contracts')
7979 }
8080
8181 // get signers
82- const deployer = ( await bre . ethers . getSigners ( ) ) [ 0 ]
82+ const deployer = ( await hre . ethers . getSigners ( ) ) [ 0 ]
8383 console . log ( 'Deployer' , await deployer . getAddress ( ) )
8484
8585 if ( args . multisig ) {
8686 // deploy new implementation
8787 const implementation = await upgrades . prepareUpgrade (
8888 args . address ,
89- await bre . ethers . getContractFactory ( args . contract ) ,
89+ await hre . ethers . getContractFactory ( args . contract ) ,
9090 )
9191 console . log (
9292 `New implementation for ${ args . contract } deployed to` ,
9393 implementation ,
9494 )
9595
9696 // 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 ) ,
9999 ProxyAdmin . abi ,
100100 deployer ,
101101 )
@@ -106,7 +106,7 @@ task('ampl:upgrade', 'Upgrade ampleforth contracts')
106106 console . log ( `Upgrade transaction` , upgradeTx )
107107
108108 // send upgrade transaction to multisig
109- const multisig = new bre . ethers . Contract (
109+ const multisig = new hre . ethers . Contract (
110110 args . multisig ,
111111 MultiSigWallet ,
112112 deployer ,
@@ -126,8 +126,33 @@ task('ampl:upgrade', 'Upgrade ampleforth contracts')
126126 } else {
127127 await upgrades . upgradeProxy (
128128 args . address ,
129- await bre . ethers . getContractFactory ( args . contract ) ,
129+ await hre . ethers . getContractFactory ( args . contract ) ,
130130 )
131131 console . log ( args . contract , 'upgraded' )
132132 }
133133 } )
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