Skip to content

Instantly share code, notes, and snippets.

@ConsenSys-Academy
Last active October 24, 2021 23:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ConsenSys-Academy/6d93a805ce0e90d8a793a4eb6e69b4c5 to your computer and use it in GitHub Desktop.
Save ConsenSys-Academy/6d93a805ce0e90d8a793a4eb6e69b4c5 to your computer and use it in GitHub Desktop.
A Solidity SimpleStorage contract
[
{
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "x",
"type": "uint256"
}
],
"name": "set",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "newValue",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "updatedBy",
"type": "address"
}
],
"name": "storageUpdate",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "get",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
pragma solidity >=0.4.0 <0.7.0;
// Rinkeby address: 0x49Bb098E781eD5C50D85E82d85cbA1a6F03FD3e6
contract SimpleStorage {
uint storedData;
event storageUpdate(uint newValue, address updatedBy);
function set(uint x) public {
storedData = x;
emit storageUpdate(x, msg.sender);
}
function get() public view returns (uint) {
return storedData;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment