Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions fees/hyperliquid-hlp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import adapters from './hyperliquid'
const { breakdown, ...rest } = adapters

const methodology = {
Fees: "1% of the hyperliquid spot and perp fees goes to HLP liquidity providers, before 30 Aug 2025 it was 3%",
SupplySideRevenue: "1% of fees go to HLP Vault suppliers, before 30 Aug 2025 it was 3%",
}

export default {
...rest,
methodology,
adapter: breakdown["hlp"],
}
25 changes: 25 additions & 0 deletions fees/hyperliquid-perp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import adapters from './hyperliquid'
const { breakdown, ...rest } = adapters
import { METRIC } from "../helpers/metrics";

const breakdownMethodology = {
Fees: {
'Trade Fees': 'Perp trade fees and Ticker auction proceeds',
},
HoldersRevenue: {
[METRIC.TOKEN_BUY_BACK]: "All the revenue is used for buying back HYPE tokens"
},
}

const methodology = {
Fees: "Trade fees and Ticker auction proceeds. Note this excludes HyperEVM fees.",
Revenue: "99% of fees go to Assistance Fund for buying HYPE tokens, before 30 Aug 2025 it was 97% of fees",
ProtocolRevenue: "Protocol doesn't keep any fees.",
HoldersRevenue: "99% of fees go to Assistance Fund for bbuying HYPE tokens, before 30 Aug 2025 it was 97% of fees",
}
export default {
...rest,
methodology,
breakdownMethodology,
adapter: breakdown["perp"],
}
25 changes: 25 additions & 0 deletions fees/hyperliquid-spot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import adapters from './hyperliquid'
const { breakdown, ...rest } = adapters
import { METRIC } from "../helpers/metrics";

const breakdownMethodology = {
Fees: {
'Trade Fees': 'Perp trade fees and Ticker auction proceeds',
},
HoldersRevenue: {
[METRIC.TOKEN_BUY_BACK]: "All the revenue is used for buying back HYPE tokens"
},
}

const methodology = {
Fees: "Trade fees and Ticker auction proceeds. Note this excludes HyperEVM fees.",
Revenue: "99% of fees go to Assistance Fund for buying HYPE tokens, before 30 Aug 2025 it was 97% of fees",
ProtocolRevenue: "Protocol doesn't keep any fees.",
HoldersRevenue: "99% of fees go to Assistance Fund for bbuying HYPE tokens, before 30 Aug 2025 it was 97% of fees",
}
export default {
...rest,
methodology,
breakdownMethodology,
adapter: breakdown['spot'],
}
101 changes: 54 additions & 47 deletions fees/hyperliquid.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CHAIN } from "../helpers/chains"
import { Adapter, FetchOptions, } from '../adapters/types';
import { findClosest } from "../helpers/utils/findClosest";
import { httpGet } from "../utils/fetchURL";
import { BreakdownAdapter, FetchOptions } from "../adapters/types";
import { METRIC } from "../helpers/metrics";

let data: any
Expand All @@ -10,59 +10,66 @@ async function getAllData() {
}

// fees source: https://hyperdash.info/statistics
const fetch = async (options: FetchOptions) => {
if (!data) data = getAllData()
data = await data
const fetch = (market_type: string) => {
return async (options: FetchOptions) => {
if (!data) data = getAllData()
data = await data

const dailyFees = options.createBalances()
const startCumFees: any = findClosest(options.startTimestamp, data, 3600)
const endCumFees: any = findClosest(options.endTimestamp, data, 3600)
dailyFees.addUSDValue((endCumFees.total_fees - startCumFees.total_fees) / 1e6, 'Trade fees')
const dailyFees = options.createBalances()
const startCumFees: any = findClosest(options.startTimestamp, data, 3600)
const endCumFees: any = findClosest(options.endTimestamp, data, 3600)

const totalFees = (endCumFees.total_fees - startCumFees.total_fees) / 1e6;
const totalSpotFees = (endCumFees.total_spot_fees - startCumFees.total_spot_fees) / 1e6;

// confirm from hyperliquid team
// before 30 Aug, 97% of fees go to Assistance Fund for burning tokens, remaining 3% go to HLP Vault
// after 30 Aug, 99% of fees go to Assistance Fund for burning tokens, remaining 1% go to HLP Vault
const dailyRevenue = dailyFees.clone(options.startTimestamp >= 1756512000 ? 0.99 : 0.97);
const dailySupplySideRevenue = dailyFees.clone(options.startTimestamp >= 1756512000 ? 0.01 : 0.03, 'HLP');

return {
dailyFees,
dailyUserFees: dailyFees,
dailySupplySideRevenue,
dailyRevenue,
dailyHoldersRevenue: dailyRevenue.clone(1, METRIC.TOKEN_BUY_BACK),
dailyProtocolRevenue: 0,
}
}
if (market_type === "spot" || market_type === "perp") {
market_type === "spot" ? dailyFees.addUSDValue(totalSpotFees, 'Trade fees') : dailyFees.addUSDValue(totalFees - totalSpotFees, 'Trade fees');

// confirm from hyperliquid team
// before 30 Aug, 97% of fees go to Assistance Fund for burning tokens, remaining 3% go to HLP Vault
// after 30 Aug, 99% of fees go to Assistance Fund for burning tokens, remaining 1% go to HLP Vault
const dailyRevenue = dailyFees.clone(options.startTimestamp >= 1756512000 ? 0.99 : 0.97);

const breakdownMethodology = {
Fees: {
'Trade Fees': 'Perp trade fees and Ticker auction proceeds',
},
SupplySideRevenue: {
'HLP': '1% of the fees go to HLP vault (used to be 3%)',
},
HoldersRevenue: {
[METRIC.TOKEN_BUY_BACK]: "All the revenue is used for buying back HYPE tokens"
},
}
return {
dailyFees,
dailyUserFees: dailyFees,
dailyRevenue,
dailyHoldersRevenue: dailyRevenue.clone(1, METRIC.TOKEN_BUY_BACK),
dailyProtocolRevenue: 0,
dailySupplySideRevenue: 0
}
}
else {
dailyFees.addUSDValue(totalFees, 'Trade fees')
const dailySupplySideRevenue = dailyFees.clone(options.startTimestamp >= 1756512000 ? 0.01 : 0.03, 'HLP');

const methodology = {
Fees: "Trade fees and Ticker auction proceeds. Note this excludes the HLP vault and HyperEVM fees.",
Revenue: "99% of fees go to Assistance Fund for buying HYPE tokens, before 30 Aug 2025 it was 97% of fees",
ProtocolRevenue: "Protocol doesn't keep any fees.",
HoldersRevenue: "99% of fees go to Assistance Fund for bbuying HYPE tokens, before 30 Aug 2025 it was 97% of fees",
SupplySideRevenue: "1% of fees go to HLP Vault suppliers, before 30 Aug 2025 it was 3%",
return {
dailyFees: dailySupplySideRevenue,
dailySupplySideRevenue,
}
}
}
}

const adapter: Adapter = {
const adapters: BreakdownAdapter = {
version: 2,
fetch,
breakdownMethodology,
chains: [CHAIN.HYPERLIQUID],
methodology,
}
breakdown: {
spot: {
[CHAIN.HYPERLIQUID]: {
fetch: fetch("spot"),
},
},
perp: {
[CHAIN.HYPERLIQUID]: {
fetch: fetch("perp"),
},
},
hlp: {
[CHAIN.HYPERLIQUID]: {
fetch: fetch("hlp")
}
}
},
};

export default adapter
export default adapters;
Loading