Skip to content

joyexcel/Base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

// SPDX-License-Identifier: MIT pragma solidity ^0.8.0;

contract BasicMath { uint256 constant MAX_INT = type(uint256).max;

function adder(uint256 _a, uint256 _b) external pure returns (uint256 sum, bool error) {
    if (_b > MAX_INT - _a) {
        return (0, true); // Overflow occurred
    }
    return (_a + _b, false);
}

function subtractor(uint256 _a, uint256 _b) external pure returns (uint256 difference, bool error) {
    if (_b > _a) {
        return (0, true); // Underflow occurred
    }
    return (_a - _b, false);
}

}

About

Contract deployment (testnet)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published