7

There are a few instructions in Metaplex which would allow a delegate to freeze an NFT in user wallet, so I though it would be possible to stake user NFTs by freezing them in their wallets, so that I never need to transfer it from a user. However, it doesn't seem to work, as a user would be able to first call Revoke, then call Approve for their own account and after that call ThawDelegatedAccount on their own token, and our program wouldn't know that an NFT got unfrozen. So what is the use for those two instructions? And are there any other solutions for staking which do not involve creating a wallet and transferring NFTs from users?

The solution for staking (which sadly doesn't seem to work) was:

  1. User calls our program and signs.
  2. The program calls Approve on a user NFT wallet.
  3. The program calls FreezeDelegatedAccount.
  4. NFT is staked.

However, the user then can:

  1. Call Revoke on their wallet.
  2. Call Approve for their own account.
  3. Call ThawDelegatedAccount to unfreeze an NFT.
  4. NFT is thawed but our program doesn't know about it.

1 Answer 1

5

Once the token account is frozen, the owner cannot revoke, approve or thaw this is the whole point of being frozen, the user cannot do anything until the freeze_authority, in this case the metaplex PDA and indirectly the staking program thaws it.

The code checking to prevent revoke if the token account is frozen

https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/processor.rs#L397-L399

2
  • Is there anything the user can do in this state. e.g. burn?
    – C.OG
    Aug 5, 2022 at 17:57
  • You can read the spl-token program, there is nothing you can do once it is frozen. Each process is guarded by is_frozen()
    – Arowana
    Aug 10, 2022 at 6:06

Your Answer

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

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