Skip to content

Commit

Permalink
feat: Native staking fees
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress committed Nov 7, 2024
1 parent edcb94b commit ca17e2f
Show file tree
Hide file tree
Showing 5 changed files with 12 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

0 comments on commit ca17e2f

Please sign in to comment.