From 92cf342191b6c87b95a0384406ca341656e8793c Mon Sep 17 00:00:00 2001 From: tiltom Date: Thu, 30 Jun 2022 16:16:00 +0200 Subject: [PATCH] Add Zero to TVL stats (#2288) * Table labels renaming * Add zero total to tvlData * Rename zero contracts label Co-authored-by: soulBit --- src/app/containers/StatsPage/types.ts | 4 + .../components/TotalValueLocked/index.tsx | 5 + src/app/pages/LandingPage/index.tsx | 90 +- src/locales/en/translation.json | 7 +- src/utils/blockchain/abi/StabilityPool.json | 1231 +++++++++++ src/utils/blockchain/abi/TroveManager.json | 1852 +++++++++++++++++ src/utils/blockchain/contracts.testnet.ts | 10 + src/utils/blockchain/contracts.ts | 10 + 8 files changed, 3204 insertions(+), 5 deletions(-) create mode 100644 src/utils/blockchain/abi/StabilityPool.json create mode 100644 src/utils/blockchain/abi/TroveManager.json diff --git a/src/app/containers/StatsPage/types.ts b/src/app/containers/StatsPage/types.ts index c16e80138..68b027348 100644 --- a/src/app/containers/StatsPage/types.ts +++ b/src/app/containers/StatsPage/types.ts @@ -32,6 +32,10 @@ export type TvlData = { totalBtc: number; totalUsd: number; }; + tvlZero: { + totalBtc: number; + totalUsd: number; + }; total_btc: number; total_usd: number; }; diff --git a/src/app/pages/LandingPage/components/TotalValueLocked/index.tsx b/src/app/pages/LandingPage/components/TotalValueLocked/index.tsx index e472916ac..b3198ed4b 100644 --- a/src/app/pages/LandingPage/components/TotalValueLocked/index.tsx +++ b/src/app/pages/LandingPage/components/TotalValueLocked/index.tsx @@ -32,6 +32,11 @@ export const TotalValueLocked: React.FC = ({ btcValue: data?.tvlAmm?.totalBtc || 0, usdValue: data?.tvlAmm?.totalUsd || 0, }, + { + contract: t(translations.landingPage.tvl.zero), + btcValue: data?.tvlZero?.totalBtc || 0, + usdValue: data?.tvlZero?.totalUsd || 0, + }, { contract: t(translations.landingPage.tvl.subProtocol), btcValue: data?.tvlSubprotocols?.totalBtc || 0, diff --git a/src/app/pages/LandingPage/index.tsx b/src/app/pages/LandingPage/index.tsx index 1f62de117..c770abb07 100644 --- a/src/app/pages/LandingPage/index.tsx +++ b/src/app/pages/LandingPage/index.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useRef, useState } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { Helmet } from 'react-helmet-async'; import { useTranslation } from 'react-i18next'; import { translations } from 'locales/i18n'; @@ -19,6 +19,13 @@ import { CryptocurrencyPrices } from './components/CryptocurrencyPrices'; import { IAssets } from './components/CryptocurrencyPrices/types'; import styles from './index.module.scss'; import { IPairsData } from 'types/trading-pairs'; +import { numberFromWei } from 'utils/blockchain/math-helpers'; +import { bridgeNetwork } from '../BridgeDepositPage/utils/bridge-network'; +import { Asset, Chain } from 'types'; +import { getContract } from 'utils/blockchain/contract-helpers'; +import { useDenominateAssetAmount } from 'app/hooks/trading/useDenominateAssetAmount'; +import { useDollarValue } from 'app/hooks/useDollarValue'; +import { bignumber } from 'mathjs'; const url = backendUrl[currentChainId]; @@ -27,7 +34,7 @@ interface ILandingPageProps { } export const LandingPage: React.FC = ({ - refreshInterval = 300000, + refreshInterval = 600000, }) => { const { t } = useTranslation(); @@ -37,6 +44,12 @@ export const LandingPage: React.FC = ({ const [pairsData, setPairsData] = useState(); const [assetLoading, setAssetLoading] = useState(false); const [assetData, setAssetData] = useState(); + const [zusdDepositsWeiAmount, setZusdDepositsWeiAmount] = useState('0'); + const [ + rbtcCollateralValueWeiAmount, + setRbtcCollateralValueWeiAmount, + ] = useState('0'); + const [zeroLoading, setZeroLoading] = useState(false); const cancelDataRequest = useRef(); const cancelPairsDataRequest = useRef(); @@ -62,6 +75,36 @@ export const LandingPage: React.FC = ({ }); }, []); + const getZeroTvlData = useCallback(() => { + setZeroLoading(true); + + bridgeNetwork + .multiCall(Chain.RSK, [ + { + address: getContract('zero_troveManager').address, + abi: getContract('zero_troveManager').abi, + fnName: 'getEntireSystemColl', + args: [], + key: 'rbtcCollateral', + parser: value => value[0].toString(), + }, + { + address: getContract('zero_stabilityPool').address, + abi: getContract('zero_stabilityPool').abi, + fnName: 'getTotalZUSDDeposits', + args: [], + key: 'zusdDeposits', + parser: value => value[0].toString(), + }, + ]) + .then(result => { + setZusdDepositsWeiAmount(result.returnData.zusdDeposits); + setRbtcCollateralValueWeiAmount(result.returnData.rbtcCollateral); + }) + .catch(e => console.error(e)) + .finally(() => setZeroLoading(false)); + }, []); + const getPairsData = useCallback(() => { setPairsLoading(true); cancelPairsDataRequest.current && cancelPairsDataRequest.current(); @@ -105,6 +148,7 @@ export const LandingPage: React.FC = ({ useInterval( () => { getTvlData(); + getZeroTvlData(); getPairsData(); getAssetData(); }, @@ -112,6 +156,48 @@ export const LandingPage: React.FC = ({ { immediate: true }, ); + const zusdDepositRbtcValue = useDenominateAssetAmount( + Asset.XUSD, // we cannot use Asset.ZUSD but 1 ZUSD === 1 XUSD + Asset.RBTC, + zusdDepositsWeiAmount, + ); + + const rbtcCollateralUsdValue = useDollarValue( + Asset.RBTC, + rbtcCollateralValueWeiAmount, + ); + + useEffect(() => { + if ( + !zeroLoading && + rbtcCollateralValueWeiAmount !== '0' && + zusdDepositsWeiAmount !== '0' + ) { + const zeroTotalRbtc = numberFromWei( + bignumber(zusdDepositRbtcValue.value) + .add(rbtcCollateralValueWeiAmount) + .toString(), + ); + const zeroTotalUsd = numberFromWei( + bignumber(zusdDepositsWeiAmount) + .add(rbtcCollateralUsdValue.value) + .toString(), + ); + setTvlData(tvlData => ({ + ...tvlData!, + tvlZero: { totalBtc: zeroTotalRbtc, totalUsd: zeroTotalUsd }, + total_btc: (tvlData?.total_btc || 0) + zeroTotalRbtc, + total_usd: (tvlData?.total_usd || 0) + zeroTotalUsd, + })); + } + }, [ + rbtcCollateralUsdValue.value, + rbtcCollateralValueWeiAmount, + zeroLoading, + zusdDepositRbtcValue.value, + zusdDepositsWeiAmount, + ]); + return ( <> diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index e821ed4f3..1220c8e47 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -2587,10 +2587,11 @@ "btc": "Value (BTC)", "usd": "Value (USD)", "protocol": "Protocol Contract", - "lend": "Lending Contract", - "amm": "Amm Contract", + "lend": "Lending Contracts", + "amm": "AMM Contracts", + "zero": "Zero Contracts", "staked": "Bitocracy Staking Contract", - "subProtocol": "Subprotocol Bonding Curve Contracts", + "subProtocol": "MYNT Bonding Curve Contract", "subtotal": "Sub total", "total": "Total" }, diff --git a/src/utils/blockchain/abi/StabilityPool.json b/src/utils/blockchain/abi/StabilityPool.json new file mode 100644 index 000000000..21a4cd116 --- /dev/null +++ b/src/utils/blockchain/abi/StabilityPool.json @@ -0,0 +1,1231 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newActivePoolAddress", + "type": "address" + } + ], + "name": "ActivePoolAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newBorrowerOperationsAddress", + "type": "address" + } + ], + "name": "BorrowerOperationsAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newCommunityIssuanceAddress", + "type": "address" + } + ], + "name": "CommunityIssuanceAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newDefaultPoolAddress", + "type": "address" + } + ], + "name": "DefaultPoolAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_depositor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_P", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_S", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_G", + "type": "uint256" + } + ], + "name": "DepositSnapshotUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_depositor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ETH", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ZUSDLoss", + "type": "uint256" + } + ], + "name": "ETHGainWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "_currentEpoch", + "type": "uint128" + } + ], + "name": "EpochUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "EtherSent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_frontEnd", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_kickbackRate", + "type": "uint256" + } + ], + "name": "FrontEndRegistered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_frontEnd", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_P", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_G", + "type": "uint256" + } + ], + "name": "FrontEndSnapshotUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_frontEnd", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_newFrontEndStake", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "_depositor", + "type": "address" + } + ], + "name": "FrontEndStakeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_depositor", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "_frontEnd", + "type": "address" + } + ], + "name": "FrontEndTagSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_G", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "_epoch", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "_scale", + "type": "uint128" + } + ], + "name": "G_Updated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_P", + "type": "uint256" + } + ], + "name": "P_Updated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newPriceFeedAddress", + "type": "address" + } + ], + "name": "PriceFeedAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_S", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "_epoch", + "type": "uint128" + }, + { + "indexed": false, + "internalType": "uint128", + "name": "_scale", + "type": "uint128" + } + ], + "name": "S_Updated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint128", + "name": "_currentScale", + "type": "uint128" + } + ], + "name": "ScaleUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newSortedTrovesAddress", + "type": "address" + } + ], + "name": "SortedTrovesAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_newBalance", + "type": "uint256" + } + ], + "name": "StabilityPoolETHBalanceUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_newBalance", + "type": "uint256" + } + ], + "name": "StabilityPoolZUSDBalanceUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newTroveManagerAddress", + "type": "address" + } + ], + "name": "TroveManagerAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_depositor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_newDeposit", + "type": "uint256" + } + ], + "name": "UserDepositChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_depositor", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ZERO", + "type": "uint256" + } + ], + "name": "ZEROPaidToDepositor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_frontEnd", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ZERO", + "type": "uint256" + } + ], + "name": "ZEROPaidToFrontEnd", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newZUSDTokenAddress", + "type": "address" + } + ], + "name": "ZUSDTokenAddressChanged", + "type": "event" + }, + { + "inputs": [], + "name": "DECIMAL_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_NET_DEBT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "P", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SCALE_FACTOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ZUSD_GAS_COMPENSATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_100pct", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "activePool", + "outputs": [ + { + "internalType": "contract IActivePool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "borrowerOperations", + "outputs": [ + { + "internalType": "contract IBorrowerOperations", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "communityIssuance", + "outputs": [ + { + "internalType": "contract ICommunityIssuance", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentEpoch", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentScale", + "outputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultPool", + "outputs": [ + { + "internalType": "contract IDefaultPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "depositSnapshots", + "outputs": [ + { + "internalType": "uint256", + "name": "S", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "P", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "G", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "scale", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "epoch", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "deposits", + "outputs": [ + { + "internalType": "uint256", + "name": "initialValue", + "type": "uint256" + }, + { + "internalType": "address", + "name": "frontEndTag", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "name": "epochToScaleToG", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "name": "epochToScaleToSum", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "frontEndSnapshots", + "outputs": [ + { + "internalType": "uint256", + "name": "S", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "P", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "G", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "scale", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "epoch", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "frontEndStakes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "frontEnds", + "outputs": [ + { + "internalType": "uint256", + "name": "kickbackRate", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "registered", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_frontEnd", + "type": "address" + } + ], + "name": "getCompoundedFrontEndStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositor", + "type": "address" + } + ], + "name": "getCompoundedZUSDDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositor", + "type": "address" + } + ], + "name": "getDepositorETHGain", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_depositor", + "type": "address" + } + ], + "name": "getDepositorZEROGain", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getETH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEntireSystemColl", + "outputs": [ + { + "internalType": "uint256", + "name": "entireSystemColl", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEntireSystemDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "entireSystemDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_frontEnd", + "type": "address" + } + ], + "name": "getFrontEndZEROGain", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTotalZUSDDeposits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastETHError_Offset", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastZEROError", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastZUSDLossError_Offset", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "liquityBaseParams", + "outputs": [ + { + "internalType": "contract ILiquityBaseParams", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_debtToOffset", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_collToAdd", + "type": "uint256" + } + ], + "name": "offset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "priceFeed", + "outputs": [ + { + "internalType": "contract IPriceFeed", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_frontEndTag", + "type": "address" + } + ], + "name": "provideToSP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_kickbackRate", + "type": "uint256" + } + ], + "name": "registerFrontEnd", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_liquityBaseParamsAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_borrowerOperationsAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_troveManagerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_activePoolAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_zusdTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_sortedTrovesAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_priceFeedAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_communityIssuanceAddress", + "type": "address" + } + ], + "name": "setAddresses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sortedTroves", + "outputs": [ + { + "internalType": "contract ISortedTroves", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "troveManager", + "outputs": [ + { + "internalType": "contract ITroveManager", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_upperHint", + "type": "address" + }, + { + "internalType": "address", + "name": "_lowerHint", + "type": "address" + } + ], + "name": "withdrawETHGainToTrove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdrawFromSP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "zusdToken", + "outputs": [ + { + "internalType": "contract IZUSDToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/src/utils/blockchain/abi/TroveManager.json b/src/utils/blockchain/abi/TroveManager.json new file mode 100644 index 000000000..f4b52067a --- /dev/null +++ b/src/utils/blockchain/abi/TroveManager.json @@ -0,0 +1,1852 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_activePoolAddress", + "type": "address" + } + ], + "name": "ActivePoolAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_baseRate", + "type": "uint256" + } + ], + "name": "BaseRateUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newBorrowerOperationsAddress", + "type": "address" + } + ], + "name": "BorrowerOperationsAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_collSurplusPoolAddress", + "type": "address" + } + ], + "name": "CollSurplusPoolAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_defaultPoolAddress", + "type": "address" + } + ], + "name": "DefaultPoolAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_feeDistributorAddress", + "type": "address" + } + ], + "name": "FeeDistributorAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_gasPoolAddress", + "type": "address" + } + ], + "name": "GasPoolAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_L_ETH", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_L_ZUSDDebt", + "type": "uint256" + } + ], + "name": "LTermsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_lastFeeOpTime", + "type": "uint256" + } + ], + "name": "LastFeeOpTimeUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_liquidatedDebt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_liquidatedColl", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_collGasCompensation", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ZUSDGasCompensation", + "type": "uint256" + } + ], + "name": "Liquidation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_borrowerOperationsAddress", + "type": "address" + } + ], + "name": "LiquityBaseParamsAddressChanges", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newPriceFeedAddress", + "type": "address" + } + ], + "name": "PriceFeedAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_attemptedZUSDAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_actualZUSDAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ETHSent", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_ETHFee", + "type": "uint256" + } + ], + "name": "Redemption", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_sortedTrovesAddress", + "type": "address" + } + ], + "name": "SortedTrovesAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_stabilityPoolAddress", + "type": "address" + } + ], + "name": "StabilityPoolAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_totalStakesSnapshot", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_totalCollateralSnapshot", + "type": "uint256" + } + ], + "name": "SystemSnapshotsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_newTotalStakes", + "type": "uint256" + } + ], + "name": "TotalStakesUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_newIndex", + "type": "uint256" + } + ], + "name": "TroveIndexUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_debt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_coll", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "operation", + "type": "uint8" + } + ], + "name": "TroveLiquidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_troveManagerRedeemOps", + "type": "address" + } + ], + "name": "TroveManagerRedeemOpsAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "_L_ETH", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_L_ZUSDDebt", + "type": "uint256" + } + ], + "name": "TroveSnapshotsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_debt", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "_coll", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stake", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "operation", + "type": "uint8" + } + ], + "name": "TroveUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_zeroStakingAddress", + "type": "address" + } + ], + "name": "ZEROStakingAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_zeroTokenAddress", + "type": "address" + } + ], + "name": "ZEROTokenAddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "_newZUSDTokenAddress", + "type": "address" + } + ], + "name": "ZUSDTokenAddressChanged", + "type": "event" + }, + { + "inputs": [], + "name": "BETA", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BOOTSTRAP_PERIOD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CCR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DECIMAL_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "L_ETH", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "L_ZUSDDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MCR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINUTE_DECAY_FACTOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MIN_NET_DEBT", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "NAME", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SECONDS_IN_ONE_MINUTE", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "TroveOwners", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "Troves", + "outputs": [ + { + "internalType": "uint256", + "name": "debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "coll", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stake", + "type": "uint256" + }, + { + "internalType": "enum TroveManagerStorage.Status", + "name": "status", + "type": "uint8" + }, + { + "internalType": "uint128", + "name": "arrayIndex", + "type": "uint128" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ZUSD_GAS_COMPENSATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_100pct", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "_getCurrentICR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "_getPendingETHReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "_getPendingZUSDDebtReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_getRedemptionRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "_hasPendingRewards", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_stabilityPool", + "outputs": [ + { + "internalType": "contract IStabilityPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_zeroStaking", + "outputs": [ + { + "internalType": "contract IZEROStaking", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_zeroToken", + "outputs": [ + { + "internalType": "contract IZEROToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_zusdToken", + "outputs": [ + { + "internalType": "contract IZUSDToken", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "activePool", + "outputs": [ + { + "internalType": "contract IActivePool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "addTroveOwnerToArray", + "outputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "applyPendingRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "baseRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_troveArray", + "type": "address[]" + } + ], + "name": "batchLiquidateTroves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "borrowerOperationsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "checkRecoveryMode", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "closeTrove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decayBaseRateFromBorrowing", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collDecrease", + "type": "uint256" + } + ], + "name": "decreaseTroveColl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_debtDecrease", + "type": "uint256" + } + ], + "name": "decreaseTroveDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "defaultPool", + "outputs": [ + { + "internalType": "contract IDefaultPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "feeDistributor", + "outputs": [ + { + "internalType": "contract IFeeDistributor", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ZUSDDebt", + "type": "uint256" + } + ], + "name": "getBorrowingFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ZUSDDebt", + "type": "uint256" + } + ], + "name": "getBorrowingFeeWithDecay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBorrowingRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getBorrowingRateWithDecay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "getCurrentICR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getEntireDebtAndColl", + "outputs": [ + { + "internalType": "uint256", + "name": "debt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "coll", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pendingZUSDDebtReward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pendingETHReward", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEntireSystemColl", + "outputs": [ + { + "internalType": "uint256", + "name": "entireSystemColl", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getEntireSystemDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "entireSystemDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getNominalICR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getPendingETHReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getPendingZUSDDebtReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ETHDrawn", + "type": "uint256" + } + ], + "name": "getRedemptionFeeWithDecay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRedemptionRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRedemptionRateWithDecay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "getTCR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getTroveColl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getTroveDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getTroveFromTroveOwnersArray", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTroveOwnersCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getTroveStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "getTroveStatus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "hasPendingRewards", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collIncrease", + "type": "uint256" + } + ], + "name": "increaseTroveColl", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_debtIncrease", + "type": "uint256" + } + ], + "name": "increaseTroveDebt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lastETHError_Redistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastFeeOperationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastZUSDDebtError_Redistribution", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "liquidate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_n", + "type": "uint256" + } + ], + "name": "liquidateTroves", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquityBaseParams", + "outputs": [ + { + "internalType": "contract ILiquityBaseParams", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "priceFeed", + "outputs": [ + { + "internalType": "contract IPriceFeed", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ZUSDamount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_firstRedemptionHint", + "type": "address" + }, + { + "internalType": "address", + "name": "_upperPartialRedemptionHint", + "type": "address" + }, + { + "internalType": "address", + "name": "_lowerPartialRedemptionHint", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_partialRedemptionHintNICR", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxIterations", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxFeePercentage", + "type": "uint256" + } + ], + "name": "redeemCollateral", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "removeStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "rewardSnapshots", + "outputs": [ + { + "internalType": "uint256", + "name": "ETH", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "ZUSDDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_feeDistributorAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_troveManagerRedeemOps", + "type": "address" + }, + { + "internalType": "address", + "name": "_liquityBaseParamsAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_borrowerOperationsAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_activePoolAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_defaultPoolAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_stabilityPoolAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_gasPoolAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_collSurplusPoolAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_priceFeedAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_zusdTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_sortedTrovesAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_zeroTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "_zeroStakingAddress", + "type": "address" + } + ], + "name": "setAddresses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_num", + "type": "uint256" + } + ], + "name": "setTroveStatus", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "sortedTroves", + "outputs": [ + { + "internalType": "contract ISortedTroves", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalCollateralSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalStakes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalStakesSnapshot", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "troveManagerRedeemOps", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "updateStakeAndTotalStakes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_borrower", + "type": "address" + } + ], + "name": "updateTroveRewardSnapshots", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/utils/blockchain/contracts.testnet.ts b/src/utils/blockchain/contracts.testnet.ts index 0a30e2c9b..61a1a7a3d 100644 --- a/src/utils/blockchain/contracts.testnet.ts +++ b/src/utils/blockchain/contracts.testnet.ts @@ -40,6 +40,8 @@ import perpetualLimitOrderBookAbi from './abi/PerpetualLimitOrderBook.json'; import marginTokenAbi from './abi/MarginToken.json'; import fastBtcBridgeAbi from './abi/fastBtcBridge.json'; import fastBtcMultisigAbi from './abi/fastBtcMultisig.json'; +import TroveManager from './abi/TroveManager.json'; +import StabilityPool from './abi/StabilityPool.json'; export const contracts = { sovrynProtocol: { @@ -352,4 +354,12 @@ export const contracts = { address: '0x6b41566353d6C7B8C2a7931d498F11489DacAc29', abi: erc20TokenAbi, }, + zero_troveManager: { + address: '0x56743107c181B32D3A7455d46Be7923aA1045D9E', + abi: TroveManager, + }, + zero_stabilityPool: { + address: '0xd6eD2f49D0A3bF20126cB78119c7CB24D02d605F', + abi: StabilityPool, + }, }; diff --git a/src/utils/blockchain/contracts.ts b/src/utils/blockchain/contracts.ts index 9ff1bc536..d522e1d9a 100644 --- a/src/utils/blockchain/contracts.ts +++ b/src/utils/blockchain/contracts.ts @@ -43,6 +43,8 @@ import fastBtcMultisigAbi from './abi/fastBtcMultisig.json'; import perpetualManagerAbi from './abi/PerpetualManager.json'; import perpetualLimitOrderBookAbi from './abi/PerpetualLimitOrderBook.json'; import marginTokenAbi from './abi/MarginToken.json'; +import TroveManager from './abi/TroveManager.json'; +import StabilityPool from './abi/StabilityPool.json'; export const contracts = { sovrynProtocol: { @@ -353,4 +355,12 @@ export const contracts = { address: '0xdB107FA69E33f05180a4C2cE9c2E7CB481645C2d', abi: erc20TokenAbi, }, + zero_troveManager: { + address: '0x82B09695ee4F214f3A0803683C4AaEc332E4E0a3', + abi: TroveManager, + }, + zero_stabilityPool: { + address: '0xd46C0225D1331B46700d64fF8c906709D15C9202', + abi: StabilityPool, + }, };