-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add smart contract and deploy script #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rlho WIPで方向性確認PR投げましたのでご確認お願いします!
artifacts | ||
cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hardhat compile
時に生成されるこれらってコミット対象外であってます・・?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
はい!あってます!!
contracts/ERC1155NFT.sol
Outdated
uint256 public constant ITEM_1 = 1; | ||
|
||
constructor() ERC1155("https://rlho.github.io/nft_sample/{id}}.json") { | ||
_mint(msg.sender, ITEM_1, 1, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
試しということでシンプルに _mint
のみ書きましたがどういった条件でどのNFTに対するmintがいくつ発行されるなどの仕様詳細を、お手すきで教えてくださーい!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!
個数とtoken_idは引数で渡せるようにして欲しいです〜!
hardhat.config.js
Outdated
|
||
module.exports = { | ||
solidity: "0.8.17", | ||
defaultNetwork: "mumbai", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mumbaiで良いのでしょうか・・
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今回はEtheriumを考えてます!
url: TESTNET_API_URL, | ||
accounts: [TESTNET_PRIVATE_KEY] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testnetに何を使ったら良いかわかっておらず、Goerli?などでAPI URLを取得する必要があるようですがこちらありますでしょうか!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DMで送ります!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mainnetとtestnetのAPI_URLとPRIVATE_KEYの2つでいいのかな?を .env
に入れてもらう形ですー
@@ -0,0 +1,2 @@ | |||
const { expect } = require("chai"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://hardhat.org/hardhat-runner/docs/guides/test-contracts
こちらを参考にこれから書いていこうと思います。
NFTの仕様をざーっくりで良いので教えていただければと思ってますb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fuzzy31u
全体的に方向性合ってます!ありがとうございます!
多分仕様の詳細お伝えできてないと思うのでいちどお話ししましょう〜!
contracts/ERC1155NFT.sol
Outdated
uint256 public constant ITEM_1 = 1; | ||
|
||
constructor() ERC1155("https://rlho.github.io/nft_sample/{id}}.json") { | ||
_mint(msg.sender, ITEM_1, 1, ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!
個数とtoken_idは引数で渡せるようにして欲しいです〜!
hardhat.config.js
Outdated
|
||
module.exports = { | ||
solidity: "0.8.17", | ||
defaultNetwork: "mumbai", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
今回はEtheriumを考えてます!
url: TESTNET_API_URL, | ||
accounts: [TESTNET_PRIVATE_KEY] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DMで送ります!
e7ee017
to
7c423ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rlho mint functionのところ、こんな実装で良きでしょうか?
} | ||
|
||
function mintDocuments(num) private{ | ||
require(balanceOf(msg.sender, ITEM_DOCUMENTS) == 0, "You already have a Documents.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こういったバリデーション処理は要りますか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全然仕様をお伝えできてなくてすみません><
バリデーション助かります!
今回は複数持てるようにしようかと思ってるのでちょっと違う形になりそうです!
|
||
constructor() ERC1155(NFT_URI) {} | ||
|
||
function mint(token_id, num) public{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clientからはこちらを呼んでもらうイメージです!
url: TESTNET_API_URL, | ||
accounts: [TESTNET_PRIVATE_KEY] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mainnetとtestnetのAPI_URLとPRIVATE_KEYの2つでいいのかな?を .env
に入れてもらう形ですー
|
||
module.exports = { | ||
solidity: "0.8.17", | ||
// defaultNetwork: "hardhat", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
サンプルコード見てるとここはtestかlocalっぽいnetworkを入れてるケースが多そうに見えましたが何を指定すべきかわからずコメントアウトしておりますー。testnetにします??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうですね!デフォルトはtestnetにしておきたいです!
if (token_id == ITEM_DOCUMENTS) { | ||
mintDocuments(num); | ||
} else if (token_id == ITEM_FLOWER_1) { | ||
mintFlower1(num); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solidity自体にはswitch文がないんですね・・?ググったらassemblyとやらでswitch使えると書いてありましたが一応ifにしておきました。もっと良い書き方あるのかな??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switchないんですよね…
今回はシンプルなのでif文で良いと思います!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMです 👍 ✨
ここまで書いてくださりめちゃくちゃ助かりました…!
if (token_id == ITEM_DOCUMENTS) { | ||
mintDocuments(num); | ||
} else if (token_id == ITEM_FLOWER_1) { | ||
mintFlower1(num); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switchないんですよね…
今回はシンプルなのでif文で良いと思います!
} | ||
|
||
function mintDocuments(num) private{ | ||
require(balanceOf(msg.sender, ITEM_DOCUMENTS) == 0, "You already have a Documents.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全然仕様をお伝えできてなくてすみません><
バリデーション助かります!
今回は複数持てるようにしようかと思ってるのでちょっと違う形になりそうです!
|
||
module.exports = { | ||
solidity: "0.8.17", | ||
// defaultNetwork: "hardhat", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうですね!デフォルトはtestnetにしておきたいです!
Issue
#1
Overview