@@ -6,7 +6,8 @@ task("market:base:add-rewards-to-existing-flywheel", "Adds rewards to existing f
66 . addParam ( "market" , "market address" , undefined , types . string )
77 . addParam ( "rewardAmount" , "the amount of tokens streamed to first epoch" , undefined , types . string )
88 . addParam ( "reward" , "token address of reward token" , undefined , types . string )
9- . setAction ( async ( { market, rewardAmount, reward } , { viem, run, deployments, getNamedAccounts } ) => {
9+ . addParam ( "name" , "name of deployment" , undefined , types . string )
10+ . setAction ( async ( { market, rewardAmount, reward, name } , { viem, run, deployments, getNamedAccounts } ) => {
1011 const { deployer } = await getNamedAccounts ( ) ;
1112 const publicClient = await viem . getPublicClient ( ) ;
1213 /*
@@ -61,18 +62,25 @@ task("market:base:add-rewards-to-existing-flywheel", "Adds rewards to existing f
6162 `Implementation successfully set to ${implementationAddress}: ${setImplementationTx}`
6263 );
6364 */
64- /*
65+
6566 // Sending tokens
6667 const ionToken = await viem . getContractAt ( "EIP20Interface" , reward ) ;
6768 const balance = await ionToken . read . balanceOf ( [ market ] ) ;
6869 if ( balance < parseEther ( rewardAmount ) ) {
6970 await ionToken . write . transfer ( [ market , parseEther ( rewardAmount ) ] ) ;
7071 }
71- */
72+
73+ let contractName ;
74+ if ( name . includes ( "Borrow" ) ) {
75+ contractName = "IonicFlywheelBorrow" ;
76+ } else {
77+ contractName = "IonicFlywheel" ;
78+ }
79+
7280 // Approving token sepening for fwRewards contract
7381 const flywheel = await viem . getContractAt (
74- "IonicFlywheel" ,
75- ( await deployments . get ( "IonicFlywheel_ION_v3" ) ) . address as Address
82+ ` ${ contractName } ` ,
83+ ( await deployments . get ( ` ${ contractName } _ ${ name } ` ) ) . address as Address
7684 ) ;
7785
7886 const _market = await viem . getContractAt ( "CErc20RewardsDelegate" , market ) ;
@@ -179,9 +187,9 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market")
179187 flywheelBoosterAddress = ( await deployments . get ( booster ) ) . address as Address ;
180188 } else flywheelBoosterAddress = zeroAddress ;
181189
182- let _flywheel = await deployments . getOrNull ( `${ contractName } _${ name } _v3 ` ) ;
190+ let _flywheel = await deployments . getOrNull ( `${ contractName } _${ name } ` ) ;
183191 if ( ! _flywheel ) {
184- _flywheel = await deployments . deploy ( `${ contractName } _${ name } _v3 ` , {
192+ _flywheel = await deployments . deploy ( `${ contractName } _${ name } ` , {
185193 contract : contractName ,
186194 from : deployer ,
187195 log : true ,
@@ -205,14 +213,14 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market")
205213 // Deploying flywheel rewards
206214 const flywheel = await viem . getContractAt (
207215 `${ contractName } ` ,
208- ( await deployments . get ( `${ contractName } _${ name } _v3 ` ) ) . address as Address
216+ ( await deployments . get ( `${ contractName } _${ name } ` ) ) . address as Address
209217 ) ;
210218
211- let flywheelRewards = await deployments . getOrNull ( `IonicFlywheelDynamicRewards_${ name } _v3 ` ) ;
219+ let flywheelRewards = await deployments . getOrNull ( `IonicFlywheelDynamicRewards_${ name } ` ) ;
212220 if ( flywheelRewards ) {
213221 console . log ( `Flywheel rewards ${ name } already deployed at ${ flywheelRewards . address } ` ) ;
214222 } else {
215- flywheelRewards = await deployments . deploy ( `IonicFlywheelDynamicRewards_${ name } _v3 ` , {
223+ flywheelRewards = await deployments . deploy ( `IonicFlywheelDynamicRewards_${ name } ` , {
216224 contract : "IonicFlywheelDynamicRewards" ,
217225 from : deployer ,
218226 log : true ,
@@ -264,20 +272,22 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market")
264272task ( "market:base:add-flywheel-ION-rewards-to-ionbsdETH" , "Adds rewards to existing flywheel" ) . setAction (
265273 async ( _ , { viem, run, deployments, getNamedAccounts } ) => {
266274 const market = "0x3d9669de9e3e98db41a1cbf6dc23446109945e3c" ; // ionbsdETH
267- const rewardAmount = "23334" ; // epoch will start 2 days so 25000 / 30 * 2
275+ const rewardAmount = "23334" ; // epoch will last for 28 days so 25000 / 30 * 28
268276 const ion = "0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5" ;
277+ const name = "ION" ; // For borrow flywheel use Borrow_ION for supply flywheel just ION
269278 await run ( "market:base:add-rewards-to-existing-flywheel" , {
270279 market,
271280 rewardAmount,
272- reward : ion
281+ reward : ion ,
282+ name : name
273283 } ) ;
274284 }
275285) ;
276286
277287task ( "market:base:deploy-flywheel-and-add-ION-rewards-to-ionhyUSD" , "Deploys flywheel and adds rewards" ) . setAction (
278288 async ( _ , { viem, run, deployments, getNamedAccounts } ) => {
279289 const market = "0x751911bDa88eFcF412326ABE649B7A3b28c4dEDe" ; // ionhyUSD
280- const rewardAmount = "14000" ; // epoch will start 2 days so 15000 / 30 * 2
290+ const rewardAmount = "14000" ; // epoch will last for 28 days so 15000 / 30 * 28
281291 const ion = "0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5" ;
282292 const name = "ION" ; // For borrow flywheel use Borrow_ION for supply flywheel just ION
283293 // NOTE: Make sure that epoch duration for supply and borrow are not the same
0 commit comments