Code · 1 file
Sample Solidity File
Solidity, the language of Ethereum smart contracts. Our contract is for testing tools only and is not deployed anywhere. Every language sample implements the same small program so you can compare them side by side.
Solidity · 1.2 KB
Sample Solidity file
An idiomatic Solidity example — the same customer program (or, for hardware languages, a small counter design) we offer in every language.
CC0 · free for any use · Verified by an independent tool · Report a problem
// SPDX-License-Identifier: CC0-1.0
// Sample Solidity contract — samplefiles.com (for testing tools only; never deployed)
pragma solidity ^0.8.24;
contract CustomerRegistry {
struct Customer {
uint256 id;
string name;
uint256 balanceCents;
}
uint256 public constant VIP_THRESHOLD_CENTS = 1_000_000;
address public immutable owner;
Customer[] private customers;
event CustomerAdded(uint256 indexed id, string name, uint256 balanceCents);
error NotOwner();
modifier onlyOwner() {
if (msg.sender != owner) revert NotOwner();
_;
}
constructor() {File details
Download from the command line
curl -L -o CustomerRegistry.sol https://files.samplefiles.com/code/sol/CustomerRegistry.solwget https://files.samplefiles.com/code/sol/CustomerRegistry.solhttps://files.samplefiles.com/code/sol/CustomerRegistry.solprintf '%s %s\n' 1a9dcc27852ca2b9d965835932c6861cb2dfb833575e6a0c7fd5940a971c0606 CustomerRegistry.sol | shasum -a 256 -cOr check the download in your browser with the checksum calculator.