nash-io / neo-ico-template

An ICO Template for NEO projects
GNU General Public License v3.0
117 stars 56 forks source link

NEO -> Token calculation incorrect? #9

Closed brianlenz closed 6 years ago

brianlenz commented 6 years ago

It's quite possible I'm just not understanding the logic here, so please correct me if I'm wrong or overlooking the obvious. I can't make sense of the following math in the template:

exchanged_tokens = attachments.neo_attached * token.tokens_per_neo / 100000000

If you send 1 NEO in the template, shouldn't exchanged_tokens be set to 4,000,000,000 (i.e. 40.00000000 tokens)? The fact that the statement divides by 100000000 means that exchanged_tokens will ultimately be equal to just 40, which doesn't seem right since the intent is to track 8 decimal places of precision on the token.

localhuman commented 6 years ago

Neo is represented in TransactionOutput with a precision of 8, same as gas.

brianlenz commented 6 years ago

Ah, that's the piece I was missing. Thanks for clarifying 👍