From d8535e22f1b201ed484eae9108b4cc2a1f649896 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 24 Jan 2022 14:22:17 +0200 Subject: [PATCH 1/5] add LiquityLegacy to the sidebar --- src/App.js | 2 ++ src/components/Sidebar.js | 23 ++++++++++++++++------- src/containers/Liquity.js | 2 +- src/containers/LiquityLegacy.js | 27 +++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 src/containers/LiquityLegacy.js diff --git a/src/App.js b/src/App.js index 1e637a8..3a993af 100644 --- a/src/App.js +++ b/src/App.js @@ -19,6 +19,7 @@ routerStore.setRouteProps(browserHistory) const Dashboard = React.lazy(() => import("./containers/Dashboard")); const Compound = React.lazy(() => import("./containers/Compound")); const Liquity = React.lazy(() => import("./containers/Liquity")); +const LiquityLegacy = React.lazy(() => import("./containers/LiquityLegacy")); const Risk = React.lazy(() => import("./containers/Risk")); const TermsOfUse = React.lazy(() => import("./containers/Terms")); const FAQ = React.lazy(() => import("./containers/FAQ")); @@ -53,6 +54,7 @@ const App = observer(() => { (renderPage(props, Dashboard))} /> (renderPage(props, Compound))} /> (renderPage(props, Liquity))} /> + (renderPage(props, LiquityLegacy))} /> (renderPage(props, FAQ))} /> (renderPage(props, TermsOfUse))} /> (renderPage(props, Risk))} /> diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index 28a4c88..f1abeb9 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -125,6 +125,11 @@ class Sidebar extends Component {
Backstop
+
+ + + +
{false && (Testnet)}
- -
- - - -
- Lending + Legacy
this.handleItemSelect("compound")}>
+ +
this.handleItemSelect("liquity-leagacy")}> + + {false && (Testnet)} +
+ ); + } +} + +export default observer(LiquityLegacy) From cba049fc29974a4cf23581a0c5d07c7969ef5564 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 24 Jan 2022 18:02:59 +0200 Subject: [PATCH 2/5] updating TVL --- src/components/Tvl.js | 5 ++-- src/components/TvlTooltip.js | 32 ++++++++++++------------ src/containers/FarmInfo.js | 4 +-- src/stores/apy.store.js | 3 ++- src/stores/main.hundred.store.js | 42 ++++++++++++++++++++++++++++++++ src/stores/main.liquity.store.js | 4 +-- 6 files changed, 65 insertions(+), 25 deletions(-) create mode 100644 src/stores/main.hundred.store.js diff --git a/src/components/Tvl.js b/src/components/Tvl.js index b2b4300..87ba487 100644 --- a/src/components/Tvl.js +++ b/src/components/Tvl.js @@ -7,6 +7,7 @@ import {device} from "../screenSizes"; import mainStore, {toCommmSepratedString} from "../stores/main.store" import mainCompStore from "../stores/main.comp.store" import liquityStore from "../stores/main.liquity.store" +import mainHundredStore from "../stores/main.hundred.store" import AnimateNumberChange from "./style-components/AnimateNumberChange" import TvlTooltip from "./TvlTooltip" @@ -152,8 +153,8 @@ class Tvl extends Component { render() { const { tvlNumeric: compTvl } = mainCompStore const { tvlUsdNumeric: makerTvl } = mainStore - const { liquityTvlNumeric: liquityTvl, othersTvlNumeric } = liquityStore - const tvl = (compTvl + makerTvl + liquityTvl + othersTvlNumeric) + const { liquityTvlNumeric: liquityTvl } = liquityStore + const tvl = (compTvl + makerTvl + liquityTvl + mainHundredStore.TVL) return (
diff --git a/src/components/TvlTooltip.js b/src/components/TvlTooltip.js index f78ec7b..899fc74 100644 --- a/src/components/TvlTooltip.js +++ b/src/components/TvlTooltip.js @@ -6,6 +6,7 @@ import mainStore from "../stores/main.store" import apyStore from "../stores/apy.store" import {toCommmSepratedString} from '../lib/Utils' import liquityStore from "../stores/main.liquity.store" +import mainHundredStore from "../stores/main.hundred.store" const ToolTipLine = styled.div` min-width: 160px; @@ -33,7 +34,8 @@ const ToolTipTitle = styled.div` class TvlTooltip extends React.Component { render() { - const { liquityTvlNumeric, othersTvlNumeric } = liquityStore + const { liquityTvlNumeric } = liquityStore + const totalDeposits = parseFloat(apyStore.totalCollateral) + liquityTvlNumeric + mainHundredStore.TVL return ( @@ -42,16 +44,12 @@ class TvlTooltip extends React.Component {
total deposits:
-
${toCommmSepratedString(parseFloat(apyStore.totalCollateral).toFixed(2))}
+
${toCommmSepratedString(parseFloat(totalDeposits).toFixed(2))}
total debt:
${toCommmSepratedString(parseFloat(apyStore.totalDebt).toFixed(2))}
- -
number of users:
-
{apyStore.totalUsers}
-
Maker @@ -65,10 +63,6 @@ class TvlTooltip extends React.Component {
debt:
${toCommmSepratedString(parseFloat(apyStore.makerTotalDebt).toFixed(2))}
- -
users:
-
{apyStore.makerUsers}
-
Compound @@ -82,21 +76,25 @@ class TvlTooltip extends React.Component {
debt:
${toCommmSepratedString(parseFloat(apyStore.compoundTotalDebt).toFixed(2))}
- -
users:
-
{apyStore.compoundUsers}
-
Liquity -
bprotocol.org:
+
Deposits:
${toCommmSepratedString((liquityTvlNumeric).toFixed(2))}
+ + Hundred + + + +
Arbitrum:
+
${toCommmSepratedString((mainHundredStore.hundredTvlArbitrum).toFixed(2))}
+
-
pickle.finance & others:
-
${toCommmSepratedString((othersTvlNumeric).toFixed(2))}
+
Fantom:
+
${toCommmSepratedString((mainHundredStore.hundredTvlFantom).toFixed(2))}
diff --git a/src/containers/FarmInfo.js b/src/containers/FarmInfo.js index 001455a..2b43c0b 100644 --- a/src/containers/FarmInfo.js +++ b/src/containers/FarmInfo.js @@ -179,8 +179,8 @@ class FarmInfo extends Component { const params = qs.parse(search, { ignoreQueryPrefix: true }) const { tvlNumeric: compTvl } = mainCompStore const { tvlUsdNumeric: makerTvl } = mainStore - const { liquityTvlNumeric: liquityTvl, othersTvlNumeric } = liquityStore - const tvl = parseInt((compTvl + makerTvl + liquityTvl + othersTvlNumeric) / 1000000) + const { liquityTvlNumeric: liquityTvl } = liquityStore + const tvl = parseInt((compTvl + makerTvl + liquityTvl) / 1000000) const instaAccounts = instaStore.accounts if(params.inIframe){ diff --git a/src/stores/apy.store.js b/src/stores/apy.store.js index 91cccf1..e1fce6c 100644 --- a/src/stores/apy.store.js +++ b/src/stores/apy.store.js @@ -10,6 +10,7 @@ import {BP_API} from "../common/constants" import { getUserLiquityTvl } from "../lib/liquity.interface" import userStore from "../stores/user.store" import liquityStore from "../stores/main.liquity.store" +import mainHundredStore from "../stores/main.hundred.store" const {toBN, fromWei, toWei} = Web3.utils const _1e18 = toBN("10").pow(toBN("18")) @@ -85,7 +86,7 @@ export class ApyStore { const liquityColl = await getUserLiquityTvl(userStore.web3, userStore.networkType, userStore.user) this.liquityUserCollateral = fromWei(liquityColl) await liquityStore.dataPromise - this.liquityTotalCollateral = liquityStore.liquityTvlNumeric + liquityStore.othersTvlNumeric + this.liquityTotalCollateral = liquityStore.liquityTvlNumeric } getUserCollateral = async () => { diff --git a/src/stores/main.hundred.store.js b/src/stores/main.hundred.store.js new file mode 100644 index 0000000..6840c20 --- /dev/null +++ b/src/stores/main.hundred.store.js @@ -0,0 +1,42 @@ +import { makeAutoObservable, runInAction } from "mobx" +import axios from "axios" + +/** + * Main Store is desigend for general purpose app data + */ +class MainHundredStore { + + hundredTvlFantom = 0 + hundredTvlArbitrum = 0 + + get TVL(){ + return this.hundredTvlFantom + this.hundredTvlArbitrum + } + + constructor (){ + makeAutoObservable(this) + this.dataPromise = this.fetchGeneralDappData() + } + + async fetchGeneralDappData () { + try{ + await this.fetchBammUsd() + } catch (err) { + console.error(err) + } + } + + async fetchBammUsd () { + try{ + const {data} = await axios.get('https://api.llama.fi/protocol/b.protocol') + const {currentChainTvls} = data + debugger + this.hundredTvlArbitrum = currentChainTvls.Arbitrum + this.hundredTvlFantom = currentChainTvls.Fantom + } catch (err) { + console.error(err) + } + } +} + +export default new MainHundredStore() diff --git a/src/stores/main.liquity.store.js b/src/stores/main.liquity.store.js index 1e33650..a4bd2ba 100644 --- a/src/stores/main.liquity.store.js +++ b/src/stores/main.liquity.store.js @@ -11,7 +11,6 @@ const { fromWei} = Web3.utils class MainLiquityStore { liquityTvlNumeric = 0 - othersTvlNumeric = 0 constructor (){ makeAutoObservable(this) @@ -34,8 +33,7 @@ class MainLiquityStore { return parseFloat(fromWei(lusd)) })) runInAction(()=>{ - this.liquityTvlNumeric = bammsTvls.shift() || 0 - this.othersTvlNumeric = bammsTvls.reduce((x, y)=> x + y) + this.liquityTvlNumeric = bammsTvls.reduce((x, y)=> x + y) }) } } From 89284e17d4ac8eb36e41103f8fbc2ae2f1f56186 Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 24 Jan 2022 18:16:24 +0200 Subject: [PATCH 3/5] liquity first on sidebar --- src/components/Sidebar.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index f1abeb9..da51d0a 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -125,11 +125,6 @@ class Sidebar extends Component {
Backstop
-
{false && (Testnet)}
+
+ + + +
Legacy
From d7c8f499af2cc54be1daba8b02d101659c2fe16e Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 24 Jan 2022 18:17:07 +0200 Subject: [PATCH 4/5] farmInfo tvl --- src/containers/FarmInfo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/containers/FarmInfo.js b/src/containers/FarmInfo.js index 2b43c0b..a421cd2 100644 --- a/src/containers/FarmInfo.js +++ b/src/containers/FarmInfo.js @@ -13,6 +13,7 @@ import bproStore, {uBproStore} from "../stores/bpro.store" import mainStore from "../stores/main.store" import mainCompStore from "../stores/main.comp.store" import liquityStore from "../stores/main.liquity.store" +import mainHundredStore from "../stores/main.hundred.store" import userStore from "../stores/user.store" import instaStore, {bproInstaStores} from "../stores/insta.store" import BproClaimModal from "../components/modals/BproClaimModal" @@ -180,7 +181,7 @@ class FarmInfo extends Component { const { tvlNumeric: compTvl } = mainCompStore const { tvlUsdNumeric: makerTvl } = mainStore const { liquityTvlNumeric: liquityTvl } = liquityStore - const tvl = parseInt((compTvl + makerTvl + liquityTvl) / 1000000) + const tvl = parseInt((compTvl + makerTvl + liquityTvl + mainHundredStore.TVL) / 1000000) const instaAccounts = instaStore.accounts if(params.inIframe){ From 390f6eebbe48f2e66362016d2abcef655a8ef46c Mon Sep 17 00:00:00 2001 From: shmuel Date: Mon, 31 Jan 2022 13:46:19 +0200 Subject: [PATCH 5/5] added deprication label to sidebar --- src/components/Sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index da51d0a..9918a89 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -167,7 +167,7 @@ class Sidebar extends Component { }`} onClick={() => this.handleItemSelect("liquity-leagacy")}> - {false && (Testnet)} + (Deprecated)