Simple ETH Contract
unknown
plain_text
a year ago
594 B
7
Indexable
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SimpleStorage {
// Variable to store the data
uint256 private data;
// Event to emit when data is updated
event DataUpdated(uint256 oldData, uint256 newData);
// Function to set the data
function set(uint256 _data) public {
uint256 oldData = data; // Keep track of old value
data = _data;
emit DataUpdated(oldData, _data); // Emit event
}
// Function to get the data
function get() public view returns (uint256) {
return data;
}
}
Editor is loading...
Leave a Comment