github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/test/contracts/uniswap/v2/SafeMath.sol (about) 1 pragma solidity =0.5.16 || =0.6.6; 2 3 // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) 4 5 library SafeMath { 6 function add(uint x, uint y) internal pure returns (uint z) { 7 require((z = x + y) >= x, 'ds-math-add-overflow'); 8 } 9 10 function sub(uint x, uint y) internal pure returns (uint z) { 11 require((z = x - y) <= x, 'ds-math-sub-underflow'); 12 } 13 14 function mul(uint x, uint y) internal pure returns (uint z) { 15 require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); 16 } 17 }