Déploiement de la collecte NFT sur CSC. hé hé hé ! | par zeroxlive | Coinmons | mai 2022

IAavec
Différence entre les ressources fongibles et non fongibles
mkdir crc721
npm install --save-dev hardhat
npx hardhat
npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers
npm install @openzeppelin/contracts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

// Import the openzepplin contracts
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

// GameItem is ERC721 signifies that the contract we are creating imports ERC721 and follows ERC721 contract from openzeppelin
contract nft is ERC721 {

constructor() ERC721("simple nft", "NFT") {
// mint an NFT to yourself
_mint(msg.sender, 1);
}
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract nft is ERC721 {

constructor() ERC721("simple nft", "NFT") {
// mint an NFT to yourself
_mint(msg.sender, 1);
}
}

npx hardhat compile
const { ethers } = require("hardhat");

async function main() {
/*
A ContractFactory in ethers.js is an abstraction used to deploy new smart contracts,
so nftContract here is a factory for instances of our GameItem contract.
*/
const nftContract = await ethers.getContractFactory("NFT");

// here we deploy the contract
const deployedNFTContract = await nftContract.deploy();

// print the address of the deployed contract
console.log("NFT Contract Address:", deployedNFTContract.address);
}

// Call the main function and catch if there is any error
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

require("@nomiclabs/hardhat-waffle");// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
module.exports = {
solidity: "0.8.10",
networks: {
csc: {
url: "https://testnet-rpc.coinex.net",
accounts: ["YOUR-PRIVATE_KEY"],
}
}
};
npx hardhat run scripts/run.js --network csc

Rejoignez Coinmonks Telegram Channel et Youtube Channel pour en savoir plus sur le trading et l’investissement cryptographiques

Source medium.com

Investissez avec l'IA
Comet by Perplexity
1 mois de Pro offert

Donnez votre avis

Soyez le 1er à noter cet article


Partagez cet article maintenant !

Envoyez simplement nos contenus crypto et finance à vos proches.