-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from wbydo/release
Release
- Loading branch information
Showing
12 changed files
with
2,818 additions
and
693 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
contract WbydoProfileNft is ERC721Enumerable, Ownable { | ||
string private _BASE_URI; | ||
|
||
constructor(string memory __baseURI) | ||
ERC721("wbydo Profile Token", "wbydo") | ||
Ownable() | ||
{ | ||
_BASE_URI = __baseURI; | ||
} | ||
|
||
function _baseURI() internal view override(ERC721) returns (string memory) { | ||
return _BASE_URI; | ||
} | ||
|
||
function mint(uint256 tokenId) public onlyOwner { | ||
_safeMint(_msgSender(), tokenId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { expect } from 'chai'; | ||
import { waffle, ethers } from 'hardhat'; | ||
|
||
import { BigNumber } from 'ethers'; | ||
|
||
const { loadFixture } = waffle; | ||
|
||
const baseURI = 'https://example.com/metadata/'; | ||
|
||
describe('WbydoProfileNft', () => { | ||
const fixture = async () => { | ||
const [owner, other] = await ethers.getSigners(); | ||
|
||
const nft = await ethers | ||
.getContractFactory('WbydoProfileNft') | ||
.then((factory) => { | ||
return factory.deploy(baseURI); | ||
}) | ||
.then((contracts) => { | ||
return contracts.deployed(); | ||
}); | ||
|
||
return { owner, nft, other }; | ||
}; | ||
|
||
it('deploy', async () => { | ||
await loadFixture(fixture); | ||
}); | ||
|
||
describe('TokenURI', async () => { | ||
it('tokenURIが期待通りであること', async () => { | ||
const { nft, owner } = await loadFixture(fixture); | ||
const connectedNft = nft.connect(owner); | ||
await connectedNft.mint(0); | ||
expect(await connectedNft.tokenURI(0)).to.be.equal( | ||
'https://example.com/metadata/0' | ||
); | ||
}); | ||
}); | ||
|
||
describe('mint', async () => { | ||
it('owner以外が実行するとrevertすること', async () => { | ||
const { nft, other } = await loadFixture(fixture); | ||
await expect(nft.connect(other).mint(999)).to.be.revertedWith( | ||
'Ownable: caller is not the owner' | ||
); | ||
}); | ||
|
||
it('mint関数実行後にnftを所有していること', async () => { | ||
const { nft, owner } = await loadFixture(fixture); | ||
const connectedNft = nft.connect(owner); | ||
await connectedNft.mint(555); | ||
expect(await connectedNft.ownerOf(555)).to.be.equal(owner.address); | ||
|
||
await connectedNft.mint(666); | ||
expect(await connectedNft.ownerOf(666)).to.be.equal(owner.address); | ||
|
||
expect(await connectedNft.balanceOf(owner.address)).to.be.equal(2); | ||
}); | ||
}); | ||
}); |
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "wbydo", | ||
"description": "https://wbydo.com", | ||
"image": "https://wbydo.github.io/profile-nft/img/000.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "tackuhm", | ||
"description": "https://twitter.com/tackuhm", | ||
"image": "https://wbydo.github.io/profile-nft/img/001.png" | ||
} |
Oops, something went wrong.