Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 1.1 KB

OZ SignedSafeMath.md

File metadata and controls

26 lines (21 loc) · 1.1 KB

OpenZeppelin SignedSafeMath: provides the same mathematical functions as SafeMath but for signed integers

  1. myNumber.add(otherNumber): Returns the addition of two signed integers, reverting on overflow. Counterpart to Solidity's + operator.

  2. myNumber.sub(otherNumber): Returns the subtraction of two signed integers, reverting on overflow (when the result is negative). Counterpart to Solidity's - operator.

  3. myNumber.div(otherNumber): Returns the division of two signed integers, reverting on overflow. The result is rounded towards zero. Counterpart to Solidity's / operator.

  4. myNumber.mul(otherNumber): Returns the multiplication of two signed integers, reverting on overflow. Counterpart to Solidity's * operator.


Slide Screenshot

176.jpg


Slide Text

  • Math Functions
  • Safe -> Overflow/Underflow
  • add & sub & mul & div & mod
  • using SignedSafeMath for int256
  • Required: solc < 0.8.0

References


Tags