Adapter

ENS Fees

Query domain registration fees paid to the ENS DAO

Sub-Adapters 1

Preview and test each sub adapter.

ENS (ens)

Metadata

ID
ens
name

"ENS"

icon
protocolLaunch

"2020-08-07"

category

"other"

description

"ENS is a naming protocol for wallets, websites and more."

feeDescription

"Registration fees are paid to the DAO treasury."

blockchain

"Ethereum"

source

"The Graph Protocol"

website

"https://ens.domains"

events

[ { "date": "2021-11-09", "description": "ENS DAO & token launched" } ]

Queries

Adapter Code

Check the entire code written for the Adapter.

Source code

Showing TS source.
1export const name = 'ENS Fees';
2export const version = '0.1.4';
3export const license = 'MIT';
4export const description = 'Query domain registration fees paid to the ENS DAO';
5
6export function setup(sdk: Context) {
7  const getFees = async (startDate: string, endDate: string): Promise<number> => {
8    const startOfDayBlock = await sdk.chainData.getBlockNumber(startDate);
9    const endOfDayBlock = await sdk.chainData.getBlockNumber(endDate);
10
11    const query = `query txFees {
12      startOfDay: ens(id: "ens", block: {number: ${startOfDayBlock}}) {
13        usdCollected
14      }
15      endOfDay: ens(id: "ens", block: {number: ${endOfDayBlock}}) {
16        usdCollected
17      }
18    }`
19
20    const data = await sdk.graph.query({
21      subgraphId: '9ZA2QGwURbZ8S3PfdKs4UyKKTvyoHfG4SsLkGBaiVi1Y',
22      query,
23    });
24
25    const fees = parseFloat(data.endOfDay.usdCollected) - parseFloat(data.startOfDay.usdCollected);
26
27    return fees;
28  }
29
30  const getOneDayFees = (date: string) => {
31    const nextDay = sdk.date.offsetDaysFormatted(date, 1);
32    return getFees(date, nextDay);
33  }
34
35  sdk.register({
36    id: 'ens',
37    queries: {
38      oneDayTotalFees: getOneDayFees,
39      oneDayProtocolFees: getOneDayFees,
40      dateRangeTotalFees: getFees,
41      dateRangeProtocolFees: getFees,
42
43    },
44    metadata: {
45      name: 'ENS',
46      icon: sdk.ipfs.getDataURILoader('QmcVVHX9MmeJkATvuhNBhVUL4sXqNuU5eT6m6W47E2yxnN', 'image/svg+xml'),
47      protocolLaunch: '2020-08-07', // Don't currently have data before this
48      category: 'other',
49      description: 'ENS is a naming protocol for wallets, websites and more.',
50      feeDescription: 'Registration fees are paid to the DAO treasury.',
51      blockchain: 'Ethereum',
52      source: 'The Graph Protocol',
53      website: 'https://ens.domains',
54      events: [
55        {
56          date: '2021-11-09',
57          description: 'ENS DAO & token launched',
58        },
59      ],
60    },
61  })
62}
63

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

QmQ3bjHxGoUkqrZbNthE9AhQAZZjxeknMGjK8jFEnRYo1f

CID (source)

QmeiMWUL3V5QL4WNUEGDN931xwA8JR7WmUHZtQwb2XLiQA

Author

mihal.eth