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:0xe5f0df818789b2ec44f189032e116fdaa1637461|verified:true|block:23578082|tx:0x855b020479f3c549b32f484a332e61937e8452f2f9508803a874d0e39a931522|first_check:1760512349

Submitted on: 2025-10-15 09:12:30

Comments

Log in to comment.

No comments yet.