Hi, thanks for the feedback.
I think there is some confusion. I am working with ERC721 contracts, they are transfers of NFTs.
It is not about this function:
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
Otherwise from safeTransferFrom, which only exists in ERC721, and is not present in ERC20:
nterface IERC20:
totalSupply(), balanceOf(account), transfer(to, value), allowance(owner, spender), approve(spender, value), transferFrom(from, to, value).
Whereby, in order to perform a token ERC20 transfer, it is necessary to approve the submission and then execute the transfer after.
The main function is this one, which validates the NFT property before performing the transfer, and which has public visibility:
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
transferFrom(from, to, tokenId);
_checkOnERC721Received(from, to, tokenId, data);
}
Therefore I think you are wrong when you state that:
"
This function is part of an internal contract mechanism that allows such a contract to execute transferFrom securely on an ERC20 token contract that does not meet the ERC20 standard."
It is a public function to send NFTs between users.
And I know of no other way to send an NFT from a dApp by a user to another.
The security is that if you don't delegate ownership of the NFT you will have to sign the send order. The user must put the address and sign the transaction as this cannot be done automatically, with the exception of NFTs marketplace intermediary contracts, who are the ones sending the NFTs, either because they are the temporary owners of the crypto assets or have delegated ownership for such uses.