bump solc to 0.5.14

chainId implementation (commented out for now)

improve events

move safeTransfer in UniswapV2

tweak error messages
This commit is contained in:
Noah Zinsmeister
2019-12-12 14:52:15 -05:00
parent f128ef3bc9
commit 4e4546d0a9
14 changed files with 144 additions and 189 deletions

View File

@ -1,18 +1,24 @@
pragma solidity 0.5.13;
pragma solidity 0.5.14;
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
return x <= y ? x : y;
z = x <= y ? x : y;
}
function clamp112(uint y) internal pure returns (uint112 z) {
z = y <= uint112(-1) ? uint112(y) : uint112(-1);
}
function sqrt(uint y) internal pure returns (uint z) {
if (y == 0) return 0;
else if (y <= 3) return 1;
uint x = (y + 1) / 2;
z = y;
while (x < z) {
z = x;
x = (y / x + x) / 2;
if (y > 3) {
uint x = (y + 1) / 2;
z = y;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}

View File

@ -1,17 +1,15 @@
pragma solidity 0.5.13;
pragma solidity 0.5.14;
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function clamp112(uint y) internal pure returns (uint112 z) {
z = y <= uint112(-1) ? uint112(y) : uint112(-1);
}
}

View File

@ -1,9 +1,9 @@
pragma solidity 0.5.13;
pragma solidity 0.5.14;
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112.112 fixed point number s.t. `y := y_encoded / 2**112` (i.e. with a Q112 denominator).
// encode a uint112 as a UQ112.112 fixed point number s.t. `y := z / 2**112`
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}