Adapter

SpookySwap Fees

SpookySwap is a decentralized exchange on Fantom Opera

Sub-Adapters 1

Preview and test each sub adapter.

SpookySwap (spookyswap)

Metadata

ID
spookyswap
category

"dex"

name

"SpookySwap"

icon
description

"SpookySwap is a decentralized exchange on Fantom Opera"

feeDescription

"Trading fees are paid by traders to liquidity providers and BOO stakers"

source

"The Graph Protocol"

tokenTicker

"BOO"

tokenCoingecko

"spookyswap"

website

"https://spookyswap.finance"

protocolLaunch

"2021-04-16"

blockchain

"Fantom"

Queries

Adapter Code

Check the entire code written for the Adapter.

Source code

Showing TS source.
1export const name = 'SpookySwap Fees';
2export const version = '0.1.4';
3export const license = 'MIT';
4
5const SEC_IN_DAY = 86400;
6
7export function setup(sdk: Context) {
8  const createFeeDataQuery = (feePercentage: number) => async (date: string): Promise<number> => {
9    const dateId = Math.floor(sdk.date.dateToTimestamp(date) / SEC_IN_DAY);
10    
11    const graphQuery = `query fees($dateId: Int!, $nextDay: Int!) {
12      uniswapDayData(id: $dateId) {
13        dailyVolumeUSD
14      }
15      nextDay: uniswapDayData(id: $nextDay) {
16        dailyVolumeUSD
17      }
18    }`;
19
20    const data = await sdk.graph.query(
21      'eerieeight/spookyswap',
22      graphQuery,
23      { dateId, nextDay: dateId + 1 },
24    );
25
26    if (!data.nextDay) {
27      return null;
28    }
29
30    const oneDay = parseFloat(data.uniswapDayData.dailyVolumeUSD) * feePercentage;
31
32    return oneDay;
33  }
34
35  sdk.register({
36    id: 'spookyswap',
37    queries: {
38      oneDayTotalFees: createFeeDataQuery(0.002),
39      oneDayProtocolFees: createFeeDataQuery(0.0003),
40    },
41    metadata: {
42      category: 'dex',
43      name: 'SpookySwap',
44      icon: sdk.ipfs.getDataURILoader('QmP6ppT45RCsTDxNtacoq84ENR9MudNVZfLbE9Sg7Bf9nQ', 'image/svg+xml'),
45      description: 'SpookySwap is a decentralized exchange on Fantom Opera',
46      feeDescription: 'Trading fees are paid by traders to liquidity providers and BOO stakers',
47      source: 'The Graph Protocol',
48      tokenTicker: 'BOO',
49      tokenCoingecko: 'spookyswap',
50      website: 'https://spookyswap.finance',
51      protocolLaunch: '2021-04-16',
52      blockchain: 'Fantom',
53    },
54  })
55}

It's something off?

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

Adapter Info

Version

0.1.4

License

MIT

IPFS CID

QmXJ8LyKvbKGm3zhu6b1XXpHgJdzBqib4C7tmVButrj5Hu

CID (source)

QmYPuYZ3EqJ9Y1bYVzZb5V8eZPwg4QoXMdYH1xRGDHW6VB

Collections

Author

mihal.eth