Skip to content

Commit

Permalink
Merge branch 'develop' into preview
Browse files Browse the repository at this point in the history
  • Loading branch information
quanghuynguyen1902 committed May 31, 2024
2 parents e1c1e50 + f5e84b5 commit 4c413e1
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/commands/vault/info/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ export async function vaultReport(interaction: ButtonInteraction) {
}
}

function getVaultEquityEmoji(percent: string | number = 0) {
const p = Number(percent)
if (p <= 20) return "🦀"
if (p <= 50) return "🐙"
if (p <= 70) return "🐬"
if (p <= 90) return "🦈"

return "🐳"
}

export async function runGetVaultDetail(
selectedVault: string,
interaction: OriginalMessage,
Expand Down Expand Up @@ -192,7 +202,7 @@ export async function runGetVaultDetail(
new Date(data.created_at),
)}`,
`${getEmoji("ANIMATED_BADGE_1")}\`Tier. \` ${report.account_tier}`,
`${getEmoji("CASH")}\`Balance. \`${utils.formatUsdPriceDigit({
`${getEmoji("CASH")}\`Balance. \` ${utils.formatUsdPriceDigit({
value: report.current_balance,
shorten: false,
})}`,
Expand Down Expand Up @@ -227,9 +237,19 @@ export async function runGetVaultDetail(

const vaultEquity = [
"**Vault equity**",
`${getEmoji("CHART")} \`Your share. \` 100%`,
`${getEmoji("MONEY")} \`Claimable amount. \` ${utils.formatUsdPriceDigit({
value: Math.max(report.vault_equity.claimable, 0),
`${getVaultEquityEmoji(
report.vault_equity.stake_percent,
)} \`Your share. \` ${utils.formatPercentDigit(
Number(report.vault_equity.stake_percent),
)}`,
`${getEmoji("GIFT")} \`Floating profit. \` ${utils.formatUsdPriceDigit({
value: Number(report.vault_equity.floating_profit ?? 0),
shorten: false,
})}`,
`${getEmoji(
"ANIMATED_PARTY_POPPER",
)} \`Claimable amount. \` ${utils.formatUsdPriceDigit({
value: Number(report.vault_equity.claimable ?? 0),
shorten: false,
})}`,
].join("\n")
Expand Down

0 comments on commit 4c413e1

Please sign in to comment.