Is there a way to create an enum in a vyper file ?

I have tried this:

from enum import Enum

But it does not work

Any idea ?



There is no native enum type in Vyper, so you'll have to construct your own.

Others may have better ideas, but you could either use:

...but you'll have to consider the gas costs of each.

The best alternative is probably to architect your contract in such a way as to avoid needing enums.

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.