What's up everyone!

I'm working on adding royalties to my ERC-721 smart contract. My goal is to give royalties back to the artist whenever someone mints a new token or transfers a token.

However, now I'm getting an error when I try to migrate my contract.

TypeError: Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested


This is my contract

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./@rarible/royalties/contracts/impl/RoyaltiesV2Impl.sol";
import "./@rarible/royalties/contracts/LibPart.sol";
import "./@rarible/royalties/contracts/LibRoyaltiesV2.sol";

contract EpicTest is ERC721, Ownable, RoyaltiesV2Impl {
    using SafeMath for uint256;
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIdTracker;

    uint256 public constant MAX_ELEMENTS = 1000;
    bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
    uint256 private startSales = 1634124766;
    address public constant artistAddress = 0xcBC0x0x0x0x0x0x0x0x0x0x0x0;

    constructor() ERC721("EpicTest", "ET") {}
    function mint(address _to) public onlyOwner {
        super._mint(_to, _tokenIdTracker.current());

    function setRoyalties(uint _tokenId, address payable _royaltiesReceipientAddress, uint96 _percentageBasisPoints) public onlyOwner {
        LibPart.Part[] memory _royalties = new LibPart.Part[](1);
        _royalties[0].value = _percentageBasisPoints;
        _royalties[0].account = _royaltiesReceipientAddress;
        _saveRoyalties(_tokenId, _royalties);

    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) {
        LibPart.Part[] memory _royalties = royalties[_tokenId];
        if(_royalties.length > 0) {
            return (_royalties[0].account, (_salePrice * _royalties[0].value)/10000);
        return (address(0), 0);


I was using the EpicEagles contract as reference smart contract code, and they seem to be doing something similar, I might be missing a step. Any help would be appreciated, thank you in advance.

What i've tried:

  • address payable constant artistAddress = 0xcBC0x0x0x0x0x0x0x0;
  • 1
    Maybe setRoyalties(_tokenIdTracker.current(),payable(devAddress),2000); works?
    – Icarus23
    Oct 13 '21 at 22:22
  • That did the trick! Thank you.
    – jalapina
    Oct 14 '21 at 18:32

Your call is sending devAddress to the setRoyalties method which expects in its place address payable _royaltiesReceipientAddress. Since its expecting a paybale address on the function you have to convert it before it goes to the method, you can do so by casting it as payable while calling the function:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.