Simple ETH Contract
Anonymous
plain_text
11/15/2024 11:15 PM
792 B
18
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