You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently stumbled across a great feature request to add a block list to combat marketplaces not respecting royalties. I think the proposal was good, but it was unfortunately not very performant because the creator could have used a mapping instead as it is more efficient. I’ve rewritten the proposal using a more efficient mapping instead.
mapping (uint128 => address[]) public blockedAddrs;
uint256 numberOfBlockedAddressesBecauseOfCreatorRoyaltiesDisrespectingCreators = 0;
function populateBlockedAddrs(Address addr) public onlyOwner{
blockedAddrs[numberOfBlockedAddressesBecauseOfCreatorRoyaltiesDisrespectingCreators] = addr;
numberOfBlockedAddressesBecauseOfCreatorRoyaltiesDisrespectingCreators++;
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual override(ERC721, ERC721Enumerable) {
uint256 i = 0;
while(i < numberOfBlockedAddressesBecauseOfCreatorRoyaltiesDisrespectingCreators) {
for (uint256 j = 0; j < blockedAddrs[i].length; j++) {
require(msg.sender != blockedAddrs[i][j], "Thanks for the consideration");
j = j + 1;
}
unchecked {
i++;
}
}
super._beforeTokenTransfer(from, to, tokenId);
}
The text was updated successfully, but these errors were encountered:
After much discussion, we have decided it is unsuitable for inclusion, citing reasons highlighted in #416.
However, due to the supposedly greatly improved efficiency of this implementation, we may leave this request open for a while as a reference for any devs aspiring to build a similar feature.
Hi team,
I recently stumbled across a great feature request to add a block list to combat marketplaces not respecting royalties. I think the proposal was good, but it was unfortunately not very performant because the creator could have used a mapping instead as it is more efficient. I’ve rewritten the proposal using a more efficient mapping instead.
The text was updated successfully, but these errors were encountered: