fn approve_for_all(
            &mut self,
            to: AccountId,
            approved: bool,
        ) -> Result<(), Error> {
            let caller = self.env().caller();
            if to == caller {
                return Err(Error::NotAllowed)
            }
            self.env().emit_event(ApprovalForAll {
                owner: caller,
                operator: to,
                approved,
            });

            if approved {
                self.operator_approvals.insert((&caller, &to), &());
            } else {
                self.operator_approvals.remove((&caller, &to));
            }

            Ok(())
        }
/// Approves or disapproves the operator to transfer all tokens of the caller.
Approves or disapproves the operator to transfer all tokens of the caller.
Approves or disapproves the operator to transfer all tokens of the caller .
fn approve_for_all(
            &mut self,
            to: AccountId,
            approved: bool,
        ) -> Result<(), Error> {
            let caller = self.env().caller();
            if to == caller {
                return Err(Error::NotAllowed)
            }
            self.env().emit_event(ApprovalForAll {
                owner: caller,
                operator: to,
                approved,
            });
            if approved {
                self.operator_approvals.insert((&caller, &to), &());
            } else {
                self.operator_approvals.remove((&caller, &to));
            }
            Ok(())
        }
fn approve_for_all ( & mut self , to : AccountId , approved : bool , ) -> Result < ( ) , Error > { let caller = self . env ( ) . caller ( ) ; if to == caller { return Err ( Error :: NotAllowed ) } self . env ( ) . emit_event ( ApprovalForAll { owner : caller , operator : to , approved , } ) ; if approved { self . operator_approvals . insert ( ( & caller , & to ) , & ( ) ) ; } else { self . operator_approvals . remove ( ( & caller , & to ) ) ; } Ok ( ( ) ) }
Approves or disapproves the operator to transfer all tokens of the caller.
Approves or disapproves the operator to transfer all tokens of the caller .
&mut self
to
AccountId
approved
bool
&mut self
to
AccountId
approved
bool