0

I have a contract C that is Ownable so I can use ownerOnly on its admin functions. Recently, I added some functionality that I'm going to start using in other projects. I refactored the functionality out to a second contract Refactored, so now contract C is Refactored, Ownable.

But then I discovered that some of the functionality of Refactored needs to be protected as well, so I added contract Refactored is Ownable and everything broke with a Linearization of inheritance graph impossible error.

I ended up leaving Ownable on Refactored and removing it from C - and that solved it - but now it looks like C is using ownerOnly functionality without including Ownable - i.e. it works, but doesn't look good.

Is there any way I can have both contracts be Ownable and still have one of them inherit the other? (I'd like to avoid having a variable in C be of type Refactored because then I'll have to expose a bunch of getter functions, negating the whole refactoring).

0

1 Answer 1

0

I ended up leaving Ownable on Refactored and removing it from C - and that solved it - but now it looks like C is using ownerOnly functionality without including Ownable

I don't know why you'd think that. That's how inheritence works in pretty much any object-oriented language. If B is A's child and C is B's child, A is C's parent.

To answer your question, no, there's no way of doing what you're trying to do. You'll have to do with how it is currently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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