rgb-std
rgb-std copied to clipboard
add statechange for owned-fraction in rgb21 invoice data
Background:
Now there are Amount
, and Ownedfraction
in the RGB invoice module, that is
pub struct Amount( u64);
and pub struct OwnedFraction(u64);
. We can perform a state change operation for the amount type when we want to build a transfer
transition, and there is also the check_add
method for the amount type.
Both the StateChange
and check_add
for the amount type can perform algorithm operation(+, -).
Then for the rgb21 invoice, there is Ownedfraction which is u64
similar to Amount
, and now if we want to build a transfer
operation for the rgb21 contract, we just push all of them(owned fraction, token index) into the data state. So I think maybe there is also a state change and a check_add
method requirement for the Ownedfraction
type, and then the user can add an owned fraction when they want to transfer. Finally, they can push (changed owned fraction, token index) into a data state.
Description:
impl StateChange for Ownedfraction