A Solidity smart contract for minting and managing NFTs that represent research contributions on Treekipedia. Built on the ERC721 standard.
CELO Mainnet: 0x5Ed6240fCC0B2A231887024321Cc9481ba07f3c6
see the deployed contract on celoscan...
Ethereum Sepolia: 0x1Ad2317DEBD2ac4730641A1E317B204bd2fEeFA8
The Research Contreebution NFT contract allows for the creation, transfer, and management of unique tokens that represent research contributions on Treekipedia. Each token can store metadata via a URI, making it perfect for linking to research content stored on IPFS or other decentralized storage solutions.
- ERC721 Compliance: Fully compatible with the ERC721 standard for non-fungible tokens
- Metadata Storage: Each token can store custom metadata through URIs
- Burning Capability: Tokens can be permanently destroyed if needed
- Access Control: Only the contract owner can mint new tokens
- Name: Research Contreebution
- Symbol: treekipediaRSRCH
- Solidity Version: ^0.8.20
- OpenZeppelin Version: 5.0.0
For Celo L1 Remix does not support Solidity compiler version 0.8.20 and above for EVM versions above Paris.
A workaround is to go into the advanced settings for the compiler in Remix and choose Paris as the EVM version.
see more at CELO documentation
Initializes the contract with the specified initial owner.
Mints a new token and assigns it to the specified address with the given metadata URI.
- Only callable by the contract owner
- Parameters:
to: The address that will receive the minted tokentokenId: The ID to assign to the new tokenuri: The metadata URI for the token
Returns the metadata URI for a specific token.
- Parameters:
tokenId: The ID of the token to query
Determines if the contract supports a specific interface.
- Parameters:
interfaceId: The interface identifier to check
This contract inherits from several OpenZeppelin contracts, providing additional functionality:
-
From ERC721:
balanceOf(address): Returns the number of tokens owned by an addressownerOf(uint256): Returns the owner of a specific tokensafeTransferFrom(address, address, uint256): Safely transfers a tokensafeTransferFrom(address, address, uint256, bytes): Safely transfers a token with additional datatransferFrom(address, address, uint256): Transfers a tokenapprove(address, uint256): Approves an address to transfer a specific tokensetApprovalForAll(address, bool): Approves an address to transfer all tokensgetApproved(uint256): Gets the approved address for a tokenisApprovedForAll(address, address): Checks if an operator is approved for all tokens
-
From ERC721Burnable:
burn(uint256): Burns (destroys) a specific token
-
From Ownable:
owner(): Returns the address of the current ownerrenounceOwnership(): Leaves the contract without an ownertransferOwnership(address): Transfers ownership to a new address
-
Install dependencies:
npm install @openzeppelin/[email protected]
-
Compile the contract:
npx hardhat compile
-
Deploy to your chosen network:
npx hardhat run scripts/deploy.js --network <your-network>
const { ethers } = require("hardhat");
async function main() {
const [deployer] = await ethers.getSigners();
console.log("Deploying contracts with the account:", deployer.address);
const ResearchContreebution = await ethers.getContractFactory("ResearchContreebution");
const contract = await ResearchContreebution.deploy(deployer.address);
await contract.waitForDeployment();
console.log("ResearchContreebution deployed to:", await contract.getAddress());
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});This project is licensed under the MIT License.