Say I want to take a cut of an NFT each time the token is transferred. If I were to change the openzeppelin erc721 transfer function to transfer 1% of the NFTs holding to myself, can that standard still be used in exchanges?
I'm currently evaluating the same. Was thinking if it would be possible to higher the gas transfer price to then cut x percent and send this to a constant wallet.
Still unsure if this would work, but I think what you originally would do is a Royaltie, that could been integrated like this, but only works on exchanges: https://eips.ethereum.org/EIPS/eip-2981
If someone has an idea for putting a fee into the transfer action would be nice to hear.
If it implements all functions on the IERC721 interface is not falling from the standard. As @Airwave mentioned there is the
EIP2981 standard for royalties and you can see OpenZeppen implementation here, that is still under revision and to be released on their next version but right now is on the open review period.
Your override of the transfer method should just include a call to the EIP2981
royaltyInfo function, and send the returned
royaltyAmount to the returned
receiver that would be you in your case. And remember to call the method to set the royalty before executing any transfer.
Disclaimer: I do work at OpenZeppelin but this answer was written as a personal contribution.