ditto-lab / ditto

NFT Future protocol
MIT License
60 stars 3 forks source link

NFT trade can revert on `supportsInterface` and `royaltyInfo` #83

Closed 0xbok closed 1 year ago

0xbok commented 1 year ago

royaltyInfo may also return address(0) as royalty receiver. Some erc20 tokens revert on transfer to zero address.

0xbok commented 1 year ago

Suggested fix:

calvbore commented 1 year ago

Are there any significant ERC20s that revert on transfer to the zero address? That is pretty irregular behaviour isn't it?

How would using low level calls address this issue?

0xbok commented 1 year ago

Not sure which existing tokens revert on transfer to zero address, but OZ does this: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol#L232. Since we are building it for general erc20s, we should accommodate this case.

low lever calls only address the royaltyInfo and supportsInterface revert. Like try catch.

0xbok commented 1 year ago

USDC revert on zero address https://etherscan.io/address/0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf#code