Erc20 synced, but not erc1155

Currently I am creating syncs for erc20, erc721 and erc1155. ERC20 and erc721 work as charm, but when it comes to erc1155 it creates the sync and the table, but the server never populates it. My server is https://mtpuogs4dqvh.usemoralis.com:2053/server and below there is a log of the options used for creating the hook.

ERC1155

{
  "options": {
    "chainId": "0x1",
    "address": "0x36aa43ab431a988892113ab2b1d5518c1f202eb3",
    "topic": "TransferSingle",
    "abi": {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "operator",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "from",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "to",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "id",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "value",
          "type": "uint256"
        }
      ],
      "name": "TransferSingle",
      "type": "event"
    },
    "limit": 2000000,
    "tableName": "myTableNFT",
    "sync_historical": true
  }
}

await Moralis.Cloud.run('watchContractEvent', options, {
      useMasterKey: true,
    });

ERC20

  "options": {
    "chainId": "0x1",
    "address": "0x147faF8De9d8D8DAAE129B187F0D02D819126750",
    "topic": "Transfer",
    "abi": {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "name": "from",
          "type": "address"
        },
        {
          "indexed": true,
          "name": "to",
          "type": "address"
        },
        {
          "indexed": false,
          "name": "value",
          "type": "uint256"
        }
      ],
      "name": "Transfer",
      "type": "event"
    },
    "limit": 2000000,
    "tableName": "myTableToken",
    "sync_historical": true
  }

await Moralis.Cloud.run('watchContractEvent', options, {
      useMasterKey: true,
    });

I was checking the ABI of your ERC1155 contract on etherscan and it only shows this as the contract abi. Are you using correct abi for the event?


https://etherscan.io/address/0x36aa43ab431a988892113ab2b1d5518c1f202eb3#code

Did you test the sync for any other erc1155 contract?

tried with https://polygonscan.com/address/0x2953399124f0cbb46d2cbacd8a89cf0599974963 and it is not working either.

 "options": {
    "chainId": "0x89",
    "address": "0x2953399124F0cBB46d2CbACD8A89cF0599974963",
    "topic": "TransferSingle",
    "abi": {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "operator",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "from",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "to",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "id",
          "type": "uint256"
        },
        {
          "indexed": false,
          "internalType": "uint256",
          "name": "value",
          "type": "uint256"
        }
      ],
      "name": "TransferSingle",
      "type": "event"
    },
    "limit": 2000000,
    "tableName": "myTableOpenSea",
    "sync_historical": true
  }

await Moralis.Cloud.run('watchContractEvent', options, {
    useMasterKey: true,
  });

If I create them manually (UI) and they work. Weird. Why are the responses of Moralis.Cloud.run so uninformative?

it looks like there are some events for that server in the dashboard

most of them doesn’t seem to have data, what exactly doesn’t work? are you sure that all the info is correct?

Programatically creating a sync for ERC1155 does not populate its DB table, while creating it with the UI does.

can you see those two events in the database dashboard, to see if it is anything different?

I can see events on the ones I created them manually, but If you focus on the ones starting with “myTable” such as myTableNFT or myTableOpenSea there are no events populated. I also did another run adding the suffix “other” to syncs created programatically

I didn’t see these tables in event syncs on this server:

I need to run some tests, but I think that the issue is that the topic field within options means the topic signature. Instead of passing Transfer I should pass Transfer(address,address,uint256). For some reason I am doing it well on erc20 and erc721 but not for erc1155.

yes, the topic has to be in that complete form

1 Like