Sync and Watch Contract Events not being captured when enum used in argument list

Hi

I’ve written a smart contract and deployed to local ganache environment that emits the following events:

event Payout(address indexed winner, uint amount);
event MaxBet(uint amount);
event Play(address indexed player, uint betSize, Side side, uint maxBet);

I’ve configured all 3 events to be captured by Moralis in their respective tables using the ‘Sync and Watch Contract Events’ plugin.

However, only the MaxBet and Payout events are successfully captured by Moralis. The PlayEvents table never gets created by Moralis. Nothing in the log files either.

The events do fire as I can capture these events in my front-end application using the web3.eth.Contract(abi, contractAddress) object to listen for the respective events.

The Play event does declare an enum Side as one of the arguments. I’m wondering whether this is the source of the issue although the plugin does get registered successfully.

The Play plugin configuration is as follows:

Play Event

topic : Play(address, uint, Side, uint)

{
  "anonymous": false,
  "inputs": [
    {
      "indexed": true,
      "internalType": "address",
      "name": "player",
      "type": "address"
    },
    {
      "indexed": false,
      "internalType": "uint256",
      "name": "betSize",
      "type": "uint256"
    },
    {
      "indexed": false,
      "internalType": "enum CoinToss.Side",
      "name": "side",
      "type": "uint8"
    },
    {
      "indexed": false,
      "internalType": "uint256",
      "name": "maxBet",
      "type": "uint256"
    }
  ],
  "name": "Play",
  "type": "event"
}

The server url is: https://y1gn3irfux99.moralis.io:2053/server

Thanks

Jon

1 Like

Hi, Jon.

I noticed you are using Play(address, uint, Side, uint)

There is no side type, so please use exactly as it is on the abi you provided Play(address,uint256,uint8,uint256)

1 Like

@Mauro

Thanks for the spot. I tried to recreate the plugin with a revised topic definition but a new mandatory field chainId now appears on the form but it doesn’t contain any values so I can’t satisfy the validation check.

1 Like

I noticed you remove the numbers from the topic. It’s important to make the difference between the 256 and 8 on the topic. Additionally, to set up the new plugins, make sure to update to the latest version of the server.