Skip to content

Instantly share code, notes, and snippets.

@alexroan
Last active June 17, 2021 14:45
Show Gist options
  • Save alexroan/2d0b0701677834a67d88c4bb593bdbbd to your computer and use it in GitHub Desktop.
Save alexroan/2d0b0701677834a67d88c4bb593bdbbd to your computer and use it in GitHub Desktop.
Contract Structure Example
// 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