I am trying to listen to a UniSwap v3 Swap event but I get no response from the network. I am connected to polygon network via websocket and after firing up the listener I get no callbacks even though Polygonscan shows recent emitted events. I even log the active listeners and it shows "1".

Any thoughts?

Polygonscan address events: https://polygonscan.com/address/0x45dDa9cb7c25131DF268515131f647d726f50608#events UniSwap v3 documentation: https://docs.uniswap.org/protocol/reference/core/interfaces/pool/IUniswapV3PoolEvents#swap

const wsProvider = new ethers.providers.WebSocketProvider(WS_ALCHEMY);
const wallet = new ethers.Wallet(PRIVATE_KEY);
const signer = wallet.connect(wsProvider);

const address = "0x45dDa9cb7c25131DF268515131f647d726f50608";
const abi = "event Swap(address sender, address recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick)";

const contract = new ethers.Contract(address, [abi], signer);
contract.on("Swap", (sender: string, recipient: string, amount0: number, amount1: number, sqrtPriceX96: number, liquidity: number, tick: number) => {

1 Answer 1


For future users, make sure to copy the abi from etherscan/polygonscan as an object. While the above example might work, this time it caused the event to not get called without any errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.