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:0x63ced3e062bd5678fc9dbcdf5a56a99de37c2a13|verified:true|block:23578201|tx:0x47cce6e608fc90362b61d5f2613aa81ea7647254f83fc86ebfd91d53a0d89551|first_check:1760512549

Submitted on: 2025-10-15 09:15:50

Comments

Log in to comment.

No comments yet.