Skip to content

Commit

Permalink
Merge pull request #152 from ionicprotocol/feat/task-sfs-register
Browse files Browse the repository at this point in the history
Register in SFS task
  • Loading branch information
rhlsthrm authored Feb 1, 2024
2 parents 3e28173 + 01498e4 commit 980f91e
Show file tree
Hide file tree
Showing 9 changed files with 274 additions and 115 deletions.
8 changes: 4 additions & 4 deletions packages/chains/deployments/mode.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
"address": "0x6352b5231de62be60c7ADB8250b08CA9CCF7a9A5"
},
"CTokenFirstExtension": {
"address": "0x8C58ECb9C0050824177f4e1Cd71C335421d4aeA2"
"address": "0x36a84B42fa436DBcB3854e2E46ba26546C651530"
},
"Comptroller": {
"address": "0x8b2B6a9dC8Cd73309Cef8d64920831d4C73F43a7"
},
"ComptrollerFirstExtension": {
"address": "0xE1A3006be645a80F206311d9f18C866c204bA02f"
"address": "0xCa41Aa7472C8f85C84a8Cb03deaF064ab6498Dd7"
},
"DefaultProxyAdmin": {
"address": "0x985a323A1CccA8Cd5fb8935590EE33FbcFE849d0"
Expand All @@ -66,7 +66,7 @@
"address": "0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A"
},
"IonicUniV3Liquidator_Implementation": {
"address": "0xB48221b8a1137895e384aBcaFF8120d053Be43F5"
"address": "0x462fAa7042542C5CF28BC73D8F8C029267EF3E51"
},
"IonicUniV3Liquidator_Proxy": {
"address": "0xa12c1E460c06B1745EFcbfC9A1f666a8749B0e3A"
Expand Down Expand Up @@ -96,7 +96,7 @@
"address": "0xc71B968C6C23e2723Bae32957D815C9bE3ca1b34"
},
"LiquidatorsRegistryExtension": {
"address": "0xdd7F712Af76074993F05C0d544331792997Bd39b"
"address": "0xB08FAfc6E8280ce351CF22d2Db8ABd241E8A5E47"
},
"LiquidatorsRegistrySecondExtension": {
"address": "0x45A4a3eBb986083597Ac3B34ee2d7dcC3Be8c5C1"
Expand Down
73 changes: 50 additions & 23 deletions packages/sdk/deployments/mode/CTokenFirstExtension.json

Large diffs are not rendered by default.

73 changes: 50 additions & 23 deletions packages/sdk/deployments/mode/ComptrollerFirstExtension.json

Large diffs are not rendered by default.

34 changes: 25 additions & 9 deletions packages/sdk/deployments/mode/IonicUniV3Liquidator.json

Large diffs are not rendered by default.

103 changes: 80 additions & 23 deletions packages/sdk/deployments/mode/IonicUniV3Liquidator_Implementation.json

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions packages/sdk/deployments/mode/LiquidatorsRegistryExtension.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/sdk/tasks/market/upgrade-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ task("market:set-latest", "Updates the markets' implementations whitelist").setA
const cfe = (await ethers.getContract("CTokenFirstExtension")) as CTokenFirstExtension;
{
const exts = await fuseFeeDistributor.callStatic.getCErc20DelegateExtensions(erc20Delegate.address);
if (!exts.length) {
if (exts.length == 0 || exts[0] != cfe.address) {
console.log(`setting the extension for delegate ${erc20Delegate.address}`);
tx = await fuseFeeDistributor._setCErc20DelegateExtensions(erc20Delegate.address, [
erc20Delegate.address,
Expand All @@ -32,7 +32,7 @@ task("market:set-latest", "Updates the markets' implementations whitelist").setA

{
const exts = await fuseFeeDistributor.callStatic.getCErc20DelegateExtensions(erc20PluginDelegate.address);
if (!exts.length) {
if (exts.length == 0 || exts[0] != cfe.address) {
console.log(`setting the extension for plugin delegate ${erc20PluginDelegate.address}`);
tx = await fuseFeeDistributor._setCErc20DelegateExtensions(erc20PluginDelegate.address, [
erc20PluginDelegate.address,
Expand All @@ -48,7 +48,7 @@ task("market:set-latest", "Updates the markets' implementations whitelist").setA

{
const exts = await fuseFeeDistributor.callStatic.getCErc20DelegateExtensions(erc20PluginRewardsDelegate.address);
if (!exts.length) {
if (exts.length == 0 || exts[0] != cfe.address) {
console.log(`setting the extension for plugin rewards delegate ${erc20PluginRewardsDelegate.address}`);
tx = await fuseFeeDistributor._setCErc20DelegateExtensions(erc20PluginRewardsDelegate.address, [
erc20PluginRewardsDelegate.address,
Expand Down
32 changes: 32 additions & 0 deletions packages/sdk/tasks/one-time/mode-test-txs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { task } from "hardhat/config";

import { ComptrollerFirstExtension } from "../../typechain";
import { IonicComptroller } from "../../typechain/ComptrollerInterface.sol/IonicComptroller";
import { ICErc20 } from "../../typechain/CTokenInterfaces.sol/ICErc20";
import { ERC20 } from "../../typechain/ERC20";
Expand Down Expand Up @@ -99,3 +100,34 @@ task("test:txs").setAction(async ({}, { ethers, getNamedAccounts }) => {
console.log(`mined ${tx.hash}`);
}
});

task("mode:sfs:register").setAction(async ({}, { ethers, getNamedAccounts }) => {
let tx;
const { deployer } = await getNamedAccounts();
const modePoolAddr = "0xFB3323E24743Caf4ADD0fDCCFB268565c0685556";

const comptrollerAsExtension = (await ethers.getContractAt(
"ComptrollerFirstExtension",
modePoolAddr,
deployer
)) as ComptrollerFirstExtension;

tx = await comptrollerAsExtension.registerInSFS();
console.log(`registering the pool in SFS with tx ${tx.hash}`);
await tx.wait();
console.log(`registered the pool in SFS`);

const markets = await comptrollerAsExtension.callStatic.getAllMarkets();
for (let j = 0; j < markets.length; j++) {
const market = markets[j];
console.log(`market ${market}`);
const cTokenInstance = (await ethers.getContractAt("CTokenInterfaces.sol:ICErc20", market)) as ICErc20;

tx = await cTokenInstance.registerInSFS();
console.log(`registering the market ${market} in SFS with tx ${tx.hash}`);
await tx.wait();
console.log(`registered the market ${market} in SFS`);
}

console.log(`Done`);
});

0 comments on commit 980f91e

Please sign in to comment.