Skip to content

Commit

Permalink
Merge pull request #163 from ionicprotocol/development
Browse files Browse the repository at this point in the history
main
  • Loading branch information
rhlsthrm authored Feb 1, 2024
2 parents d4922a5 + 980f91e commit c1703c0
Show file tree
Hide file tree
Showing 64 changed files with 1,436 additions and 912 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`);
});
4 changes: 3 additions & 1 deletion packages/ui/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"es2021": true
},
"extends": [
"prettier",
"../../.eslintrc.json",
"plugin:@typescript-eslint/recommended",
"next",
Expand All @@ -25,7 +26,8 @@
"@typescript-eslint",
"unused-imports",
"typescript-sort-keys",
"sort-keys"
"sort-keys",
"prettier"
],
"settings": {
"import/resolver": {
Expand Down
23 changes: 11 additions & 12 deletions packages/ui/app/_components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable @next/next/no-img-element */
'use client';
import React, { useState, useEffect, useRef } from 'react';
import Link from 'next/link';
import { ConnectButton } from '@rainbow-me/rainbowkit';
import { useAccount } from 'wagmi';
// import { useStore } from "@/store/Store";
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import React, { useState } from 'react';
// import { useStore } from "@/store/Store";

export default function Navbar() {
const [isActive, setIsActive] = useState<boolean>(false);
Expand All @@ -22,13 +21,13 @@ export default function Navbar() {
earn Ionic points. Borrowing will be open soon...
</div>
<Link
href={'/'}
className={`flex items-center pr-10 `}
href={'/'}
>
<img
src="/img/logo/logo.png"
alt="logo"
className={`h-5 `}
src="/img/logo/logo.png"
/>
</Link>

Expand All @@ -41,17 +40,17 @@ export default function Navbar() {
>
{!isActive ? (
<img
src="/img/menu.png"
alt="menu"
width={'38'}
className={` duration-100 transition-all ease-linear`}
src="/img/menu.png"
width={'38'}
/>
) : (
<img
src="/img/plus.png"
alt="menu"
width={'38'}
className={` duration-100 transition-all ease-linear rotate-45`}
src="/img/plus.png"
width={'38'}
/>
)}
</div>
Expand All @@ -64,8 +63,8 @@ export default function Navbar() {
}`}
>
<Link
href={'/'}
className="pointer-events-none relative"
href={'/'}
>
<span className="absolute px-[5px] top-[90%] right-[50%] translate-x-1/2 bg-lime rounded-lg text-xxs text-darkone whitespace-nowrap ">
Soon!
Expand All @@ -79,8 +78,8 @@ export default function Navbar() {
</p>
</Link>
<Link
href={'/'}
className="pointer-events-none relative"
href={'/'}
>
<span className="absolute px-[5px] top-[90%] right-[50%] translate-x-1/2 bg-lime rounded-lg text-xxs text-darkone whitespace-nowrap ">
Soon!
Expand Down
18 changes: 9 additions & 9 deletions packages/ui/app/_components/ResultHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React from 'react';
import { ThreeCircles } from 'react-loader-spinner';

type ResultHandlerProps = {
center?: boolean;
children: React.ReactNode;
isLoading: boolean;
color?: string;
height?: string;
isFetching?: boolean;
isLoading: boolean;
width?: string;
height?: string;
color?: string;
center?: boolean;
};

export default function ResultHandler({
Expand All @@ -23,16 +23,16 @@ export default function ResultHandler({
if (isLoading || isFetching) {
return (
<ThreeCircles
visible={true}
ariaLabel="three-circles-loading"
color={color}
height={height}
visible={true}
width={width}
color={color}
wrapperStyle={{
width: `${width}px`,
height: `${height}px`,
margin: center ? 'auto' : '0px'
margin: center ? 'auto' : '0px',
width: `${width}px`
}}
ariaLabel="three-circles-loading"
/>
);
}
Expand Down
14 changes: 7 additions & 7 deletions packages/ui/app/_components/dashboards/SupplyRows.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint-disable @next/next/no-img-element */
import Link from 'next/link';
import React from 'react';
import { usePathname } from 'next/navigation';
import React from 'react';
interface ISupply {
asset: string;
amount: number;
asset: string;
cAPR: number;
mode?: string;
rewards: number;
sAPR: number;
utilisation: number;
rewards: number;
mode?: string;
}
const SupplyRows = ({
asset,
Expand All @@ -27,9 +27,9 @@ const SupplyRows = ({
>
<div className={` flex gap-2 items-center justify-center `}>
<img
src={`/img/logo/${asset}.png `}
alt={asset}
className="h-7"
src={`/img/logo/${asset}.png `}
/>
<h3 className={` `}>{asset}</h3>
</div>
Expand All @@ -40,19 +40,19 @@ const SupplyRows = ({
<h3 className={``}>{rewards}</h3>
<div className={` col-span-2 flex items-center justify-center gap-3`}>
<Link
className={`w-full rounded-lg bg-accent text-black py-1.5 px-3`}
href={`${pathname}?popmode=${
mode === 'SUPPLY'
? 'BORROW&specific=REPAY'
: 'SUPPLY&specific=WITHDRAW'
}`}
// changed on borrow condition
className={`w-full rounded-lg bg-accent text-black py-1.5 px-3`}
>
{mode === 'SUPPLY' ? 'REPAY' : 'Withdraw'}
</Link>
<Link
href={`${pathname}?popmode=DEFAULT`}
className={`w-full rounded-lg border text-white/50 border-white/50 py-1.5 px-3`}
href={`${pathname}?popmode=DEFAULT`}
>
Manage
</Link>
Expand Down
57 changes: 37 additions & 20 deletions packages/ui/app/_components/markets/PoolRows.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,58 @@
/* eslint-disable @next/next/no-img-element */
'use client';
import { ConnectButton } from '@rainbow-me/rainbowkit';
import { useMultiMidas } from '@ui/context/MultiIonicContext';
import Link from 'next/link';
import type { Dispatch, SetStateAction } from 'react';
import React from 'react';

import { PopupMode } from '../popup/page';

import React, { Dispatch, SetStateAction } from 'react';
import { useMultiMidas } from '@ui/context/MultiIonicContext';

interface IRows {
asset: string;
supplyBalance: string;
totalSupplied: string;
borrowBalance: string;
totalBorrowing: string;
supplyAPR: string;
borrowAPR: string;
borrowBalance: string;
logo: string;
membership: boolean;
setPopupMode: Dispatch<SetStateAction<PopupMode | undefined>>;
setSelectedSymbol: Dispatch<SetStateAction<string | undefined>>;
supplyAPR: string;
supplyBalance: string;
totalBorrowing: string;
totalSupplied: string;
}
const PoolRows = ({
asset,
supplyBalance,
totalSupplied,
borrowBalance,
membership,
totalBorrowing,
supplyAPR,
borrowAPR,
logo,
setSelectedSymbol
setSelectedSymbol,
setPopupMode
}: IRows) => {
const { address } = useMultiMidas();

return (
<div
className={`w-full hover:bg-graylite transition-all duration-200 ease-linear bg-grayUnselect rounded-xl mb-3 px-2 gap-x-1 grid grid-cols-18 py-4 text-xs text-white/80 font-semibold text-center items-center `}
className={`w-full hover:bg-graylite transition-all duration-200 ease-linear bg-grayUnselect rounded-xl mb-3 px-2 gap-x-1 grid grid-cols-18 py-4 text-xs text-white/80 font-semibold text-center items-center relative ${
membership && 'border border-lime'
}`}
>
{membership && (
<span className="absolute top-[-9px] right-[-15px] px-2 text-darkone bg-lime rounded-lg">
Collateral
</span>
)}

<div className={`col-span-2 flex gap-2 items-center justify-center `}>
<img
src={logo}
alt={asset}
className="h-7"
src={logo}
/>
<h3 className={` `}>{asset}</h3>
</div>
Expand All @@ -51,21 +65,24 @@ const PoolRows = ({
<div className={` col-span-4 flex items-center justify-center gap-3`}>
{address ? (
<>
<Link
href={`/?popmode=SUPPLY`}
<button
className={`rounded-lg bg-accent text-black py-1.5 px-3 uppercase`}
onClick={() => setSelectedSymbol(asset)}
onClick={() => {
setSelectedSymbol(asset);
setPopupMode(PopupMode.SUPPLY);
}}
>
Supply / Withdraw
</Link>
<Link
// href={`/?popmode=BORROW`}
href={`/`}
</button>
<button
className={`rounded-lg border text-white/50 border-white/50 py-1.5 px-3 uppercase opacity-30 pointer-events-none `}
onClick={() => setSelectedSymbol(asset)}
// onClick={() => {
// setSelectedSymbol(asset);
// setPopupMode(PopupMode.BORROW);
// }}
>
Borrow / Repay
</Link>
</button>
</>
) : (
<div className="connect-button">
Expand Down
Loading

0 comments on commit c1703c0

Please sign in to comment.