This repository contains the smart contract and scripts for deploying and interacting with Music NFTs on the Energi blockchain. The contract is based on the ERC721 standard and is designed for minting music-related non-fungible tokens (NFTs).
- Minting Fees: The minting fees are paid by the minter (the user who mints the NFT). The mint price is set by the contract owner, and the owner can modify this fee at any time.
- Royalties: The contract owner does not receive royalties from the minting or resale of NFTs. If the contract is modified to include royalties, this can be done through custom implementations of the ERC721 standard.
- Base Contract: The base contract used is OpenZeppelin’s
BeaconProxy
. This allows the contract to be upgradeable while ensuring flexibility in contract functionality and ownership management. - Upgradeable NFT contract
- Energi blockchain compatible
- OpenZeppelin security standards
- Minting Fee: A minting fee is set by the contract owner, which must be paid by the minter. The current default fee is set to
0.05 NRG
. - Royalty Info: By default, no royalties are collected by the owner during NFT minting or resales. Royalties can be added if desired by extending the ERC721 standard with OpenZeppelin’s
ERC2981
interface for royalties. - Upgradeable Contract: The contract uses OpenZeppelin’s
BeaconProxy
to allow future upgrades of the logic contract without changing the storage of previously minted NFTs.
Before getting started, ensure you have the following installed:
- Node.js (version 14 or higher)
- Hardhat for contract compilation and deployment
- Metamask or another Ethereum-compatible wallet
- Ether or test tokens for paying gas on the network (Energi Testnet or Mainnet)
Clone the repository and install the required dependencies:
git clone https://github.com/smartnfts/music-nft-erc721.git music-nft-moonshot
cd music-nft-moonshot
npm install
The contract is written in Solidity and can be compiled using Hardhat. To compile the contract:
npx hardhat compile
This will compile the contract and generate the necessary artifacts.
To deploy the contract, use the following command. Ensure that you’ve updated your .env
file with the correct RPC URL and your private key.
- Create a
.env
file in the root of the project directory with the following content:
RPC_URL="https://nodeapi.test.energi.network" # Energi testnet URL
PRIVATE_KEY="your_private_key" # Replace with your private key
MUSIC_NFT_ADDRESS="0xab77c088e806D30D7269e06a23C0B007Ee93cD07" # Replace with Deployed contract address
BASEURI="ipfs://QmeS1BSypLJ3KP3NmpokErySopqqrUos8m6ULAygMCJh79/" # Replace with BASEURI to metadata
- Deploy the contract using Hardhat:
npx hardhat run scripts/deploy.js --network energiTestnet
This will deploy the contract to the Energi Testnet. You can change energiTestnet
to energiMainnet
if deploying to the mainnet.
To verify the contract on the Energi Block Explorer run the following command:
npx hardhat verify --network <network_name> <contract_address> "<arg1>" <arg2> "<arg3>"
Note
arg
in quotes are of type string. Do not need to put quotes for type decimal/number.
Example:
npx hardhat verify --network energiTestnet 0xd1985BBd1F0B6D0276C0281F2dBc8255Ed95ae53 "Moonshot by Violetta Zironi Test" "MSVZ" 2500 "0xd66Ee1691Ffe9F7d476Afc5d90C38e41cB44DC3E"
To mint an NFT, use the following script:
npx hardhat run scripts/mint-nft.js --network energiTestnet
The script will mint a new NFT for the user and will charge the minting fee.
To mint multiple NFTs, add your private key in PRIVATE_KEY (line 10) on the bash script bin/mint.sh
.
Update line 13, to specify how many NFTs you want to mint.
After saving the changes, run the following:
bin/mint.sh
- Minting Fee: The minting fee is set in the contract and can be updated by the contract owner. The fee is required by users who wish to mint NFTs.
- Upgradeable Contracts: The contract uses OpenZeppelin's
BeaconProxy
, allowing future upgrades to the logic while maintaining the same storage and NFTs minted. - Ether Payment: When users mint NFTs, they will need to pay the minting fee in NRG.
This project is licensed under the MIT License - see the LICENSE file for details.