Skip to content

Commit c8b6638

Browse files
Merge pull request #1 from darwinia-network/bear-erc721
ERC721 example
2 parents 2295dcd + 2f6f361 commit c8b6638

10 files changed

Lines changed: 4503 additions & 5 deletions

File tree

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## NPM
21
node_modules
3-
4-
token-address.txt
2+
token-address.txt
3+
.env
4+
tokens

erc20/contracts/BootcampERC20.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ contract Bootcamp is ERC20 {
1010
_mint(msg.sender, initialSupply);
1111
}
1212
}
13-

erc20/scripts/deploy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const deploy = async () => {
2323

2424
// Construct the contract instance
2525
const contract = new ethers.ContractFactory(abi, bin, wallet);
26-
26+
2727
let initialSupply = ethers.parseUnits("1000"); // Represents 1000 * 10^18
2828
let res = await contract.deploy(initialSupply);
2929
let address = await res.getAddress();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// SPDX-License-Identifier: GPL-3.0
2+
3+
pragma solidity ^0.8.17;
4+
5+
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
6+
7+
contract Bootcamp is ERC721URIStorage {
8+
uint256 public nextTokenId;
9+
10+
constructor() ERC721("Lesson", "LS") {}
11+
12+
function mint(address to, string memory tokenURI) public returns (uint256) {
13+
uint256 tokenId = nextTokenId++;
14+
15+
_mint(to, tokenId);
16+
_setTokenURI(tokenId, tokenURI);
17+
18+
return tokenId;
19+
}
20+
}

0 commit comments

Comments
 (0)