-
-
Save OnahProsperity/7d678d308a6ae47dc149d755054f20f9 to your computer and use it in GitHub Desktop.
Enum as a interface and used in other contract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity 0.8.9; | |
interface interEnum { | |
enum SIDE { | |
buy, | |
sell | |
} | |
} | |
contract B is interEnum { | |
function bEnum(SIDE side) external { | |
// do something with here | |
} | |
} | |
contract A { | |
B b; | |
enum NUM { | |
buy, | |
sell | |
} | |
function bEnum(NUM num) external { | |
// i cant pass in an enum from here. | |
// invalid explicit conversion from uint256 to Enum when i tried it this way | |
// b.bEnum(uint256(num); | |
// b | |
// invalid explicit conversion from enum to enum.... | |
// b.bEnum(num); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment