diff --git a/README.md b/README.md index d237a38a1..c8b3c04af 100644 --- a/README.md +++ b/README.md @@ -61,18 +61,30 @@ REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS ## Install Görli contracts ``` -yarn upgrade @threshold-network/solidity-contracts@goerli \ - @keep-network/keep-core@1.8.1-goerli.0 \ +yarn upgrade @keep-network/coverage-pools@goerli \ + @keep-network/ecdsa@goerli \ + @keep-network/keep-core@goerli \ @keep-network/keep-ecdsa@goerli \ + @keep-network/random-beacon@goerli \ @keep-network/tbtc@goerli \ - @keep-network/coverage-pools@goerli + @keep-network/tbtc-v2@goerli \ + @keep-network/tbtc-v2.ts@goerli \ + @threshold-network/coverage-pools@npm:@keep-network/coverage-pools@goerli \ + @threshold-network/solidity-contracts@goerli \ ``` -**NOTE 1:** We provide explicit version of the `keep-core` package, because -using `goerli` tag results in `expected manifest` error - probably caused by bug -in Yarn: https://github.com/yarnpkg/yarn/issues/4731. +**NOTE 1:** We use the same Goerli versions for both +`@keep-network/coverage-pools` and `@threshold-network/coverage-pools`, because +we don't have the newest version of the package on Goerli network, only on the +Mainnet. -**NOTE 2:** The `token-dashboard` package contains an indirect dependency to +**NOTE 2:** If you encounter an `expected manifest` error while executing this, +then try providing an explicit version of the `keep-core` package: +`@keep-network/keep-core@1.8.1-goerli.0` +The error is probably caused by a bug in Yarn: +https://github.com/yarnpkg/yarn/issues/4731. + +**NOTE 3:** The `token-dashboard` package contains an indirect dependency to `@summa-tx/relay-sol@2.0.2` package, which downloads one of its sub-dependencies via unathenticated `git://` protocol. That protocol is no longer supported by GitHub. This means that in certain situations installation of the package or diff --git a/package.json b/package.json index 22410941b..a95d3e815 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "@threshold-network/components": "development", + "@threshold-network/coverage-pools": "npm:@keep-network/coverage-pools@development", "@threshold-network/solidity-contracts": "development", "@types/jest": "^27.0.1", "@types/node": "^16.9.1", diff --git a/src/components/Link/index.tsx b/src/components/Link/index.tsx index 989bd0c62..abc31f4fc 100644 --- a/src/components/Link/index.tsx +++ b/src/components/Link/index.tsx @@ -17,9 +17,9 @@ type ConditionalLinkProps = | { isExternal?: false; to: string; href?: never } | { isExternal: true; to?: never; href: string } -export type LinkProps = CommonLinkProps & ConditionalLinkProps +export type LinkProps = ChakraLinkProps & CommonLinkProps & ConditionalLinkProps -const Link: FC = forwardRef( +const Link: FC = forwardRef( ({ isExternal, href, to, icon, children, ...props }, ref) => { const defaultColor = useColorModeValue("brand.500", "white") const finalColor = props.color ? props.color : defaultColor diff --git a/src/components/StatHighlightCard.tsx b/src/components/StatHighlightCard.tsx new file mode 100644 index 000000000..8e0a5b536 --- /dev/null +++ b/src/components/StatHighlightCard.tsx @@ -0,0 +1,63 @@ +import { + BoxProps, + Card, + H1, + HStack, + IconProps, + LabelSm, + TextProps, + VStack, +} from "@threshold-network/components" +import { FC } from "react" +import TooltipIcon from "./TooltipIcon" + +export const StatHighlightCard: FC = ({ children, ...restProps }) => { + return ( + + {children} + + ) +} + +export const StatHighlightTitle: FC<{ title: string } & TextProps> = ({ + title, + children, + ...restProps +}) => { + return ( + + + {title} + + {children} + + ) +} + +export const StatHighlightTitleTooltip: FC< + { label: string | JSX.Element } & IconProps +> = ({ label, ...restProps }) => { + return ( + + ) +} + +export const StatHighlightValue: FC<{ value: string & TextProps }> = ({ + value, + ...restProps +}) => { + return ( +

+ {value} +

+ ) +} diff --git a/src/components/tBTC/Stats.tsx b/src/components/tBTC/Stats.tsx index 5501d0e36..a3cdfc160 100644 --- a/src/components/tBTC/Stats.tsx +++ b/src/components/tBTC/Stats.tsx @@ -7,12 +7,12 @@ import { ExternalHref } from "../../enums" import { RecentDeposit } from "../../hooks/tbtc" import Link from "../Link" -export type TVLProps = { +export type TvlProps = { tvl: string tvlInUSD: string } -export const TVL: FC = ({ tvl, tvlInUSD }) => { +export const Tvl: FC = ({ tvl, tvlInUSD }) => { return ( <> TVL diff --git a/src/enums/externalHref.ts b/src/enums/externalHref.ts index 46c1dd2f4..86c30a254 100644 --- a/src/enums/externalHref.ts +++ b/src/enums/externalHref.ts @@ -34,4 +34,5 @@ export enum ExternalHref { mintersAndGuardiansDocs = "https://blog.threshold.network/minters-guardians-and-a-strong-tbtc/", tBTCDuneDashboard = "https://dune.com/threshold/tbtc", delight = "https://delightlabs.io", + coveragePoolsDocs = "https://docs.threshold.network/applications/tbtc-v2/coverage-pool", } diff --git a/src/hooks/__tests__/useFetchTvl.test.tsx b/src/hooks/__tests__/useFetchTvl.test.tsx index 7b0444fba..923517741 100644 --- a/src/hooks/__tests__/useFetchTvl.test.tsx +++ b/src/hooks/__tests__/useFetchTvl.test.tsx @@ -2,6 +2,7 @@ import { renderHook } from "@testing-library/react-hooks" import * as ethersUnits from "@ethersproject/units" import { Token } from "../../enums" import { + useAssetPoolContract, useKeepAssetPoolContract, useKeepBondingContract, useKeepTokenStakingContract, @@ -15,9 +16,11 @@ import * as useTokenModule from "../useToken" import { TokenContext } from "../../contexts/TokenContext" import * as usdUtils from "../../utils/getUsdBalance" import { useTBTCv2TokenContract } from "../../web3/hooks/useTBTCv2TokenContract" +import { FC } from "react" jest.mock("../../web3/hooks", () => ({ ...(jest.requireActual("../../web3/hooks") as {}), + useAssetPoolContract: jest.fn(), useKeepAssetPoolContract: jest.fn(), useKeepBondingContract: jest.fn(), useKeepTokenStakingContract: jest.fn(), @@ -63,10 +66,11 @@ describe("Test `useFetchTvl` hook", () => { const mockedKeepBondingContract = { address: "0x0" } const mockedTStakingContract = { address: "0x2" } const mockedMultiCallContract = { interface: {}, address: "0x3" } - const mockedKeepAssetPoolContract = { interface: {}, address: "0x4" } - const mockedtBTCTokenContract = { interface: {}, address: "0x5" } + const mockedAssetPoolContract = { interface: {}, address: "0x4" } + const mockedKeepAssetPoolContract = { interface: {}, address: "0x5" } + const mockedtBTCTokenContract = { interface: {}, address: "0x6" } - const wrapper = ({ children }) => ( + const wrapper: FC = ({ children }) => ( { ;(useMulticallContract as jest.Mock).mockReturnValue( mockedMultiCallContract ) + ;(useAssetPoolContract as jest.Mock).mockReturnValue( + mockedAssetPoolContract + ) ;(useKeepAssetPoolContract as jest.Mock).mockReturnValue( mockedKeepAssetPoolContract ) @@ -108,7 +115,11 @@ describe("Test `useFetchTvl` hook", () => { // given const ethInKeepBonding = { raw: "10000000000000000000", format: "10.0" } const tbtcTokenTotalSupply = { raw: "5000000000000000000", format: "5.0" } - const coveragePoolTvl = { raw: "300000000000000000000", format: "300.0" } + const coveragePoolTvl = { raw: "500000000000000000000", format: "500.0" } + const keepCoveragePoolTvl = { + raw: "300000000000000000000", + format: "300.0", + } const keepStaking = { raw: "500000000000000000000", format: "500.0" } const tStaking = { raw: "600000000000000000000", format: "600.0" } const tBTC = { raw: "700000000000000000000", format: "700.0" } @@ -117,6 +128,7 @@ describe("Test `useFetchTvl` hook", () => { ethInKeepBonding.raw, tbtcTokenTotalSupply.raw, coveragePoolTvl.raw, + keepCoveragePoolTvl.raw, keepStaking.raw, tStaking.raw, tBTC.raw, @@ -131,7 +143,8 @@ describe("Test `useFetchTvl` hook", () => { const _expectedResult = { ecdsa: +ethInKeepBonding.format * mockedETHData.usdPrice, tbtc: +tbtcTokenTotalSupply.format * tbtcv1Context.usdConversion, - keepCoveragePool: +coveragePoolTvl.format * keepContext.usdConversion, + coveragePool: +coveragePoolTvl.format * tContext.usdConversion, + keepCoveragePool: +keepCoveragePoolTvl.format * keepContext.usdConversion, keepStaking: +keepStaking.format * keepContext.usdConversion, tStaking: +tStaking.format * tContext.usdConversion, tBTC: +tBTC.format * tBTCContext.usdConversion, @@ -142,6 +155,7 @@ describe("Test `useFetchTvl` hook", () => { const expectedResult = { ecdsa: `${_expectedResult.ecdsa.toString()}.0`, tbtcv1: `${_expectedResult.tbtc.toString()}.0`, + coveragePool: `${_expectedResult.coveragePool.toString()}.0`, keepCoveragePool: `${_expectedResult.keepCoveragePool.toString()}.0`, keepStaking: `${_expectedResult.keepStaking.toString()}.0`, tStaking: `${_expectedResult.tStaking.toString()}.0`, @@ -149,6 +163,7 @@ describe("Test `useFetchTvl` hook", () => { total: `${ _expectedResult.ecdsa + _expectedResult.tbtc + + _expectedResult.coveragePool + _expectedResult.keepCoveragePool + _expectedResult.keepStaking + _expectedResult.tStaking + @@ -169,6 +184,7 @@ describe("Test `useFetchTvl` hook", () => { expect(spyOnUseToken).toHaveBeenCalledWith(Token.TBTCV2) expect(useKeepBondingContract).toHaveBeenCalled() expect(useMulticallContract).toHaveBeenCalled() + expect(useAssetPoolContract).toHaveBeenCalled() expect(useKeepAssetPoolContract).toHaveBeenCalled() expect(useTStakingContract).toHaveBeenCalled() expect(useKeepTokenStakingContract).toHaveBeenCalled() @@ -184,6 +200,11 @@ describe("Test `useFetchTvl` hook", () => { address: tbtcv1Context.contract.address, method: "totalSupply", }, + { + interface: mockedAssetPoolContract.interface, + address: mockedAssetPoolContract.address, + method: "totalValue", + }, { interface: mockedKeepAssetPoolContract.interface, address: mockedKeepAssetPoolContract.address, @@ -225,32 +246,37 @@ describe("Test `useFetchTvl` hook", () => { ) expect(spyOnToUsdBalance).toHaveBeenNthCalledWith( - 7, + 8, ethInKeepBonding.format, mockedETHData.usdPrice ) expect(spyOnToUsdBalance).toHaveBeenNthCalledWith( - 8, + 9, tbtcTokenTotalSupply.format, tbtcv1Context.usdConversion ) expect(spyOnToUsdBalance).toHaveBeenNthCalledWith( - 9, + 10, tBTC.format, tBTCContext.usdConversion ) expect(spyOnToUsdBalance).toHaveBeenNthCalledWith( - 10, + 11, coveragePoolTvl.format, + tContext.usdConversion + ) + expect(spyOnToUsdBalance).toHaveBeenNthCalledWith( + 12, + keepCoveragePoolTvl.format, keepContext.usdConversion ) expect(spyOnToUsdBalance).toHaveBeenNthCalledWith( - 11, + 13, keepStaking.format, keepContext.usdConversion ) expect(spyOnToUsdBalance).toHaveBeenNthCalledWith( - 12, + 14, tStaking.format, tContext.usdConversion ) diff --git a/src/hooks/useFetchTvl.ts b/src/hooks/useFetchTvl.ts index a145dbb59..fc21632da 100644 --- a/src/hooks/useFetchTvl.ts +++ b/src/hooks/useFetchTvl.ts @@ -5,6 +5,7 @@ import { useKeepBondingContract, useMulticall, useMulticallContract, + useAssetPoolContract, useKeepAssetPoolContract, useTStakingContract, useKeepTokenStakingContract, @@ -14,19 +15,21 @@ import { useToken } from "./useToken" import { Token } from "../enums" import { toUsdBalance } from "../utils/getUsdBalance" -interface TVLRawData { - ecdsaTVL: string - tbtcv1TVL: string - keepCoveragePoolTVL: string - keepStakingTVL: string - tStakingTVL: string +interface TvlRawData { + ecdsaTvl: string + tbtcv1Tvl: string + coveragePoolTvl: string + keepCoveragePoolTvl: string + keepStakingTvl: string + tStakingTvl: string tBTC: string // TODO: add PRE and NU TVL } -interface TVLData { +interface TvlData { ecdsa: string tbtcv1: string + coveragePool: string keepCoveragePool: string keepStaking: string tStaking: string @@ -35,27 +38,29 @@ interface TVLData { } const initialState = { - ecdsaTVL: "0", - tbtcv1TVL: "0", + ecdsaTvl: "0", + tbtcv1Tvl: "0", tBTC: "0", - keepCoveragePoolTVL: "0", - keepStakingTVL: "0", - tStakingTVL: "0", + coveragePoolTvl: "0", + keepCoveragePoolTvl: "0", + keepStakingTvl: "0", + tStakingTvl: "0", } export const useFetchTvl = (): [ - TVLData, - () => Promise, - TVLRawData + TvlData, + () => Promise, + TvlRawData ] => { - const [rawData, setRawData] = useState(initialState) + const [rawData, setRawData] = useState(initialState) const { - ecdsaTVL, - tbtcv1TVL: tbtcTVL, - keepCoveragePoolTVL, - keepStakingTVL, - tStakingTVL, - tBTC: tBTCTVL, + ecdsaTvl, + tbtcv1Tvl: tbtcTvl, + coveragePoolTvl, + keepCoveragePoolTvl, + keepStakingTvl, + tStakingTvl, + tBTC: tBTCTvl, } = rawData const eth = useETHData() @@ -64,6 +69,7 @@ export const useFetchTvl = (): [ const t = useToken(Token.T) const keepBonding = useKeepBondingContract() const multicall = useMulticallContract() + const assetPool = useAssetPoolContract() const keepAssetPool = useKeepAssetPoolContract() const tTokenStaking = useTStakingContract() const keepTokenStaking = useKeepTokenStakingContract() @@ -81,6 +87,11 @@ export const useFetchTvl = (): [ interface: tbtcv1.contract?.interface!, method: "totalSupply", }, + { + address: assetPool?.address!, + interface: assetPool?.interface!, + method: "totalValue", + }, { address: keepAssetPool?.address!, interface: keepAssetPool?.interface!, @@ -105,7 +116,7 @@ export const useFetchTvl = (): [ }, ]) - const fetchTVLData = useCallback(async () => { + const fetchTvlData = useCallback(async () => { const chainData = await fetchOnChainData() if (chainData.length === 0) return initialState @@ -113,17 +124,19 @@ export const useFetchTvl = (): [ ethInKeepBonding, tbtcv1TokenTotalSupply, coveragePoolTvl, + keepCoveragePoolTvl, keepStaking, tStaking, tBTCTokenTotalSupply, ] = chainData.map((amount: BigNumberish) => amount.toString()) - const data: TVLRawData = { - ecdsaTVL: ethInKeepBonding, - tbtcv1TVL: tbtcv1TokenTotalSupply, - keepCoveragePoolTVL: coveragePoolTvl, - keepStakingTVL: keepStaking, - tStakingTVL: tStaking, + const data: TvlRawData = { + ecdsaTvl: ethInKeepBonding, + tbtcv1Tvl: tbtcv1TokenTotalSupply, + coveragePoolTvl: coveragePoolTvl, + keepCoveragePoolTvl: keepCoveragePoolTvl, + keepStakingTvl: keepStaking, + tStakingTvl: tStaking, tBTC: tBTCTokenTotalSupply, } setRawData(data) @@ -132,45 +145,52 @@ export const useFetchTvl = (): [ }, [fetchOnChainData]) const data = useMemo(() => { - const ecdsa = toUsdBalance(formatUnits(ecdsaTVL), eth.usdPrice) + const ecdsa = toUsdBalance(formatUnits(ecdsaTvl), eth.usdPrice) - const tbtcv1USD = toUsdBalance(formatUnits(tbtcTVL), tbtcv1.usdConversion) - const tBTCUSD = toUsdBalance(formatUnits(tBTCTVL), tBTCToken.usdConversion) + const tbtcv1USD = toUsdBalance(formatUnits(tbtcTvl), tbtcv1.usdConversion) + const tBTCUSD = toUsdBalance(formatUnits(tBTCTvl), tBTCToken.usdConversion) + + const coveragePool = toUsdBalance( + formatUnits(coveragePoolTvl), + t.usdConversion + ) const keepCoveragePool = toUsdBalance( - formatUnits(keepCoveragePoolTVL), + formatUnits(keepCoveragePoolTvl), keep.usdConversion ) const keepStaking = toUsdBalance( - formatUnits(keepStakingTVL), + formatUnits(keepStakingTvl), keep.usdConversion ) - const tStaking = toUsdBalance(formatUnits(tStakingTVL), t.usdConversion) + const tStaking = toUsdBalance(formatUnits(tStakingTvl), t.usdConversion) return { ecdsa: ecdsa.toString(), tbtcv1: tbtcv1USD.toString(), + coveragePool: coveragePool.toString(), keepCoveragePool: keepCoveragePool.toString(), keepStaking: keepStaking.toString(), tStaking: tStaking.toString(), tBTC: tBTCUSD.toString(), total: ecdsa .addUnsafe(tbtcv1USD) + .addUnsafe(coveragePool) .addUnsafe(keepCoveragePool) .addUnsafe(keepStaking) .addUnsafe(tStaking) .addUnsafe(tBTCUSD) .toString(), - } as TVLData + } as TvlData }, [ - ecdsaTVL, - keepCoveragePoolTVL, - tbtcTVL, - keepStakingTVL, - tStakingTVL, - tBTCTVL, + ecdsaTvl, + keepCoveragePoolTvl, + tbtcTvl, + keepStakingTvl, + tStakingTvl, + tBTCTvl, eth.usdPrice, keep.usdConversion, tbtcv1.usdConversion, @@ -178,5 +198,5 @@ export const useFetchTvl = (): [ tBTCToken.usdConversion, ]) - return [data, fetchTVLData, rawData] + return [data, fetchTvlData, rawData] } diff --git a/src/pages/Overview/Network/TotalValueLocked.tsx b/src/pages/Overview/Network/TotalValueLocked.tsx index 37095c983..d76bb8dc8 100644 --- a/src/pages/Overview/Network/TotalValueLocked.tsx +++ b/src/pages/Overview/Network/TotalValueLocked.tsx @@ -1,7 +1,10 @@ import { FC } from "react" -import CardTemplate from "./CardTemplate" -import { H1 } from "@threshold-network/components" import { formatFiatCurrencyAmount } from "../../../utils/formatAmount" +import { + StatHighlightCard, + StatHighlightTitle, + StatHighlightValue, +} from "../../../components/StatHighlightCard" const TotalValueLocked: FC<{ totalValueLocked: number | string }> = ({ totalValueLocked, @@ -9,11 +12,10 @@ const TotalValueLocked: FC<{ totalValueLocked: number | string }> = ({ const tvl = formatFiatCurrencyAmount(totalValueLocked) return ( - -

- {tvl} -

-
+ + + + ) } diff --git a/src/pages/Overview/Network/index.tsx b/src/pages/Overview/Network/index.tsx index 0ee45b9a7..0cdf8002a 100644 --- a/src/pages/Overview/Network/index.tsx +++ b/src/pages/Overview/Network/index.tsx @@ -21,6 +21,7 @@ import { useAppDispatch, useAppSelector } from "../../../hooks/store" import { selectBridgeActivity, tbtcSlice } from "../../../store/tbtc" import ButtonLink from "../../../components/ButtonLink" import upgradeToTIcon from "../../../static/images/upgrade-to-t.svg" +import { CoveragePoolsTvlCard } from "../../tBTC/CoveragePools" const Network: PageComponent = () => { const [tvlInUSD, fetchtTvlData, tvlInTokenUnits] = useFetchTvl() @@ -58,6 +59,7 @@ const Network: PageComponent = () => { isBridgeActivityFetching={isBridgeActivityFetching} /> + diff --git a/src/pages/Overview/Network/tBTCBridgeStats.tsx b/src/pages/Overview/Network/tBTCBridgeStats.tsx index c4c563eb7..041a4a45c 100644 --- a/src/pages/Overview/Network/tBTCBridgeStats.tsx +++ b/src/pages/Overview/Network/tBTCBridgeStats.tsx @@ -4,11 +4,11 @@ import { ProtocolHistory, ProtocolHistoryProps, TBTCText, - TVL, - TVLProps, + Tvl, + TvlProps, } from "../../../components/tBTC" -type TBTCBridgeStatsProps = ProtocolHistoryProps & TVLProps +type TBTCBridgeStatsProps = ProtocolHistoryProps & TvlProps export const TBTCBridgeStats: FC = ({ tvl, @@ -20,7 +20,7 @@ export const TBTCBridgeStats: FC = ({ Bridge Stats - + diff --git a/src/pages/Staking/StakingTVLCard.tsx b/src/pages/Staking/StakingTVLCard.tsx deleted file mode 100644 index 88bd6a70f..000000000 --- a/src/pages/Staking/StakingTVLCard.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { FC } from "react" -import { H1, LabelSm, Card, BoxProps } from "@threshold-network/components" -import { formatFiatCurrencyAmount } from "../../utils/formatAmount" - -export interface StakingTvlCardProps extends BoxProps { - tvl: string -} - -const StakingTVLCard: FC = ({ tvl, ...restProps }) => { - return ( - - - staking tvl - -

{formatFiatCurrencyAmount(tvl)}

-
- ) -} - -export default StakingTVLCard diff --git a/src/pages/Staking/StakingTvlCard.tsx b/src/pages/Staking/StakingTvlCard.tsx new file mode 100644 index 000000000..fbf7b94ca --- /dev/null +++ b/src/pages/Staking/StakingTvlCard.tsx @@ -0,0 +1,36 @@ +import { FC } from "react" +import { H1, LabelSm, Card, BoxProps } from "@threshold-network/components" +import { formatFiatCurrencyAmount } from "../../utils/formatAmount" +import { + StatHighlightCard, + StatHighlightTitle, + StatHighlightValue, +} from "../../components/StatHighlightCard" + +export interface StakingTvlCardProps extends BoxProps { + stakingTvl: string +} + +const StakingTvlCard: FC = ({ + stakingTvl, + ...restProps +}) => { + const formattedStakingTvl = formatFiatCurrencyAmount(stakingTvl) + + return ( + + + + + ) + return ( + + + staking tvl + +

{formatFiatCurrencyAmount(stakingTvl)}

+
+ ) +} + +export default StakingTvlCard diff --git a/src/pages/Staking/index.tsx b/src/pages/Staking/index.tsx index 2d2d58793..c80a79641 100644 --- a/src/pages/Staking/index.tsx +++ b/src/pages/Staking/index.tsx @@ -1,5 +1,5 @@ import { useEffect, useMemo } from "react" -import StakingTVLCard from "./StakingTVLCard" +import StakingTvlCard from "./StakingTvlCard" import StakedPortfolioCard from "./StakedPortfolioCard" import PageLayout from "../PageLayout" import StakeCard from "./StakeCard" @@ -106,7 +106,7 @@ const StakingPage: PageComponent = (props) => { totalRewardsBalance={totalRewardsBalance} /> - + {hasStakes && }
diff --git a/src/pages/tBTC/Bridge/components/BridgeProcessEmptyState.tsx b/src/pages/tBTC/Bridge/components/BridgeProcessEmptyState.tsx index d7891a6eb..a97b1cd47 100644 --- a/src/pages/tBTC/Bridge/components/BridgeProcessEmptyState.tsx +++ b/src/pages/tBTC/Bridge/components/BridgeProcessEmptyState.tsx @@ -6,7 +6,7 @@ import { ProtocolHistoryRecentDeposits, ProtocolHistoryTitle, ProtocolHistoryViewMoreLink, - TVL, + Tvl, } from "../../../../components/tBTC" import { useFetchRecentDeposits } from "../../../../hooks/tbtc" import { useFetchTvl } from "../../../../hooks/useFetchTvl" @@ -32,7 +32,7 @@ export const BridgeProcessEmptyState: FC<{
{title}
- + + +const LearnMoreLink: FC = ({ children, ...restProps }) => { + return ( + + {children} + + ) +} + +export const CoveragePoolsTvlCard: FC = ({ + coveragePoolTvl, + ...restProps +}) => { + const formattedTvl = formatFiatCurrencyAmount(coveragePoolTvl) + const tooltipLabel = ( + <> + Threshold Coverage Pool serves as a backstop for assets secured by the + tBTC protocol. In the event that secured Bitcoin is los from protocol, + assets from the coverage pool are withdrawn by the risk manager, converted + to BTC, an put back into the protocol to achieve the supply peg as closely + as possible. Learn more + + ) + return ( + + + + + +
+ Learn more about Coverage Pools +
+
+ ) +} diff --git a/src/pages/tBTC/CoveragePools/index.tsx b/src/pages/tBTC/CoveragePools/index.tsx new file mode 100644 index 000000000..363963aab --- /dev/null +++ b/src/pages/tBTC/CoveragePools/index.tsx @@ -0,0 +1 @@ +export * from "./CoveragePoolsTvlCard" diff --git a/src/web3/hooks/index.ts b/src/web3/hooks/index.ts index d1a1b7293..474a3d491 100644 --- a/src/web3/hooks/index.ts +++ b/src/web3/hooks/index.ts @@ -13,6 +13,7 @@ export * from "./useVendingMachineRatio" export * from "./useMulticallContract" export * from "./useKeepBondingContract" export * from "./useAssetPoolContract" +export * from "./useKeepAssetPoolContract" export * from "./useTBTCTokenContract" export * from "./useTStakingContract" export * from "./useKeepTokenStakingContract" diff --git a/src/web3/hooks/useAssetPoolContract.ts b/src/web3/hooks/useAssetPoolContract.ts index 99f20fa29..a4d4aea00 100644 --- a/src/web3/hooks/useAssetPoolContract.ts +++ b/src/web3/hooks/useAssetPoolContract.ts @@ -1,6 +1,6 @@ import { useContract } from "./useContract" -import AssetPool from "@keep-network/coverage-pools/artifacts/AssetPool.json" +import AssetPool from "@threshold-network/coverage-pools/artifacts/AssetPool.json" -export const useKeepAssetPoolContract = () => { +export const useAssetPoolContract = () => { return useContract(AssetPool.address, AssetPool.abi) } diff --git a/src/web3/hooks/useKeepAssetPoolContract.ts b/src/web3/hooks/useKeepAssetPoolContract.ts new file mode 100644 index 000000000..99f20fa29 --- /dev/null +++ b/src/web3/hooks/useKeepAssetPoolContract.ts @@ -0,0 +1,6 @@ +import { useContract } from "./useContract" +import AssetPool from "@keep-network/coverage-pools/artifacts/AssetPool.json" + +export const useKeepAssetPoolContract = () => { + return useContract(AssetPool.address, AssetPool.abi) +} diff --git a/yarn.lock b/yarn.lock index e106ec6a9..a5d80305e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4086,6 +4086,17 @@ resolved "https://registry.npmjs.org/@threshold-network/components/-/components-1.0.0-dev.31.tgz#7767a9f136156f8d4f3044d90e87a1014eb07a67" integrity sha512-ftzJV6p2He3Co0wLYky+sX0NAFVGrJCRvBDI0n3KF4POBO425Qy3yodS7HOkT1TgGRNU8AGO0KebS2X7gfgAEA== +"@threshold-network/coverage-pools@npm:@keep-network/coverage-pools@development": + version "2.1.0-dev.3" + resolved "https://registry.yarnpkg.com/@keep-network/coverage-pools/-/coverage-pools-2.1.0-dev.3.tgz#95b2c7df4a109a6d82fcb067ea1f4bbac4e9434a" + integrity sha512-b6UMu5/8Rd/OS33T6RwMAHyyJtIInzJVwVFx4ZxMwKvPBE/orRAIVkgkCUWUNM04WWexgt/i5h393lia9d00IQ== + dependencies: + "@keep-network/keep-core" "1.8.1-dev.0" + "@keep-network/tbtc" "1.1.2-dev.1" + "@openzeppelin/contracts" "^4.8" + "@thesis/solidity-contracts" "github:thesis/solidity-contracts#4985bcf" + "@threshold-network/solidity-contracts" "1.3.0-dev.5" + "@threshold-network/solidity-contracts@1.3.0-dev.5", "@threshold-network/solidity-contracts@development": version "1.3.0-dev.5" resolved "https://registry.yarnpkg.com/@threshold-network/solidity-contracts/-/solidity-contracts-1.3.0-dev.5.tgz#f7a2727d627a10218f0667bc0d33e19ed8f87fdc"