0

I'm trying to build a contract based on the ERC1404 standard outlined here: https://github.com/simple-restricted-token/simple-restricted-token

The contracts allow you to add restrictions on top of tokens and are composable. The examples cover using a single restriction, however i need to use many restriction in my token. The restrictions I am trying to use are: MaxNumShareholdersToken, IndividualOwnershipStakeToken

I have created the following contract, which inherits from both these files:

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 {

    }
}

However, when compiling i see the following error message:

TypeError: Linearization of inheritance graph impossible

I have followed the inheritance tree and from my understanding, this should work. Here is the inheritance tree for the files in question.

enter image description here

What am I doing wrong?

0

This error happens when different parents are inheriting from each other or the same contracts. To solve it you usually just have to reorder the parents in the contract declaration.

2
  • I have tried reordering with no success. I believe its the diamond problem where both classes have a common parent yet I've tried to override all the common methods in the subclass with no success. – Spyros Nov 1 '20 at 10:39
  • Could you share your code? – MrClottom Nov 1 '20 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.