Skip to content

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mantasfam committed Sep 25, 2024
1 parent 7f11192 commit 0eea3f1
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/factory/providers/optimism/synthetix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,15 @@ const QUERY_NO_BLOCK = gql`

async function getSnxHolders(block, chain) {
let holders = [];
try {
for (let i = 0; i <= 5000; i += 1000) {
const holder = (
await request(GRAPHQL_ENDPOINT, QUERY_NO_BLOCK, {
block,
skip: i,
})
).snxholders;
holders = [...holders, ...holder];
}
} catch (e) {
console.log(`Issue with SubGraph on block ${block}`);
holders = await getSnxHolders(block - basicUtil.getDelay(chain), chain);

for (let i = 0; i <= 5000; i += 1000) {
const holder = (
await request(GRAPHQL_ENDPOINT, QUERY_NO_BLOCK, {
block,
skip: i,
})
).snxholders;
holders = [...holders, ...holder];
}

return holders;
Expand Down

0 comments on commit 0eea3f1

Please sign in to comment.