[Solved] Custom Sync not working (Polygon Mumbai)

I just created a custom sync to test events on contract, and it does not seem to be working.

Dapp Url: https://wybemdie4rfe.usemoralis.com:2053/server
Contract address: 0xc8b4084f878e89d947168Ec0444951d1FA4A830e
ABI:https://mumbai.polygonscan.com/address/0xc8b4084f878e89d947168ec0444951d1fa4a830e#code
Chain: Polygon Mumbai

I verified that the contract actually emits through polygonscan.
Contract code:

    event optionCreated(uint32 _dropID, uint256 _price, uint32 _quantity, string _uri);
    function createOption(uint32 _dropID, uint256 _price, uint32 _quantity, string memory _uri) public onlyRole(ADMIN_ROLE){
      ...
      emit optionCreated(_dropID, _price, _quantity, _uri);
    }
    

In your ABI that you use for the sync, you just have to remove the _ from the input names (for the optionCreated portion), the sync should work after this.

Updated:

...
{
      "anonymous":false,
      "inputs":[
         {
            "indexed":false,
            "internalType":"uint32",
            "name":"dropID",
            "type":"uint32"
         },
         {
            "indexed":false,
            "internalType":"uint256",
            "name":"price",
            "type":"uint256"
         },
         {
            "indexed":false,
            "internalType":"uint32",
            "name":"quantity",
            "type":"uint32"
         },
         {
            "indexed":false,
            "internalType":"string",
            "name":"uri",
            "type":"string"
         }
      ],
      "name":"optionCreated",
      "type":"event"
   }
...
1 Like

That works! Couple you please explain why that is?

Not exactly sure why on a technical level, it’s just due to an issue with leading _ which is incompatible.