eth-sdk icon indicating copy to clipboard operation
eth-sdk copied to clipboard

eth-sdk fails to fetch ABI for some contracts: invalid ABI fetched instead

Open Pzixel opened this issue 3 years ago • 2 comments

I've created a sample repo: https://github.com/Pzixel/eth-sdk-test

What's happens there: I have a simple sdk:

import { defineConfig } from '@dethcrypto/eth-sdk'

export default defineConfig({
  contracts: {
    mainnet: {
      curveRegistry3: '0xB9fC157394Af804a3578134A6585C0dc9cc990d4',
    },
  },
})

Then I'm running yarn eth-sdk and check output json file https://github.com/Pzixel/eth-sdk-test/blob/master/eth-sdk/abis/mainnet/curveRegistry3.json

The problem is that it's unrelated to contract 0xB9fC157394Af804a3578134A6585C0dc9cc990d4. For example, fetched JSON suggests that there is a function integrate_checkpoint which doesn't exist on real contract: img

Meanwhile contract has a function metapool_implementations which is missing in generated ABI:

img

Contract: https://etherscan.io/address/0xB9fC157394Af804a3578134A6585C0dc9cc990d4#code

Pzixel avatar May 21 '22 07:05 Pzixel

Ping?

Pzixel avatar May 28 '22 17:05 Pzixel

This might be a problem with how we try to follow proxies and so on. Thanks for bringing this up.

Quick fix is to manually overwrite abi file with whatever you need. Once it's there, eth-sdk won't try to overwrite it.

krzkaczor avatar Jun 21 '22 13:06 krzkaczor