diff --git a/app/src/components/common/TradingLeaderboardTable/index.tsx b/app/src/components/common/TradingLeaderboardTable/index.tsx index 48d2e592..43340306 100644 --- a/app/src/components/common/TradingLeaderboardTable/index.tsx +++ b/app/src/components/common/TradingLeaderboardTable/index.tsx @@ -145,7 +145,9 @@ const TradingLeaderboardTable = ({ traders, onClick, onBoostClick, pageSize, ... return null } - const sortedRows = rows.sort((a, b) => b.dailyRewards - a.dailyRewards) + const sortedRows = accountIsTopWallet + ? [rows[0], ...rows.slice(1).sort((a, b) => b.dailyRewards - a.dailyRewards)] + : rows.sort((a, b) => b.dailyRewards - a.dailyRewards) return ( => { - const [globalRewardEpochs, accountRewardEpochs, tradingLeaderboard] = await Promise.all([ + const [globalRewardEpochs, accountRewardEpochs, tradingLeaderboards] = await Promise.all([ getLyraSDK(network).globalRewardEpochs(), walletAddress ? getLyraSDK(network).accountRewardEpochs(walletAddress) : [], fetchTradingLeaderboard(network), @@ -51,6 +54,8 @@ export const fetchLeaderboardPageData = async ( const latestAccountRewardEpoch = accountRewardEpochs.find( e => e.globalEpoch.startTimestamp === latestGlobalRewardEpoch.startTimestamp ) + const epochNumber = network === Network.Arbitrum ? latestGlobalRewardEpoch.id - 5 : latestGlobalRewardEpoch.id - 18 + const tradingLeaderboard: TradingRewardsLeaderboard = tradingLeaderboards ? tradingLeaderboards[epochNumber] : {} const leaderboard = [] const traders: TradingRewardsTraders = [] @@ -72,7 +77,10 @@ export const fetchLeaderboardPageData = async ( ) const latestDaily = dailyRewards[0] const boost = Math.max(latestDaily.referralBoost, latestDaily.stakingBoost, latestDaily.tradingBoost) - const dailyReward = totalPoints > 0 ? (latestDaily.points / totalPoints) * totalRewards.amount : 0 + const dailyReward = + totalPoints > 0 && latestDaily.points > 0 + ? (Math.sqrt(latestDaily.points) / totalPoints) * totalRewards.amount + : 0 leaderboard.push({ trader: trader, traderEns: traderENSMap[trader], diff --git a/app/src/utils/rewards/fetchTradingLeaderboard.ts b/app/src/utils/rewards/fetchTradingLeaderboard.ts index 2dfdc0ff..58a9c5a4 100644 --- a/app/src/utils/rewards/fetchTradingLeaderboard.ts +++ b/app/src/utils/rewards/fetchTradingLeaderboard.ts @@ -42,7 +42,7 @@ export type TradingRewardsLeaderboard = { } } -const fetchTradingLeaderboard = async (network: Network): Promise => { +const fetchTradingLeaderboard = async (network: Network): Promise => { const res = await fetch(`${process.env.REACT_APP_API_URL}/rewards/tradingLeaderboard?network=${network}`, { method: 'GET', mode: 'cors', @@ -51,7 +51,7 @@ const fetchTradingLeaderboard = async (network: Network): Promise