From c2920d32fb27b85db7b1d6c859fc4b252ad2692e Mon Sep 17 00:00:00 2001 From: antisaa Date: Mon, 19 Aug 2024 07:40:18 +0200 Subject: [PATCH] Update script --- tasks/chain-specific/base/rewards.ts | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tasks/chain-specific/base/rewards.ts b/tasks/chain-specific/base/rewards.ts index 349cd529..62628ead 100644 --- a/tasks/chain-specific/base/rewards.ts +++ b/tasks/chain-specific/base/rewards.ts @@ -61,18 +61,18 @@ task("market:base:add-rewards-to-existing-flywheel", "Adds rewards to existing f `Implementation successfully set to ${implementationAddress}: ${setImplementationTx}` ); */ - +/* // Sending tokens const ionToken = await viem.getContractAt("EIP20Interface", reward); const balance = await ionToken.read.balanceOf([market]); if (balance < parseEther(rewardAmount)) { await ionToken.write.transfer([market, parseEther(rewardAmount)]); } - +*/ // Approving token sepening for fwRewards contract const flywheel = await viem.getContractAt( "IonicFlywheel", - (await deployments.get("IonicFlywheel_ION_v2")).address as Address + (await deployments.get("IonicFlywheel_ION_v3")).address as Address ); const _market = await viem.getContractAt("CErc20RewardsDelegate", market); @@ -82,7 +82,7 @@ task("market:base:add-rewards-to-existing-flywheel", "Adds rewards to existing f console.log(`mining tx ${tx}`); await publicClient.waitForTransactionReceipt({ hash: tx }); console.log(`approved flywheel ${flywheel.address} to pull reward tokens from market ${market}`); - /* + // Adding strategies to flywheel const allFlywheelStrategies = (await flywheel.read.getAllStrategies()) as Address[]; if (!allFlywheelStrategies.map((s) => s.toLowerCase()).includes(market.toLowerCase())) { @@ -91,7 +91,6 @@ task("market:base:add-rewards-to-existing-flywheel", "Adds rewards to existing f await publicClient.waitForTransactionReceipt({ hash: addTx }); console.log(`Added strategy (${market}) to flywheel (${flywheel.address})`); } else console.log(`Strategy (${market}) was already added to flywheel (${flywheel.address})`); - */ }); task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market") @@ -175,14 +174,14 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market") } else { contractName = "IonicFlywheel"; } - /* + if (booster != "") { flywheelBoosterAddress = (await deployments.get(booster)).address as Address; } else flywheelBoosterAddress = zeroAddress; - let _flywheel = await deployments.getOrNull(`${contractName}_${name}_v2`); + let _flywheel = await deployments.getOrNull(`${contractName}_${name}_v3`); if (!_flywheel) { - _flywheel = await deployments.deploy(`${contractName}_${name}_v2`, { + _flywheel = await deployments.deploy(`${contractName}_${name}_v3`, { contract: contractName, from: deployer, log: true, @@ -202,18 +201,18 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market") } else { console.log(`Flywheel ${name} already deployed at ${_flywheel.address}`); } - */ + // Deploying flywheel rewards const flywheel = await viem.getContractAt( `${contractName}`, - (await deployments.get(`${contractName}_${name}_v2`)).address as Address + (await deployments.get(`${contractName}_${name}_v3`)).address as Address ); - let flywheelRewards = await deployments.getOrNull(`IonicFlywheelDynamicRewards_${name}_v2`); + let flywheelRewards = await deployments.getOrNull(`IonicFlywheelDynamicRewards_${name}_v3`); if (flywheelRewards) { console.log(`Flywheel rewards ${name} already deployed at ${flywheelRewards.address}`); } else { - flywheelRewards = await deployments.deploy(`IonicFlywheelDynamicRewards_${name}_v2`, { + flywheelRewards = await deployments.deploy(`IonicFlywheelDynamicRewards_${name}_v3`, { contract: "IonicFlywheelDynamicRewards", from: deployer, log: true, @@ -229,7 +228,7 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market") const txFlywheel = await flywheel.write.setFlywheelRewards([flywheelRewards.address as Address]); await publicClient.waitForTransactionReceipt({ hash: txFlywheel }); console.log(`Set rewards (${flywheelRewards.address}) to flywheel (${flywheel.address})`); - /* + // Adding strategies to flywheel const allFlywheelStrategies = (await flywheel.read.getAllStrategies()) as Address[]; if (!allFlywheelStrategies.map((s) => s.toLowerCase()).includes(market.toLowerCase())) { @@ -250,7 +249,7 @@ task("market:base:deploy-flywheel-and-add-rewards", "Sets caps on a market") console.log(`Flywheel ${flywheel.address} already added to pool ${COMPTROLLER}`); } console.log(`Added flywheel (${flywheel.address}) to pool (${COMPTROLLER})`); - */ + // Approving token sepening for fwRewards contract const _market = await viem.getContractAt("CErc20RewardsDelegate", market); const fwRewards = await flywheel.read.flywheelRewards();