Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit 3d3a0bf

Browse files
committed
fix: scripts
1 parent ebcd9cf commit 3d3a0bf

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

deploy/18-deploy-ionic-flywheel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const func: DeployFunction = async ({ run, viem, getNamedAccounts, deployments }
3737
const tx = await flywheel.write.updateFeeSettings([0, deployer.address]);
3838
await publicClient.waitForTransactionReceipt({ hash: tx });
3939
*/
40-
const booster = await run("flywheel:deploy-borrow-booster", { name: "Booster" });
40+
await run("flywheel:deploy-borrow-booster", { name: "Booster" });
4141

4242
// NOTE: change name and reward token
4343
await run("flywheel:deploy-dynamic-rewards-fw", {

tasks/flywheel/deploy.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { viem } from "hardhat";
12
import { task, types } from "hardhat/config";
23
import { Address, getAddress, zeroAddress } from "viem";
34

@@ -54,7 +55,8 @@ task("flywheel:deploy-static-rewards-fw", "Deploy static rewards flywheel for LM
5455
task("flywheel:deploy-static-rewards", "Deploy static rewards flywheel for LM rewards")
5556
.addParam("name", "String to append to the flywheel contract name", undefined, types.string)
5657
.addParam("flywheel", "flywheel to which to add the rewards contract", undefined, types.string)
57-
.setAction(async ({ signer, name, flywheel }, { viem, deployments, getNamedAccounts }) => {
58+
.setAction(async ({ name, flywheel }, { viem, deployments, getNamedAccounts }) => {
59+
const publicClient = await viem.getPublicClient();
5860
const { deployer } = await getNamedAccounts();
5961
const rewards = await deployments.deploy(`WithdrawableFlywheelStaticRewards_${name}`, {
6062
contract: "WithdrawableFlywheelStaticRewards",
@@ -68,11 +70,9 @@ task("flywheel:deploy-static-rewards", "Deploy static rewards flywheel for LM re
6870
waitConfirmations: 1
6971
});
7072

71-
const ionicSdkModule = await import("../ionicSdk");
72-
const sdk = await ionicSdkModule.getOrCreateIonic(deployer);
73-
74-
const tx = await sdk.setFlywheelRewards(flywheel, rewards.address);
75-
await tx.wait();
73+
const flywheelContract = await viem.getContractAt("IonicFlywheel", flywheel);
74+
const tx = await flywheelContract.write.setFlywheelRewards([rewards.address as Address]);
75+
await publicClient.waitForTransactionReceipt({ hash: tx });
7676
return rewards;
7777
});
7878

@@ -143,13 +143,11 @@ task("flywheel:deploy-dynamic-rewards-fw", "Deploy dynamic rewards flywheel for
143143
let contractName;
144144
if (booster != "") {
145145
flywheelBooster = await viem.getContractAt(booster, (await deployments.get(booster)).address as Address);
146-
}
147-
else flywheelBooster = zeroAddress;
146+
} else flywheelBooster = zeroAddress;
148147

149148
if (name.includes("Borrow")) {
150149
contractName = "IonicFlywheelBorrow";
151-
}
152-
else contractName = "IonicFlywheel"
150+
} else contractName = "IonicFlywheel";
153151

154152
console.log({ signer, name, rewardToken, booster, strategies, pool });
155153
const flywheel = await deployments.deploy(`${contractName}_${name}`, {
@@ -191,7 +189,8 @@ task("flywheel:deploy-dynamic-rewards-fw", "Deploy dynamic rewards flywheel for
191189
task("flywheel:deploy-dynamic-rewards", "Deploy dynamic rewards flywheel for LM rewards")
192190
.addParam("name", "String to append to the flywheel contract name", undefined, types.string)
193191
.addParam("flywheel", "flywheel to which to add the rewards contract", undefined, types.string)
194-
.setAction(async ({ name, flywheel }, { deployments, getNamedAccounts }) => {
192+
.setAction(async ({ name, flywheel }, { viem, deployments, getNamedAccounts }) => {
193+
const publicClient = await viem.getPublicClient();
195194
const { deployer } = await getNamedAccounts();
196195
const rewards = await deployments.deploy(`IonicFlywheelDynamicRewards_${name}`, {
197196
contract: "IonicFlywheelDynamicRewards",
@@ -203,12 +202,9 @@ task("flywheel:deploy-dynamic-rewards", "Deploy dynamic rewards flywheel for LM
203202
],
204203
waitConfirmations: 1
205204
});
206-
207-
const ionicSdkModule = await import("../ionicSdk");
208-
const sdk = await ionicSdkModule.getOrCreateIonic(deployer);
209-
210-
const tx = await sdk.setFlywheelRewards(flywheel, rewards.address);
211-
await tx.wait();
205+
const flywheelContract = await viem.getContractAt("IonicFlywheel", flywheel);
206+
const tx = await flywheelContract.write.setFlywheelRewards([rewards.address as Address]);
207+
await publicClient.waitForTransactionReceipt({ hash: tx });
212208
return rewards;
213209
});
214210

@@ -225,4 +221,4 @@ task("flywheel:deploy-borrow-booster", "Deploy flywheel borrow bosster for LM re
225221
});
226222

227223
return booster;
228-
});
224+
});

0 commit comments

Comments
 (0)