Following the documentation I try to add a enum to my interface. Inside the interface I have a method called get that returns one of the enum value. Im trying to add the enum to the interface, because in the get function one of the return value is one value of the enum. I follow this example.



TypeError: Enumerable cannot be declared in interfaces

Is wrong the docu??

  • The compiler solidity version is the 0.4.24 – UnexpectedCharacter Feb 13 '19 at 8:57
  • 1
    Not possible unfortunately (at least up to v0.4.25, maybe different in v0.5 onward). – goodvibration Feb 13 '19 at 9:10
  • Thx @goodvibration. So there is no way to set a enum like a return paramter in 0.4.24 no? – UnexpectedCharacter Feb 13 '19 at 9:12
  • 1
    Not in an interface (or more generally, you can use an enum only within the scope of the contract where it is declared). – goodvibration Feb 13 '19 at 9:56

If you check the docs for the version of the compiler you're using, located here, it says under note 5 under the Interfaces header that they cannot define enums. If you want the ability to do that, you'll have to upgrade to 0.5.0+


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.