-
-
Notifications
You must be signed in to change notification settings - Fork 30
Feature/multi peg frontend #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
6a631d4
9b5301e
ebf28f0
5c9d18d
07bc96e
8ea163e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import BigNumber from "bignumber.js"; | |
| import { motion, AnimatePresence } from "framer-motion"; | ||
| import GauIcon from "@/lib/components/icons/GauIcon"; | ||
| import GaucIcon from "@/lib/components/icons/GaucIcon"; | ||
| import { protocolConfig } from "@/lib/config/protocol"; | ||
|
|
||
| interface GluonStats { | ||
| ergPrice: number | null; | ||
|
|
@@ -305,11 +306,32 @@ export function GluonStats() { | |
|
|
||
| {/* Token Grid - Responsive */} | ||
| <div className="mb-6 grid grid-cols-1 gap-4 md:grid-cols-3"> | ||
| {renderStatCard("Gram of Gold", "Gold (from Oracle)", stats.goldPrice, <Scale className="h-8 w-8 text-yellow-700" />, "ERG", 0.1)} | ||
| {renderStatCard( | ||
| protocolConfig.ui.labels.goldPriceTitle, | ||
| protocolConfig.ui.labels.goldPriceSubtitle, | ||
| stats.goldKgPrice, | ||
| <Scale className="h-8 w-8 text-yellow-700" />, | ||
| "ERG", | ||
| 0.1 | ||
| )} | ||
|
|
||
| {renderStatCard("GAU", "Gold Pegged Token", stats.gauPrice, <GauIcon className="h-8 w-8" />, "ERG", 0.2)} | ||
| {renderStatCard( | ||
| protocolConfig.tokens.neutron.ticker, | ||
| protocolConfig.ui.labels.neutronSubtitle, | ||
| stats.gauPrice, | ||
| <GauIcon className="h-8 w-8" />, | ||
| "ERG", | ||
| 0.2 | ||
| )} | ||
|
|
||
| {renderStatCard("GAUC", "Leveraged Yield Token", stats.gaucPrice, <GaucIcon className="h-8 w-8" />, "ERG", 0.3)} | ||
| {renderStatCard( | ||
| protocolConfig.tokens.proton.ticker, | ||
| protocolConfig.ui.labels.protonSubtitle, | ||
| stats.gaucPrice, | ||
| <GaucIcon className="h-8 w-8" />, | ||
| "ERG", | ||
| 0.3 | ||
| )} | ||
| </div> | ||
|
|
||
| {/* Stats */} | ||
|
|
@@ -360,25 +382,29 @@ export function GluonStats() { | |
| <div className="text-2xl font-bold text-foreground"> | ||
| {isLoading ? <Skeleton className="mx-auto h-8 w-16" /> : hasError ? "—" : nanoErgsToErgs(protocolMetrics.volume14Day.neutronsToProtons).toFixed(2)} | ||
| </div> | ||
| <div className="text-sm text-muted-foreground">14d GAU to GAUC Volume (ERG)</div> | ||
| <div className="text-sm text-muted-foreground"> | ||
| 14d {protocolConfig.tokens.neutron.ticker} to {protocolConfig.tokens.proton.ticker} Volume (ERG) | ||
| </div> | ||
| </div> | ||
| <div className="space-y-2"> | ||
| <div className="text-2xl font-bold text-foreground"> | ||
| {isLoading ? <Skeleton className="mx-auto h-8 w-16" /> : hasError ? "—" : nanoErgsToErgs(protocolMetrics.volume14Day.protonsToNeutrons).toFixed(2)} | ||
| </div> | ||
| <div className="text-sm text-muted-foreground">14d GAUC to GAU Volume (ERG)</div> | ||
| <div className="text-sm text-muted-foreground"> | ||
| 14d {protocolConfig.tokens.proton.ticker} to {protocolConfig.tokens.neutron.ticker} Volume (ERG) | ||
| </div> | ||
| </div> | ||
| <div className="space-y-2"> | ||
| <div className="text-2xl font-bold text-foreground"> | ||
| {isLoading ? <Skeleton className="mx-auto h-8 w-16" /> : hasError ? "—" : convertFromDecimals(protocolMetrics.circulatingSupply.neutrons).toFixed(2)} | ||
| </div> | ||
| <div className="text-sm text-muted-foreground">GAU Supply</div> | ||
| <div className="text-sm text-muted-foreground">{protocolConfig.ui.labels.neutronSupplyLabel}</div> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we could use the neutron ticker from config and then " Supply". Then we wouldn't need to define |
||
| </div> | ||
| <div className="space-y-2"> | ||
| <div className="text-2xl font-bold text-foreground"> | ||
| {isLoading ? <Skeleton className="mx-auto h-8 w-16" /> : hasError ? "—" : convertFromDecimals(protocolMetrics.circulatingSupply.protons).toFixed(2)} | ||
| </div> | ||
| <div className="text-sm text-muted-foreground">GAUC Supply</div> | ||
| <div className="text-sm text-muted-foreground">{protocolConfig.ui.labels.protonSupplyLabel}</div> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here too, for protons. |
||
| </div> | ||
| </div> | ||
| </Card> | ||
|
|
@@ -434,8 +460,11 @@ export function GluonStats() { | |
| transition={{ duration: 0.3 }} | ||
| className="text-center" | ||
| > | ||
| <div className="mb-1 text-4xl font-bold text-foreground">{hasError ? "—" : stats.priceCrashCushion ? Math.round(+stats.priceCrashCushion) : "—" }%</div> | ||
| <div className="text-sm font-medium text-muted-foreground">{renderTooltip("Price Crash Cushion", "Maximum drop in the price of ERG w.r.t. Gold that can be tolerated for GAU to remain pegged to Gold. When 0%, GAU depegs to prevent bank runs and maintain non-zero GAUC price.")}</div> | ||
| <div className="text-4xl font-bold text-foreground mb-1"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that, in this code block, some recent changes that iIhad committed are being erased. Are you sure that you are working on the latest version of the |
||
| {hasError ? '—' : stats.reserveRatio ? Math.round(- (100 / (100 - stats.reserveRatio)) * 100)/100 : '—'}x <br /> | ||
| </div> | ||
| <div className="font-medium text-sm text-muted-foreground">Current {protocolConfig.tokens.proton.ticker} Leverage</div> | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| </motion.div> | ||
| )} | ||
| </AnimatePresence> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| export const protocolConfig = { | ||
| peg: { | ||
| asset: "Gold", | ||
| adjective: "gold-pegged", | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| description: "digital gold-pegged tokens", | ||
| }, | ||
| tokens: { | ||
| /** | ||
| * Neutron = stable token in the Gluon protocol. | ||
| * For the current deployment this corresponds to GAU. | ||
| */ | ||
| neutron: { | ||
| ticker: "GAU", | ||
| name: "Gluon Gold", | ||
| shortDescription: "Stable token pegged to 1g of Gold.", | ||
| }, | ||
| /** | ||
| * Proton = volatile token in the Gluon protocol. | ||
| * For the current deployment this corresponds to GAUC. | ||
| */ | ||
| proton: { | ||
| ticker: "GAUC", | ||
| name: "Gluon Gold Certificate", | ||
| shortDescription: "Volatile token that tokenizes the reserve surplus.", | ||
| }, | ||
| }, | ||
| seo: { | ||
| defaultTitle: "Gluon | Gold Protocol on Ergo", | ||
| defaultDescription: | ||
| "Gluon is a decentralized finance protocol on Ergo blockchain that enables users to trade, swap, and manage gold-backed tokens.", | ||
| defaultKeywords: "Gluon, Ergo, DeFi, Blockchain, Cryptocurrency, Gold-backed tokens, GAU, GAUC, Digital Assets", | ||
| defaultUrl: "https://www.gluon.gold/", | ||
| defaultImage: "/logo/gluon.png", | ||
| }, | ||
| ui: { | ||
| hero: { | ||
| tagline: "Trade and transact with digital gold-pegged tokens.", | ||
| subTagline: "Secured by the Ergo blockchain and its decentralized gold price oracle.", | ||
| }, | ||
| labels: { | ||
| navbarTitle: "GLUON GOLD", | ||
| telegramHandle: "GluonGold", | ||
| goldPriceTitle: "1 kg of Gold", | ||
| goldPriceSubtitle: "Oracle Gold Price", | ||
| neutronSubtitle: "Gold Pegged Token", | ||
| protonSubtitle: "Leveraged Yield Token", | ||
| neutronSupplyLabel: "GAU Supply", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my other comment. Lines 47 adn 48 can be removed. |
||
| protonSupplyLabel: "GAUC Supply", | ||
| }, | ||
| mechanics: { | ||
| overviewTitle: "Gluon Mechanics", | ||
| overviewBody: [ | ||
| "Get exposure to Gold with GAU.", | ||
| "GAU is the stablecoin pegged to 1g of Gold.", | ||
| "Get leveraged volatility and yield with GAUC.", | ||
| "GAUC tokenizes the reserve surplus.", | ||
| "Both GAU and GAUC are fully backed by ERG.", | ||
| ], | ||
| actions: { | ||
| fission: { | ||
| title: "Fission", | ||
| description: "Splits $ERG tokens into $GAU stable tokens and $GAUC volatile tokens.", | ||
| }, | ||
| fusion: { | ||
| title: "Fusion", | ||
| description: "Merges $GAU stable tokens and $GAUC volatile tokens into $ERG tokens.", | ||
| }, | ||
| transmuteToPeg: { | ||
| title: "Transmute To Gold", | ||
| description: "Transmutes $GAUC volatile tokens into $GAU stable tokens.", | ||
| }, | ||
| transmuteFromPeg: { | ||
| title: "Transmute From Gold", | ||
| description: "Transmutes $GAU stable tokens into $GAUC volatile tokens.", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| } as const; | ||
|
|
||
| export type ProtocolConfig = typeof protocolConfig; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.