Using the wizard how could I achieve this.
Basically I want to FORCE the user to OWN an ERC721 to hold future ERC721, ERC1155 and ERC20 in my ecosystem.
Only problem is that the ERC721 is already created, so I would like to check if msg.sender has >= 1 of 0x000000 (erc721), or fail
Does anybody have an idea?
Cast the address of your erc721 contract as IERC721 on the new contract and call balance method with user address
IERC721 nft721 = IERC721(addresscontract);
uint256 balance= nft721.balanceOf(msg.sender);
You can define the IERC721 as property of your contract if you want, so you don't need to cast it anymore.
I am not be the smartest developer, or experienced....
I tried this;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract NFT2 is ERC721, Ownable {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("MyToken", "MTK") {}
function safeMint(address to) public onlyOwner {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
}
IERC721 nft721 = IERC721(0xf8e81D47203A594245E36C48e151709F0C19fBe8);
uint256 balance= nft721.balanceOf(msg.sender);
}
Above is NFT2 and the IERC721(0xf8e81.....) is NFT 1, but I am able to own these (both) on any wallet I try to send the minted NFT's to?
What am I missing here?
I don't know why you try to achieve maybe this