Skip to content

Instantly share code, notes, and snippets.

@ihor
Created February 22, 2023 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihor/dc6fb8150e35dc42f132d81e9700a742 to your computer and use it in GitHub Desktop.
Save ihor/dc6fb8150e35dc42f132d81e9700a742 to your computer and use it in GitHub Desktop.

The current implementation of the set_approval_for_all method in the CEP-78 NFT standard does not behave as expected. Ideally, this method should allow for the approval of multiple operators, enabling token owners to list their tokens on multiple marketplaces. However, this is not currently possible with the CEP-78 standard, limiting it to exclusive listings.

The method only approves tokens owned at the time of the entry point call, and does not cover tokens acquired later. This is because it simply loops over all of the owner's tokens and approves them individually, making the operation very expensive in terms of gas usage. In fact, a warning in the comments next to the entry point advises developers to "DO NOT invoke this entrypoint unless absolutely necessary."

This unexpected behavior may also confuse dApp developers who are familiar with Ethereum's ERC-721 standard, potentially hurting the adoption of the Casper network.

To address these issues, we propose changing the set_approval_for_all implementation in the following ways:

  1. The entry point should allow owners to approve operators to manage all of their tokens in the contract, rather than individual tokens owned at the time of execution.
  2. The entry point should make it possible to allow approval of multiple operators.
  3. The entry point should have a corresponding getter method called is_approved_for_all, which returns whether an operator is approved to manage all tokens owned by an owner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment