/
KiloPowerHalf.json
71 lines (71 loc) · 77 KB
/
KiloPowerHalf.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
"address": "0x8Da96a2eDe1dd5Af8Bd3BD142226820f6Bb09751",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Fixed6OverflowError",
"type": "error"
},
{
"inputs": [
{
"internalType": "Fixed6",
"name": "price",
"type": "int256"
}
],
"name": "payoff",
"outputs": [
{
"internalType": "Fixed6",
"name": "",
"type": "int256"
}
],
"stateMutability": "pure",
"type": "function"
}
],
"transactionHash": "0x23d50a388c4489b40ce4be78700c6318e2851a9940ff6d7f65e8769c2ca64582",
"receipt": {
"to": null,
"from": "0x66a7fDB96C583c59597de16d8b2B989231415339",
"contractAddress": "0x8Da96a2eDe1dd5Af8Bd3BD142226820f6Bb09751",
"transactionIndex": 1,
"gasUsed": "835336",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x05f884763ef66dde313621a480507e39bd98d7a77861011d7157394ec68acdb7",
"transactionHash": "0x23d50a388c4489b40ce4be78700c6318e2851a9940ff6d7f65e8769c2ca64582",
"logs": [],
"blockNumber": 135921102,
"cumulativeGasUsed": "835336",
"status": 1,
"byzantium": true
},
"args": [],
"numDeployments": 1,
"solcInputHash": "2c6e25839257e7c837f044fa2f8c67c2",
"metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Fixed6OverflowError\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"Fixed6\",\"name\":\"price\",\"type\":\"int256\"}],\"name\":\"payoff\",\"outputs\":[{\"internalType\":\"Fixed6\",\"name\":\"\",\"type\":\"int256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@equilibria/perennial-v2-payoff/contracts/payoff/KiloPowerHalf.sol\":\"KiloPowerHalf\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[],\"viaIR\":true},\"sources\":{\"@equilibria/perennial-v2-payoff/contracts/payoff/KiloPowerHalf.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity 0.8.19;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport \\\"@equilibria/perennial-v2/contracts/interfaces/IPayoffProvider.sol\\\";\\n\\ncontract KiloPowerHalf is IPayoffProvider {\\n uint256 private constant BASE = 1e6;\\n UFixed6 private constant MULTIPLICAND = UFixed6.wrap(1e9);\\n\\n function payoff(Fixed6 price) external pure override returns (Fixed6) {\\n return\\n Fixed6Lib.from(\\n UFixed6.wrap(Math.sqrt(UFixed6.unwrap(price.abs().mul(MULTIPLICAND).mul(MULTIPLICAND)) * BASE))\\n );\\n }\\n}\\n\",\"keccak256\":\"0xe5d108d15a11e87ef9343bbf261312f6e18b615b9e49d64b2ca4e5bb7f7d3374\",\"license\":\"Apache-2.0\"},\"@equilibria/perennial-v2/contracts/interfaces/IPayoffProvider.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.13;\\n\\nimport \\\"@equilibria/root/number/types/Fixed6.sol\\\";\\n\\ninterface IPayoffProvider {\\n function payoff(Fixed6 price) external pure returns (Fixed6 payoff);\\n}\\n\",\"keccak256\":\"0xda57bdec535b0768c7c25889f5c1d7fbce94acc41ca836b821e5ea9f686f8898\",\"license\":\"Apache-2.0\"},\"@equilibria/root/number/NumberMath.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.13;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/math/SignedMath.sol\\\";\\n\\n/**\\n * @title NumberMath\\n * @notice Library for additional math functions that are not included in the OpenZeppelin libraries.\\n */\\nlibrary NumberMath {\\n error DivisionByZero();\\n\\n /**\\n * @notice Divides `a` by `b`, rounding the result away from zero if there is a remainder\\n * @param a Dividend\\n * @param b Divisor\\n * @return Resulting quotient\\n */\\n function divOut(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (b == 0) revert DivisionByZero();\\n return Math.ceilDiv(a, b);\\n }\\n\\n /**\\n * @notice Divides `a` by `b`, rounding the result away from zero if there is a remainder\\n * @param a Dividend\\n * @param b Divisor\\n * @return Resulting quotient\\n */\\n function divOut(int256 a, int256 b) internal pure returns (int256) {\\n return sign(a) * sign(b) * int256(divOut(SignedMath.abs(a), SignedMath.abs(b)));\\n }\\n\\n /**\\n * @notice Returns the sign of an int256\\n * @dev Returns: -1 for negative\\n * 0 for zero\\n * 1 for positive\\n * @param a int256 to find the sign of\\n * @return Sign of the int256\\n */\\n function sign(int256 a) internal pure returns (int256) {\\n if (a > 0) return 1;\\n if (a < 0) return -1;\\n return 0;\\n }\\n}\\n\",\"keccak256\":\"0x8d3578ce6e74ee6589ba0468e2c539ef1eb51d6687b508e637620926eb8396b4\",\"license\":\"Apache-2.0\"},\"@equilibria/root/number/types/Fixed18.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.13;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SignedMath.sol\\\";\\nimport \\\"../NumberMath.sol\\\";\\nimport \\\"./Fixed6.sol\\\";\\nimport \\\"./UFixed18.sol\\\";\\n\\n/// @dev Fixed18 type\\ntype Fixed18 is int256;\\nusing Fixed18Lib for Fixed18 global;\\ntype Fixed18Storage is bytes32;\\nusing Fixed18StorageLib for Fixed18Storage global;\\n\\n/**\\n * @title Fixed18Lib\\n * @notice Library for the signed fixed-decimal type.\\n */\\nlibrary Fixed18Lib {\\n error Fixed18OverflowError(uint256 value);\\n\\n int256 private constant BASE = 1e18;\\n Fixed18 public constant ZERO = Fixed18.wrap(0);\\n Fixed18 public constant ONE = Fixed18.wrap(BASE);\\n Fixed18 public constant NEG_ONE = Fixed18.wrap(-1 * BASE);\\n Fixed18 public constant MAX = Fixed18.wrap(type(int256).max);\\n Fixed18 public constant MIN = Fixed18.wrap(type(int256).min);\\n\\n /**\\n * @notice Creates a signed fixed-decimal from an unsigned fixed-decimal\\n * @param a Unsigned fixed-decimal\\n * @return New signed fixed-decimal\\n */\\n function from(UFixed18 a) internal pure returns (Fixed18) {\\n uint256 value = UFixed18.unwrap(a);\\n if (value > uint256(type(int256).max)) revert Fixed18OverflowError(value);\\n return Fixed18.wrap(int256(value));\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a sign and an unsigned fixed-decimal\\n * @param s Sign\\n * @param m Unsigned fixed-decimal magnitude\\n * @return New signed fixed-decimal\\n */\\n function from(int256 s, UFixed18 m) internal pure returns (Fixed18) {\\n if (s > 0) return from(m);\\n if (s < 0) {\\n // Since from(m) multiplies m by BASE, from(m) cannot be type(int256).min\\n // which is the only value that would overflow when negated. Therefore,\\n // we can safely negate from(m) without checking for overflow.\\n unchecked { return Fixed18.wrap(-1 * Fixed18.unwrap(from(m))); }\\n }\\n return ZERO;\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a signed integer\\n * @param a Signed number\\n * @return New signed fixed-decimal\\n */\\n function from(int256 a) internal pure returns (Fixed18) {\\n return Fixed18.wrap(a * BASE);\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a base-6 signed fixed-decimal\\n * @param a Base-6 signed fixed-decimal\\n * @return New signed fixed-decimal\\n */\\n function from(Fixed6 a) internal pure returns (Fixed18) {\\n return Fixed18.wrap(Fixed6.unwrap(a) * 1e12);\\n }\\n\\n /**\\n * @notice Returns whether the signed fixed-decimal is equal to zero.\\n * @param a Signed fixed-decimal\\n * @return Whether the signed fixed-decimal is zero.\\n */\\n function isZero(Fixed18 a) internal pure returns (bool) {\\n return Fixed18.unwrap(a) == 0;\\n }\\n\\n /**\\n * @notice Adds two signed fixed-decimals `a` and `b` together\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Resulting summed signed fixed-decimal\\n */\\n function add(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(Fixed18.unwrap(a) + Fixed18.unwrap(b));\\n }\\n\\n /**\\n * @notice Subtracts signed fixed-decimal `b` from `a`\\n * @param a Signed fixed-decimal to subtract from\\n * @param b Signed fixed-decimal to subtract\\n * @return Resulting subtracted signed fixed-decimal\\n */\\n function sub(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(Fixed18.unwrap(a) - Fixed18.unwrap(b));\\n }\\n\\n /**\\n * @notice Multiplies two signed fixed-decimals `a` and `b` together\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Resulting multiplied signed fixed-decimal\\n */\\n function mul(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(Fixed18.unwrap(a) * Fixed18.unwrap(b) / BASE);\\n }\\n\\n /**\\n * @notice Multiplies two signed fixed-decimals `a` and `b` together, rounding the result away from zero if there is a remainder\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Resulting multiplied signed fixed-decimal\\n */\\n function mulOut(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(NumberMath.divOut(Fixed18.unwrap(a) * Fixed18.unwrap(b), BASE));\\n }\\n\\n /**\\n * @notice Divides signed fixed-decimal `a` by `b`\\n * @param a Signed fixed-decimal to divide\\n * @param b Signed fixed-decimal to divide by\\n * @return Resulting divided signed fixed-decimal\\n */\\n function div(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(Fixed18.unwrap(a) * BASE / Fixed18.unwrap(b));\\n }\\n\\n /**\\n * @notice Divides signed fixed-decimal `a` by `b`, rounding the result away from zero if there is a remainder\\n * @param a Signed fixed-decimal to divide\\n * @param b Signed fixed-decimal to divide by\\n * @return Resulting divided signed fixed-decimal\\n */\\n function divOut(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18Lib.from(sign(a) * sign(b), a.abs().divOut(b.abs()));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0`, `MAX` for `n/0`, and `MIN` for `-n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDiv(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n if (isZero(b)) {\\n if (gt(a, ZERO)) return MAX;\\n if (lt(a, ZERO)) return MIN;\\n return ONE;\\n } else {\\n return div(a, b);\\n }\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`, rounding the result away from zero if there is a remainder\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0`, `MAX` for `n/0`, and `MIN` for `-n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDivOut(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n if (isZero(b)) {\\n if (gt(a, ZERO)) return MAX;\\n if (lt(a, ZERO)) return MIN;\\n return ONE;\\n } else {\\n return divOut(a, b);\\n }\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First signed fixed-decimal\\n * @param b Signed number to multiply by\\n * @param c Signed number to divide by\\n * @return Resulting computation\\n */\\n function muldiv(Fixed18 a, int256 b, int256 c) internal pure returns (Fixed18) {\\n return muldiv(a, Fixed18.wrap(b), Fixed18.wrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First signed fixed-decimal\\n * @param b Signed number to multiply by\\n * @param c Signed number to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(Fixed18 a, int256 b, int256 c) internal pure returns (Fixed18) {\\n return muldivOut(a, Fixed18.wrap(b), Fixed18.wrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First signed fixed-decimal\\n * @param b Signed fixed-decimal to multiply by\\n * @param c Signed fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldiv(Fixed18 a, Fixed18 b, Fixed18 c) internal pure returns (Fixed18) {\\n return Fixed18.wrap(Fixed18.unwrap(a) * Fixed18.unwrap(b) / Fixed18.unwrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First signed fixed-decimal\\n * @param b Signed fixed-decimal to multiply by\\n * @param c Signed fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(Fixed18 a, Fixed18 b, Fixed18 c) internal pure returns (Fixed18) {\\n return Fixed18.wrap(NumberMath.divOut(Fixed18.unwrap(a) * Fixed18.unwrap(b), Fixed18.unwrap(c)));\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is equal to `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is equal to `b`\\n */\\n function eq(Fixed18 a, Fixed18 b) internal pure returns (bool) {\\n return compare(a, b) == 1;\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is greater than `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is greater than `b`\\n */\\n function gt(Fixed18 a, Fixed18 b) internal pure returns (bool) {\\n return compare(a, b) == 2;\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is less than `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is less than `b`\\n */\\n function lt(Fixed18 a, Fixed18 b) internal pure returns (bool) {\\n return compare(a, b) == 0;\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is greater than or equal to `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is greater than or equal to `b`\\n */\\n function gte(Fixed18 a, Fixed18 b) internal pure returns (bool) {\\n return gt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is less than or equal to `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is less than or equal to `b`\\n */\\n function lte(Fixed18 a, Fixed18 b) internal pure returns (bool) {\\n return lt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Compares the signed fixed-decimals `a` and `b`\\n * @dev Returns: 2 for greater than\\n * 1 for equal to\\n * 0 for less than\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Compare result of `a` and `b`\\n */\\n function compare(Fixed18 a, Fixed18 b) internal pure returns (uint256) {\\n (int256 au, int256 bu) = (Fixed18.unwrap(a), Fixed18.unwrap(b));\\n if (au > bu) return 2;\\n if (au < bu) return 0;\\n return 1;\\n }\\n\\n /**\\n * @notice Returns a signed fixed-decimal representing the ratio of `a` over `b`\\n * @param a First signed number\\n * @param b Second signed number\\n * @return Ratio of `a` over `b`\\n */\\n function ratio(int256 a, int256 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(a * BASE / b);\\n }\\n\\n /**\\n * @notice Returns the minimum of signed fixed-decimals `a` and `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Minimum of `a` and `b`\\n */\\n function min(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(SignedMath.min(Fixed18.unwrap(a), Fixed18.unwrap(b)));\\n }\\n\\n /**\\n * @notice Returns the maximum of signed fixed-decimals `a` and `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Maximum of `a` and `b`\\n */\\n function max(Fixed18 a, Fixed18 b) internal pure returns (Fixed18) {\\n return Fixed18.wrap(SignedMath.max(Fixed18.unwrap(a), Fixed18.unwrap(b)));\\n }\\n\\n /**\\n * @notice Converts the signed fixed-decimal into an integer, truncating any decimal portion\\n * @param a Signed fixed-decimal\\n * @return Truncated signed number\\n */\\n function truncate(Fixed18 a) internal pure returns (int256) {\\n return Fixed18.unwrap(a) / BASE;\\n }\\n\\n /**\\n * @notice Returns the sign of the signed fixed-decimal\\n * @dev Returns: -1 for negative\\n * 0 for zero\\n * 1 for positive\\n * @param a Signed fixed-decimal\\n * @return Sign of the signed fixed-decimal\\n */\\n function sign(Fixed18 a) internal pure returns (int256) {\\n if (Fixed18.unwrap(a) > 0) return 1;\\n if (Fixed18.unwrap(a) < 0) return -1;\\n return 0;\\n }\\n\\n /**\\n * @notice Returns the absolute value of the signed fixed-decimal\\n * @param a Signed fixed-decimal\\n * @return Absolute value of the signed fixed-decimal\\n */\\n function abs(Fixed18 a) internal pure returns (UFixed18) {\\n return UFixed18.wrap(SignedMath.abs(Fixed18.unwrap(a)));\\n }\\n}\\n\\nlibrary Fixed18StorageLib {\\n function read(Fixed18Storage self) internal view returns (Fixed18 value) {\\n assembly (\\\"memory-safe\\\") {\\n value := sload(self)\\n }\\n }\\n\\n function store(Fixed18Storage self, Fixed18 value) internal {\\n assembly (\\\"memory-safe\\\") {\\n sstore(self, value)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xdd3541bc1dbe5ca81f996a1ed5a05a7b8c74247426aab221d1a8f37be91d0e4f\",\"license\":\"Apache-2.0\"},\"@equilibria/root/number/types/Fixed6.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.13;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/SignedMath.sol\\\";\\nimport \\\"../NumberMath.sol\\\";\\nimport \\\"./Fixed18.sol\\\";\\nimport \\\"./UFixed6.sol\\\";\\n\\n/// @dev Fixed6 type\\ntype Fixed6 is int256;\\nusing Fixed6Lib for Fixed6 global;\\ntype Fixed6Storage is bytes32;\\nusing Fixed6StorageLib for Fixed6Storage global;\\n\\n/**\\n * @title Fixed6Lib\\n * @notice Library for the signed fixed-decimal type.\\n */\\nlibrary Fixed6Lib {\\n error Fixed6OverflowError(uint256 value);\\n\\n int256 private constant BASE = 1e6;\\n Fixed6 public constant ZERO = Fixed6.wrap(0);\\n Fixed6 public constant ONE = Fixed6.wrap(BASE);\\n Fixed6 public constant NEG_ONE = Fixed6.wrap(-1 * BASE);\\n Fixed6 public constant MAX = Fixed6.wrap(type(int256).max);\\n Fixed6 public constant MIN = Fixed6.wrap(type(int256).min);\\n\\n /**\\n * @notice Creates a signed fixed-decimal from an unsigned fixed-decimal\\n * @param a Unsigned fixed-decimal\\n * @return New signed fixed-decimal\\n */\\n function from(UFixed6 a) internal pure returns (Fixed6) {\\n uint256 value = UFixed6.unwrap(a);\\n if (value > uint256(type(int256).max)) revert Fixed6OverflowError(value);\\n return Fixed6.wrap(int256(value));\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a sign and an unsigned fixed-decimal\\n * @param s Sign\\n * @param m Unsigned fixed-decimal magnitude\\n * @return New signed fixed-decimal\\n */\\n function from(int256 s, UFixed6 m) internal pure returns (Fixed6) {\\n if (s > 0) return from(m);\\n if (s < 0) {\\n // Since from(m) multiplies m by BASE, from(m) cannot be type(int256).min\\n // which is the only value that would overflow when negated. Therefore,\\n // we can safely negate from(m) without checking for overflow.\\n unchecked { return Fixed6.wrap(-1 * Fixed6.unwrap(from(m))); }\\n }\\n return ZERO;\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a signed integer\\n * @param a Signed number\\n * @return New signed fixed-decimal\\n */\\n function from(int256 a) internal pure returns (Fixed6) {\\n return Fixed6.wrap(a * BASE);\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a base-18 signed fixed-decimal\\n * @param a Base-18 signed fixed-decimal\\n * @return New signed fixed-decimal\\n */\\n function from(Fixed18 a) internal pure returns (Fixed6) {\\n return Fixed6.wrap(Fixed18.unwrap(a) / 1e12);\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a base-18 signed fixed-decimal\\n * @param a Base-18 signed fixed-decimal\\n * @param roundOut Whether to round the result away from zero if there is a remainder\\n * @return New signed fixed-decimal\\n */\\n function from(Fixed18 a, bool roundOut) internal pure returns (Fixed6) {\\n return roundOut ? Fixed6.wrap(NumberMath.divOut(Fixed18.unwrap(a), 1e12)): from(a);\\n }\\n\\n /**\\n * @notice Returns whether the signed fixed-decimal is equal to zero.\\n * @param a Signed fixed-decimal\\n * @return Whether the signed fixed-decimal is zero.\\n */\\n function isZero(Fixed6 a) internal pure returns (bool) {\\n return Fixed6.unwrap(a) == 0;\\n }\\n\\n /**\\n * @notice Adds two signed fixed-decimals `a` and `b` together\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Resulting summed signed fixed-decimal\\n */\\n function add(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(Fixed6.unwrap(a) + Fixed6.unwrap(b));\\n }\\n\\n /**\\n * @notice Subtracts signed fixed-decimal `b` from `a`\\n * @param a Signed fixed-decimal to subtract from\\n * @param b Signed fixed-decimal to subtract\\n * @return Resulting subtracted signed fixed-decimal\\n */\\n function sub(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(Fixed6.unwrap(a) - Fixed6.unwrap(b));\\n }\\n\\n /**\\n * @notice Multiplies two signed fixed-decimals `a` and `b` together\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Resulting multiplied signed fixed-decimal\\n */\\n function mul(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(Fixed6.unwrap(a) * Fixed6.unwrap(b) / BASE);\\n }\\n\\n /**\\n * @notice Multiplies two signed fixed-decimals `a` and `b` together, rounding the result away from zero if there is a remainder\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Resulting multiplied signed fixed-decimal\\n */\\n function mulOut(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(NumberMath.divOut(Fixed6.unwrap(a) * Fixed6.unwrap(b), BASE));\\n }\\n\\n /**\\n * @notice Divides signed fixed-decimal `a` by `b`\\n * @param a Signed fixed-decimal to divide\\n * @param b Signed fixed-decimal to divide by\\n * @return Resulting divided signed fixed-decimal\\n */\\n function div(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(Fixed6.unwrap(a) * BASE / Fixed6.unwrap(b));\\n }\\n\\n /**\\n * @notice Divides signed fixed-decimal `a` by `b`, rounding the result away from zero if there is a remainder\\n * @param a Signed fixed-decimal to divide\\n * @param b Signed fixed-decimal to divide by\\n * @return Resulting divided signed fixed-decimal\\n */\\n function divOut(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6Lib.from(sign(a) * sign(b), a.abs().divOut(b.abs()));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0`, `MAX` for `n/0`, and `MIN` for `-n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDiv(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n if (isZero(b)) {\\n if (gt(a, ZERO)) return MAX;\\n if (lt(a, ZERO)) return MIN;\\n return ONE;\\n } else {\\n return div(a, b);\\n }\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`, rounding the result away from zero if there is a remainder\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0`, `MAX` for `n/0`, and `MIN` for `-n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDivOut(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n if (isZero(b)) {\\n if (gt(a, ZERO)) return MAX;\\n if (lt(a, ZERO)) return MIN;\\n return ONE;\\n } else {\\n return divOut(a, b);\\n }\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First signed fixed-decimal\\n * @param b Signed number to multiply by\\n * @param c Signed number to divide by\\n * @return Resulting computation\\n */\\n function muldiv(Fixed6 a, int256 b, int256 c) internal pure returns (Fixed6) {\\n return muldiv(a, Fixed6.wrap(b), Fixed6.wrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First signed fixed-decimal\\n * @param b Signed number to multiply by\\n * @param c Signed number to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(Fixed6 a, int256 b, int256 c) internal pure returns (Fixed6) {\\n return muldivOut(a, Fixed6.wrap(b), Fixed6.wrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First signed fixed-decimal\\n * @param b Signed fixed-decimal to multiply by\\n * @param c Signed fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldiv(Fixed6 a, Fixed6 b, Fixed6 c) internal pure returns (Fixed6) {\\n return Fixed6.wrap(Fixed6.unwrap(a) * Fixed6.unwrap(b) / Fixed6.unwrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First signed fixed-decimal\\n * @param b Signed fixed-decimal to multiply by\\n * @param c Signed fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(Fixed6 a, Fixed6 b, Fixed6 c) internal pure returns (Fixed6) {\\n return Fixed6.wrap(NumberMath.divOut(Fixed6.unwrap(a) * Fixed6.unwrap(b), Fixed6.unwrap(c)));\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is equal to `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is equal to `b`\\n */\\n function eq(Fixed6 a, Fixed6 b) internal pure returns (bool) {\\n return compare(a, b) == 1;\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is greater than `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is greater than `b`\\n */\\n function gt(Fixed6 a, Fixed6 b) internal pure returns (bool) {\\n return compare(a, b) == 2;\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is less than `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is less than `b`\\n */\\n function lt(Fixed6 a, Fixed6 b) internal pure returns (bool) {\\n return compare(a, b) == 0;\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is greater than or equal to `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is greater than or equal to `b`\\n */\\n function gte(Fixed6 a, Fixed6 b) internal pure returns (bool) {\\n return gt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Returns whether signed fixed-decimal `a` is less than or equal to `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Whether `a` is less than or equal to `b`\\n */\\n function lte(Fixed6 a, Fixed6 b) internal pure returns (bool) {\\n return lt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Compares the signed fixed-decimals `a` and `b`\\n * @dev Returns: 2 for greater than\\n * 1 for equal to\\n * 0 for less than\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Compare result of `a` and `b`\\n */\\n function compare(Fixed6 a, Fixed6 b) internal pure returns (uint256) {\\n (int256 au, int256 bu) = (Fixed6.unwrap(a), Fixed6.unwrap(b));\\n if (au > bu) return 2;\\n if (au < bu) return 0;\\n return 1;\\n }\\n\\n /**\\n * @notice Returns a signed fixed-decimal representing the ratio of `a` over `b`\\n * @param a First signed number\\n * @param b Second signed number\\n * @return Ratio of `a` over `b`\\n */\\n function ratio(int256 a, int256 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(a * BASE / b);\\n }\\n\\n /**\\n * @notice Returns the minimum of signed fixed-decimals `a` and `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Minimum of `a` and `b`\\n */\\n function min(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(SignedMath.min(Fixed6.unwrap(a), Fixed6.unwrap(b)));\\n }\\n\\n /**\\n * @notice Returns the maximum of signed fixed-decimals `a` and `b`\\n * @param a First signed fixed-decimal\\n * @param b Second signed fixed-decimal\\n * @return Maximum of `a` and `b`\\n */\\n function max(Fixed6 a, Fixed6 b) internal pure returns (Fixed6) {\\n return Fixed6.wrap(SignedMath.max(Fixed6.unwrap(a), Fixed6.unwrap(b)));\\n }\\n\\n /**\\n * @notice Converts the signed fixed-decimal into an integer, truncating any decimal portion\\n * @param a Signed fixed-decimal\\n * @return Truncated signed number\\n */\\n function truncate(Fixed6 a) internal pure returns (int256) {\\n return Fixed6.unwrap(a) / BASE;\\n }\\n\\n /**\\n * @notice Returns the sign of the signed fixed-decimal\\n * @dev Returns: -1 for negative\\n * 0 for zero\\n * 1 for positive\\n * @param a Signed fixed-decimal\\n * @return Sign of the signed fixed-decimal\\n */\\n function sign(Fixed6 a) internal pure returns (int256) {\\n if (Fixed6.unwrap(a) > 0) return 1;\\n if (Fixed6.unwrap(a) < 0) return -1;\\n return 0;\\n }\\n\\n /**\\n * @notice Returns the absolute value of the signed fixed-decimal\\n * @param a Signed fixed-decimal\\n * @return Absolute value of the signed fixed-decimal\\n */\\n function abs(Fixed6 a) internal pure returns (UFixed6) {\\n return UFixed6.wrap(SignedMath.abs(Fixed6.unwrap(a)));\\n }\\n}\\n\\nlibrary Fixed6StorageLib {\\n function read(Fixed6Storage self) internal view returns (Fixed6 value) {\\n assembly (\\\"memory-safe\\\") {\\n value := sload(self)\\n }\\n }\\n\\n function store(Fixed6Storage self, Fixed6 value) internal {\\n assembly (\\\"memory-safe\\\") {\\n sstore(self, value)\\n }\\n }\\n}\\n\",\"keccak256\":\"0xba2715da2fdf9393cc5e3ce7f9a38f7bfd3b271dcbf9a7fac5245f7c3ecc4522\",\"license\":\"Apache-2.0\"},\"@equilibria/root/number/types/UFixed18.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.13;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport \\\"../NumberMath.sol\\\";\\nimport \\\"./Fixed18.sol\\\";\\nimport \\\"./UFixed6.sol\\\";\\n\\n/// @dev UFixed18 type\\ntype UFixed18 is uint256;\\nusing UFixed18Lib for UFixed18 global;\\ntype UFixed18Storage is bytes32;\\nusing UFixed18StorageLib for UFixed18Storage global;\\n\\n/**\\n * @title UFixed18Lib\\n * @notice Library for the unsigned fixed-decimal type.\\n */\\nlibrary UFixed18Lib {\\n error UFixed18UnderflowError(int256 value);\\n\\n uint256 private constant BASE = 1e18;\\n UFixed18 public constant ZERO = UFixed18.wrap(0);\\n UFixed18 public constant ONE = UFixed18.wrap(BASE);\\n UFixed18 public constant MAX = UFixed18.wrap(type(uint256).max);\\n\\n /**\\n * @notice Creates a unsigned fixed-decimal from a signed fixed-decimal\\n * @param a Signed fixed-decimal\\n * @return New unsigned fixed-decimal\\n */\\n function from(Fixed18 a) internal pure returns (UFixed18) {\\n int256 value = Fixed18.unwrap(a);\\n if (value < 0) revert UFixed18UnderflowError(value);\\n return UFixed18.wrap(uint256(value));\\n }\\n\\n /**\\n * @notice Creates a unsigned fixed-decimal from a unsigned integer\\n * @param a Unsigned number\\n * @return New unsigned fixed-decimal\\n */\\n function from(uint256 a) internal pure returns (UFixed18) {\\n return UFixed18.wrap(a * BASE);\\n }\\n\\n /**\\n * @notice Creates a signed fixed-decimal from a base-6 signed fixed-decimal\\n * @param a Base-6 signed fixed-decimal\\n * @return New signed fixed-decimal\\n */\\n function from(UFixed6 a) internal pure returns (UFixed18) {\\n return UFixed18.wrap(UFixed6.unwrap(a) * 1e12);\\n }\\n\\n /**\\n * @notice Returns whether the unsigned fixed-decimal is equal to zero.\\n * @param a Unsigned fixed-decimal\\n * @return Whether the unsigned fixed-decimal is zero.\\n */\\n function isZero(UFixed18 a) internal pure returns (bool) {\\n return UFixed18.unwrap(a) == 0;\\n }\\n\\n /**\\n * @notice Adds two unsigned fixed-decimals `a` and `b` together\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Resulting summed unsigned fixed-decimal\\n */\\n function add(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(UFixed18.unwrap(a) + UFixed18.unwrap(b));\\n }\\n\\n /**\\n * @notice Subtracts unsigned fixed-decimal `b` from `a`\\n * @param a Unsigned fixed-decimal to subtract from\\n * @param b Unsigned fixed-decimal to subtract\\n * @return Resulting subtracted unsigned fixed-decimal\\n */\\n function sub(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(UFixed18.unwrap(a) - UFixed18.unwrap(b));\\n }\\n\\n /**\\n * @notice Multiplies two unsigned fixed-decimals `a` and `b` together\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Resulting multiplied unsigned fixed-decimal\\n */\\n function mul(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(UFixed18.unwrap(a) * UFixed18.unwrap(b) / BASE);\\n }\\n\\n /**\\n * @notice Multiplies two unsigned fixed-decimals `a` and `b` together, rounding the result up to the next integer if there is a remainder\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Resulting multiplied unsigned fixed-decimal\\n */\\n function mulOut(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(NumberMath.divOut(UFixed18.unwrap(a) * UFixed18.unwrap(b), BASE));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function div(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(UFixed18.unwrap(a) * BASE / UFixed18.unwrap(b));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`, rounding the result up to the next integer if there is a remainder\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function divOut(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(NumberMath.divOut(UFixed18.unwrap(a) * BASE, UFixed18.unwrap(b)));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0` and `MAX` for `n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDiv(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n if (isZero(b)) {\\n return isZero(a) ? ONE : MAX;\\n } else {\\n return div(a, b);\\n }\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`, rounding the result up to the next integer if there is a remainder\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0` and `MAX` for `n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDivOut(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n if (isZero(b)) {\\n return isZero(a) ? ONE : MAX;\\n } else {\\n return divOut(a, b);\\n }\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned number to multiply by\\n * @param c Unsigned number to divide by\\n * @return Resulting computation\\n */\\n function muldiv(UFixed18 a, uint256 b, uint256 c) internal pure returns (UFixed18) {\\n return muldiv(a, UFixed18.wrap(b), UFixed18.wrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned number to multiply by\\n * @param c Unsigned number to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(UFixed18 a, uint256 b, uint256 c) internal pure returns (UFixed18) {\\n return muldivOut(a, UFixed18.wrap(b), UFixed18.wrap(c));\\n }\\n\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned fixed-decimal to multiply by\\n * @param c Unsigned fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldiv(UFixed18 a, UFixed18 b, UFixed18 c) internal pure returns (UFixed18) {\\n return UFixed18.wrap(UFixed18.unwrap(a) * UFixed18.unwrap(b) / UFixed18.unwrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned fixed-decimal to multiply by\\n * @param c Unsigned fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(UFixed18 a, UFixed18 b, UFixed18 c) internal pure returns (UFixed18) {\\n return UFixed18.wrap(NumberMath.divOut(UFixed18.unwrap(a) * UFixed18.unwrap(b), UFixed18.unwrap(c)));\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is equal to `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is equal to `b`\\n */\\n function eq(UFixed18 a, UFixed18 b) internal pure returns (bool) {\\n return compare(a, b) == 1;\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is greater than `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is greater than `b`\\n */\\n function gt(UFixed18 a, UFixed18 b) internal pure returns (bool) {\\n return compare(a, b) == 2;\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is less than `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is less than `b`\\n */\\n function lt(UFixed18 a, UFixed18 b) internal pure returns (bool) {\\n return compare(a, b) == 0;\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is greater than or equal to `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is greater than or equal to `b`\\n */\\n function gte(UFixed18 a, UFixed18 b) internal pure returns (bool) {\\n return gt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is less than or equal to `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is less than or equal to `b`\\n */\\n function lte(UFixed18 a, UFixed18 b) internal pure returns (bool) {\\n return lt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Compares the unsigned fixed-decimals `a` and `b`\\n * @dev Returns: 2 for greater than\\n * 1 for equal to\\n * 0 for less than\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Compare result of `a` and `b`\\n */\\n function compare(UFixed18 a, UFixed18 b) internal pure returns (uint256) {\\n (uint256 au, uint256 bu) = (UFixed18.unwrap(a), UFixed18.unwrap(b));\\n if (au > bu) return 2;\\n if (au < bu) return 0;\\n return 1;\\n }\\n\\n /**\\n * @notice Returns a unsigned fixed-decimal representing the ratio of `a` over `b`\\n * @param a First unsigned number\\n * @param b Second unsigned number\\n * @return Ratio of `a` over `b`\\n */\\n function ratio(uint256 a, uint256 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(a * BASE / b);\\n }\\n\\n /**\\n * @notice Returns the minimum of unsigned fixed-decimals `a` and `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Minimum of `a` and `b`\\n */\\n function min(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(Math.min(UFixed18.unwrap(a), UFixed18.unwrap(b)));\\n }\\n\\n /**\\n * @notice Returns the maximum of unsigned fixed-decimals `a` and `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Maximum of `a` and `b`\\n */\\n function max(UFixed18 a, UFixed18 b) internal pure returns (UFixed18) {\\n return UFixed18.wrap(Math.max(UFixed18.unwrap(a), UFixed18.unwrap(b)));\\n }\\n\\n /**\\n * @notice Converts the unsigned fixed-decimal into an integer, truncating any decimal portion\\n * @param a Unsigned fixed-decimal\\n * @return Truncated unsigned number\\n */\\n function truncate(UFixed18 a) internal pure returns (uint256) {\\n return UFixed18.unwrap(a) / BASE;\\n }\\n}\\n\\nlibrary UFixed18StorageLib {\\n function read(UFixed18Storage self) internal view returns (UFixed18 value) {\\n assembly (\\\"memory-safe\\\") {\\n value := sload(self)\\n }\\n }\\n\\n function store(UFixed18Storage self, UFixed18 value) internal {\\n assembly (\\\"memory-safe\\\") {\\n sstore(self, value)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x8497089d30704af15ad095173e6e32dd38ef8f6213b8eca613182aec02d90fd4\",\"license\":\"Apache-2.0\"},\"@equilibria/root/number/types/UFixed6.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\npragma solidity ^0.8.13;\\n\\nimport \\\"@openzeppelin/contracts/utils/math/Math.sol\\\";\\nimport \\\"../NumberMath.sol\\\";\\nimport \\\"./Fixed6.sol\\\";\\nimport \\\"./UFixed18.sol\\\";\\n\\n/// @dev UFixed6 type\\ntype UFixed6 is uint256;\\nusing UFixed6Lib for UFixed6 global;\\ntype UFixed6Storage is bytes32;\\nusing UFixed6StorageLib for UFixed6Storage global;\\n\\n/**\\n * @title UFixed6Lib\\n * @notice Library for the unsigned fixed-decimal type.\\n */\\nlibrary UFixed6Lib {\\n error UFixed6UnderflowError(int256 value);\\n\\n uint256 private constant BASE = 1e6;\\n UFixed6 public constant ZERO = UFixed6.wrap(0);\\n UFixed6 public constant ONE = UFixed6.wrap(BASE);\\n UFixed6 public constant MAX = UFixed6.wrap(type(uint256).max);\\n\\n /**\\n * @notice Creates a unsigned fixed-decimal from a signed fixed-decimal\\n * @param a Signed fixed-decimal\\n * @return New unsigned fixed-decimal\\n */\\n function from(Fixed6 a) internal pure returns (UFixed6) {\\n int256 value = Fixed6.unwrap(a);\\n if (value < 0) revert UFixed6UnderflowError(value);\\n return UFixed6.wrap(uint256(value));\\n }\\n\\n /**\\n * @notice Creates a unsigned fixed-decimal from a unsigned integer\\n * @param a Unsigned number\\n * @return New unsigned fixed-decimal\\n */\\n function from(uint256 a) internal pure returns (UFixed6) {\\n return UFixed6.wrap(a * BASE);\\n }\\n\\n /**\\n * @notice Creates an unsigned fixed-decimal from a base-18 unsigned fixed-decimal\\n * @param a Base-18 unsigned fixed-decimal\\n * @return New unsigned fixed-decimal\\n */\\n function from(UFixed18 a) internal pure returns (UFixed6) {\\n return UFixed6.wrap(UFixed18.unwrap(a) / 1e12);\\n }\\n\\n /**\\n * @notice Creates an unsigned fixed-decimal from a base-18 unsigned fixed-decimal\\n * @param a Base-18 unsigned fixed-decimal\\n * @param roundOut Whether to round the result away from zero if there is a remainder\\n * @return New unsigned fixed-decimal\\n */\\n function from(UFixed18 a, bool roundOut) internal pure returns (UFixed6) {\\n return roundOut ? UFixed6.wrap(NumberMath.divOut(UFixed18.unwrap(a), 1e12)): from(a);\\n }\\n\\n /**\\n * @notice Returns whether the unsigned fixed-decimal is equal to zero.\\n * @param a Unsigned fixed-decimal\\n * @return Whether the unsigned fixed-decimal is zero.\\n */\\n function isZero(UFixed6 a) internal pure returns (bool) {\\n return UFixed6.unwrap(a) == 0;\\n }\\n\\n /**\\n * @notice Adds two unsigned fixed-decimals `a` and `b` together\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Resulting summed unsigned fixed-decimal\\n */\\n function add(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(UFixed6.unwrap(a) + UFixed6.unwrap(b));\\n }\\n\\n /**\\n * @notice Subtracts unsigned fixed-decimal `b` from `a`\\n * @param a Unsigned fixed-decimal to subtract from\\n * @param b Unsigned fixed-decimal to subtract\\n * @return Resulting subtracted unsigned fixed-decimal\\n */\\n function sub(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(UFixed6.unwrap(a) - UFixed6.unwrap(b));\\n }\\n\\n /**\\n * @notice Multiplies two unsigned fixed-decimals `a` and `b` together\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Resulting multiplied unsigned fixed-decimal\\n */\\n function mul(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(UFixed6.unwrap(a) * UFixed6.unwrap(b) / BASE);\\n }\\n\\n /**\\n * @notice Multiplies two unsigned fixed-decimals `a` and `b` together, rounding the result up to the next integer if there is a remainder\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Resulting multiplied unsigned fixed-decimal\\n */\\n function mulOut(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(NumberMath.divOut(UFixed6.unwrap(a) * UFixed6.unwrap(b), BASE));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function div(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(UFixed6.unwrap(a) * BASE / UFixed6.unwrap(b));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`, rounding the result up to the next integer if there is a remainder\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function divOut(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(NumberMath.divOut(UFixed6.unwrap(a) * BASE, UFixed6.unwrap(b)));\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0` and `MAX` for `n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDiv(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n if (isZero(b)) {\\n return isZero(a) ? ONE : MAX;\\n } else {\\n return div(a, b);\\n }\\n }\\n\\n /**\\n * @notice Divides unsigned fixed-decimal `a` by `b`, rounding the result up to the next integer if there is a remainder\\n * @dev Does not revert on divide-by-0, instead returns `ONE` for `0/0` and `MAX` for `n/0`.\\n * @param a Unsigned fixed-decimal to divide\\n * @param b Unsigned fixed-decimal to divide by\\n * @return Resulting divided unsigned fixed-decimal\\n */\\n function unsafeDivOut(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n if (isZero(b)) {\\n return isZero(a) ? ONE : MAX;\\n } else {\\n return divOut(a, b);\\n }\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned number to multiply by\\n * @param c Unsigned number to divide by\\n * @return Resulting computation\\n */\\n function muldiv(UFixed6 a, uint256 b, uint256 c) internal pure returns (UFixed6) {\\n return muldiv(a, UFixed6.wrap(b), UFixed6.wrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned number to multiply by\\n * @param c Unsigned number to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(UFixed6 a, uint256 b, uint256 c) internal pure returns (UFixed6) {\\n return muldivOut(a, UFixed6.wrap(b), UFixed6.wrap(c));\\n }\\n\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned fixed-decimal to multiply by\\n * @param c Unsigned fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldiv(UFixed6 a, UFixed6 b, UFixed6 c) internal pure returns (UFixed6) {\\n return UFixed6.wrap(UFixed6.unwrap(a) * UFixed6.unwrap(b) / UFixed6.unwrap(c));\\n }\\n\\n /**\\n * @notice Computes a * b / c without loss of precision due to BASE conversion, rounding the result up to the next integer if there is a remainder\\n * @param a First unsigned fixed-decimal\\n * @param b Unsigned fixed-decimal to multiply by\\n * @param c Unsigned fixed-decimal to divide by\\n * @return Resulting computation\\n */\\n function muldivOut(UFixed6 a, UFixed6 b, UFixed6 c) internal pure returns (UFixed6) {\\n return UFixed6.wrap(NumberMath.divOut(UFixed6.unwrap(a) * UFixed6.unwrap(b), UFixed6.unwrap(c)));\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is equal to `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is equal to `b`\\n */\\n function eq(UFixed6 a, UFixed6 b) internal pure returns (bool) {\\n return compare(a, b) == 1;\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is greater than `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is greater than `b`\\n */\\n function gt(UFixed6 a, UFixed6 b) internal pure returns (bool) {\\n return compare(a, b) == 2;\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is less than `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is less than `b`\\n */\\n function lt(UFixed6 a, UFixed6 b) internal pure returns (bool) {\\n return compare(a, b) == 0;\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is greater than or equal to `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is greater than or equal to `b`\\n */\\n function gte(UFixed6 a, UFixed6 b) internal pure returns (bool) {\\n return gt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Returns whether unsigned fixed-decimal `a` is less than or equal to `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Whether `a` is less than or equal to `b`\\n */\\n function lte(UFixed6 a, UFixed6 b) internal pure returns (bool) {\\n return lt(a, b) || eq(a, b);\\n }\\n\\n /**\\n * @notice Compares the unsigned fixed-decimals `a` and `b`\\n * @dev Returns: 2 for greater than\\n * 1 for equal to\\n * 0 for less than\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Compare result of `a` and `b`\\n */\\n function compare(UFixed6 a, UFixed6 b) internal pure returns (uint256) {\\n (uint256 au, uint256 bu) = (UFixed6.unwrap(a), UFixed6.unwrap(b));\\n if (au > bu) return 2;\\n if (au < bu) return 0;\\n return 1;\\n }\\n\\n /**\\n * @notice Returns a unsigned fixed-decimal representing the ratio of `a` over `b`\\n * @param a First unsigned number\\n * @param b Second unsigned number\\n * @return Ratio of `a` over `b`\\n */\\n function ratio(uint256 a, uint256 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(a * BASE / b);\\n }\\n\\n /**\\n * @notice Returns the minimum of unsigned fixed-decimals `a` and `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Minimum of `a` and `b`\\n */\\n function min(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(Math.min(UFixed6.unwrap(a), UFixed6.unwrap(b)));\\n }\\n\\n /**\\n * @notice Returns the maximum of unsigned fixed-decimals `a` and `b`\\n * @param a First unsigned fixed-decimal\\n * @param b Second unsigned fixed-decimal\\n * @return Maximum of `a` and `b`\\n */\\n function max(UFixed6 a, UFixed6 b) internal pure returns (UFixed6) {\\n return UFixed6.wrap(Math.max(UFixed6.unwrap(a), UFixed6.unwrap(b)));\\n }\\n\\n /**\\n * @notice Converts the unsigned fixed-decimal into an integer, truncating any decimal portion\\n * @param a Unsigned fixed-decimal\\n * @return Truncated unsigned number\\n */\\n function truncate(UFixed6 a) internal pure returns (uint256) {\\n return UFixed6.unwrap(a) / BASE;\\n }\\n}\\n\\nlibrary UFixed6StorageLib {\\n function read(UFixed6Storage self) internal view returns (UFixed6 value) {\\n assembly (\\\"memory-safe\\\") {\\n value := sload(self)\\n }\\n }\\n\\n function store(UFixed6Storage self, UFixed6 value) internal {\\n assembly (\\\"memory-safe\\\") {\\n sstore(self, value)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0b5d83bc38b4587bafd397b45b953154e12065ba3d5b755d52727dd92949b055\",\"license\":\"Apache-2.0\"},\"@openzeppelin/contracts/utils/math/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary Math {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa1e8e83cd0087785df04ac79fb395d9f3684caeaf973d9e2c71caef723a3a5d6\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/math/SignedMath.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard signed math utilities missing in the Solidity language.\\n */\\nlibrary SignedMath {\\n /**\\n * @dev Returns the largest of two signed numbers.\\n */\\n function max(int256 a, int256 b) internal pure returns (int256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two signed numbers.\\n */\\n function min(int256 a, int256 b) internal pure returns (int256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two signed numbers without overflow.\\n * The result is rounded towards zero.\\n */\\n function average(int256 a, int256 b) internal pure returns (int256) {\\n // Formula from the book \\\"Hacker's Delight\\\"\\n int256 x = (a & b) + ((a ^ b) >> 1);\\n return x + (int256(uint256(x) >> 255) & (a ^ b));\\n }\\n\\n /**\\n * @dev Returns the absolute unsigned value of a signed value.\\n */\\n function abs(int256 n) internal pure returns (uint256) {\\n unchecked {\\n // must be unchecked in order to support `n = type(int256).min`\\n return uint256(n >= 0 ? n : -n);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xf92515413956f529d95977adc9b0567d583c6203fc31ab1c23824c35187e3ddc\",\"license\":\"MIT\"}},\"version\":1}",
"bytecode": "0x608080604052346100165761032a908161001c8239f35b600080fdfe6080604052600436101561001257600080fd5b6000803560e01c63d7c7a9351461002857600080fd5b3461012d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261012d5761007690600435818112610126575b61007c620f424080948193610130565b04610130565b048281029281840414901517156100f957610096826101b1565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81116100c857602090604051908152f35b602490604051907feecaa25d0000000000000000000000000000000000000000000000000000000082526004820152fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b8103610066565b80fd5b90633b9aca009182810292818404149015171561014957565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8115610182570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b80156102ee5761027c816000908360801c806102e2575b508060401c806102d5575b508060201c806102c8575b508060101c806102bb575b508060081c806102ae575b508060041c806102a1575b508060021c80610294575b50600191828092811c61028d575b1c1b6102248185610178565b01811c6102318185610178565b01811c61023e8185610178565b01811c61024b8185610178565b01811c6102588185610178565b01811c6102658185610178565b01811c6102728185610178565b01901c8092610178565b80821015610288575090565b905090565b0181610218565b600291509101903861020a565b60049150910190386101ff565b60089150910190386101f4565b60109150910190386101e9565b60209150910190386101de565b60409150910190386101d3565b915050608090386101c8565b5060009056fea26469706673582212200094e09e4b596559b42392f0f1779de1b484d02b90e5ab264eb4fe5fb6985dd864736f6c63430008130033",
"deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c63d7c7a9351461002857600080fd5b3461012d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261012d5761007690600435818112610126575b61007c620f424080948193610130565b04610130565b048281029281840414901517156100f957610096826101b1565b7f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81116100c857602090604051908152f35b602490604051907feecaa25d0000000000000000000000000000000000000000000000000000000082526004820152fd5b807f4e487b7100000000000000000000000000000000000000000000000000000000602492526011600452fd5b8103610066565b80fd5b90633b9aca009182810292818404149015171561014957565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8115610182570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b80156102ee5761027c816000908360801c806102e2575b508060401c806102d5575b508060201c806102c8575b508060101c806102bb575b508060081c806102ae575b508060041c806102a1575b508060021c80610294575b50600191828092811c61028d575b1c1b6102248185610178565b01811c6102318185610178565b01811c61023e8185610178565b01811c61024b8185610178565b01811c6102588185610178565b01811c6102658185610178565b01811c6102728185610178565b01901c8092610178565b80821015610288575090565b905090565b0181610218565b600291509101903861020a565b60049150910190386101ff565b60089150910190386101f4565b60109150910190386101e9565b60209150910190386101de565b60409150910190386101d3565b915050608090386101c8565b5060009056fea26469706673582212200094e09e4b596559b42392f0f1779de1b484d02b90e5ab264eb4fe5fb6985dd864736f6c63430008130033",
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
},
"storageLayout": {
"storage": [],
"types": null
}
}