@@ -6,7 +6,8 @@ task("market:base:add-rewards-to-existing-flywheel", "Adds rewards to existing f
6
6
. addParam ( "market" , "market address" , undefined , types . string )
7
7
. addParam ( "rewardAmount" , "the amount of tokens streamed to first epoch" , undefined , types . string )
8
8
. 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 } ) => {
10
11
const { deployer } = await getNamedAccounts ( ) ;
11
12
const publicClient = await viem . getPublicClient ( ) ;
12
13
/*
@@ -61,18 +62,25 @@ task("market:base:add-rewards-to-existing-flywheel", "Adds rewards to existing f
61
62
`Implementation successfully set to ${implementationAddress}: ${setImplementationTx}`
62
63
);
63
64
*/
64
- /*
65
+
65
66
// Sending tokens
66
67
const ionToken = await viem . getContractAt ( "EIP20Interface" , reward ) ;
67
68
const balance = await ionToken . read . balanceOf ( [ market ] ) ;
68
69
if ( balance < parseEther ( rewardAmount ) ) {
69
70
await ionToken . write . transfer ( [ market , parseEther ( rewardAmount ) ] ) ;
70
71
}
71
- */
72
+
73
+ let contractName ;
74
+ if ( name . includes ( "Borrow" ) ) {
75
+ contractName = "IonicFlywheelBorrow" ;
76
+ } else {
77
+ contractName = "IonicFlywheel" ;
78
+ }
79
+
72
80
// Approving token sepening for fwRewards contract
73
81
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
76
84
) ;
77
85
78
86
const _market = await viem . getContractAt ( "CErc20RewardsDelegate" , market ) ;
@@ -179,9 +187,9 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market")
179
187
flywheelBoosterAddress = ( await deployments . get ( booster ) ) . address as Address ;
180
188
} else flywheelBoosterAddress = zeroAddress ;
181
189
182
- let _flywheel = await deployments . getOrNull ( `${ contractName } _${ name } _v3 ` ) ;
190
+ let _flywheel = await deployments . getOrNull ( `${ contractName } _${ name } ` ) ;
183
191
if ( ! _flywheel ) {
184
- _flywheel = await deployments . deploy ( `${ contractName } _${ name } _v3 ` , {
192
+ _flywheel = await deployments . deploy ( `${ contractName } _${ name } ` , {
185
193
contract : contractName ,
186
194
from : deployer ,
187
195
log : true ,
@@ -205,14 +213,14 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market")
205
213
// Deploying flywheel rewards
206
214
const flywheel = await viem . getContractAt (
207
215
`${ contractName } ` ,
208
- ( await deployments . get ( `${ contractName } _${ name } _v3 ` ) ) . address as Address
216
+ ( await deployments . get ( `${ contractName } _${ name } ` ) ) . address as Address
209
217
) ;
210
218
211
- let flywheelRewards = await deployments . getOrNull ( `IonicFlywheelDynamicRewards_${ name } _v3 ` ) ;
219
+ let flywheelRewards = await deployments . getOrNull ( `IonicFlywheelDynamicRewards_${ name } ` ) ;
212
220
if ( flywheelRewards ) {
213
221
console . log ( `Flywheel rewards ${ name } already deployed at ${ flywheelRewards . address } ` ) ;
214
222
} else {
215
- flywheelRewards = await deployments . deploy ( `IonicFlywheelDynamicRewards_${ name } _v3 ` , {
223
+ flywheelRewards = await deployments . deploy ( `IonicFlywheelDynamicRewards_${ name } ` , {
216
224
contract : "IonicFlywheelDynamicRewards" ,
217
225
from : deployer ,
218
226
log : true ,
@@ -264,20 +272,22 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market")
264
272
task ( "market:base:add-flywheel-ION-rewards-to-ionbsdETH" , "Adds rewards to existing flywheel" ) . setAction (
265
273
async ( _ , { viem, run, deployments, getNamedAccounts } ) => {
266
274
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
268
276
const ion = "0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5" ;
277
+ const name = "ION" ; // For borrow flywheel use Borrow_ION for supply flywheel just ION
269
278
await run ( "market:base:add-rewards-to-existing-flywheel" , {
270
279
market,
271
280
rewardAmount,
272
- reward : ion
281
+ reward : ion ,
282
+ name : name
273
283
} ) ;
274
284
}
275
285
) ;
276
286
277
287
task ( "market:base:deploy-flywheel-and-add-ION-rewards-to-ionhyUSD" , "Deploys flywheel and adds rewards" ) . setAction (
278
288
async ( _ , { viem, run, deployments, getNamedAccounts } ) => {
279
289
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
281
291
const ion = "0x3eE5e23eEE121094f1cFc0Ccc79d6C809Ebd22e5" ;
282
292
const name = "ION" ; // For borrow flywheel use Borrow_ION for supply flywheel just ION
283
293
// NOTE: Make sure that epoch duration for supply and borrow are not the same
0 commit comments