Alethio / web3-multicall-go

Go interface for a Multicall contract to batch EVM state reads in a single ethcall
MIT License
35 stars 29 forks source link

New release #5

Open jon4hz opened 3 years ago

jon4hz commented 3 years ago

Currently if you try to import that repo it automatically grabs the release v0.0.15 which is not compatible with go-ethereum releases after 1.9.25. However it seems like that this issue was already addressed a few months ago. So would it be possible to make a new release?

jon4hz commented 3 years ago

For everyone else running in this issue in the meantime: go get github.com/alethio/web3-multicall-go@9249f76c1578cf90b7bc239049b858b9db3633fa grabs the latest changes :)

journeytosilius commented 2 years ago

and how do you import it ? I get import error when I install it this way ... Thanks !

jon4hz commented 2 years ago

At the time I opened that issue, I defined the exact commit of the library in the go.mod file. However in the meantime I forked the repository to https://github.com/jon4hz/web3-multicall-go, made some small changes and create a new release.

journeytosilius commented 2 years ago

thanks ! If I run the example with ETH RPC and ETH addresses it works, but when I switch to, for example Fantom it fails. My program is setup to accept any network, but this library fails when I switch. Is there something that I have to add to the library for other ERC20 based networks to work as well ? Maybe there is something hardcoded for ETH only ? The multicall contract I'm using is the same as the one you use on the example but on Fantom. Thanks for keeping this up. If changes are required for other networks I might subnmit a PR on your fork ? Thanks

jon4hz commented 2 years ago

The multicall contract address is hardcoded but you can simply pass in a string when creating the multicall client like this:

contract := "0xContractAddress"
multicall.New(eth, multicall.ContractAddress(contract))

The contract is deployed on the following networks:

BSC: 0x6Cf63cC81660Dd174A49e0C61A1f916456Ee1471 Polygon: 0x8a233a018a2e123c0D96435CF99c8e65648b429F Fantom: 0x08AB4aa09F43cF2D45046870170dd75AE6FBa306 BSC Testnet: 0xD3c6D8dAa57dfD38609047447cccDEF7Db6631b5 Ropsten: 0x5Efdd3fb0ab27A307FE806f5c7CEDd3217b3904a

journeytosilius commented 2 years ago

thanks for this, will take a look asap !