Add Royalties for NFTs

オープン
#70 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Amxx がすでに取り組んでいます。

2022年7月18日 から。

  • #151 @Amxx による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
solidity, typescript

調査の方向性

まず、ERC721 と ERC1155 のオプションがどのように提示され、コントラクトコードがどのように生成されるかを追跡します。両方の標準規格に royalty 設定と、アクセス制御された royalty メソッドを生成する機能を追加し、ERC1155Supply に重複した import が追加されないようにします。選択したオプションによって、要求されたコンストラクターの動作を持つ有効なコントラクトが生成されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Add options for users to be able to integrate royalties on their ERC721 and ERC1155 contracts. This is a suggested set of changes:

  • Include it on the options after selecting ERC721 or ERC1155.
    image
    Populating those fields would inherit from the tokenRoyalty contract and call the setDefaultRoyalty from the constructor.

  • Include this parts on the code:

    • An import for the new module: import "@openzeppelin/contracts/token/tokenERC/extensions/tokenERCRoyalty.sol";
    • An inheritance: contract MyToken is ERC721, AccessControl { We'll use Access control to handle the roles of who can set royalties.
    • This calls to the royalties functions:
    function setTokenRoyalty(
        uint256 tokenId,
        address recipient,
        uint96 fraction
    ) public onlyRole(ROYALTY_SETTER_ROLE) {
        _setTokenRoyalty(tokenId, recipient, fraction);
    }

    function setDefaultRoyalty(address recipient, uint96 fraction) public onlyRole(ROYALTY_SETTER_ROLE) {
        _setDefaultRoyalty(recipient, fraction);
    }
- [ ] This constructor: 
bytes32 public constant ROYALTY_SETTER_ROLE= keccak256("ROYALTY_SETTER_ROLE");
constructor() ERC721("MyToken", "MTK") {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(ROYALTY_SETTER_ROLE, msg.sender);
    }

Take into consideration for the ERC1155, if the user specifies royalties and select ERC1155Supply do not import it btwice into the code, since the royalties contract inherits from this module.

主要言語
TypeScript
スター
296
フォーク
188
平均マージ
3時間 24分
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenZeppelin/contracts-wizard のほかの issue

OpenZeppelin/contracts-wizard の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。