Sub-Adapters 1
Preview and test each sub adapter.
Velodrome (velodrome)
Metadata
- ID
- velodrome
- name
"Velodrome"
- icon
- category
"dex"
- description
"Velodrome is a decentralized exchange on the Optimism L2."
- feeDescription
"Trading fees are paid by traders to veVELO voters."
- website
"https://velodrome.finance"
- blockchain
"Optimism"
- source
"The Graph Protocol"
- tokenTicker
"VELO"
- tokenCoingecko
"velodrome-finance"
- protocolLaunch
"2022-06-01"
- tokenLaunch
"2022-06-01"
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
Showing TS source.
1export const name = 'Velodrome Fees';
2export const version = '0.1.1';
3export const license = 'MIT';
4
5const ONE_DAY = 86400;
6
7export function setup(sdk: Context) {
8 async function getDayData(date: string): Promise<number> {
9 const graphQuery = `query fees($date: Int!, $tomorrow: Int!) {
10 dayData(id: $date) {
11 date
12 dailyVolumeUSD
13 }
14 tomorrow: dayData(id: $tomorrow) {
15 date
16 dailyVolumeUSD
17 }
18 }`;
19
20 const dateId = Math.floor(sdk.date.dateToTimestamp(date) / ONE_DAY);
21 const data = await sdk.graph.query('dmihal/velodrome', graphQuery, {
22 date: dateId,
23 tomorrow: dateId + 1,
24 });
25
26 if (!data.tomorrow) {
27 throw new Error('Day incomplete');
28 }
29
30 const oneDayVolume = parseFloat(
31 data.dayData.dailyVolumeUSD
32 );
33 const oneDay = oneDayVolume * 0.0002;
34
35 return oneDay;
36 }
37
38 sdk.register({
39 id: 'velodrome',
40 queries: {
41 oneDayTotalFees: getDayData,
42 },
43 metadata: {
44 name: 'Velodrome',
45 icon: sdk.ipfs.getDataURILoader('QmR8FfKuq2W8U8NfNCsBDjJ9J2zJBaCY28ef1EENJg8C5w', 'image/svg+xml'),
46 category: 'dex',
47 description: 'Velodrome is a decentralized exchange on the Optimism L2.',
48 feeDescription: 'Trading fees are paid by traders to veVELO voters.',
49 website: 'https://velodrome.finance',
50 blockchain: 'Optimism',
51 source: 'The Graph Protocol',
52 tokenTicker: 'VELO',
53 tokenCoingecko: 'velodrome-finance',
54 protocolLaunch: '2022-06-01',
55 tokenLaunch: '2022-06-01',
56 },
57 });
58}
59
It's something off?
Report it to the discussion board on Discord, we will take care of it.