zilpay / zil-pay

ZilPay browser extension enables browsing Zilliqa blockchain enabled websites.
https://zilpay.io
Other
3 stars 1 forks source link

Wrong amout sent/received by 10^12 #19

Closed SvenMeyer closed 4 years ago

SvenMeyer commented 4 years ago

I have a contract on Zilliqa Testnet where user can register String/hash with their account. Contract owner can set the price, which I set to 1 ZIL. User has to send exactly the same amount so that registration will be executed. It worked within savant IDE ... but not using ZILPAY + ZILPAY Editor. Checking the transaction log, it turn out that the price is set to "1", but amount is 1000000000000 (10^12) when I sent 1 ZIL.

https://viewblock.io/zilliqa/tx/0xc66d610a4922b789eab4ae6fc8739de5be00b206295b24bb167eae47e96acaf7?network=testnet

v3_payment-test_2

hicaru commented 4 years ago

Thanks for your issue. Yes this amount in Qa, for it need just switcher for change mode ZIL or Qa. I will make it coming time)

SvenMeyer commented 4 years ago

Actually, its like I expected, I just could not find any reference to a smaller currency denomination than ZIL. Now, that you mentioned "Qa", I found this code on Gitter which states:

        // Note all transactional values has to be converted to Qa (the smallest accounting unit) when using the Zilliqa protocol.
        // 1 Qa is 10^-12 Zil.

https://gitter.im/Zilliqa/ecogrant?at=5c3fefcc95e17b45256382b0

I have not seen this anywhere else before. Not that I know that, I have just to make sure that the price in my contract is set in Qa as well.

Of, course if there is a need to transfer a very small amount, it might help to be able to enter that in Qa instead of ZIL, but now that the inner working is clarified, I found out that I can send fractional ZIL as well (like 0.001), it might even lead to more confusion, if the user has (optionally) to deal with different currency denominations - so I would even argue to leave it as is.