Open
Conversation
jksf
reviewed
Nov 16, 2017
| MAX_NUMBER, | ||
| LOTTERY_DURATION | ||
| LOTTERY_DURATION, | ||
| web3.toWei(0.1, 'ether') |
Contributor
There was a problem hiding this comment.
Move 0.1 ether to a named constant.
jksf
reviewed
Nov 16, 2017
| const LOTTERY_DURATION = 10; | ||
|
|
||
| const TICKET_FEE_WEI = web3.toWei(0.1, 'ether'); | ||
| const EXPECTED_TICKET_FEE_WEI = web3.toWei(0.1, 'ether'); |
Contributor
There was a problem hiding this comment.
No need for a separate const.
jksf
reviewed
Nov 16, 2017
| it('Should create lotto object with ticketFee', async () => { | ||
| const ticketFee = await lotto.ticketFee(); | ||
| assert.equal(ticketFee, EXPECTED_TICKET_FEE_WEI); | ||
| assert.equal(TICKET_FEE_WEI, EXPECTED_TICKET_FEE_WEI); |
Contributor
There was a problem hiding this comment.
Check ticketFee instead of const.
jksf
reviewed
Nov 16, 2017
|
|
||
| it('Should exit when ownerCollect is called by not owner user', async () => { | ||
| const action = lotto.ownerCollect.bind(lotto, { from: PLAYER }); | ||
| assertThrowsInvalidOpcode(action); |
jksf
reviewed
Nov 16, 2017
| @@ -98,8 +98,11 @@ contract MicroLotto { | |||
| function ownerCollect() public { | |||
Contributor
There was a problem hiding this comment.
accumulatedValue is resetted in draw() and blocks the funds forever. Split accumulatedValue to separate fields prize and fees.
jksf
reviewed
Nov 16, 2017
contracts/MicroLotto.sol
Outdated
|
|
||
| // TODO: Do you see a problem here? | ||
| ticket.account.transfer(profit); | ||
| // ticket.account.transfer(profit); |
jksf
reviewed
Nov 16, 2017
| address ticketAccount = ticket.account; | ||
|
|
||
| wonPrizes[ticketAccount] = profit; | ||
| if (wonPrizes[ticketAccount] > 0) wonPrizes[ticketAccount] += profit; |
Contributor
There was a problem hiding this comment.
An uninitialized wonPrizes value will have 0 value anyway. No need for if/else.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.