From dbd5b730b78ff0f6632dfe326bc214ac5c4f9ef0 Mon Sep 17 00:00:00 2001 From: Zak Date: Mon, 11 Nov 2024 09:50:33 +0000 Subject: [PATCH 1/4] feat: remove ~ and update share message --- src/assets/twitterlogo.svg | 4 ++-- src/components/tst-staking/StakingRewardsList.jsx | 4 ++-- src/components/tst-staking/StakingSummary.jsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/assets/twitterlogo.svg b/src/assets/twitterlogo.svg index b2dd139..437e2bf 100644 --- a/src/assets/twitterlogo.svg +++ b/src/assets/twitterlogo.svg @@ -1,3 +1,3 @@ - - + + diff --git a/src/components/tst-staking/StakingRewardsList.jsx b/src/components/tst-staking/StakingRewardsList.jsx index b012b1f..3d9bdcf 100644 --- a/src/components/tst-staking/StakingRewardsList.jsx +++ b/src/components/tst-staking/StakingRewardsList.jsx @@ -99,13 +99,13 @@ const StakingRewardsList = ({ {ethers.formatUnits(amount, decimals)}
- ~${value.toFixed(8)} + ${value.toFixed(8)} {ethers.formatUnits(dailyReward, decimals)}
- ~${rate.toFixed(8)} + ${rate.toFixed(8)} diff --git a/src/components/tst-staking/StakingSummary.jsx b/src/components/tst-staking/StakingSummary.jsx index 6382851..90ff257 100644 --- a/src/components/tst-staking/StakingSummary.jsx +++ b/src/components/tst-staking/StakingSummary.jsx @@ -274,7 +274,7 @@ const StakingSummary = ({ const lowestTier = STATUS_TIERS[STATUS_TIERS.length - 1]; - const shareText = `🏆 ${currentTier.name} on @TheStandardIO\n\n💫 Staking ${formatNumber(stakedAmount)} TST\n💰 Earning ${formatUSD(dailyEarnings)} daily\n⚡️ Supporting zero-interest borrowing\n\nJoin the future of DeFi!\nthestandard.io`; + const shareText = `🏆 Yes! I made it to ${currentTier.name} on @TheStandard_io\n\n💫 Staking ${formatNumber(stakedAmount)} TST\n💰 Earning ${formatUSD(dailyEarnings)} daily\n⚡️ Supporting zero-interest borrowing\n\nJoin the future of DeFi!\nthestandard.io`; if (!rawStakedSince) { return ( From 2406bf07ab0a140657e6cc7b2ab74de99656ecd4 Mon Sep 17 00:00:00 2001 From: Zak Date: Mon, 11 Nov 2024 10:25:48 +0000 Subject: [PATCH 2/4] fix: prevent infinity when dayssince <= 0 --- src/components/tst-staking/StakingSummary.jsx | 45 ++++++++++++++----- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/components/tst-staking/StakingSummary.jsx b/src/components/tst-staking/StakingSummary.jsx index 90ff257..c0ede2f 100644 --- a/src/components/tst-staking/StakingSummary.jsx +++ b/src/components/tst-staking/StakingSummary.jsx @@ -251,7 +251,10 @@ const StakingSummary = ({ const totalRateUSD = rewardsWithPrices.reduce((sum, reward) => sum + reward.usdRate, 0) || 0; const daysStaked = getDaysStaked() || 0; - const dailyEarnings = (totalRateUSD / daysStaked) || 0; + let dailyEarnings = (totalRateUSD / daysStaked) || 0; + if (!(daysStaked >= 1)) { + dailyEarnings = 0; + } const monthlyProjection = (dailyEarnings * 30) || 0; const currentTier = getCurrentTier(stakedAmount); @@ -446,21 +449,39 @@ const StakingSummary = ({ -
-
-
- - Your Daily Earnings + {daysStaked >= 1 ? ( +
+
+
+ + Your Daily Earnings + + + {formatUSD(dailyEarnings)} + +
+ + Earning {formatUSD(monthlyProjection)} monthly at current rates - - {formatUSD(dailyEarnings)} +
+
+ ) : ( +
+
+
+ + Your Daily Earnings + + + {formatUSD(0)} + +
+ + Rates will be calculated after the first 24 hours period passes
- - Earning {formatUSD(monthlyProjection)} monthly at current rates -
-
+ )}
From 25abb30d457f961f214a0d86a95dcd40266db369 Mon Sep 17 00:00:00 2001 From: Zak Date: Mon, 11 Nov 2024 11:09:48 +0000 Subject: [PATCH 3/4] chore: wip apy --- src/components/tst-staking/StakingSummary.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/tst-staking/StakingSummary.jsx b/src/components/tst-staking/StakingSummary.jsx index c0ede2f..7ac064a 100644 --- a/src/components/tst-staking/StakingSummary.jsx +++ b/src/components/tst-staking/StakingSummary.jsx @@ -228,10 +228,14 @@ const StakingSummary = ({ const calculateSimpleAPY = (stakedAmount, totalRewardsValue, daysStaked) => { const dailyEarnings = totalRewardsValue || 0; const annualEarningsPerTST = (dailyEarnings * 365) / Number(stakedAmount) || 0; - return annualEarningsPerTST; } + // const calculateSimpleAPY = (totalValueUSD, dailyEarnings) => { + // const apy = Number(dailyEarnings * 365); + // return apy; + // } + const rewardsWithPrices = rewardsData.map(reward => { const useAmount = ethers.formatUnits(reward.amount, reward.decimals); const useRate = ethers.formatUnits(reward.dailyReward, reward.decimals); @@ -246,7 +250,6 @@ const StakingSummary = ({ }; }) - const totalValueUSD = rewardsWithPrices.reduce((sum, reward) => sum + reward.usdValue, 0) || 0; const totalRateUSD = rewardsWithPrices.reduce((sum, reward) => sum + reward.usdRate, 0) || 0; @@ -265,6 +268,7 @@ const StakingSummary = ({ progress = (stakedAmount / nextTier.minAmount) * 100; } const apyDisplay = calculateSimpleAPY(stakedAmount, totalRateUSD, daysStaked) + '%' || '0%'; + // const apyDisplay = calculateSimpleAPY(totalValueUSD, dailyEarnings).toFixed(8) + '%' || '0%'; let stakeRatio = 'TODO.DOTO'; @@ -396,8 +400,7 @@ const StakingSummary = ({ Participate in protocol governance - {/*
*/} -
+
From 688cb68798009a8e613b3addb2065d3abd9a22a1 Mon Sep 17 00:00:00 2001 From: Zak Date: Mon, 11 Nov 2024 11:51:39 +0000 Subject: [PATCH 4/4] feat: ux tweaks josh --- src/App.css | 24 +++++++++++++++++++ src/components/vault/TokenList.jsx | 22 ++++++++++------- .../vault/yield/YieldPerformanceModal.jsx | 2 +- src/components/vault/yield/YieldViewModal.jsx | 2 +- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/App.css b/src/App.css index 78b7344..588e864 100644 --- a/src/App.css +++ b/src/App.css @@ -717,3 +717,27 @@ button.btn.btn-outline:disabled { -webkit-mask: radial-gradient(67px, #0000 98%, #000); mask: radial-gradient(67px, #0000 98%, #000); } + +.btn-ping-wrap { + position: relative; + display: flex; +} + +.btn-ping-wrap > .btn { + z-index: 1; +} + +.btn-ping { + position: absolute; + opacity: 0.75; + animation: btn-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; + z-index: 0; +} + +@keyframes btn-ping { + 75%, + 100% { + transform: scaleX(1.1)scaleY(1.5); + opacity: 0; + } +} \ No newline at end of file diff --git a/src/components/vault/TokenList.jsx b/src/components/vault/TokenList.jsx index e81ce14..0d376fd 100644 --- a/src/components/vault/TokenList.jsx +++ b/src/components/vault/TokenList.jsx @@ -230,14 +230,20 @@ const TokenList = ({ > Swap - +
+ + {(amount <= 0 || !yieldEnabled || !tokenYield) ? (null) : ( + + )} +
)} diff --git a/src/components/vault/yield/YieldPerformanceModal.jsx b/src/components/vault/yield/YieldPerformanceModal.jsx index 353ba72..ec17703 100644 --- a/src/components/vault/yield/YieldPerformanceModal.jsx +++ b/src/components/vault/yield/YieldPerformanceModal.jsx @@ -253,7 +253,7 @@ const YieldPerformanceModal = ({