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

Commit 5a1b45d

Browse files
committed
Update upgrade script
1 parent afbdb0c commit 5a1b45d

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

tasks/chain-specific/base.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,23 @@ task("market:base:rsr-ion-rewards", "Sets caps on a market").setAction(
1818
const markets = `${ionbsdETH},${ioneUSD}`;
1919

2020
// STEP 1: upgrade markets to the new implementation
21-
console.log(`Upgrading market: ${ionbsdETH} to CErc20PluginRewardsDelegate with plugin: ${zeroAddress}`);
21+
console.log(`Upgrading market: ${ionbsdETH} to CErc20RewardsDelegate`);
2222
await run("market:upgrade", {
2323
comptroller,
2424
underlying: bsdETH,
25-
implementationAddress: (await deployments.get("CErc20PluginRewardsDelegate")).address,
26-
pluginAddress: zeroAddress,
25+
implementationAddress: (await deployments.get("CErc20RewardsDelegate")).address,
2726
signer: deployer
2827
});
2928

30-
console.log(`Upgrading market: ${ioneUSD} to CErc20PluginRewardsDelegate with plugin: ${zeroAddress}`);
29+
console.log(`Upgrading market: ${ioneUSD} to CErc20RewardsDelegate`);
3130
await run("market:upgrade", {
3231
comptroller,
3332
underlying: eUSD,
34-
implementationAddress: (await deployments.get("CErc20PluginRewardsDelegate")).address,
35-
pluginAddress: zeroAddress,
33+
implementationAddress: (await deployments.get("CErc20RewardsDelegate")).address,
3634
signer: deployer
3735
});
3836
console.log("Market upgraded");
39-
37+
/*
4038
const ionToken = await viem.getContractAt("EIP20Interface", IONIC);
4139
const balance = await ionToken.read.balanceOf([ionbsdETH]);
4240
if (balance < parseEther("105263.157895")) {
@@ -46,17 +44,18 @@ task("market:base:rsr-ion-rewards", "Sets caps on a market").setAction(
4644
if (balanceUSD < parseEther("114416.475973")) {
4745
await ionToken.write.transfer([ioneUSD, parseEther("114416.475973")]);
4846
}
49-
47+
*/
5048
/*
51-
// NOTE: change name and reward token
52-
await run("flywheel:deploy-dynamic-rewards-fw", { name: "RSR", rewardToken: "RSR_TOKEN_ADDRESS", booster: "", strategies: markets, pool: fpd.address });
49+
// NOTE: change name and reward token
50+
await run("flywheel:deploy-dynamic-rewards-fw", { name: "RSR", rewardToken: "RSR_TOKEN_ADDRESS", booster: "", strategies: markets, pool: fpd.address });
5351
54-
const flywheel = await viem.getContractAt("IonicFlywheel", (await deployments.get("IonicFlywheel")).address as Address);
55-
await run("approve-market-flywheel", { fwAddress: flywheel.address, markets: markets });
56-
57-
const tx = await flywheel.write.updateFeeSettings([0, deployer.address]);
58-
await publicClient.waitForTransactionReceipt({ hash: tx });
59-
*/
52+
const flywheel = await viem.getContractAt("IonicFlywheel", (await deployments.get("IonicFlywheel")).address as Address);
53+
await run("approve-market-flywheel", { fwAddress: flywheel.address, markets: markets });
54+
55+
const tx = await flywheel.write.updateFeeSettings([0, deployer.address]);
56+
await publicClient.waitForTransactionReceipt({ hash: tx });
57+
*/
58+
/*
6059
await run("flywheel:deploy-borrow-booster", { name: "ION" });
6160
// NOTE: change name and reward token
6261
await run("flywheel:deploy-dynamic-rewards-fw", {
@@ -75,5 +74,6 @@ task("market:base:rsr-ion-rewards", "Sets caps on a market").setAction(
7574
7675
const txBorrow = await flywheelBorrow.write.updateFeeSettings([0n, deployer as Address]);
7776
await publicClient.waitForTransactionReceipt({ hash: txBorrow });
77+
*/
7878
}
7979
);

tasks/market/upgrade.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ export default task("market:upgrade", "Upgrades a market's implementation")
55
.addParam("comptroller", "address of comptroller", undefined, types.string) // TODO I would rather use id or comptroller address directly.
66
.addParam("underlying", "Underlying asset symbol or address", undefined, types.string)
77
.addParam("implementationAddress", "The address of the new implementation", "", types.string)
8-
.addOptionalParam("pluginAddress", "The address of plugin which is supposed to used", "", types.string)
98
.addOptionalParam("signer", "Named account that is an admin of the pool", "deployer", types.string)
109
.setAction(async (taskArgs, { viem, deployments }) => {
1110
const publicClient = await viem.getPublicClient();
1211
const { implementationAddress, comptroller: comptrollerAddress, underlying, signer: namedSigner } = taskArgs;
13-
let { pluginAddress } = taskArgs;
1412

1513
const comptroller = await viem.getContractAt("IonicComptroller", comptrollerAddress as Address);
1614

@@ -33,13 +31,9 @@ export default task("market:upgrade", "Upgrades a market's implementation")
3331
throw Error(`No market corresponds to this underlying: ${underlying}`);
3432
}
3533

36-
if (!pluginAddress) {
37-
pluginAddress = zeroAddress;
38-
}
39-
40-
const implementationData = encodeAbiParameters(parseAbiParameters("address"), [pluginAddress]);
34+
const implementationData = "0x";
4135

42-
console.log(`Setting implementation to ${implementationAddress} with plugin ${pluginAddress}`);
36+
console.log(`Setting implementation to ${implementationAddress}`);
4337
const setImplementationTx = await cTokenInstance.write._setImplementationSafe([
4438
implementationAddress,
4539
implementationData
@@ -52,7 +46,7 @@ export default task("market:upgrade", "Upgrades a market's implementation")
5246
throw `Failed set implementation to ${implementationAddress}`;
5347
}
5448
console.log(
55-
`Implementation successfully set to ${implementationAddress} with plugin ${await cTokenInstance.read.plugin()}: ${setImplementationTx}`
49+
`Implementation successfully set to ${implementationAddress}: ${setImplementationTx}`
5650
);
5751
});
5852

0 commit comments

Comments
 (0)