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

Improve the logic of the complex balance #80

Merged
merged 13 commits into from
Jul 29, 2024

Conversation

ihoroleksiienko
Copy link
Contributor

@ihoroleksiienko ihoroleksiienko commented Jul 3, 2024

Main changes

  1. The possibility to transfer frozen balance even if the related tokens are restricted has been added. E.g.:
    • The X account has 100 tokens in total.
    • 100 tokens are restricted to transfer only to account A.
    • 10 tokens are frozen and expected to be transferred to account B.
    • Despite of the restricted balance, the transferFrozen() function can transfer all 10 frozen tokens from X to B. Previously it did not work. The transferFrozen() function could only transfer tokens from X to the purposed account A.
  2. All error checks related to complex balances have been moved from the internal _afterTokenTransfer() function of specific base contracts to the same-name internal function of the CWToken base contract. It allows to concentrate the check logic of the complex balance in a single place instead of spreading it among multiple functions.
  3. Redundant internal functions have been removed.
  4. The tests have been updated to properly cover the updated logic.
  5. The new complex tests have been added to check the transferFrozen() function when other limitations exist.

Test coverage

New functionality was fully covered with tests.

@ihoroleksiienko ihoroleksiienko changed the title Ref after token transfer Move after token transfer hooks Jul 8, 2024
@ihoroleksiienko ihoroleksiienko marked this pull request as ready for review July 8, 2024 13:17
@ihoroleksiienko ihoroleksiienko changed the title Move after token transfer hooks Improve the logic of the complex balance Jul 9, 2024
@igorsenych-cw igorsenych-cw merged commit 63a0831 into main Jul 29, 2024
7 checks passed
@igorsenych-cw igorsenych-cw deleted the ref_after_token_transfer branch July 29, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants