Skip to content
Verified contractPartial

SafeMath

Address0x0b4dd2bc8bf556e0397941b1e52f00628c5028cf
Balance

0 ETH

 

Transactions

5

 

Compiler

solc 0.4.15

 

Same code

141 more contracts

 

Details

Compiler
solc 0.4.15+commit.bbb8e64f
Language
solidity
Optimization
Yes, 200 runs
License
Not stated
Match
Partialcreation code: no, runtime code: yes
Verified on Sourcify
Created in block
3,958,155
Creation transaction
0x16a81e3572…e761258b9b

SafeMath.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
pragma solidity ^0.4.11;


/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMath {
  function mul(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal constant returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  function sub(uint256 a, uint256 b) internal constant returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  function add(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.