autonity / aut

A command-line RPC client for Autonity
MIT License
11 stars 10 forks source link

'aut token balance-of' returning incorrect balance - decimal position wrong for token contract but NTN OK #74

Closed cmjc closed 1 year ago

cmjc commented 1 year ago

If I query balance of a liquid newton account, I find my liquid supply is 10000 but balance-of returns 0.000000000000010000.

ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut validator info --validator 0xA9F070101236476fe077F4A058C0C22E81b8A6C9
{
  "treasury": "0x11A87b260Dd85ff7189d848Fd44b28Cc8505fa9C",
  "addr": "0xA9F070101236476fe077F4A058C0C22E81b8A6C9",
  "enode": "enode://11e025123dc489f30c26f2f46cef177de2c72d07c3b0f6aa948a2575e2b4be362b8098c14ec4720e4e46daceb390caeb1ad273f3adbfca8c4150e58c0c71f24b@51.89.151.55:30303",
  "commission_rate": 1000,
  "bonded_stake": 10000,
  "total_slashed": 0,
  "liquid_contract": "0xf4D9599aFd90B5038b18e3B551Bc21a97ed21c37",
  "liquid_supply": 10000,
  "registration_block": 0,
  "state": 0
}
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut token balance-of --token 0xf4D9599aFd90B5038b18e3B551Bc21a97ed21c37 0x11a87b260dd85ff7189d848fd44b28cc8505fa9c
0.000000000000010000
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ 

If I query for Newton balance it works correctly:

ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut protocol mint 1 0xbf2f718f948de541123f3e0a06a9100ee1df128c | aut tx sign - | aut tx send -
(consider using 'KEYFILEPWD' env var).
Enter passphrase (or CTRL-d to exit): 
0x4a2c8f8e7f3c8dfb3df2e2e77864686851e77956237a0cfdf0596ad9712b5485
ubuntu@vps-c7c3e8c7:~/TEST/autcli$ aut token balance-of --ntn 0xbf2f718f948de541123f3e0a06a9100ee1df128c
1.000000000000000000
dtebbs commented 1 year ago

Everything seems conistent there, although I probably need to adjust some of the ouput. The validator info output is still using the token units, so 0.000000000000010000 seems to be the correct output. There appear to genuinely only be 0.000000000000010000 staked.

dtebbs commented 1 year ago

Closing as this seemed not to be a tool issue. Will create a separate issue for the raw validator description output.