Skip to content

Commit

Permalink
fix emissions, use generic coin icon
Browse files Browse the repository at this point in the history
  • Loading branch information
callmephilip committed Nov 27, 2023
1 parent f95ba27 commit 8bff5c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
6 changes: 6 additions & 0 deletions bots/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class LiquidityPool:
gauge_total_supply: float
emissions: Amount
emissions_token: Token
weekly_emissions: Amount

@classmethod
def from_tuple(
Expand All @@ -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],
Expand All @@ -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
Expand Down
20 changes: 8 additions & 12 deletions bots/ui/pool_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()

Expand All @@ -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,
)
Expand Down

0 comments on commit 8bff5c1

Please sign in to comment.