Last active
June 17, 2021 14:45
-
-
Save alexroan/2d0b0701677834a67d88c4bb593bdbbd to your computer and use it in GitHub Desktop.
Contract Structure Example
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: MIT | |
pragma solidity ^0.8.0; // solidity version | |
// imports | |
import "./AnInterface.sol"; | |
import "./ALibrary.sol"; | |
contract Example is AnInterface { | |
// library using statements | |
using ALibrary for uint256; | |
// Structs | |
struct MyStruct { | |
... | |
} | |
// Constants, Immutables and Storage vars | |
MyStruct private s_information; | |
... | |
// Events | |
event InformationUpdated( | |
... | |
) | |
// Constructor | |
constructor() { | |
} | |
// Functions | |
function UpdateInformation( | |
uint256 newInfo, | |
... | |
) | |
external | |
override // Inherited from AnInterface | |
validInfo(newInfo) | |
{ | |
... | |
} | |
// Modifiers | |
modifier validInfo( | |
uint256 info | |
) { | |
require(something, "Not valid info"); | |
_; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment