From 8bff5c14f4f41f0ae2a1f2bfcd107b7003803c2a Mon Sep 17 00:00:00 2001 From: Philip Nuzhnyi Date: Mon, 27 Nov 2023 16:40:35 +0000 Subject: [PATCH] fix emissions, use generic coin icon --- bots/data.py | 6 ++++++ bots/ui/pool_stats.py | 20 ++++++++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/bots/data.py b/bots/data.py index 16461eb..70fb754 100644 --- a/bots/data.py +++ b/bots/data.py @@ -212,6 +212,7 @@ class LiquidityPool: gauge_total_supply: float emissions: Amount emissions_token: Token + weekly_emissions: Amount @classmethod def from_tuple( @@ -224,6 +225,8 @@ def from_tuple( emissions_token = normalize_address(t[18]) emissions = t[17] + seconds_in_a_week = 7 * 24 * 60 * 60 + return LiquidityPool( lp=normalize_address(t[0]), symbol=t[1], @@ -240,6 +243,9 @@ def from_tuple( gauge_total_supply=t[12], emissions_token=tokens.get(emissions_token), emissions=Amount.build(emissions_token, emissions, tokens, prices), + weekly_emissions=Amount.build( + emissions_token, emissions * seconds_in_a_week, tokens, prices + ), ) @classmethod diff --git a/bots/ui/pool_stats.py b/bots/ui/pool_stats.py index 962d3df..147e71f 100644 --- a/bots/ui/pool_stats.py +++ b/bots/ui/pool_stats.py @@ -45,7 +45,7 @@ async def render( "emissions": self.emojis.get("emissions", ":zap:"), "space": self.emojis.get("space", " "), "deposit": self.emojis.get("deposit", ":pig2:"), - "coinplaceholder": self.emojis.get("coinplaceholder", ":coin:"), + "coin": self.emojis.get("coinplaceholder", ":coin:"), } token0_volume_coin = format_currency( @@ -65,9 +65,11 @@ async def render( pool.reserve1.amount_in_stable if pool.reserve1 else 0 ) emissions_coin = format_currency( - pool.emissions.amount, symbol=pool.emissions.token.symbol, prefix=False + pool.weekly_emissions.amount, + symbol=pool.emissions.token.symbol, + prefix=False, ) - emissions_stable = format_currency(pool.emissions.amount_in_stable) + emissions_stable = format_currency(pool.weekly_emissions.amount_in_stable) embed = discord.Embed() @@ -85,26 +87,20 @@ async def render( # vertical space embed.add_field(name="", value=f"{emojis['space']}", inline=False) - token0_coin_icon = self.emojis.get( - pool.token0.symbol.lower(), emojis["coinplaceholder"] - ) + coin_icon = emojis["coin"] # token0 reserve: top row in coin # bottom row in stable embed.add_field( - name=f"{token0_coin_icon} {token0_volume_coin}{emojis['space'] * 3}", + name=f"{coin_icon} {token0_volume_coin}{emojis['space'] * 3}", value=f"{emojis['dashgrey']} _~{token0_volume_stable}_", inline=True, ) - token1_coin_icon = self.emojis.get( - pool.token1.symbol.lower(), emojis["coinplaceholder"] - ) - # token1 reserve: top row in coin # bottom row in stable embed.add_field( - name=f"{token1_coin_icon} {token1_volume_coin}", + name=f"{coin_icon} {token1_volume_coin}", value=f"{emojis['dashgrey']} _~{token1_volume_stable}_", inline=True, )