Skip to content

Commit

Permalink
always show break even time in days
Browse files Browse the repository at this point in the history
  • Loading branch information
haloooloolo authored and InvisibleSymbol committed Oct 24, 2024
1 parent 2cb7515 commit b1c28e7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions rocketwatch/plugins/constellation/constellation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import logging
import datetime
import humanize

from discord.ext.commands import Cog, Context, hybrid_command
from motor.motor_asyncio import AsyncIOMotorClient
Expand Down Expand Up @@ -123,7 +121,7 @@ async def constellation(self, ctx: Context):
gas_price_wei: int = w3.eth.gas_price
deployment_cost_wei: int = deployment_gas * max(0, gas_price_wei - 5_000_000_000)
daily_income_wei: int = round((32 - eth_bond) * 1e18 * solo_apr * operator_commission / 365)
break_even_time = datetime.timedelta(days=round(deployment_cost_wei / daily_income_wei))
break_even_days: int = round(deployment_cost_wei / daily_income_wei)

embed = Embed(title="Gravita Constellation")
embed.add_field(
Expand All @@ -136,7 +134,7 @@ async def constellation(self, ctx: Context):
embed.add_field(name="MP Limit", value=max_validators)
embed.add_field(name="ETH Stake", value=f"{eth_staked:,}")
embed.add_field(name="RPL Stake", value=f"{rpl_staked:,.2f}")
embed.add_field(name="RPL Bond", value=f"{rpl_stake_pct:.2f}%")
embed.add_field(name="RPL Bond", value=f"{rpl_stake_pct:,.2f}%")

# yes, it's really unnecessary to be this specific
if max_new_minipools > 0:
Expand All @@ -155,8 +153,8 @@ async def constellation(self, ctx: Context):
f"{mp_creation_status}",
inline=False
)
embed.add_field(name="Gas Price", value=f"{(gas_price_wei / 1e9):.2f} gwei")
embed.add_field(name="Break-Even", value=humanize.naturaldelta(break_even_time))
embed.add_field(name="Gas Price", value=f"{(gas_price_wei / 1e9):,.2f} gwei")
embed.add_field(name="Break-Even", value=f"{break_even_days:,} days")
embed.add_field(
name="Protocol TVL",
value=f"{el_explorer_url(xreth_address, name=' xrETH')}: `{tvl_eth:,.2f}` ETH\n"
Expand Down

0 comments on commit b1c28e7

Please sign in to comment.