Created
February 9, 2021 15:29
-
-
Save fetsorn/ccb2e55cfb7d8a3a1d91f4cbedc10459 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
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.7.0 <0.8.0; | |
contract Test { | |
enum SomeData {DEFAULT,ONE,TWO} | |
SomeData someData; | |
constructor() { | |
someData = SomeData.DEFAULT; | |
} | |
function setValues(SomeData test) external { | |
someData = test; | |
} | |
function getValues() external view returns (string memory) { | |
return mapValues(someData); | |
} | |
function mapValues(SomeData d) internal pure returns (string memory) { | |
if (d == SomeData.DEFAULT) { | |
return "DEFAULT"; | |
} else if (d == SomeData.ONE) { | |
return "ONE"; | |
} else { | |
return "TWO"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment