Events From Internal Contract Transactions Are Not Received Through The Websockets API

I believe I have found a bug in that events generated from internal contract transactions are not received from event listeners when using the websockets api. I’m working on a bot that listens for events from certain sets of contracts, in particular the uniswap factory contract which emits a PairCreated event anytime a new uniswap pair is created through the factory.

To test this bot I’m comparing it’s results against https:// twitter. com/uniswaptokenbot which tweets all pairs that are created. I’ve noticed a discrepancy between what my bot finds, and what this twitter bot finds. This discrepancy is that any pair created through an internal contract transaction will be missed by my bot, but discovered by the twitter account. However this doesn’t always appear to be the case, but it is the main common denominator of events which are missed by my bot.

The code I have which listens for the events is displayed below

        // this uses contract bindings generated by abigen to create a factory contract
	factory, err := c.uc.Factory()
	if err != nil {
		return err
	ch := make(chan *uniswapv2factory.Uniswapv2factoryPairCreated, 100)
	sub, err := factory.WatchPairCreated(nil, ch, nil, nil)
	if err != nil {
		return err
	defer func() {
	logger := c.l.Named("uniswap.factory")
	logger.Info("starting uniswap factory pair creation monitor")
	for {
		select {
		case <-c.ctx.Done():
			return nil
		case err := <-sub.Err():
			logger.Error("encountered error watching uniswap factory", zap.Error(err))
			return err
		case evLog := <-ch:
                       // do stuff

hi @bonedaddy,

Any chance you could try a plain wscat subscription and see if you spot the same differences:

If you can send me one contract address where you’ve noticed this I can play around a little bit.


1 Like

Sure I can try to use wscat. I took a look at the documentation you linked but I’m a bit confused as how I would make it subscribe to a particular contract instead of new block heads?

If you can send me one contract address where you’ve noticed this I can play around a little bit.

0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f this is the address of the uniswapv2 factory

0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac is the address of the sushiswap factory.

I’ve noticed the same issues happening on both.

Thanks, I’ll run some tests as well.
You can use the subscription for logs and a particular contract address and/or a specific topic, it should return the generated events. Something like this:

wscat -c wss://

{“jsonrpc”:“2.0”, “id”: 1, “method”: “eth_subscribe”, “params”: [“logs”, {“address”: “0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f”, “topics”: [“0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9”]}]}

Is there any update about this? Having same issue