MintRallyの実装を見ていく
created: 2023-06-02
/
updated: 2023-06-02
2023-06-02時点での自分用メモ。情報が古くなっているかもなのでご留意ください。
情報ズ
- https://www.mintrally.xyz/
- https://github.com/hackdays-io/mint-rally
- https://opensea.io/collection/mintrally-xyz
- https://polygonscan.com/token/0x7d895ca96caa5344ec0b732c6e1defa560671e14
スマートコントラクト
- https://github.com/hackdays-io/mint-rally/blob/main/README.md によれば
contract: Solidity, ERC721Enumerable, Hardhat
image: IPFS, Pinata
- このへんを見るといい? https://github.com/hackdays-io/mint-rally/tree/main/hardhat/contracts
- https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/ERC2771ContextUpgradeable.sol
- ERC-2771って知らないやつだ
- https://eips.ethereum.org/EIPS/eip-2771
- EIPを読んだけどピンとこなかった
- メタトランザクションとは - Zenn
- (余談) なんかChatGPTっぽい文体だな、という不思議な感覚を抱いた
- なるほど、アプリケーションのエンドユーザの代わりにガス代を払う仲介者を置けるっぽい
- 登場人物、これらを語彙として押さえておけるとよさそう
- Transaction Signer
- Gas Relay
- Trusted Forwarder
- Recipient
- OpenZeppelinにもあるみたい
- OpenZeppelinのやつは
_trustedForwarderがimmutableだけど、こっちはそうじゃない
- ERC-2771って知らないやつだ
- https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/MintNFT.sol
is ERC721EnumerableUpgradeable, ERC2771ContextUpgradeable, OwnableUpgradeable- いわゆるNFTで、Gas Relay対応していて、オーナーならコントラクトを更新できる
- https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/IMintNFT.sol
- MintNFTのインターフェイス
- https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/Forwarder.sol
- Forwarderだ
- verifyしてexecuteする、ってことね
is EIP712- https://eips.ethereum.org/EIPS/eip-712 は過去にEIP-712を理解したいで調べた
- 署名のとき、構造化されているデータが読みやすいってやつだね
- Forwarderだ
- https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/Event.sol
- ファイル名は
Event.solだけど定義しているのはEventManagerなのね - Event関連の処理をこのファイルにまとめているっぽい
- ファイル名は
- https://polygonscan.com/token/0x7d895ca96caa5344ec0b732c6e1defa560671e14#writeContract
- Polygonscanを見るとOwnerがどんな操作をできるのか把握できる
Web UI
- https://github.com/hackdays-io/mint-rally/blob/main/README.md によれば
frontend: Next.js, Typecript
- Next.jsとTypeScriptね〜
TypecriptになっていたのでPull Requestを出した
- https://github.com/hackdays-io/mint-rally/blob/main/frontend/package.json
- thirdwebのSDKを使っているのね
- https://github.com/hackdays-io/mint-rally/blob/main/frontend/yarn.lock
- npmじゃなくてyarnを使っているっぽい
- https://github.com/hackdays-io/mint-rally/blob/main/frontend/src/pages/index.tsx
- Next.js製のアプリケーションとして、ここから順番に読んでいけばいいかな
- Pinata https://www.pinata.cloud/
- へぇ、知らなかった