MintRally の実装を見ていく
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://scrapbox.io/files/6479b923e9765d001ccff94d.webp
スマートコントラクト
- 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/
- へぇ、知らなかった