I am making an ERC-721 smart contract and want a feature where an NFT with special perks can only be claimed when it has been transferred to a different wallet. Scenario: Person A mints an NFT with special perks but cannot claimed bc it has not been transferred/sold to a different wallet. Person A sells the NFT to person B. Now person B can claim the perks since there has been a transfer on the blockchain. How would I implement this in solidity. I am thinking of a counter that keeps track of times the claimable NFT has been transferred. So if counter > 1 : NFT is claimable. Any ideas??
1 Answer
I guess the easy way would be when user A mints the NFT it gets minted to the contract itself and when someone buys it then the ownership gets transferred to that person.
This wouldn't allow anyone to transfer the NFTs which have been minted but not sold, because the contract has the ownership.
Using counters doesn't seem an optimized idea as you would need individual counters for each NFT.
My approach can also be security vulnerable but we can think more on this.
-
What I learned is that "erc-2981 -> There is no way of knowing if a NFT transfer included some kind of sale. A marketplace needs to implement some form of SC that would take funds/NFT and move them around. The SC itself is the "proof" that it was sold and only if this SC moved the funds/NFT, it counts a sold. All other NFT movement would be a normal transfer." May 25 at 23:01
-
and what I was thinking is should I incorporate a smart contract similar to what market places are using to identify a sale. That contract will then trigger an update in a claimable variable for each token. The problem is not all tokens will have a claimable attribute but this way makes it so that all tokens do. May 25 at 23:01