Counter

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "settings": {
    "evmVersion": "cancun",
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  },
  "sources": {
    "project/contracts/Counter.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/**
 * @title Counter
 * @dev A simple counter contract that demonstrates basic Solidity functionality
 */
contract Counter {

    uint256 public count;

    event CountIncremented(uint256 newCount);
    event CountDecremented(uint256 newCount);
    event CountReset();

    /**
     * @dev Increment the counter by 1
     */
    function increment() public {
        count++;
        emit CountIncremented(count);
    }

    /**
     * @dev Decrement the counter by 1
     */
    function decrement() public {
        require(count > 0, "Counter cannot be negative");
        count--;
        emit CountDecremented(count);
    }

    /**
     * @dev Reset the counter to 0
     */
    function reset() public {
        count = 0;
        emit CountReset();
    }

    /**
     * @dev Get the current count value
     * @return The current count
     */
    function get() public view returns (uint256) {
        return count;
    }
}
"
    }
  }
}}

Tags:
Factory|addr:0x48d0c26e7625c9e95d48907fb2bc9827bfb3bb86|verified:true|block:23578049|tx:0xaaf507b5d6031e1e3ce43c15c3439a2c85859fdc6e3128b94278d423c3625741|first_check:1760512280

Submitted on: 2025-10-15 09:11:21

Comments

Log in to comment.

No comments yet.