dapphub / dapptools

Dapp, Seth, Hevm, and more
https://dapp.tools
2.1k stars 325 forks source link

seth output error #935

Open henry-hz opened 2 years ago

henry-hz commented 2 years ago

When using the token command to check the balance, got an error:

token balance $CONTRACT $ETH_FROM
Error: invalid data for function output (arg="data", errorArg="", errorValue="0x", value="0x", reason="insufficient data for uint256 type", version=4.0.32)
henry-hz commented 2 years ago

in fact, the issue is with seth:

seth call $ETH_USDT "balanceOf(address)(uint)" $ETH_FROM
henry-hz commented 2 years ago

in fact, the issue is with the abi decoding in seth, when the returned balance is zero

❯ seth --abi-decode 'balanceOf(address)(uint)' '0x'
Error: invalid data for function output (arg="data", errorArg="", errorValue="0x", value="0x", reason="insufficient data for uint256 type", version=4.0.32)
saucepoint commented 2 years ago

This command works fine for me:

seth call 0xdAC17F958D2ee523a2206206994597C13D831ec7 "balanceOf(address)(uint)" 0x3355d6E71585d4e619f4dB4C7c5Bfe549b278299
2656420038

Also replacing uint with uint256 yields the same result, was going to suggest that but doesnt seem like it makes a difference

henry-hz commented 2 years ago

@saucepoint yep, the issue is only when the return value is 0, so the return value is 0x that causes the error. I think that it was working in the former releases, and maybe ethers changed how they deal with it.

RaphaelNdonga commented 2 years ago

I got this error when I had set the wrong $ETH_RPC_URL