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

feat: psp22 standard for decrease_allowance and burn pallet methods #322

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

chungquantin
Copy link
Collaborator

@chungquantin chungquantin commented Oct 2, 2024

Discussion: #300 (comment)

  • For decrease_allowance: Fungibles::decrease_allowance() saturating_sub the value, it should checked_sub and throw an error instead. Hence, we don't have to handle InsufficientAllowance on the contract side.
  • For burn: InsufficientBalance case is not returned in the burn pallet api if the value exceeds the minted value. In decrease_balance method of pallet-assets, it is also saturating_sub.

NOTE: Original PR #311 includes file permission changes which is hard to revert and makes the commit history unclean. Hence, I created this PR to substitute the original on and move all comments / resolve comments left by reviewers.

@chungquantin chungquantin changed the base branch from main to chungquantin/main-psp22_pallet October 2, 2024 10:42
@chungquantin chungquantin changed the base branch from chungquantin/main-psp22_pallet to main October 2, 2024 10:48
@chungquantin chungquantin marked this pull request as ready for review October 2, 2024 10:49
@chungquantin chungquantin requested review from Daanvdplas and evilrobot-01 and removed request for Daanvdplas October 2, 2024 10:49
@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 76.78571% with 13 lines in your changes missing coverage. Please review.

Project coverage is 51.57%. Comparing base (5083a46) to head (d8a1bc4).

Files with missing lines Patch % Lines
pallets/api/src/fungibles/weights.rs 50.00% 13 Missing ⚠️
@@            Coverage Diff             @@
##             main     #322      +/-   ##
==========================================
+ Coverage   51.47%   51.57%   +0.10%     
==========================================
  Files          48       48              
  Lines        4894     4907      +13     
  Branches     4894     4907      +13     
==========================================
+ Hits         2519     2531      +12     
- Misses       2326     2327       +1     
  Partials       49       49              
Files with missing lines Coverage Δ
pallets/api/src/fungibles/mod.rs 92.51% <100.00%> (-0.39%) ⬇️
pallets/api/src/fungibles/tests.rs 99.69% <100.00%> (+<0.01%) ⬆️
pallets/api/src/fungibles/weights.rs 50.00% <50.00%> (ø)

Copy link
Collaborator

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

Looks great, and thank you for getting the permissions issue resolved. 🙌

@Daanvdplas Daanvdplas merged commit dcd465d into main Oct 2, 2024
26 checks passed
@Daanvdplas Daanvdplas deleted the chungquantin/feat-impl_psp22_pallet branch October 2, 2024 20:16
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.

4 participants