Adapter

Pangolin Fees - Clone

Pangolin is a decentralized exchange on Avalanche

Sub-Adapters 1

Preview and test each sub adapter.

Pangolin (pangolin)

Metadata

ID
pangolin
category

"dex"

name

"Pangolin"

blockchain

"Avalanche"

description

"Pangolin is a decentralized exchange on Avalanche"

feeDescription

"Trading fees are paid by traders to liquidity providers"

source

"The Graph Protocol"

tokenTicker

"PNG"

tokenCoingecko

"pangolin"

website

"https://pangolin.exchange"

icon
protocolLaunch

"2021-02-20"

Queries

Adapter Code

Check the entire code written for the Adapter.

Source code

Showing TS source.
1export const name = 'Pangolin Fees - Clone';
2export const version = '0.1.2';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6  const queryFeeData = async (date: string): Promise<number> => {
7    const graphQuery = `query fees($date: Int!, $nextDate: Int!) {
8      pangolinDayDatas(where: { date: $date }) {
9        dailyVolumeUSD
10      },
11      nextDay: pangolinDayDatas(where: { date: $nextDate }) {
12        dailyVolumeUSD
13      },
14    }`;
15
16    const nextDate = sdk.date.dateToTimestamp(sdk.date.getNextDay(date))
17    
18    const data = await sdk.graph.query(
19      'dasconnor/pangolin-dex',
20      graphQuery,
21      {
22        variables: {
23          date: sdk.date.dateToTimestamp(date),
24          nextDate
25        },
26      },
27    );
28
29    if (data.pangolinDayDatas.length === 0) {
30      throw new Error(`No Pangolin data found on ${date}`);
31    }
32
33    if (data.nextDay.length === 0) {
34      throw new Error(`Incomplete Pangolin data found on ${date}`);
35    }
36
37    const oneDay = parseFloat(data.pangolinDayDatas[0].dailyVolumeUSD) * 0.003;
38
39    return oneDay;
40  }
41
42  sdk.register({
43    id: 'pangolin',
44    queries: {
45      oneDayTotalFees: queryFeeData,
46    },
47    metadata: {
48      category: 'dex',
49      name: 'Pangolin',
50      blockchain: 'Avalanche',
51      description: 'Pangolin is a decentralized exchange on Avalanche',
52      feeDescription: 'Trading fees are paid by traders to liquidity providers',
53      source: 'The Graph Protocol',
54      tokenTicker: 'PNG',
55      tokenCoingecko: 'pangolin',
56      website: 'https://pangolin.exchange',
57      icon: sdk.ipfs.getDataURILoader('QmXDPs9Y2nXwJ331z5QdRZ4917G78DRqL4DKMWmYmVaLuF', 'image/svg+xml'),
58      protocolLaunch: '2021-02-20',
59    },
60  });
61}

It's something off?

Report it to the discussion board on Discord, we will take care of it.

Adapter Info

Version

0.1.2

License

MIT

IPFS CID

Qmbivg76j4CUajPt99sd4Ljd3wkoww3rBQLkufDwfyk3hE

CID (source)

QmWf3btkPpom3NNTWWbpZKUcCYL5g33rrq3HLD231AqPLY

Author

ap0calyp.eth