0

solidity | ERC2981 版税

 1 year ago
source link: https://benpaodewoniu.github.io/2023/02/24/solidity71/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ERC2981 版税

姑苏城外一茅屋,万树梅花月满天

ERC2981 是版税合约。

ERC2981 正在将版税机制,在发行阶段嵌入到资产中,即当每次该 NFT 进行转账交易时,都将在交易额中扣除部分版税(可以按照固定、衰减、动态等方式对版税进行自定义),这意味着创作者获得版税,将不再依赖于 NFT 交易平台,并进一步帮助 NFT 创作者们增加收入的管道。

  • import "@openzeppelin/contracts/token/common/ERC2981.sol";

其定义了一种数据结构

struct RoyaltyInfo {
address receiver; // 版税获得者
uint96 royaltyFraction; // 版税抽成比,默认是 royaltyFraction / 10000
}

其主要有几个方法

  • royaltyInfo
    • 获取版税信息
  • _setDefaultRoyalty

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK