Adapter

Basic Attention Token

The Basic Attention Token is the new token for the digital advertising industry. It pays publishers for their content and users for their attention, while providing advertisers with more in return for their ads.

Sub-Adapters 1

Preview and test each sub adapter.

Basic Attention Token (bat)

Metadata

ID
bat
name

"Basic Attention Token"

icon
category

"Application Protocol"

subcategory

"Advertising"

description

"The Basic Attention Token is the new token for the digital advertising industry. It pays publishers for their content and users for their attention, while providing advertisers with more in return for their ads."

feeDescription

"70% of ad revenue returned to users and 30% to Brave Inc."

blockchain

"Ethereum / Solana"

source

"Brave Transparency"

website

"https://basicattentiontoken.org/"

protocolLaunch

"2017-05-31"

tokenTicker

"BAT"

tokenCoingecko

"basic-attention-token"

events

[]

Queries

Adapter Code

Check the entire code written for the Adapter.

Source code

Showing TS source.
1export const name = 'Basic Attention Token';
2export const version = '0.0.1';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6  const getFees = async (startDate: string, endDate: string): Promise<number> => {
7
8    const startTime = (new Date(startDate).getTime() / 1000);
9    const endTime = (new Date(endDate).getTime() / 1000);
10  
11    const query = `query {
12      dateRangeTotalUsdFees(
13        name: "bat"
14        startTime: ${startTime}
15        endTime: ${endTime} 
16      )
17    }`;
18
19    const data = await sdk.graph.query('https://api.d4.xyz/graphql', query);
20    const fees = parseFloat(data.dateRangeTotalUsdFees);
21
22    return fees;
23  }
24
25  const getOneDayFees = (date: string) => {
26    const nextDay = sdk.date.offsetDaysFormatted(date, 1);
27    return getFees(date, nextDay);
28  }  
29
30  sdk.register({
31    id: 'bat',
32    queries: {
33      oneDayTotalFees: getOneDayFees,
34      dateRangeTotalFees: getFees,
35    },
36    metadata: {
37      name: 'Basic Attention Token',
38      icon: sdk.ipfs.getDataURILoader('QmWuCDM6vbxfvoFMU4sKDkyYUuAdc4Ns9y82WoCrNhnCqM', 'image/png'),
39      category: 'Application Protocol',
40      subcategory: 'Advertising',
41      description: 'The Basic Attention Token is the new token for the digital advertising industry. It pays publishers for their content and users for their attention, while providing advertisers with more in return for their ads.',
42      feeDescription: '70% of ad revenue returned to users and 30% to Brave Inc.',
43      blockchain: 'Ethereum / Solana',
44      source: 'Brave Transparency',
45      website: 'https://basicattentiontoken.org/',
46      protocolLaunch: '2017-05-31', 
47      tokenTicker: 'BAT',
48      tokenCoingecko: 'basic-attention-token', 
49      events: [
50      ],
51    },
52  })
53}
54

It's something off?

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

Adapter Info

Version

0.0.1

License

MIT

IPFS CID

QmS3WJYiVgUHa15mnMreXvSWbF1CwqHgRQobaS2pNmfesx

CID (source)

QmQKz8q3eT5fwRbj3RkYuwbC3PYkGApRPntwwiyCmgcDH2

Collections

Author

0x1a171a91B4Aa1A669e2397D6670746DDcDd4fbBe