From 532376dc729f2291a1255ef2212f23f3664bf4f3 Mon Sep 17 00:00:00 2001 From: Gino Date: Wed, 6 Dec 2023 11:19:24 +0100 Subject: [PATCH] create nft minter inside destination receive --- contracts/CrossNftDestinationMinter.sol | 15 +++++++++++++++ contracts/MyNFT.sol | 21 --------------------- 2 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 contracts/MyNFT.sol diff --git a/contracts/CrossNftDestinationMinter.sol b/contracts/CrossNftDestinationMinter.sol index 57f20bb..2320532 100644 --- a/contracts/CrossNftDestinationMinter.sol +++ b/contracts/CrossNftDestinationMinter.sol @@ -6,6 +6,21 @@ import {OwnerIsCreator} from "@chainlink/contracts-ccip/src/v0.8/shared/access/O import {CCIPReceiver} from "@chainlink/contracts-ccip/src/v0.8/ccip/applications/CCIPReceiver.sol"; import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol"; +contract MyNFT is ERC721URIStorage, OwnerIsCreator { + // string constant TOKEN_URI = + // "https://ipfs.io/ipfs/QmYuKY45Aq87LeL1R5dhb1hqHLp6ZFbJaCP8jxqKM1MX6y/babe_ruth_1.json"; + uint256 internal tokenId; + + constructor() ERC721("MyNFT", "MNFT"){} + + function mint(address to, string memory TOKEN_URI) public onlyOwner { + _safeMint(to, tokenId); + _setTokenURI(tokenId, TOKEN_URI); + unchecked { + tokenId++; + } + } +} contract CrossNftDestinationMinter is CCIPReceiver, OwnerIsCreator{ MyNFT public nft; uint256 price; diff --git a/contracts/MyNFT.sol b/contracts/MyNFT.sol deleted file mode 100644 index 444c31c..0000000 --- a/contracts/MyNFT.sol +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.20; - -import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; -import "@openzeppelin/contracts/access/Ownable.sol"; - -contract MyNFT is ERC721URIStorage, Ownable { - // string constant TOKEN_URI = - // "https://ipfs.io/ipfs/QmYuKY45Aq87LeL1R5dhb1hqHLp6ZFbJaCP8jxqKM1MX6y/babe_ruth_1.json"; - uint256 internal tokenId; - - constructor(address initialOwner) ERC721("MyNFT", "MNFT") Ownable(initialOwner){} - - function mint(address to, string memory TOKEN_URI) public onlyOwner { - _safeMint(to, tokenId); - _setTokenURI(tokenId, TOKEN_URI); - unchecked { - tokenId++; - } - } -} \ No newline at end of file