-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locked tokens fix #5
Conversation
Running test 04_claim_tokens_overflow.js shows that a hatcher is unable to claim their tokens. This function CommonsToken.claimTokens() calculates that the hatcher can claim more tokens that they have been allocated. This is because during CommonsToken.burn() the variable CommonsToken.unlockedInternal has increased to greater than CommonsToken.initialRaise()
- Logic added to protect against unlockedInternal being larger than the total locked tokens. - Logic added to unsure that a hatcher can never have more unlocked tokens than they have currently locked.
Correct calculation of p0 during allocation, burning and claiming tokens,
A fix for: commons-stack#18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 17 padExternal / p0
https://github.com/lightstreams-network/genesis-contracts/pull/5/files#diff-a47469acf810b124d04e7d1a3ea5b4feL17 should change to paidExternal * p0
The 02_artist_token_flow test is failing if you change p0 to 2 because of a test line: (AMOUNT_TO_RAISE_PHT / P0 )
should be also (AMOUNT_TO_RAISE_PHT * P0 )
I will commit the changes
This PR fixes the following two bugs.
BUG 1: Running test 04_claim_tokens_overflow.js shows that a hatcher is unable to claim their tokens.
The function CommonsToken.claimTokens() calculates that the hatcher can claim more tokens that they have been allocated. This is because during CommonsToken.burn() the variable CommonsToken.unlockedInternal has increased to greater than CommonsToken.initialRaise().
BUG 2: Running test 04_claim_tokens_overflow.js shows that the incorrect amount of tokens are unlocked.
This is because the calculation for unlocking tokens using p0 is incorrect.