-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Enum Types in ABI Generation (#8)
* Introducing ENUM ABI parsing support * Small fix in Enums.sol
- Loading branch information
Showing
5 changed files
with
99 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
contract EnumContract { | ||
// Define an enum | ||
enum State { Waiting, Ready, Active } | ||
|
||
// Declare a state variable of type State | ||
State public state; | ||
|
||
// Initialize the state | ||
constructor() { | ||
state = State.Waiting; | ||
} | ||
|
||
// Function to check if state is Waiting | ||
function isWaiting() public view returns(bool) { | ||
return state == State.Waiting; | ||
} | ||
|
||
// Function to check if state is Ready | ||
function isReady() public view returns(bool) { | ||
return state == State.Ready; | ||
} | ||
|
||
// Function to check if state is Active | ||
function isActive() public view returns(bool) { | ||
return state == State.Active; | ||
} | ||
|
||
// Function to set state to Ready | ||
function makeReady() public { | ||
state = State.Ready; | ||
} | ||
|
||
// Function to set state to Active | ||
function makeActive() public { | ||
state = State.Active; | ||
} | ||
|
||
// Function to reset state to Waiting | ||
function reset() public { | ||
state = State.Waiting; | ||
} | ||
} |