Skip to content

Handling Dynamic Data Sources with unknown ABIS #892

Description

@davekay100

Right now we can't run dynamic data sources for reading symbol() and decimal() and name() for all the tokens on Uniswap.

This is because Uniswap does not do any checking to see what contracts are stored in its Factory contract as a "Uniswap Exchange." This has led to the fact that the Graph Node will crash when trying to read symbol and decimal.

The feature I am requesting is this: have functionality in the mappings to call into a contract and see if a function exists. It might look something like this:

import {functionExists} from '@graphprotocol/graph-ts'
import ......

export function handleNewExchange(event: NewExchange): void {
  let id = event.params.exchange.toHex()
  let exchange = new Exchange(id)
  let erc20contract = ERC20.bind(event.params.token)

  if (erc20contract.functionExists("symbol")) {
    exchange.decimal = erc20contract.symbol()
  } else {
    exchange.decimal = null
  }
}

This is causing a blocker on Uniswap as I can't index all the exchanges for their symbol and decimal and these are important for the data, otherwise it gets confusing what you are looking at. I could hard code them all, but thats over 250 exchanges, and it isn't a long term solution.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions