0

error is coming 'token is not own' what i did.

I approved the contract to spend tokens from the token owners account lets say account A approved the contract address

function _setApprovalForAll(
         address owner,
        address operator,
        bool approved
    ) internal virtual override {
        emit ApprovalForAll(owner, operator, approved);
    }

After that i switch the Account to B user to spin the spinner and win tokens which contract will send to B user on A behalf

function winNft (uint winningNft ) internal  returns(bool){
    for(uint i=0; i < winningNft; i++){
        uint256 winningId =  block.timestamp % ((tokens.length-1) - min + 1) + min;
      _transferFrom(address(masterWallet),msg.sender,tokens[winningId]);

        tokens[winningId]=tokens[tokens.length-1];
        tokens.pop();
    }
   return true
    }
2
  • Can you share the whole contract? In particular the implementation of _transferFrom. The implementation of _setApprovalForAll doesn't do any change to the contract. The OpenZeppelin implementation stores changes in a mappgin.
    – Ismael
    Commented Mar 1, 2022 at 22:49
  • Thanks for help . i fix my problem by making the separate contract to allow contract to spend tokens on token holders behalf. Commented Mar 2, 2022 at 10:46

1 Answer 1

0

i fix my problem by making the separate contract to allow contract to spend tokens on token holders behalf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.