Adapter

Ethereum Name Service

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

Sub-Adapters 1

Preview and test each sub adapter.

Ethereum Name Service (ens)

Metadata

ID
ens
name

"Ethereum Name Service"

icon
protocolLaunch

"2020-08-07"

category

"Application Protocol"

subcategory

"Identity"

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"

tokenTicker

"ENS"

tokenCoingecko

"ethereum-name-service"

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 = 'Ethereum Name Service';
2export const version = '0.1.7';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6  const getFees = async (startDate: string, endDate: string): Promise<number> => {
7    const startOfDayBlock = await sdk.chainData.getBlockNumber(startDate);
8    const endOfDayBlock = await sdk.chainData.getBlockNumber(endDate);
9
10    const query = `query txFees {
11      startOfDay: ens(id: "ens", block: {number: ${startOfDayBlock}}) {
12        usdCollected
13      }
14      endOfDay: ens(id: "ens", block: {number: ${endOfDayBlock}}) {
15        usdCollected
16      }
17    }`
18
19    const data = await sdk.graph.query({
20      subgraphId: '9ZA2QGwURbZ8S3PfdKs4UyKKTvyoHfG4SsLkGBaiVi1Y',
21      query,
22    });
23
24    const fees = parseFloat(data.endOfDay.usdCollected) - parseFloat(data.startOfDay.usdCollected);
25
26    return fees;
27  }
28
29  const getOneDayFees = (date: string) => {
30    const nextDay = sdk.date.offsetDaysFormatted(date, 1);
31    return getFees(date, nextDay);
32  }
33
34  sdk.register({
35    id: 'ens',
36    queries: {
37      oneDayTotalFees: getOneDayFees,
38      oneDayProtocolFees: getOneDayFees,
39      dateRangeTotalFees: getFees,
40      dateRangeProtocolFees: getFees,
41
42    },
43    metadata: {
44      name: 'Ethereum Name Service',
45      icon: sdk.ipfs.getDataURILoader('QmcVVHX9MmeJkATvuhNBhVUL4sXqNuU5eT6m6W47E2yxnN', 'image/svg+xml'),
46      protocolLaunch: '2020-08-07', // Don't currently have data before this
47      category: 'Application Protocol',
48      subcategory: 'Identity',
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      tokenTicker: 'ENS',
55      tokenCoingecko: 'ethereum-name-service', 
56      events: [
57        {
58          date: '2021-11-09',
59          description: 'ENS DAO & token launched',
60        },
61      ],
62    },
63  })
64}
65

It's something off?

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

Adapter Info

Version

0.1.7

License

MIT

IPFS CID

QmdagTjzh8UWNhPjBpFkYFFKcdrKhxdygDN4PrERkKE1de

CID (source)

QmVArm5hMfus6T2ZckydLb8D6LzWRGAhNX6oLn6aePk5Wa

Collections

Author

0x1a171a91B4Aa1A669e2397D6670746DDcDd4fbBe