Skip to content

Commit 5d014e2

Browse files
committed
add root nft
0 parents  commit 5d014e2

12 files changed

+9150
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
.env
3+
coverage
4+
coverage.json
5+
typechain
6+
typechain-types
7+
8+
# Hardhat files
9+
cache
10+
artifacts
11+

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Root Network
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Root-NFT
2+
3+
An NFT721 Contract for Root based on [MintChain](https://www.mintchain.io/) and [RootChain](https://sdk.root.xyz/rootchain/intro)!
4+
5+
## Basic Usage
6+
7+
- Test on localhost
8+
1. npx hardhat node
9+
2. npx hardhat test --network localhost
10+
11+
- Deploy to mint-sepolia
12+
1. `npx hardhat run scripts/deploy.js --network mint-sepolia`
13+
14+
- Deploy to root-testnet
15+
1. `npx hardhat run scripts/deploy.js --network l2root-testnet`
16+
17+
18+
## Contracts
19+
20+
| Network | Address |
21+
| - | - |
22+
| mint-sepolia | [0xaa48b78DaE4d5e1e67025833AbEB3C8ABE900202](https://sepolia-testnet-explorer.mintchain.io//address/0xaa48b78DaE4d5e1e67025833AbEB3C8ABE900202) |
23+
| l2root-testnet | [0xb19b36b1456E65E3A6D514D3F715f204BD59f431](https://testnet-l2explorer.onebitdev.com/address/0xb19b36b1456E65E3A6D514D3F715f204BD59f431) |
24+
25+

contracts/RootNFT.sol

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.19;
3+
4+
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
5+
import "@openzeppelin/contracts/access/Ownable.sol";
6+
7+
contract RootNFT is ERC721, Ownable {
8+
constructor(string memory name, string memory symbol)
9+
ERC721(name, symbol)
10+
{}
11+
12+
// Allows minting of a new NFT
13+
function mintCollectionNFT(address collector, uint256 tokenId) public onlyOwner() {
14+
_safeMint(collector, tokenId);
15+
}
16+
17+
struct Participant {
18+
address collector;
19+
uint256 tokenId;
20+
}
21+
22+
// Allows minting of a new NFT
23+
function mintBatchCollectionNFT(Participant[] calldata ps) public onlyOwner() {
24+
for(uint i=0; i< ps.length; i++){
25+
Participant calldata p = ps[i];
26+
_safeMint(p.collector, p.tokenId);
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)