Skip to content
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

Merged
merged 7 commits into from
Jan 10, 2020
Merged

Locked tokens fix #5

merged 7 commits into from
Jan 10, 2020

Conversation

mikesmo
Copy link

@mikesmo mikesmo commented Jan 8, 2020

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.

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()
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.
- 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,
@mikesmo mikesmo assigned ggarri and unassigned ggarri Jan 8, 2020
@mikesmo mikesmo requested review from ggarri and EnchanterIO January 8, 2020 07:38
@EnchanterIO
Copy link

A fix for: commons-stack#18

Copy link

@EnchanterIO EnchanterIO left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants