Skip to content

Commit

Permalink
add base to uni-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
slasher125 committed Jan 4, 2025
1 parent ffee1fc commit e10ac14
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/adaptors/uniswap-v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ const { request, gql } = require('graphql-request');

const utils = require('../utils');

const url = sdk.graph.modifyEndpoint(
'FEtpnfQ1aqF8um2YktEkfzFD11ZKrfurvBLPeQzv9JB1'
);
const chains = {
ethereum: sdk.graph.modifyEndpoint(
'FEtpnfQ1aqF8um2YktEkfzFD11ZKrfurvBLPeQzv9JB1'
),
base: sdk.graph.modifyEndpoint(
'4jGhpKjW4prWoyt5Bwk1ZHUwdEmNWveJcjEyjoTZWCY9'
),
};

const query = gql`
{
Expand Down Expand Up @@ -102,7 +107,20 @@ const topLvl = async (
};

const main = async (timestamp = null) => {
let data = await topLvl('ethereum', url, query, queryPrior, 'v2', timestamp);
let data = [];

for (const [chain, url] of Object.entries(chains)) {
console.log(`Fetching data for ${chain}...`);
const chainData = await topLvl(
chain,
url,
query,
queryPrior,
'v2',
timestamp
);
data.push(...chainData);
}

return data.filter((p) => utils.keepFinite(p));
};
Expand Down

0 comments on commit e10ac14

Please sign in to comment.