dapptools icon indicating copy to clipboard operation
dapptools copied to clipboard

seth output error

Open henry-hz opened this issue 3 years ago • 5 comments

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 avatar Apr 11 '22 12:04 henry-hz

in fact, the issue is with seth:

seth call $ETH_USDT "balanceOf(address)(uint)" $ETH_FROM

henry-hz avatar Apr 11 '22 20:04 henry-hz

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)

henry-hz avatar Apr 11 '22 20:04 henry-hz

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

saucepoint avatar Apr 12 '22 00:04 saucepoint

@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.

henry-hz avatar Apr 12 '22 08:04 henry-hz

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

RaphaelNdonga avatar Oct 23 '22 04:10 RaphaelNdonga