Files
openzeppelin-contracts/contracts/mocks/MathMock.sol
barakman f6db5c1f30 A function which returns the absolute value of a signed value (#2984)
* Add a function which returns the absolute (and obviously unsigned) value of a signed value.

* add changelog entry and fix lint

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
2021-11-24 14:09:05 +01:00

28 lines
659 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/math/Math.sol";
contract MathMock {
function max(uint256 a, uint256 b) public pure returns (uint256) {
return Math.max(a, b);
}
function min(uint256 a, uint256 b) public pure returns (uint256) {
return Math.min(a, b);
}
function average(uint256 a, uint256 b) public pure returns (uint256) {
return Math.average(a, b);
}
function ceilDiv(uint256 a, uint256 b) public pure returns (uint256) {
return Math.ceilDiv(a, b);
}
function abs(int256 n) public pure returns (uint256) {
return Math.abs(n);
}
}