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:
- User calls our program and signs.
- The program calls
Approve
on a user NFT wallet. - The program calls
FreezeDelegatedAccount
. - NFT is staked.
However, the user then can:
- Call
Revoke
on their wallet. - Call
Approve
for their own account. - Call
ThawDelegatedAccount
to unfreeze an NFT. - NFT is thawed but our program doesn't know about it.