Skip to content

feat: add whitelist tokens#1

Open
philiphacks wants to merge 4 commits intomainfrom
pds/whitelist
Open

feat: add whitelist tokens#1
philiphacks wants to merge 4 commits intomainfrom
pds/whitelist

Conversation

@philiphacks
Copy link
Copy Markdown
Contributor

No description provided.

@philiphacks philiphacks requested a review from csgui December 31, 2021 14:27
@philiphacks
Copy link
Copy Markdown
Contributor Author

@csgui can you have a look at this? I changed a few things:

  • Imported some Arkadiko DAO code to have permissions
  • Name of the FT trait so it's the same as we use in the Arkadiko source
  • Whitelisting of tokens so the contract cannot get exploited
  • Some indentation

Copy link
Copy Markdown
Collaborator

@csgui csgui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread tests/token-vesting_test.ts Outdated
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);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

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.

2 participants