Skip to content

Commit

Permalink
Merge pull request #1667 from glyph-exchange/master
Browse files Browse the repository at this point in the history
glyph exchange v4 volumn&fees
  • Loading branch information
dtmkeng committed Jul 12, 2024
2 parents f7f1247 + df2b64d commit 527e969
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions dexs/glyph-exchange-v4/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { BreakdownAdapter } from "../../adapters/types";
import { Chain } from "@defillama/sdk/build/general";
import { CHAIN } from "../../helpers/chains";
import { getGraphDimensions } from "../../helpers/getUniSubgraph";

const endpointsClassic = {
[CHAIN.CORE]: "https://thegraph.coredao.org/subgraphs/name/glyph/algebra"
};

const VOLUME_FIELD = "totalVolumeUSD";
const DEFAULT_DAILY_VOLUME_FIELD = "volumeUSD";
const FEES_FIELD = "totalFeesUSD";
const DEFAULT_DAILY_FEES_FIELD = "feesUSD";

const graphsClassic = getGraphDimensions({
graphUrls: endpointsClassic,
totalVolume: {
factory: "factories",
field: VOLUME_FIELD,
},
dailyVolume: {
factory: "algebraDayData",
field: DEFAULT_DAILY_VOLUME_FIELD,
},
totalFees: {
factory: "factories",
field: FEES_FIELD,
},
dailyFees: {
factory: "algebraDayData",
field: DEFAULT_DAILY_FEES_FIELD,
},
//dynamic fee
feesPercent: {
type: "fees",
Fees: 100,
UserFees: 100,
Revenue: 15,
ProtocolRevenue: 15,
SupplySideRevenue: 85
}
});

const classic = Object.keys(endpointsClassic).reduce(
(acc, chain) => ({
...acc,
[chain]: {
fetch: graphsClassic(chain as Chain),
start: 1710806400,
meta: {
methodology: {
Fees: "GlyphExchange-v4 charges a dynamic fee",
UserFees: "GlyphExchange-v4 charges a dynamic fee",
Revenue: "15% fees goes to treasury",
ProtocolRevenue: "Treasury receives a share of the fees",
SupplySideRevenue: "85% fees goes to liquidity providers"
}
}
},
}),
{}
) as any;

const adapter: BreakdownAdapter = {
version: 2,
breakdown: {
classic: classic,
}
}

export default adapter

0 comments on commit 527e969

Please sign in to comment.