Closed mmsqe closed 3 years ago
since smart contract function is the same but not sure why behaviour change when call balanceOf from mainnet and kovan
balanceOf
func test(network string, tokenAddr string) { userAddr := "0x43438cd9a239a10495bedd32c6e22048deb2e869" eth, err := getETH(fmt.Sprintf("https://%s.infura.io/v3/17ed7fe26d014e5b9be7dfff5368c69d", network)) vcs := multicall.ViewCalls{ multicall.NewViewCall( network, tokenAddr, "balanceOf(address)(uint256)", []interface{}{userAddr}, ), } mc, _ := multicall.New(eth) block := "latest" res, err := mc.Call(vcs, block) if err != nil { panic(err) } result, _ := res.Calls[network] balance := result.Decoded[0].(*multicall.BigIntJSONString) balanceInt := big.Int(*balance) fmt.Println(network, balanceInt.String()) } func main() { test("mainnet", "0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B") test("kovan", "0x76c6D190639a946E894D4A480806EB1D18391E01") // mainnet 0 // panic: abi: attempting to unmarshall an empty string while arguments are expected }
since smart contract function is the same but not sure why behaviour change when call
balanceOf
from mainnet and kovan