Skip to content

Commit

Permalink
Refactor error handling in src/strategies/spooky-lp-sonic/index.ts
Browse files Browse the repository at this point in the history
* Remove try-catch block around subgraphRequest
  • Loading branch information
0xaaiden committed Jan 23, 2025
1 parent 3d19653 commit 963591a
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions src/strategies/spooky-lp-sonic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,22 @@ export async function strategy(
params.burns.__args.where.transaction_ = { blockNumber_lte: snapshot };
}

try {
const result = await subgraphRequest(subgraphURL, params);
if (result && (result.mints || result.burns)) {
const mints = result.mints;
const burns = result.burns;
const result = await subgraphRequest(subgraphURL, params);
if (result && (result.mints || result.burns)) {
const mints = result.mints;
const burns = result.burns;

mints.forEach((mint) => {
const userAddress = getAddress(mint.origin);
const amount = parseFloat(mint.amount);
score[userAddress] += amount;
});
mints.forEach((mint) => {
const userAddress = getAddress(mint.origin);
const amount = parseFloat(mint.amount);
score[userAddress] += amount;
});

burns.forEach((burn) => {
const userAddress = getAddress(burn.origin);
const amount = parseFloat(burn.amount);
score[userAddress] -= amount;
});
}
} catch (error) {
// console.error(`Error querying pool ${poolId}:`, error);
continue;
burns.forEach((burn) => {
const userAddress = getAddress(burn.origin);
const amount = parseFloat(burn.amount);
score[userAddress] -= amount;
});
}
}

Expand Down

0 comments on commit 963591a

Please sign in to comment.