Sub-Adapters 1
Preview and test each sub adapter.
Fantom (fantom)
Metadata
- ID
- fantom
- category
"l1"
- name
"Fantom"
- icon
- description
"Fantom is an aBFT EVM-compatible chain"
- feeDescription
"Transaction fees are paid to validators"
- blockchain
"Fantom"
- source
"FTMscan"
- website
"https://fantom.foundation"
- tokenTicker
"FTM"
- tokenCoingecko
"fantom"
- protocolLaunch
"2020-08-29"
- events
[ { "date": "2021-08-30", "description": "370m FTM incentive program announced" } ]
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
1export const name = 'Fantom Fees';
2export const version = '0.1.1';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 async function getFTMData(date: string): Promise<number> {
7 const [data, ftmPrice] = await Promise.all([
8 sdk.http.get(`https://cryptostats-api-proxy.vercel.app/api/v1/fantom-daily-fees/${date}`),
9 sdk.coinGecko.getHistoricalPrice('fantom', date),
10 ]);
11
12 if (data.statusCode !== 200) {
13 throw new Error(`Unable to get Fantom data on ${date}`);
14 }
15
16 const ftmFees = data.value;
17 return ftmFees * ftmPrice;
18 }
19
20 sdk.register({
21 id: 'fantom',
22 queries: {
23 oneDayTotalFees: getFTMData,
24 },
25 metadata: {
26 category: 'l1',
27 name: 'Fantom',
28 icon: sdk.ipfs.getDataURILoader('Qmej3LprBGEi5ZXaFknt3CZd2krM9MvY5HzeEEqRuGC5K7', 'image/svg+xml'),
29 description: 'Fantom is an aBFT EVM-compatible chain',
30 feeDescription: 'Transaction fees are paid to validators',
31 blockchain: 'Fantom',
32 source: 'FTMscan',
33 website: 'https://fantom.foundation',
34 tokenTicker: 'FTM',
35 tokenCoingecko: 'fantom',
36 protocolLaunch: '2020-08-29',
37 events: [
38 {
39 date: '2021-08-30',
40 description: '370m FTM incentive program announced',
41 },
42 ],
43 },
44 });
45}
46
It's something off?
Report it to the discussion board on Discord, we will take care of it.