Submitted by cmichel
The Unlock.recordKeyPurchase function computes the maxTokens as:
Note that grossNetworkProduct was already increased by valueInETH in the code before.
Meaning, the (2 + 2 * valueInETH / grossNetworkProduct) part of the computation will almost always be 2 as usually grossNetworkProduct > 2 * valueInETH, and thus the 2 * valueInETH / grossNetworkProduct is zero by integer division.
The maxTokens curve might not be computed as intended and lead to being able to receive more token rewards than intended.
The comment we distribute tokens using asymptotic curve between 0 and 0.5 should be more clear to indicate how exactly the curve looks like.
It could be that a floating-point number was desired instead of the integer division in 2 * valueInETH / grossNetworkProduct. In that case, consider adding a scaling factor to this term and divide by it at the end of the computation again.
julien51 (Unlock Protocol) commented:
0xleastwood (judge) commented:
julien51 (Unlock Protocol) commented:
0xleastwood (judge) commented:
