1539 Commits

Author SHA1 Message Date
Lawrence Forman
9bbbaadcf8 @0x/conracts-staking: Fix idiotic linter error. 2019-09-04 20:18:55 -04:00
Lawrence Forman
19f44fac1e @0x/contracts-staking: Reformulate cobb-douglas to be more efficient.
`@0x/contracts-staking`: Remove some unecessary asserts.
`@0x/contracts-staking`: Fix some broken test assertions.
`@0x/contracts-staking`: Generate better random values in tests.
`@0x/contracts-staking`: Rename `PPM_ONE` constant to `PPM_DENOMINATOR`.
`@0x/contracts-staking`: Minor solidity code improvements.
`@0x/contracts-staking`: Use more constants from `@0x/contracts-test-utils` in tests.
2019-09-04 20:18:55 -04:00
Lawrence Forman
20ba23fe5f @0x/contracts-test-utils: Allow negative values in toHex().
`@0x/contracts-test-utils`: Add `PPM_DENOMINATOR` and `PPM_100_PERCENT` constants.
2019-09-04 20:18:55 -04:00
Lawrence Forman
b78705120e @0x/contracts-utils: Fix failing tests due to RevertError behavior changes. 2019-09-04 20:18:55 -04:00
Lawrence Forman
8d5e28f099 @0x/contracts-staking: Change the way operator stake is computed.
`@0x/contracts-staking`: Denominate pool operator shares in parts-per-million.
`@0x/contracts-staking`: Update tests for new stake computation and higher precision math.
`@0x/contracts-staking`: Add `setCobbDouglasAlpha()` function.
2019-09-04 20:18:55 -04:00
Lawrence Forman
5ccbe167a1 @0x/contracts-test-utils: Increase the number of ganache accounts to 20. 2019-09-04 20:18:55 -04:00
Lawrence Forman
af10f52acf @0x/contracts-staking: Rebase with 3.0 2019-09-04 20:18:55 -04:00
Lawrence Forman
ed8a6bb97b @0x/contracts-staking: Emit CobbDouglasAlphaChanged event when calling setCobbDouglasAlpha(). 2019-09-04 20:18:55 -04:00
Lawrence Forman
c774b98002 @0x/contracts-staking: Remove unused tslint directives. 2019-09-04 20:18:55 -04:00
Lawrence Forman
9a63bea763 @0x/contracts-staking: Update LibFixedMath ln() and exp() input domains and improve precision.
`@0x/contracts-staking`: Add `_invert()` and `_mulDiv()` to `LibFixedMath`.
`@0x/contracts-staking`: Update `MixinExchangeFees._cobbDouglas()` to work with `LibFixedMath`.
`@0x/contracts-staking`: Add unit and fuzz tests for `_cobbDouglas()` and remaining `LibFixedMath` functions.
2019-09-04 20:18:55 -04:00
Lawrence Forman
0c6a6743ab @0x/contracts-staking: Write LibFixedMath unit tests. 2019-09-04 20:18:55 -04:00
Lawrence Forman
1c37334b18 @0x/contracts-staking: Add a bunch of LibFixedMath unit tests. 2019-09-04 20:18:55 -04:00
Lawrence Forman
0999805b3a @0x/contracts-test-utils: Add toHex(), hexInvert(), hexLeftPad(), and hexRightPad() hex utils. 2019-09-04 20:15:15 -04:00
Lawrence Forman
7b5e3dab17 @0x/contracts-staking: Add rich reverts.
`@0x/utils`: Add `LibFixedMath` `RevertError` types.
`@0x/order-utils`: Add `InvalidCobbDouglasAlphaerror` `RevertError` type.
2019-09-04 20:15:15 -04:00
Lawrence Forman
a09cd03ce6 @0x/contracts-staking: Remove LibFeeMath and just put _cobbDouglas() in MixinExchangeFees.
`@0x/contracts-staking`: Update `LibFixedMath` to existing naming conventions.
`@0x/contracts-staking`: Add `cobbDouglasAlphaNumerator` and `cobbDouglasAlphaDenominator` to `Mixinstorage`.
`@0x/contracts-staking`: Add external `setCobbDouglasAlpha()` function to `MixinExchnageFees`
`@0x/contracts-staking`: Update `_cobbDouglas()` to use the new `LibFixedMath` voodoo.
`@0x/contracts-staking`: In reward calculations, use only delegated stake by pool owner as opposed to both delegated and active stake to compute stake totals.
2019-09-04 20:15:15 -04:00
Lawrence Forman
c1fc454d19 @0x/contracts-staking: Add uintMul() function to LibFixedMath. 2019-09-04 20:15:15 -04:00
Lawrence Forman
93c8284a96 @0x/contracts-staking: Add LibFeeMath library. 2019-09-04 20:15:15 -04:00
Amir Bandeali
cf35a8032d
Update contracts/exchange/contracts/src/MixinProtocolFees.sol
Update comment

