get_approved - Returns the approved account ID for this token if any.
is_approved_for_all - Returns true if the operator is approved by the owner.
We can have one method with the next signature:
/// Returns `true` if the operator is approved by the owner to withdraw `id` token.
/// If `id` is `None`, returns `true` if the operator is approved to withdraw all owner's tokens.
fn allowance(owner: AccountId, operator: AccountId, id: Option<Id>) -> bool
Instead of two methods:
set_approval_for_all - Approves or disapproves the operator for all tokens of the caller.
approve - Approves the account to transfer the specified token on behalf of the caller..
We can have one method with the next signature:
/// Approves `operator` to withdraw the `id` token from the caller's account.
/// If `id` is `None` approves or disapproves the operator for all tokens of the caller.
fn approve(operator: AccountId, id: Option<Id>, approved: bool) -> Result<(), PSP34Error>
It is simpler in implementation. That will reduce the size of the contracts and add a new feature that several persons have the ability to withdraw the token(when previously it can be done by operators and one person, now operators and several persons).
Instead of two methods:
get_approved
- Returns the approved account ID for this token if any.is_approved_for_all
- Returnstrue
if the operator is approved by the owner.We can have one method with the next signature:
Instead of two methods:
set_approval_for_all
- Approves or disapproves the operator for all tokens of the caller.approve
- Approves the account to transfer the specified token on behalf of the caller..We can have one method with the next signature:
It is simpler in implementation. That will reduce the size of the contracts and add a new feature that several persons have the ability to withdraw the token(when previously it can be done by operators and one person, now operators and several persons).