首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >多重继承-继承图不可能

多重继承-继承图不可能
EN

Ethereum用户
提问于 2020-10-31 11:07:11
回答 1查看 840关注 0票数 1

我试图根据这里概述的ERC1404标准构建一份合同:https://github.com/simple-restricted-token/simple-restricted-token

契约允许您在令牌之上添加限制,并且是可组合的。示例包括使用单个限制,但是我需要在标记中使用许多限制。我试图使用的限制是: MaxNumShareholdersToken,IndividualOwnershipStakeToken

我创建了以下契约,它继承了这两个文件:

代码语言:javascript
复制
pragma solidity ^0.4.24;
import "./../mocks/BasicTokenMock.sol";
import "./restrictions/number-of-accounts/MaxNumShareholdersToken.sol";
import "./restrictions/ownership-percentage/IndividualOwnershipStakeToken.sol";

contract MyToken is BasicTokenMock, MaxNumShareholdersToken, IndividualOwnershipStakeToken {
    constructor (
        address initialAccount,
        uint256 initialBalance,
        uint256 maxNumShareholders,
        uint256 globalMaxPercentOwnershipTimesOneThousand
    )
    BasicTokenMock(initialAccount, initialBalance)
    MaxNumShareholdersToken(maxNumShareholders)
    IndividualOwnershipStakeToken(globalMaxPercentOwnershipTimesOneThousand)
    public {

    }
}

但是,在编译时,我会看到以下错误消息:

代码语言:javascript
复制
TypeError: Linearization of inheritance graph impossible

我跟随了继承树,从我的理解来看,这应该是可行的。下面是有关文件的继承树。

我做错了什么?

EN

回答 1

Ethereum用户

发布于 2020-10-31 18:52:58

当不同的父母亲相互继承或相同的契约时,就会发生此错误。要解决这个问题,你通常只需要在合同声明中重新排序父母。

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/89802

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档