Skip to content

Commit

Permalink
Merge pull request #322 from dappradar/uniswapV4
Browse files Browse the repository at this point in the history
Update uniswapV3chain.ts
  • Loading branch information
mantasfam authored Feb 4, 2025
2 parents 6b5598d + 08265c5 commit f2a5d95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util/calculators/uniswapV3chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ async function getTvl(

let offset = 10000;

let iterationCount = 0; // New iteration counter

if (Math.max(v3Pairs.block, startBlock) < block) {
for (let i = Math.max(v3Pairs.block, startBlock); ; ) {
console.log(`Trying from ${i} with offset ${offset}`);
Expand Down Expand Up @@ -127,8 +129,10 @@ async function getTvl(
token1.push(`0x${log.topics[2].slice(26)}`);
});

iterationCount++; // Increment the iteration counter

// Save into cache every 25 iterations
if (((i - Math.max(v3Pairs.block, startBlock)) / offset) % 25 === 0) {
if (iterationCount % 25 === 0) {
console.log('save');
await basicUtil.saveIntoCache(
i,
Expand Down

0 comments on commit f2a5d95

Please sign in to comment.