Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Convert min stake and max stake values in zwalletcli to ZCN ,mZCN and other formats #10

Open
hm90121 opened this issue May 13, 2021 · 7 comments
Labels

Comments

@hm90121
Copy link
Contributor

hm90121 commented May 13, 2021

Hello @vudn95 here is a sample output for ./zwallet mn-info command.

{
   "simple_miner":{
      "id":"110b07984a6592ae67f1830366f47c835f6f5f262be19ee4aedd1b9acf870aee",
      "n2n_host":"five.devnet-0chain.net",
      "host":"five.devnet-0chain.net",
      "port":31202,
      "path":"miner02",
      "public_key":"7f7a0515ae68eadee6eac5915519802911c7c7341d1ef23d913728aed47dc8090548a56031732d16916e203c4e41c2a32d022fe56758ba3956cc73b112f0961c",
      "short_name":"localhost.m02",
      "build_tag":"40058cb8b6aeeb95e61229702f29de4c7118ebaf",
      "total_stake":0,
      "delegate_wallet":"110b07984a6592ae67f1830366f47c835f6f5f262be19ee4aedd1b9acf870aee",
      "service_charge":0.1,
      "number_of_delegates":10,
      "min_stake":0,
      "max_stake":1000000000000,
      "stat":{
         "generator_rewards":187795440000000
      },
      "node_type":"miner",
      "last_health_check":1620947267
   }
}
Here min_stake and max_stake values have to be converted into ZCN and other formats
Also, in any other places or responses or flags in zwalletcli where these value types are used,they have to be converted to ZCN and other formats.

the value conversion table is as follows:
1 ZCN = 1,000 mZCN = 1,000,000 µZCN
0.1 ZCN = 100 mZCN = 100,000 µZCN
0.01 ZCN = 10 mZCN = 10,000 µZCN
0.001 ZCN = 1 mZCN = 1,000 µZCN
0.0001 ZCN = 0.1 mZCN = 100 µZCN
0.00001 ZCN = 0.01 mZCN = 10 µZCN
0.000001 ZCN = 0.001 mZCN = 1 µZCN
0.0000001 ZCN = 0.0001 mZCN = 0.1 µZCN
0.00000001 ZCN = 0.00001 mZCN = 0.01 µZCN
0.000000001 ZCN = 0.000001 mZCN = 0.001 µZCN
0.0000000001 ZCN = 0.0000001 mZCN = 0.0001 µZCN = 1 sas (Saswata, smallest unit, nickname) (edited)





@guruhubb
Copy link
Member

All ZCN related information need to change in the CLI input/output

@bbist bbist changed the title Convert min stake and max stake values in zwalletcli to ZCN ,mZCN and other formats WIP: Convert min stake and max stake values in zwalletcli to ZCN ,mZCN and other formats May 15, 2021
@bbist
Copy link
Contributor

bbist commented May 16, 2021

@guruhubb,

So the default unit for ZCN will be 1 sas, which is equal to 10^-9 ZCN, right? If so, it means that an account with a balance of 1000,000,000 will have 1 ZCN.
I think the best way to solve this is to use a common token type "ZCN" across all the applications with a unified encoding, decoding, computation, formatting, and parsing logic. It will bring consistency in usage of ZCN type across all repos.
Let me know what you think.

@guruhubb
Copy link
Member

Yes it makes sense to manage the common logic for calculation and presentation organized at one place.

@sculptex
Copy link
Contributor

It's 10^-10

@sculptex
Copy link
Contributor

I don't think this is in the realm of CLI output which should remain in Saswata (10^-10) (smallest units). Only for GUI and formatted commands should currency formatting be used, certainly not in JSON output

@bbist
Copy link
Contributor

bbist commented Sep 8, 2021

PLEASE UPDATE THIS COMMENT IF YOU FIND SOME CLI OUTPUT THAT DOESN'T FORMAT TOKEN (except JSON).

List of commands ZCN is used for CLI output:

Zwalletcli:

  1. getbalance (L32)
  2. minersc (L230)
  3. mswallet (L353)
  4. vesting (L77)

Zboxcli:

  1. getallocation (L99,L115-L121,L136-L138)
  2. readpool (L32,L39)
  3. stakepool (L17,L44,L84)

@sculptex
Copy link
Contributor

sculptex commented May 16, 2022

Please can we offer a standardized option for all commands to return results, (especially those returning ZCN currency balance) as json via --json option as per :-

https://github.com/0chain/zwalletcli/blob/staging/cmd/getbalance.go
(^ Link updated since merged)

@boddumanohar boddumanohar added the good first issue Good for newcomers label Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants