feat: add whitelist tokens#1
Open
philiphacks wants to merge 4 commits intomainfrom
Open
Conversation
Contributor
Author
|
@csgui can you have a look at this? I changed a few things:
|
csgui
approved these changes
Jan 3, 2022
Collaborator
csgui
left a comment
There was a problem hiding this comment.
Great work in the token whitelisting! Code LGTM.
Just added some comments and a change related to tests. I think that a separate case for the whitelisting stuff will make tests easier and more readable. What you think?
Comment on lines
+117
to
+139
| let block = chain.mineBlock( | ||
| [ | ||
| Tx.contractCall( | ||
| contract, "deposit", | ||
| [ | ||
| types.principal(`${deployer.address}.${vestingOptions.token}`), | ||
| types.uint(vestingOptions.amount), | ||
| types.uint(vestingOptions.lockingPeriod), | ||
| types.list(assigneesList) | ||
| ], | ||
| deployer.address | ||
| ), | ||
| Tx.contractCall( | ||
| contract, "redeem", | ||
| [types.principal(`${deployer.address}.${vestingOptions.token}`)], | ||
| txSender.address | ||
| ) | ||
| ] | ||
| ); | ||
|
|
||
| const [deposit, redeem] = block.receipts; | ||
| deposit.result.expectErr(); | ||
| redeem.result.expectErr(); |
Collaborator
There was a problem hiding this comment.
I think that a token that is not whitelisted will never be subject of a redeem. Seems better check the whitelist guard in a separate test linked to the deposit feature.
Comment on lines
+57
to
+73
| let block = chain.mineBlock( | ||
| [ | ||
| Tx.contractCall( | ||
| contract, "deposit", | ||
| [ | ||
| types.principal(`${deployer.address}.${vestingOptions.token}`), | ||
| types.uint(vestingOptions.amount), | ||
| types.uint(vestingOptions.lockingPeriod), | ||
| types.list(assigneesList) | ||
| ], | ||
| deployer.address | ||
| ), | ||
| ] | ||
| ); | ||
|
|
||
| let resp = block.receipts[0]; | ||
| resp.result.expectErr().expectUint(12); |
Collaborator
There was a problem hiding this comment.
Seems better to check the whitelist guard in a separate test case. That will free other tests from the need to check if a token is whitelisted. What you think?
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.