Who owns ERC721 tokenId 0 - And use wallet in function

Hi

Is there any way to get the address of the wallet which owns the first ever minted (id=0) nft from the bored Ape Club (0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d).

I would like to put this into a function and whenever my solidity code mints 100 tokens, it will also mint 1 token for the owner of the above mentioned NFT:

I have the code below which enables my to manually change the address of the "extra" mint, but how can I check automatically which wallet holds the nft, and update the extra mint wallet?

    uint256 public extra;

    function setextra(uint256 _extra) public onlyOwner {
        extra = _extra;
        return;
    }

    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
        _mint(address(uint160(extra)), 100);
    }

Instead of storing wallet address, you could store bored ape contract instead and get the owner of token id 0 from that contract..

IERC721 apeToken = new IRC721(0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D);

address firstApeOwner = apeToken.ownerOf(0);

Thank you!!!!!

I made this:

IERC721 apeToken = IERC721(0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d);

and this in my mint function:

   function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
        address firstApeOwner = apeToken.ownerOf(0);
        _mint(address(uint160(firstApeOwner)), 100);

Works perfectly

1 Like