我有一个 openZeppelin ERC721 NFT 合约 (MyNFTPrice.sol) 和一个单独的 PaymentSplitter 合约。我的理解是这两个合约需要单独部署。我的问题是,如何将铸币价格从我的 NFT 合约 (MyNFTPrice.sol) 发送到 PaymentSplitter 合约?目前,铸造 NFT 的价格位于 MyNFTPrice.sol 合约地址中。
MyNFTPrice.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract MyNFTPrice is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() public ERC721("MyNFTPrice", "NFTPRICE") {}
// Mint new NFT
function mintNFT(address recipient, string memory tokenURI) public payable {
require(msg.value >= 50000000000000000, "You need 0.05 ETH to mint the NFT");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(recipient, newItemId);
_setTokenURI(newItemId, tokenURI);
}
}