streamingfast / substreams-ethereum

Substreams development kit for Ethereum chains, contains Firehose Block model and helpers as well as utilities for Ethereum ABI encoding/decoding.
Apache License 2.0
22 stars 9 forks source link

Support `tuple` when doing ABI decoding generation #18

Closed maoueh closed 1 year ago

maoueh commented 1 year ago

Right now, we do not support ABI that contains tuple like:

[
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "bytes32",
        "name": "orderHash",
        "type": "bytes32"
      },
      {
        "components": [
          {
            "internalType": "enum ItemType",
            "name": "itemType",
            "type": "uint8"
          },
          {
            "internalType": "uint256",
            "name": "amount",
            "type": "uint256"
          }
        ],
        "indexed": false,
        "internalType": "struct SpentItem[]",
        "name": "offer",
        "type": "tuple[]"
      }
    ],
    "name": "OrderFulfilled",
    "type": "event"
  }
]

We need to support that for easier adoption, it seems more and more usage of tuple are made among smart contracts, for example OpenSea and Decentraland both uses tuple today.

Workaround is to "manually" code the decoding of tuple, but it's a long task if lot of events are using tuples.