1

In my smart contract I have a map which map a person and his/her contribution. Say for example a contributes 20 ether, b contributes 10 ether. Everything works fine, but when I checking it shows:

{
    "0": "address: contributor 0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db",
    "1": "uint256: amount 20000000000000000000"
}

But actually he contributed 20 ether only. How can I maintain the exact amount? So, finally I can return their exact amount. Thank you.

3

That value is 20 ether. Indeed, 20000000000000000000 wei = 20 ether. So it's correct

https://etherconverter.online/

  • So if I send that much wei will it reduce only 20 ether.. – e.k Mar 14 '18 at 13:42
  • yes, the amounts are stored in wei. – mirg Mar 14 '18 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.