Sub-Adapters 1
Preview and test each sub adapter.
Polymarket (polymarket)
Metadata
- ID
- polymarket
- name
"Polymarket"
- icon
- category
"dex"
- description
"Polymarket is a prediction market."
- feeDescription
"Trading fees are paid by traders to liquidity providers"
- blockchain
"Polygon"
- source
"The Graph Protocol"
- adapter
"polymarket"
- website
"https://polymarket.com"
- protocolLaunch
"2020-09-05"
Queries
Adapter Code
Check the entire code written for the Adapter.
Source code
Showing TS source.
1export const name = 'Polymarket Fees';
2export const version = '0.1.0';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6 const getFees = async (date: string): Promise<number> => {
7 const startOfDayBlock = await sdk.chainData.getBlockNumber(date, 'polygon');
8 const endOfDayBlock = await sdk.chainData.getBlockNumber(sdk.date.getNextDay(date), 'polygon');
9
10 const data = await sdk.graph.query(
11 'polymarket/matic-markets-4',
12 `query lpFeesOverPeriod($startOfDayBlock: Int!, $endOfDayBlock: Int!){
13 startOfDay: global(id: "", block: {number: $startOfDayBlock}){
14 scaledCollateralFees
15 }
16 endOfDay: global(id: "", block: {number: $endOfDayBlock}){
17 scaledCollateralFees
18 }
19 }`,
20 {
21 startOfDayBlock,
22 endOfDayBlock,
23 },
24 );
25
26 return data.endOfDay.scaledCollateralFees - data.startOfDay.scaledCollateralFees;
27 }
28
29 sdk.register({
30 id: 'polymarket',
31 queries: {
32 oneDayTotalFees: getFees,
33 },
34 metadata: {
35 name: 'Polymarket',
36 icon: sdk.ipfs.getDataURILoader('QmW9S8URh3A9nmYBJ9xyDDcWSau7mAnzaYjRTwZj1MJbiw', 'image/svg+xml'),
37 category: 'dex',
38 description: 'Polymarket is a prediction market.',
39 feeDescription: 'Trading fees are paid by traders to liquidity providers',
40 blockchain: 'Polygon',
41 source: 'The Graph Protocol',
42 adapter: 'polymarket',
43 website: 'https://polymarket.com',
44 protocolLaunch: '2020-09-05',
45 },
46 })
47}
48
It's something off?
Report it to the discussion board on Discord, we will take care of it.