forked from 0xKaso/deploy-result
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDesynSafeMath.json
43 lines (43 loc) · 10.7 KB
/
DesynSafeMath.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
{
"address": "0x17C211F63833B7e336FFE94F62187E43004Fb16c",
"abi": [],
"transactionHash": "0x78243cadbe635b1cdb844cb45493f0f1f61d5d5df13cbc2f20ade2e1af7f2f4b",
"receipt": {
"to": null,
"from": "0x595b85b4A418e3B8df897D02F5BD49167D00862F",
"contractAddress": "0x17C211F63833B7e336FFE94F62187E43004Fb16c",
"transactionIndex": 75,
"gasUsed": "71933",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x5d8421935ea9c24db0998b3f63f97dabe33b71e3bc3c9d2ff84aa1eb6dfd87dd",
"transactionHash": "0x78243cadbe635b1cdb844cb45493f0f1f61d5d5df13cbc2f20ade2e1af7f2f4b",
"logs": [],
"blockNumber": 7836363,
"cumulativeGasUsed": "12770703",
"status": 1,
"byzantium": true
},
"args": [],
"numDeployments": 1,
"solcInputHash": "ec6aa3e489db51b52585f0a55af97c3a",
"metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Desyn Labs\",\"details\":\"badd and bsub are basically identical to OpenZeppelin SafeMath; mul/div have extra checks\",\"kind\":\"dev\",\"methods\":{},\"title\":\"SafeMath - wrap Solidity operators to prevent underflow/overflow\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/libraries/DesynSafeMath.sol\":\"DesynSafeMath\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":20},\"remappings\":[]},\"sources\":{\"contracts/libraries/DesynConstants.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity 0.6.12;\\n\\n/**\\n * @author Desyn Labs\\n * @title Put all the constants in one place\\n */\\n\\nlibrary DesynConstants {\\n // State variables (must be constant in a library)\\n\\n // B \\\"ONE\\\" - all math is in the \\\"realm\\\" of 10 ** 18;\\n // where numeric 1 = 10 ** 18\\n uint public constant BONE = 10**18;\\n uint public constant MIN_WEIGHT = BONE;\\n uint public constant MAX_WEIGHT = BONE * 50;\\n uint public constant MAX_TOTAL_WEIGHT = BONE * 50;\\n uint public constant MIN_BALANCE = BONE / 10**6;\\n uint public constant MAX_BALANCE = BONE * 10**12;\\n uint public constant MIN_POOL_SUPPLY = BONE * 100;\\n uint public constant MAX_POOL_SUPPLY = BONE * 10**9;\\n uint public constant MIN_FEE = BONE / 10**6;\\n uint public constant MAX_FEE = BONE / 10;\\n uint public constant MANAGER_MIN_FEE = BONE / 10**6;\\n uint public constant MANAGER_MAX_FEE = BONE / 10;\\n // EXIT_FEE must always be zero, or ConfigurableRightsPool._pushUnderlying will fail\\n uint public constant EXIT_FEE = 0;\\n uint public constant MAX_IN_RATIO = BONE / 2;\\n uint public constant MAX_OUT_RATIO = (BONE / 3) + 1 wei;\\n // Must match BConst.MIN_BOUND_TOKENS and BConst.MAX_BOUND_TOKENS\\n uint public constant MIN_ASSET_LIMIT = 1;\\n uint public constant MAX_ASSET_LIMIT = 16;\\n uint public constant MAX_UINT = uint(-1);\\n uint public constant MAX_COLLECT_PERIOD = 60 days;\\n}\\n\",\"keccak256\":\"0xc143170522bbdc5b746f70602005e15612ae72224bd6ff194514df473ae887de\",\"license\":\"GPL-3.0-or-later\"},\"contracts/libraries/DesynSafeMath.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity 0.6.12;\\n\\n// Imports\\n\\nimport \\\"./DesynConstants.sol\\\";\\n\\n/**\\n * @author Desyn Labs\\n * @title SafeMath - wrap Solidity operators to prevent underflow/overflow\\n * @dev badd and bsub are basically identical to OpenZeppelin SafeMath; mul/div have extra checks\\n */\\nlibrary DesynSafeMath {\\n /**\\n * @notice Safe addition\\n * @param a - first operand\\n * @param b - second operand\\n * @dev if we are adding b to a, the resulting sum must be greater than a\\n * @return - sum of operands; throws if overflow\\n */\\n function badd(uint a, uint b) internal pure returns (uint) {\\n uint c = a + b;\\n require(c >= a, \\\"ERR_ADD_OVERFLOW\\\");\\n return c;\\n }\\n\\n /**\\n * @notice Safe unsigned subtraction\\n * @param a - first operand\\n * @param b - second operand\\n * @dev Do a signed subtraction, and check that it produces a positive value\\n * (i.e., a - b is valid if b <= a)\\n * @return - a - b; throws if underflow\\n */\\n function bsub(uint a, uint b) internal pure returns (uint) {\\n (uint c, bool negativeResult) = bsubSign(a, b);\\n require(!negativeResult, \\\"ERR_SUB_UNDERFLOW\\\");\\n return c;\\n }\\n\\n /**\\n * @notice Safe signed subtraction\\n * @param a - first operand\\n * @param b - second operand\\n * @dev Do a signed subtraction\\n * @return - difference between a and b, and a flag indicating a negative result\\n * (i.e., a - b if a is greater than or equal to b; otherwise b - a)\\n */\\n function bsubSign(uint a, uint b) internal pure returns (uint, bool) {\\n if (b <= a) {\\n return (a - b, false);\\n } else {\\n return (b - a, true);\\n }\\n }\\n\\n /**\\n * @notice Safe multiplication\\n * @param a - first operand\\n * @param b - second operand\\n * @dev Multiply safely (and efficiently), rounding down\\n * @return - product of operands; throws if overflow or rounding error\\n */\\n function bmul(uint a, uint b) internal pure returns (uint) {\\n // Gas optimization (see github.com/OpenZeppelin/openzeppelin-contracts/pull/522)\\n if (a == 0) {\\n return 0;\\n }\\n\\n // Standard overflow check: a/a*b=b\\n uint c0 = a * b;\\n require(c0 / a == b, \\\"ERR_MUL_OVERFLOW\\\");\\n\\n // Round to 0 if x*y < BONE/2?\\n uint c1 = c0 + (DesynConstants.BONE / 2);\\n require(c1 >= c0, \\\"ERR_MUL_OVERFLOW\\\");\\n uint c2 = c1 / DesynConstants.BONE;\\n return c2;\\n }\\n\\n /**\\n * @notice Safe division\\n * @param dividend - first operand\\n * @param divisor - second operand\\n * @dev Divide safely (and efficiently), rounding down\\n * @return - quotient; throws if overflow or rounding error\\n */\\n function bdiv(uint dividend, uint divisor) internal pure returns (uint) {\\n require(divisor != 0, \\\"ERR_DIV_ZERO\\\");\\n\\n // Gas optimization\\n if (dividend == 0) {\\n return 0;\\n }\\n\\n uint c0 = dividend * DesynConstants.BONE;\\n require(c0 / dividend == DesynConstants.BONE, \\\"ERR_DIV_INTERNAL\\\"); // bmul overflow\\n\\n uint c1 = c0 + (divisor / 2);\\n require(c1 >= c0, \\\"ERR_DIV_INTERNAL\\\"); // badd require\\n\\n uint c2 = c1 / divisor;\\n return c2;\\n }\\n\\n /**\\n * @notice Safe unsigned integer modulo\\n * @dev Returns the remainder of dividing two unsigned integers.\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * @param dividend - first operand\\n * @param divisor - second operand -- cannot be zero\\n * @return - quotient; throws if overflow or rounding error\\n */\\n function bmod(uint dividend, uint divisor) internal pure returns (uint) {\\n require(divisor != 0, \\\"ERR_MODULO_BY_ZERO\\\");\\n\\n return dividend % divisor;\\n }\\n\\n /**\\n * @notice Safe unsigned integer max\\n * @dev Returns the greater of the two input values\\n *\\n * @param a - first operand\\n * @param b - second operand\\n * @return - the maximum of a and b\\n */\\n function bmax(uint a, uint b) internal pure returns (uint) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @notice Safe unsigned integer min\\n * @dev returns b, if b < a; otherwise returns a\\n *\\n * @param a - first operand\\n * @param b - second operand\\n * @return - the lesser of the two input values\\n */\\n function bmin(uint a, uint b) internal pure returns (uint) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @notice Safe unsigned integer average\\n * @dev Guard against (a+b) overflow by dividing each operand separately\\n *\\n * @param a - first operand\\n * @param b - second operand\\n * @return - the average of the two values\\n */\\n function baverage(uint a, uint b) internal pure returns (uint) {\\n // (a + b) / 2 can overflow, so we distribute\\n return (a / 2) + (b / 2) + (((a % 2) + (b % 2)) / 2);\\n }\\n\\n /**\\n * @notice Babylonian square root implementation\\n * @dev (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)\\n * @param y - operand\\n * @return z - the square root result\\n */\\n function sqrt(uint y) internal pure returns (uint z) {\\n if (y > 3) {\\n z = y;\\n uint x = y / 2 + 1;\\n while (x < z) {\\n z = x;\\n x = (y / x + x) / 2;\\n }\\n } else if (y != 0) {\\n z = 1;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x9baf30b98a5f3a8c13ac9c4d5d4b176eabfd936aba8f5172c95b7c568fba68f3\",\"license\":\"GPL-3.0-or-later\"}},\"version\":1}",
"bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d496f038f4fcedad071a4928089ca476c9c0f536d35bbac9cc5f578231da2e4c64736f6c634300060c0033",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220d496f038f4fcedad071a4928089ca476c9c0f536d35bbac9cc5f578231da2e4c64736f6c634300060c0033",
"devdoc": {
"author": "Desyn Labs",
"details": "badd and bsub are basically identical to OpenZeppelin SafeMath; mul/div have extra checks",
"kind": "dev",
"methods": {},
"title": "SafeMath - wrap Solidity operators to prevent underflow/overflow",
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
},
"storageLayout": {
"storage": [],
"types": null
}
}