RGB-WG / rgb-std

RGB standard libs for WASM & low-level integrations (no FS/networking)
https://rgb.tech
Apache License 2.0
66 stars 30 forks source link

check add and sub operation for owned fraction #229

Closed cymqqqq closed 4 months ago

cymqqqq commented 4 months ago

Background: In the rgb21 contract, we have error fractionOverflow "The amount of token fractions in outputs exceeds 1", so I think maybe we should have a check add/sub-operation to check if or not the owned fraction is overflow(or the other fraction checks for add/sub-operation), also we can make a change for the allocation. It's similar to the rgb20 amount.

Description:

add check_add, check_sub, check_addassign, check_subassign, and other methods for the Ownedfraction.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 75.86207% with 21 lines in your changes missing coverage. Please review.

Project coverage is 17.6%. Comparing base (1c5b910) to head (7f637c6). Report is 4 commits behind head on master.

Files Patch % Lines
invoice/src/data.rs 75.9% 21 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #229 +/- ## ======================================== + Coverage 17.0% 17.6% +0.5% ======================================== Files 37 37 Lines 7379 7535 +156 ======================================== + Hits 1257 1323 +66 - Misses 6122 6212 +90 ``` | [Flag](https://app.codecov.io/gh/RGB-WG/rgb-std/pull/229/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RGB-WG) | Coverage Δ | | |---|---|---| | [rust](https://app.codecov.io/gh/RGB-WG/rgb-std/pull/229/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RGB-WG) | `17.6% <75.9%> (+0.5%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=RGB-WG#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.