Why are we using payable modifiers in the ERC20 functions below?

function transferFrom(address _from, address _to, uint256 _tokenId) external **payable** {
    require (zombieToOwner[_tokenId] == msg.sender || zombieApprovals[_tokenId] == msg.sender);
    _transfer(_from, _to, _tokenId);

function approve(address _approved, uint256 _tokenId) external **payable** {


1 Answer 1


The payable keyword is required for functions and addresses to be able to receive Ether.

By declaring it in transferFrom() and approve(), you are not only able to pay a contract with your ERC20 token, but also with Ether.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.