I am trying to inherit a trait in ink! as follows:

trait Erc20 {
    // ...

trait CustomErc20: Erc20 {
    // ...

However, I get this error:

ink! trait definitions with supertraits are not supported, yet

Is it possible to inherit contracts/traits in ink!, like in solidity?

1 Answer 1


It is not inheritance, it is called supertrait. It is a bound for the trait that if someone implements your CustomErc20, he also should implement the Erc20 trait.

ink! right now doesn't support it(your error says to you about it). Maybe it will be fixed during this issue or this.

You can use openbrush::trait_definition macro that allows adding bounds. But you need to use it in combination with the openbrush::contract macro(instead of ink::contract).

Right now, OpenBrush allows adding any bounds(defined with openbrush::trait_definition, ink::trait_definition and common rust traits). But in the next release, OpenBursh will allow adding only bounds defined via openbrush::trait_definition. It is because traits defined with the trait_definition macro are public and should not use bounds related to a specific language or implementation.

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.