Submitted by MiloTruck
The LSP8CompatibleERC721 contract is a wrapper around LSP8, which is meant to function similarly to ERC-721 tokens. One of its implemented functions is ERC-721s approve():
LSP8CompatibleERC721.sol#L155-L158
As approve() calls authorizeOperator() from the LSP8IdentifiableDigitalAssetCore contract, only the owner of tokenId is allowed to call approve():
LSP8IdentifiableDigitalAssetCore.sol#L105-L113
However, the implementation above deviates from the ERC-721 specification, which mentions that an authorized operator of the current owner should also be able to call approve():
This means, anyone who is an approved operator for tokenIds owner through setApprovalForAll() should also be able to grant approvals. An example of such behaviour can be seen in Openzeppelins ERC721 implementation:
ERC721.sol#L121-L123
As LSP8CompatibleERC721s approve() functions differently from ERC-721, protocols that rely on this functionality will be incompatible with LSP8 tokens that inherit from LSP8CompatibleERC721.
For example, in an NFT exchange, users might be required to call setApprovalForAll() for the protocols router contract. The router then approves a swap contract, which transfers the NFT from the user to the recipient using transferFrom().
Additionally, developers that expect LSP8CompatibleERC721 to behave exactly like ERC-721 tokens might introduce bugs in their contracts, due to the difference in approve().
Modify approve() to allow approved operators for tokenIds owner to grant approvals:
ERC721
skimaharvey (LUKSO) disputed and commented:
MiloTruck (warden) commented:
skimaharvey (LUKSO) confirmed and commented:
