Protean-Labs/graphgen

Make ABI filenames consistent with subgraph manifest

Closed this issue · 0 comments

Currently, the subgraph manifest uses the provided contract name to refer to their respective ABIs. However, the ABI generator still uses the base name of the contracts as they are written in the interface files.

For example, the following interface and tags:

/* @gg:source
  name: Pair
*/
interface IUniswapV2Pair {
  ...
}

Will generate the following entries in the subgraph manifest:

templates:
  - kind: ethereum/contract
    name: Pair
    network: mainnet
    source:
      abi: Pair
    mapping:
      ...
      abis:
        - name: Pair
          file: ./abis/Pair.json
      ...

However, the ABI file in will be under the name ./abis/IUniswapV2Pair.json whereas it should be under the name ./abis/Pair.json.

Solution: The ABI generator should use the name provided in the @gg:source tag (if any) instead of the actual name of the interface (i.e.: IUniswapV2Pair) and should use the latter name if there is no name field in the @gg:source tag.