Adapter

Tornado Cash Fees

Tornado Cash is a privacy tool for trustless asset mixing.

Sub-Adapters 1

Preview and test each sub adapter.

Tornado Cash (tornado-ethereum)

Metadata

ID
tornado-ethereum
icon
name

"Tornado Cash"

category

"other"

description

"Tornado Cash is a privacy tool for trustless asset mixing."

feeDescription

"Relay fees are paid by withdrawers to relayers."

blockchain

"Ethereum"

source

"The Graph Protocol"

tokenTicker

"TORN"

tokenCoingecko

"tornado-cash"

tokenLaunch

"2021-02-09"

protocolLaunch

"2019-12-26"

Queries

Adapter Code

Check the entire code written for the Adapter.

Source code

Showing TS source.
1export const name = 'Tornado Cash Fees';
2export const version = '0.1.0';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6  const getTornadoData = async (date: string): Promise<number> => {
7    const graphQuery = `query fees($today: Int!, $yesterday: Int!){
8      now: tornado(id: "1", block: {number: $today}) {
9        totalFeesUSD
10      }
11      yesterday: tornado(id: "1", block: {number: $yesterday}) {
12        totalFeesUSD
13      }
14    }`;
15
16    const data = await sdk.graph.query(
17      'dmihal/tornado-cash',
18      graphQuery,
19      {
20        today: await sdk.chainData.getBlockNumber(sdk.date.offsetDaysFormatted(date, 1)),
21        yesterday: await sdk.chainData.getBlockNumber(date),
22      },
23    );
24
25    return parseFloat(data.now.totalFeesUSD) - parseFloat(data.yesterday.totalFeesUSD);
26  }
27
28  sdk.register({
29    id: 'tornado-ethereum',
30    queries: {
31      oneDayTotalFees: getTornadoData,
32    },
33    metadata: {
34      icon: sdk.ipfs.getDataURILoader('QmeUzPPCdpqEYArWyMdUVZJk4GUmuR4TAkK6U4eb9vZDPa', 'image/svg+xml'),
35      name: 'Tornado Cash',
36      category: 'other',
37      description: 'Tornado Cash is a privacy tool for trustless asset mixing.',
38      feeDescription: 'Relay fees are paid by withdrawers to relayers.',
39      blockchain: 'Ethereum',
40      source: 'The Graph Protocol',
41      tokenTicker: 'TORN',
42      tokenCoingecko: 'tornado-cash',
43      tokenLaunch: '2021-02-09',
44      protocolLaunch: '2019-12-26',
45    },
46  })
47}
48

It's something off?

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

Adapter Info

Version

0.1.0

License

MIT

IPFS CID

QmXz8ZjJSKaQ5xx83wBvkkMmuep1iYio2mCJNbpHgi4eB3

CID (source)

Qme5WQQFWf1DQtdovNcAeZn4ymcytMdV1BUrCLuErWkXHq

Collections

Author

mihal.eth