BasicMath

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/Hks.sol": {
      "content": " // SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.17;\r
\r
contract BasicMath {\r
    uint256 public constant MAX_INT = type(uint256).max;\r
\r
    function adder(uint256 a, uint256 b) public pure returns (uint256 result, bool error) {\r
        unchecked {\r
            if (a > MAX_INT - b) {\r
                // Overflow -> return 0 + error = true\r
                return (0, true);\r
            } else {\r
                return (a + b, false);\r
            }\r
        }\r
    }\r
\r
    function subtractor(uint256 a, uint256 b) public pure returns (uint256 result, bool error) {\r
        unchecked {\r
            if (b > a) {\r
                // Underflow -> return 0 + error = true\r
                return (0, true);\r
            } else {\r
                return (a - b, false);\r
            }\r
        }\r
    }\r
}\r
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "remappings": []
  }
}}

Tags:
Factory|addr:0xa2b1340090406a13b2f5f1fcad3f34a47cf91dcb|verified:true|block:23723485|tx:0xb398b934d55bc2d1d58448e5d6568be733315b18894ebd9978583bdb03b2ec50|first_check:1762252227

Submitted on: 2025-11-04 11:30:30

Comments

Log in to comment.

No comments yet.