Co-Authored-By: James Towle <jalextowle@gmail.com>
2019-09-04 11:34:17 -07:00
Amir Bandeali
90ac5ec577 Fix tests 2019-09-03 20:11:48 -07:00
Amir Bandeali
d1eb414749 Use new rich reverts where applicable 2019-09-03 20:11:47 -07:00
Amir Bandeali
f792d403e5 Add new rich revert errors 2019-09-03 20:11:47 -07:00
Amir Bandeali
e5706606a0 Create private functions for encoding orders/transactions with their hash to be passed into EIP1271 compliant contract 2019-09-03 20:11:43 -07:00
Amir Bandeali
49725c8c33 Styling and comment updates 2019-09-03 17:52:41 -07:00
Amir Bandeali
dfcc0c6d09 Create _enableAndRefundNonZeroBalance to slightly reduce codesize 2019-09-03 17:52:17 -07:00
Amir Bandeali
d806701d28 Use fromHex instead of doing length -> byte length calculation 2019-09-03 17:51:41 -07:00
Amir Bandeali
3935e661fe Add more writeLength tests 2019-09-03 17:05:32 -07:00
Amir Bandeali
cb8cf1f107 Add back batchFillOrders 2019-09-03 11:06:45 -07:00
Amir Bandeali
ea8669439f Minor styling and naming changes 2019-09-03 09:48:21 -07:00
Amir Bandeali
75a8b1c081 Use same taker numerator/denominator for all math in calculateFillResults 2019-09-03 09:48:16 -07:00
Amir Bandeali
73144fa4d5 Fix _setCurrentContextAddressIfRequired 2019-09-02 20:35:20 -07:00
Amir Bandeali
a6b60f3230 Create _readSignatureType with minimal validation 2019-09-02 20:34:23 -07:00
Amir Bandeali
48dfb3317a Fix tests 2019-09-02 14:36:27 -07:00
Amir Bandeali
b3b0496c49 Fix build and linting errors 2019-09-02 11:41:13 -07:00
Amir Bandeali
e880447714 Refactor EIP1271Wallet and Validator types to use new EIP1271SignatureError 2019-09-02 11:38:52 -07:00
Amir Bandeali
fd4d10e7a4 Create EIP1271SignatureError rich revert 2019-09-02 11:37:39 -07:00
Amir Bandeali
18b65a61ff Fix build 2019-09-01 19:14:16 -07:00
Amir Bandeali
02a1e17f50 Reuse EIP1271 wallet code with internal function 2019-09-01 18:53:57 -07:00
Amir Bandeali
9a3a302754 Create writeLength function in LibBytes 2019-09-01 18:32:52 -07:00
Amir Bandeali
d131c39e46 Create _setCurrentContextAddressIfRequired function in MixinTransactions 2019-09-01 18:31:46 -07:00
Amir Bandeali
8231e7703e Allow unlimited contract sizes by default 2019-09-01 18:30:33 -07:00
Amir Bandeali
406a78a11a Use internal functions in Refundable modifiers 2019-09-01 17:43:18 -07:00
Amir Bandeali
fe01a150f0 Use internal function in onlyOwner, onlyAuthorized, and nonReentrant modifiers 2019-09-01 15:54:16 -07:00
Amir Bandeali
dd499591e9 Make assetProxies mapping internal (getter function already exists) 2019-09-01 15:13:57 -07:00
Amir Bandeali
c0f1e5f17f Make fillOrderNoThrow internal only, remove batchFillOrders 2019-09-01 12:22:00 -07:00
Amir Bandeali
b888e48a30 Remove getOrdersInfo 2019-09-01 11:24:16 -07:00
Amir Bandeali
8410ee9d2f Remove unnecessary public functions 2019-09-01 11:01:01 -07:00
Amir Bandeali
b7238c702b Increase optimizer runs 2019-09-01 11:00:07 -07:00
Amir Bandeali
b20503c5a2 Fix off by 1 error 2019-08-30 11:39:28 -07:00
Amir Bandeali
d0869a8840 Fix linting errors 2019-08-30 11:39:28 -07:00
Amir Bandeali
c156bfc534 Remove TestValidatorWallet DataType 2019-08-30 11:39:28 -07:00