pegnet / pegnetd

The pegnet daemon to track txs, conversions, etc
Other
13 stars 14 forks source link

Make denomination consistent for pFCT #31

Closed OrmEmbaar closed 5 years ago

OrmEmbaar commented 5 years ago

pegnetd balances denominates pFCT in factoshis. However, pegnetd newcvt expects the amount argument to be denominated in factoids.

Consistent denomination should be used for both in order to avoid confusion. I suggest denominating all pFCT balances/arguments in factoids in order to make sure it is consistent with pegnet burn.

OrmEmbaar commented 5 years ago

This problem actually runs a bit deeper; there appears to be some internal confusion between denominations here. I just converted 2 pFCT into 725453222 pUSD.

Entry hash: 99c678193906b708c9a052c958b976e5e29c4dbfdc7bc3ed3e694512f2437052

It appears that the conversion command accepts pFCT denominated in factoids, then converts that denomination to factoshis without treating them as factoshis. As a result, the above transaction converted 2 * 10^8 pFCT to pUSD.

OrmEmbaar commented 5 years ago

So i guess the balances command may just be interpreting balances incorrectly. Here is what I get for the above address

{"PEG":0,"pADA":0,"pBNB":0,"pBRL":0,"pCAD":0,"pCHF":0,"pCNY":0,"pDAS":0,"pDCR":0,"pETH":0,"pEUR":0,"pFCT":300000000,"pGBP":0,"pHKD":0,"pINR":0,"pJPY":0,"pKRW":0,"pLTC":0,"pMXN":0,"pPHP":0,"pRVN":0,"pSGD":0,"pUSD":725453222,"pXAG":0,"pXAU":0,"pXBC":0,"pXBT":0,"pXLM":0,"pXMR":0,"pZEC":0}

If I actually try to spend that, it does not work.

Emyrk commented 5 years ago

balances is in factoshi. I will make that consistent. That usd balance is $7.25

OrmEmbaar commented 5 years ago

It doesn't look like it's 7.25. Can we make sure that it prints what people are expecting? At least need to put a decimal point in there.

Emyrk commented 5 years ago

I made a PR to put in the decimal point and print the human-friendly balances.

Emyrk commented 5 years ago

Merged into master https://github.com/pegnet/pegnetd/pull/32