我有这个智能合约..但它给了我这个错误..我知道有很多问题有关于这件事,但没有找到答案,包括两个合同
从坚固性:类型错误:合同"ConcreteNFTmarketplace"应标记为摘要。
即使NFTmarketplace被标记为抽象,为什么
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
abstract contract NFTmarketplace is ERC721URIStorage, IERC721Receiver {
constructor() ERC721("astro market", "astro"){
owner = payable(msg.sender);
}
}
contract ConcreteNFTmarketplace is NFTmarketplace {
function onERC721Received(address _from, uint256 _tokenId) external {
// Transfer the received ERC721 token to the owner
transferFrom(_from, address(this), _tokenId);
}
}
2条答案
按热度按时间oipij1gg1#
我已经编辑了你的代码,一切正常.关于嵌入IERC721Receiver,实际上没有必要,因为要接收nfts,你可以像我在ConcreteNFTmarketplace中那样在ERC721Received上实现函数,但你也可以继承它,没有任何错误.
ne5o7dgx2#
不需要从IERC721Receiver继承。