Uniswap Pairs Added Script

Viewed 424

I am not sure if my script is working 100% as I do get logging inside the 'factory.on(' function however they are very sparse.

I get around 3 to 5 Pairs added a day running the script all day. Does this sound correct? And if it isn't then what could possibly be the issue?

I am running on mainnet and testnet using Infura.

const factory = new ethers.Contract(
  addresses.factory,
  ['event PairCreated(address indexed token0, address indexed token1, address pair, uint)'],
  account
);

const router = new ethers.Contract(
  addresses.router,
  [
    'function getAmountsOut(uint amountIn, address[] memory path) public view returns (uint[] memory amounts)',
    'function swapExactTokensForTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts)'
  ],
  account
);

factory.on('PairCreated', async (token0, token1, pairAddress) => {......
0 Answers
Related