Skip to content

SPGNFT with default disabled approvals #223

@Ramarti

Description

@Ramarti

Description and context

Typically, crypto drainers work by tricking users into signing transactions that would empty their wallet of assets instead of their intended transaction. For ERC721 is typically done through the approve or permit method when available (as seen in the popular Inferno Drainer)

For projects in the Story eco where IP Registration is a more web2 experience transparent to the user, we can assume that approve related functionality is not important for them at first. With the prevalence of drainers in the crypto space, this becomes an attack vector for the unsuspecting user going to web3 UX (or even the project's backend handling wallets)

Lens-v2 introduced ProtocolGuardians to protect user profiles (which were NFTs)
https://github.com/lens-protocol/LIPs/blob/main/LIPs/lip-4.md

We could give the deployer of an SPGNFT the option to start with ERC721 approve disabled by default, with every user having the option to enable it when they needed (for example right before listing an ERC721 in a marketplace).

Suggested solution

I would favor a simple flag. Pseudocode:

contract SPNFTExplicitApproval is SPNFT {
  // ...
  mapping(address, bool) approvalEnabled; // default is false for every address

  modifier ifApprovalEnabled(uint256 id) {
    require(approvalEnabled[ownerOf(id)]), "approvalDisabled");
    _;
  }
  
  function approve(address to, uint256 tokenId) ifApprovalEnabled(tokenId) {
    super.approve(to, tokenId);
  }

  function enableApprovals(uint256 id) onlyOwner(id) {
    approvalEnabled[ownerOf(id)] = true;
  }

}

Since this adds an SLOAD to approve, some projects might chose to go with the regular SPNFT

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions