dsa-connectors-old/contracts/common/math.sol
Lecky Lao e5f418157f Updated math.sol to use SafeMath from OZ;
update migration to deploy CurveSBTCProtocol;
Added Curvesbtc.sol sell method and got it compiled;
2020-06-30 02:15:35 +10:00

42 lines
1.0 KiB
Solidity

pragma solidity ^0.6.0;
import { SafeMath } from "@openzeppelin/contracts/math/SafeMath.sol";
contract DSMath {
uint constant WAD = 10 ** 18;
uint constant RAY = 10 ** 27;
function add(uint x, uint y) internal pure returns (uint z) {
SafeMath.add(x, y);
}
function sub(uint x, uint y) internal pure returns (uint z) {
SafeMath.sub(x, y);
}
function mul(uint x, uint y) internal pure returns (uint z) {
SafeMath.mul(x, y);
}
function div(uint x, uint y) internal pure returns (uint z) {
SafeMath.div(x, y);
}
function wmul(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, y), WAD / 2) / WAD;
}
function wdiv(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, WAD), y / 2) / y;
}
function rdiv(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, RAY), y / 2) / y;
}
function rmul(uint x, uint y) internal pure returns (uint z) {
z = SafeMath.add(SafeMath.mul(x, y), RAY / 2) / RAY;
}
}