@@ -13,75 +13,64 @@ const { AaveIncentivesController: id } = eContractid;
1313
1414task ( `deploy-incentives` , `Deploy and initializes the ${ id } contract` )
1515 . addFlag ( 'verify' )
16+ . addFlag ( 'deployProxy' )
1617 . addParam ( 'rewardToken' )
17- . addParam ( 'rewardsVault' )
18- . addOptionalParam ( 'psm' )
19- . addOptionalParam ( 'extraPsmReward' )
20- . addOptionalParam ( 'emissionManager' )
21- . addOptionalParam ( 'distributionDuration' )
22- . addParam ( 'proxyAdmin' , `The address to be added as an Admin role in ${ id } Transparent Proxy.` )
23- . addParam ( 'rewardsAdmin' , `The address to be added as an Admin role in ${ id } Transparent Proxy.` )
18+ . addParam ( 'emissionManager' )
19+ . addOptionalParam ( 'rewardsVault' )
20+ . addOptionalParam (
21+ 'proxyAdmin' ,
22+ `The address to be added as an Admin role in ${ id } Transparent Proxy.`
23+ )
2424 . setAction (
2525 async (
26- {
27- verify,
28- rewardToken,
29- rewardsVault,
30- psm,
31- extraPsmReward,
32- emissionManager,
33- distributionDuration,
34- proxyAdmin,
35- rewardsAdmin,
36- } ,
26+ { deployProxy, verify, rewardToken, rewardsVault, emissionManager, proxyAdmin } ,
3727 localBRE
3828 ) => {
3929 await localBRE . run ( 'set-dre' ) ;
40- if ( ! isAddress ( proxyAdmin ) ) {
41- throw Error ( 'Missing or incorrect admin param' ) ;
42- }
43- if ( ! isAddress ( rewardsAdmin ) ) {
44- throw Error ( 'Missing or incorrect admin param' ) ;
45- }
30+
4631 if ( ! isAddress ( rewardToken ) ) {
4732 throw Error ( 'Missing or incorrect rewardToken param' ) ;
4833 }
49- if ( ! isAddress ( rewardsVault ) ) {
34+ if ( ! isAddress ( emissionManager ) ) {
35+ throw Error ( 'Missing or incorrect emissionManager param' ) ;
36+ }
37+ if ( deployProxy && ! isAddress ( proxyAdmin ) ) {
38+ throw Error ( 'Missing or incorrect admin param' ) ;
39+ }
40+ if ( deployProxy && ! isAddress ( rewardsVault ) ) {
5041 throw Error ( 'Missing or incorrect rewardsVault param' ) ;
5142 }
52- psm = isAddress ( psm ) ? psm : ZERO_ADDRESS ;
53- extraPsmReward = extraPsmReward ? BigNumber . from ( extraPsmReward ) : BigNumber . from ( '0' ) ;
54- emissionManager = isAddress ( emissionManager ) ? emissionManager : ZERO_ADDRESS ;
55- distributionDuration = distributionDuration
56- ? BigNumber . from ( distributionDuration )
57- : BigNumber . from ( '0' ) ;
5843
5944 console . log ( `\n- ${ id } implementation deployment:` ) ;
6045
6146 const aaveIncentivesControllerImpl = await deployAaveIncentivesController (
62- [ rewardToken , psm , extraPsmReward , emissionManager ] ,
47+ [ rewardToken , emissionManager ] ,
6348 verify
6449 ) ;
6550
66- console . log ( `\tInitializing ${ id } proxy` ) ;
67-
68- const aaveIncentivesProxy = await deployInitializableAdminUpgradeabilityProxy ( verify ) ;
69-
70- const encodedParams = aaveIncentivesControllerImpl . interface . encodeFunctionData (
71- 'initialize' ,
72- [ rewardsVault , distributionDuration , rewardsAdmin ]
73- ) ;
51+ if ( deployProxy ) {
52+ console . log ( `\tDeploying${ id } proxy` ) ;
53+ const aaveIncentivesProxy = await deployInitializableAdminUpgradeabilityProxy ( verify ) ;
7454
75- await waitForTx (
76- await aaveIncentivesProxy . functions [ 'initialize(address,address,bytes)' ] (
77- aaveIncentivesControllerImpl . address ,
78- proxyAdmin ,
79- encodedParams
80- )
81- ) ;
55+ console . log ( `\tInitializing ${ id } proxy` ) ;
56+ const encodedParams = aaveIncentivesControllerImpl . interface . encodeFunctionData (
57+ 'initialize' ,
58+ [ rewardsVault ]
59+ ) ;
8260
83- console . log ( `\tFinished ${ id } deployment and initialization` ) ;
84- console . log ( `\t- Proxy: ${ aaveIncentivesProxy . address } ` ) ;
85- console . log ( `\t- Impl: ${ aaveIncentivesControllerImpl . address } ` ) ;
61+ await waitForTx (
62+ await aaveIncentivesProxy . functions [ 'initialize(address,address,bytes)' ] (
63+ aaveIncentivesControllerImpl . address ,
64+ proxyAdmin ,
65+ encodedParams
66+ )
67+ ) ;
68+ console . log ( `\tFinished ${ id } deployment and initialization` ) ;
69+ console . log ( `\t- Proxy: ${ aaveIncentivesProxy . address } ` ) ;
70+ console . log ( `\t- Impl: ${ aaveIncentivesControllerImpl . address } ` ) ;
71+ } else {
72+ console . log ( `\tFinished ${ id } deployment and initialization` ) ;
73+ console . log ( `\t- Impl: ${ aaveIncentivesControllerImpl . address } ` ) ;
74+ }
8675 }
8776 ) ;
0 commit comments