Is there a way to add enums to an interface? I’m using v0.8.0

Sep 18, 2022, 11:50 AM
Interface IContract {

function dep( uint256, enum) external returns (uint256);
}

This doesn’t seem to work is there a type for enum I should use instead?
Sep 18, 2022, 11:51 AM
uint
Sep 18, 2022, 11:58 AM
Tried that already
Sep 18, 2022, 11:58 AM
Doesn't work?
Sep 18, 2022, 11:59 AM
No
Sep 18, 2022, 12:00 PM
Ok then try uint8
Sep 18, 2022, 12:01 PM
TypeError: Operator == not compatible with types uint8 and enum Contract.NewEnum
Sep 18, 2022, 12:02 PM
Show code
Sep 18, 2022, 12:04 PM
contract Contract is IContract {
enum NewEnum { None, Start, End }

function dep ( uint256, NewEnum status ) external returns (uint256){
if (status == NewEnum.Start){
return 1;}
else if (status == NewEnum.End){
return 5; }
else {
return 0; }
}
Interface IContract {

function dep( uint256, enum) external returns (uint256);
}
Sep 18, 2022, 12:10 PM
Interface IContract {
enum NewEnum { None, Start, End }
function dep( uint256, NewEnum) external returns (uint256);
}
Try this maybe
Sep 18, 2022, 12:11 PM
🙌
Thank you
Sep 18, 2022, 12:14 PM

© 2024 Draquery.com All rights reserved.