Skip to content

Commit

Permalink
feat: Native staking fees (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress authored Nov 7, 2024
1 parent edcb94b commit 44d2435
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/components/DataRoom/FeesEarned/SlidingContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ const Stack = dynamic(() => import('./Stack'))

export type FeeType = {
label: 'SWAPS' | 'STAKING' | 'FUTURE FEES'
isLocked: boolean
isLocked?: boolean
}

const ANNUAL_SWAP_FEES_FALLBACK = 1822878.426773334
const ANNUAL_STAKE_FEES_FALLBACK = 106221.187296
const TOTAL_BARS = 10

const SlidingContent = ({ fees }: { fees: FeeType[] }) => {
const { annualSwapFees } = useSafeDataRoomStats()
const { annualSwapFees, annualStakeFees } = useSafeDataRoomStats()

const displaySwapFees = annualSwapFees ? annualSwapFees : ANNUAL_SWAP_FEES_FALLBACK
const feesMap = [displaySwapFees]
const displayStakeFees = annualStakeFees ? annualStakeFees : ANNUAL_STAKE_FEES_FALLBACK
const feesMap = [displaySwapFees, displayStakeFees]

return (
<div className={css.feeContainer}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataRoom/FeesEarned/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export type StackProps = FeeType & {
}

// TODO: decide how to normalize the fee values to show growth potential
const VALUE_PER_BAR = 1_000_000
const VALUE_PER_BAR = 500_000

const Stack = ({ totalBars, value, isLocked, label }: StackProps) => {
const Stack = ({ totalBars, value, isLocked = false, label }: StackProps) => {
const filledBars = value / VALUE_PER_BAR

const containerVariants = {
Expand Down
6 changes: 2 additions & 4 deletions src/content/dataroom.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@
"title": "Annualized community aligned</br><b>fees earned</b>:",
"fees": [
{
"label": "Native Swaps",
"isLocked": false
"label": "Native Swaps"
},
{
"label": "Native Staking",
"isLocked": true
"label": "Native Staking"
},
{
"label": "Future Fees",
Expand Down
2 changes: 2 additions & 0 deletions src/contexts/SafeDataRoomContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type SafeDataRoomStats = {
tvlAAVE: number | null
lastUpdated: number | null
annualSwapFees: number | null
annualStakeFees: number | null
annualisedOutgoingTVP: number | null
}

Expand All @@ -35,6 +36,7 @@ const SafeDataRoomContext = createContext<SafeDataRoomStats>({
tvlAAVE: null,
lastUpdated: null,
annualSwapFees: null,
annualStakeFees: null,
annualisedOutgoingTVP: null,
})

Expand Down
1 change: 1 addition & 0 deletions src/hooks/useSafeDataRoomStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type DuneDataRoomStats = {
usdc_in_safes: number
last_updated: number
annual_swap_fees: number
annual_stake_fees: number
annualised_outgoing_tvp: number
}

Expand Down
2 changes: 2 additions & 0 deletions src/pages/dataroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function getStaticProps() {
defi_tvl_uniswap,
last_updated,
annual_swap_fees,
annual_stake_fees,
annualised_outgoing_tvp,
} = dataRoomStats

Expand All @@ -49,6 +50,7 @@ export async function getStaticProps() {
tvlUniswap: Number(defi_tvl_uniswap),
lastUpdated: Number(last_updated),
annualSwapFees: Number(annual_swap_fees),
annualStakeFees: Number(annual_stake_fees),
annualisedOutgoingTVP: annualised_outgoing_tvp,
},
},
Expand Down

0 comments on commit 44d2435

Please sign in to comment.