153 Commits

Author SHA1 Message Date
Elena
c4b1f043c6
Remove obsoleted code from 0x/contracts-utils (#643)
* Remove TestAuthorizable

* Remove contracts/utils Authorizable and IAuthorizable

* Remove contracts/utils D18 contract

* Remove contracts/utils LibAddress contracts

* Remove contracts/utils LogDecoding contracts

* Remove contracts/utils Refundable contracts

* Remove contracts/utils LibAuthorizableRichErrors contracts

* Remove contracts/utils EIP712 contracts

* Remove contracts/utils TestRefundableReceiver contracts

* Remove contracts/utils EIP1271 contracts

* Remove contracts/utils ReentrancyGuardV06 contracts

* Remove contracts/utils LibMath contracts

* Remove contracts/utils LibFractions contracts

* Remove contracts/utils LibMathRichErrors contracts

* Remove DeploymentConstants as per PR review
https://github.com/0xProject/protocol/pull/643#pullrequestreview-1264963784
2023-02-06 19:35:39 +02:00
Savarn Dontamsetti (Sav)
891d173705
chore: adding V08 contracts [LIT-783] (#646)
* Adding V08 contracts

* Removing LibSafeMathV08

* Apply suggestions from code review

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
2023-01-23 18:00:43 -05:00
Elena
010a926d79
Upgrade prettier-plugin-solidity to stable v1 (#622)
* Upgrade prettier-plugin-solidity to stable v1

* Prettier format contracts
2022-11-23 11:53:40 +02:00
Elena
ca0b074893
Add Solidity linter (#608)
* Add solhint and basic configuration

* Add solhint-plugin-prettier to run prettier via solhint

* Remove all solhint-disable rules in contracts

* Turn off compiler version errors

* Fix max-line-length linter errors

* Fix linting and prettier issues in contracts

* Add global lint command to run both ts and solidity linter
2022-11-08 16:12:42 +02:00
Elyas
b04455c36f
chore: Configure prettier-solidity and run prettier-solidity [TKR-532] (#592)
* add prettier-solidity + config

* run prettier

* update lockfile

* run prettier again

* Prettier missed one /:

* keep bridge adapter the same

* yarn prettier
2022-10-06 11:44:57 -04:00
Jacob Evans
68656b4a4d
chore: Prune old contracts (#304)
Prune exchange-libs
deploy migrations at specific address
remove exchange-libs, moving LibMath into Utils
Remove staking order-utils multisig and remaining asset-proxy
2021-08-18 10:33:47 +10:00
Lawrence Forman
f9078bb1c3
`Add SPDX license IDs to 0.6+ solidity files (#105)
Co-authored-by: Lawrence Forman <me@merklejerk.com>
2021-01-05 13:55:24 -05:00
Lawrence Forman
5083fab06a
That time DevUtils wouldn't die (#97)
* `@0x/contracts-utils`: Allow for excess return data in `LibERC20TokenV06` compat* functions

* `@0x/contracts-zero-ex`: Add DevUtils-like functions to `NativeOrdersFeature`

* `@0x/contract-artifacts`: Update IZeroEx artifact

* `@0x/contract-wrappers`: Update IZeroExContract wrapper

* `@0x/contracts-zero-ex`: Address review feedback

* `@0x/contracts-utils`: Add `LibSafeMathV06.safeDowncastToUint128()`

* `@0x/contracts-zero-ex`: Fix changelog and add cancelled get relevant state tests

* `@0x/contracts-utils`: Fix changelog

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2021-01-04 17:52:29 -05:00
Lawrence Forman
561b60a24d
EP Native Orders (#27)
* `@0x/contracts-zero-ex`: add limit orders feature
`@0x/contracts-utils`: add `uint128` functions to `LibSafeMathV06`

* `@0x/contract-addresses`: Update ganache snapshot addresses

* `@0x/contracts-zero-ex`: Mask EIP712 struct hash values.

* `@0x/contracts-zero-ex`: Add more limit order tests

* `@0x/contracts-zero-ex`: Fix typos

* `@0x/contracts-zero-ex`: Compute fee collector address after protocol fee zero check.

* `@0x/contracts-zero-ex`: Remove WETH payment logic from fee collector fixin

* `@0x/contracts-zero-ex`: Convert all ETH to WETH in `FeeCollector`.

* `@0x/contracts-zero-ex`: Address review feedback

* `@0x/contracts-zero-ex`: Export more utils

* `@0x/contracts-zero-ex`: Rename `LimitOrdersFeatures`, `LibLimitOrders`, etc. into `*NativeOrders*`.
`@0x/contracts-zero-ex`: Emit `protocolFeePaid` in native order fill events.
`@0x/contracts-zero-ex`: Refactor to get around stack limits.
`@0x/contracts-zero-ex`: Use different storage mappings for RFQ and limit order pair cancellations.

* `@0x/contracts-zero-ex`: Add `getProtocolFeeMultiplier()` and `transferProtocolFeesForPools()` to `NativeOrdersFeature`.

* `@0x/contracts-zero-ex`: Fix broken tests

* update orders docs

* `@0x/contracts-zero-ex`: Add more tests to `NativeOrdersFeature`

* rebuild after rebase

* `@0x/contract-addresses`: Fix changelog booboo

* `@0x/contracts-zero-ex`: Add method selectors output to generated artifacts

* `@0x/contracts-zero-ex`: Add maker address to order cancel events.
`@0x/contracts-zreo-ex`: Remove `UpTo` suffix from order pair cancellation functions.
`@0x/contracts-zreo-ex`: Address misc review comments.

* `@0x/contracts-zero-ex`: More SafeMath in native orders

* update orders docs

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-11-17 15:39:40 -05:00
Jacob Evans
717db99b38
fix: Support Multiple Shells (#17)
* fix: Support Multiple Shells

* CHANGEGLOG
2020-10-29 17:09:23 +10:00
Jacob Evans
4d04b72674
feat: DODO (#2701)
* feat: DODO

* DODO Bridge

* export DODOFillData

* Use deployed DODOHelper

* Deployed Bridge. Half of buys supported

* other half of buys

* refactor

* CHANGELOGs

* Lint
2020-10-13 18:20:31 +10:00
Jacob Evans
7698f21517
feat: [asset-swapper] Shell 🐚 (#2722)
* feat: [asset-swapper] Shell

* Deployed and Changelogs

* Glue up the deployed address

* Glue for FQT rollup
2020-10-06 15:55:51 +10:00
Jacob Evans
630108ccb6
feat: Swerve Finance and SushiSwap (#2698)
* feat: Swerve Finance

* export SwerveFillData

* test and CHANGELOG

* feat: Sushiswap (#2700)

* feat: SushiSwap

* Changelog

* fix tests

* Deployed SushiSwap bridge

* Fix test

* IGNORED_EXCESSIVE_TYPES
2020-09-09 21:35:24 +10:00
Jacob Evans
a2f0d5eedf
feat: better Kyber quotes (#2683)
* feat: Kyber rework

* Get additional reserves per token
2020-08-27 15:58:57 +10:00
Jacob Evans
cc31445189
feat: asset-swapper mooniswap (#2675)
* feat: asset-swapper sampler early exit

* feat: asset-swapper mooniswap

* tests and linter

* deploy to mainnet

* CHANGELOGs

* fix excluded sources difference

* typo
2020-08-24 11:21:01 +10:00
Jacob Evans
7e8b56eef4
feat: mStable + FQT Rollup (#2662)
* feat: mStable

* deploy and CHANGELOG

* `@0x/contracts-utils`: Add more testnet addresses.

* `@0x/contract-addresses`: Deply Mstable on testnets

* `@0x/contract-addresses`: Remove testnet deployments of mStable :-)

* move `erc20-bridge-sampler` into `asset-swapper`
remove `DevUtils` dependency from sampler contract.

* `@0x/asset-swapper`: Add ERC20BridgeSampler support for validating orders in maker fees denominated in non-maker assets.
`@0x/asset-swapper`: Add tests for `NativeOrderSampler`.

* `@0x/asset-swapper`: Return `0` sample if native order asset data is unsupported.

* `@0x/asset-swapper`: Fix failing test.

* feat: ExchangeProxy FQT fruit rollup (#2645)

* feat: Optimize Bridges in ExchangeProxy

* compile and most work

* work around to trust the delecall contract

* force allowances

* Update Kyber/Eth2Dai bridges

* Remove memory state where not required

* cleanup

* Combine Bridges into one adapter

* mixins

* refactor out ZeroExBridge

* move out interface

* comment out hacks

* update migrations

* remove simbot hacks

* AdapterAddresses and mStable

* Share constructor arg

* fix migration

* Remove whitespace

* `@0x/contracts-zero-ex`: BridgeAdapter -- revert if bridge address is 0.

* `@0x/contract-addresses`: Deploy FQT.

Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: Lawrence Forman <lawrence@0xproject.com>

* update ganache contract addresses

* fix: asset-swapper empty batch call (#2669)

* update ganache contract addresses

* fix: asset-swapper prevent empty sampler batch call

* add sampler to migrations

* change migrations version

* Use contract-wrappers and artifacts

* remove extra data

* remove deps, set sampler to NULL_ADDRESS

* all the exports

* noop sell rate too

* update ganache contract addresses

Co-authored-by: Lawrence Forman <me@merklejerk.com>
Co-authored-by: Lawrence Forman <lawrence@0xproject.com>
2020-08-20 08:18:44 +10:00
Michael Zhu
2b39ae4800 Redeploy/verify testnet contracts 🙄 2020-08-04 11:08:03 -07:00
Jacob Evans
762e0aec2d
fix: Update to use KNP getExpectedRateAfterFee (#2629)
* Update to use KNP getExpectedRateAfterFee

* hack: use overrides instead of forking in ganache

* fix: added some tests using overrides

* override sampler

* Overrides in bridge_sampler_mainnet_test

* use getContracts to fake out tests

* chore: supply devUtils address

* feat: specify the call override by default

* CHANGELOGs

* export SamplerOverrides

* fix package.json

* fix: after rebase
2020-07-15 14:05:57 +10:00
Lawrence Forman
c546787994 @0x/contract-addresses: Redeploy DFB on kovan.
`@0x/contracts-utils`: Reorganize `DeploymentConstants` addresses.
2020-07-10 01:29:28 -04:00
Xianny
7127f541c3
UniswapV2Bridge (#2590)
* implement UniswapV2 Bridge

* More tests for UniswapV2Bridge

* cleanup and remove ERC20BridgeSampler changes

* enable multihop; address review comments

* solidity 0.6.9 doesnt allow devdoc for public storage vars

* codestyle improvements
2020-06-05 11:56:52 -07:00
xianny
b8d51fc4e8 rename contract to UniswapV2Router01
https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/UniswapV2Router01.sol
2020-06-03 12:08:08 -07:00
Lawrence Forman
429f2bb8dd @0x/contracts-utils: Add UniswapV2 to DeploymentConstants. 2020-06-03 13:57:59 -04:00
Lawrence Forman
2fce332ed7
ZeroEx: TransformERC20, TokenSpender (#2545)
* `@0x/contracts-utils`: Convert more 0.6 contracts

* `@0x/contracts-erc20`: Add solidity 0.6 contracts.

* `@0x/utils`: Add new `ZeroExRevertErrors` revert types

* `@0x/contracts-zero-ex`: Introduce the `TransformERC20` feature.

* `@0x/subproviders`: Update ganache-core.
`@0x/web3-wrapper`: Update ganache-core.

* `@0x/contracts-zero-ex`: Make `TokenSpender`'s puppet contract a distinct contract type and rename `getTokenSpenderPuppet()` to `getAllowanceTarget()`

* `@0x/zero-ex`: Rebase and use "slot" instead of "offset" language in storage buckets.

* `@0x/web3-wrapper`: Add `getAccountNonceAsync()` to `Web3Wrapper`

* `@0x/contracts-zero-ex`: Revamp TransformERC20.

* `@0x/contracts-zero-ex`: Remove `payable` from `IERC20Transformer.transform()` and disable hex capitalization linter rule because of prettier conflicts.

* `@0x/contracts-zero-ex`: Use `immutable` owner in `Puppet` instead of `Ownable`.

* `@x/utils`: Address review feedback.

* `@0x/contracts-zero-ex`: Address review feedback.

* `@0x/contracts-utils`: Address review feedback.

* `@0x/contracts-zero-ex`: Return deployment nonce in `transform()`.

* `@0x/contracts-zero-ex`: Finish returning deployment nonce in `transform()`.

* `@0x/contracts-zero-ex`: Fix doc-gen bug.

* `@0x/contracts-zero-ex`: Address review comments.

* `@0x/utils`: Add `NegativeTransformERC20OutputERror`

* `@0x/contracts-zero-ex`: Revert if the taker's output amount decreases.

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-05-20 22:47:21 -04:00
Lawrence Forman
feb672c3cd @0x/contracts-utils: Make IOwnableV06 conform to IOwnable. 2020-04-28 12:16:11 -04:00
Lawrence Forman
4212a08337 @0x/contracts-utils: Add solidity 0.6 contracts 2020-04-21 22:29:46 -04:00
Jacob Evans
277dbacf68
Set GSTCollector address and deploy Curve (#2530)
* Set GSTCollector address and deploy Curve

* CHANGELOGs
2020-03-26 18:26:16 +10:00
Jacob Evans
568e9be07e
Gas Tokens in Bridges (#2523)
* Gas Tokens in Bridges

* Added freesGasTokensFromCollector.

To handle the case where GST2 is being traded and the balanceOf checks become confusing

* Update CHANGELOGs
2020-03-26 11:58:28 +10:00
Lawrence Forman
c47825a820 @0x/contract-addresses: Redeploy bridges. 2020-03-05 18:39:48 -05:00
Lawrence Forman
5e0758917b @0x/contracts-utils: Update DevUtils address in DeploymentConstants. 2020-02-24 12:42:01 -05:00
Lawrence Forman
3da03da32a @0x/contracts-utils: Add D18 library. 2020-02-19 16:19:09 -05:00
Lawrence Forman
865a253eb5 @0x/contracts-utils: Roll back additions to LibFractions.
`@0x/contracts-dev-utils`: Add `D18` library for working with base-10, 18-digit decimals.
`@0x/contracts-dev-utils`: Use `D18` library instead of `LibFractions` in `LibDydxBalance`.
2020-02-19 15:45:27 -05:00
Lawrence Forman
9b3781abf1 Cherry pick dydx validation from #2456 2020-02-19 15:45:27 -05:00
Lawrence Forman
646b6dafb2 @0x/contract-addresses Redeploy Eth2DaiBridge and ERC20BridgeSampler. 2020-02-07 01:56:59 -05:00
Lawrence Forman
8d10f33a3f @0x/contracts-utils: Update Eth2Dai address. 2020-02-07 01:56:59 -05:00
Lawrence Forman
cb69921202
ERC20BridgeSampler: Unlock full sampling on Kovan (#2459)
* `@0x/contracts-utils`: Update kovan addresses in `DeploymentConstants`

* `@0x/contracts-erc20-bridge-sampler`: Make source IDs static on all networks, not inherited from `DeploymentConstants`.

* `@0x/contract-addresses`: Update `ERC20BridgeSampler` addresses on mainnet and kovan.

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-01-31 11:27:28 -05:00
Amir Bandeali
fa99b75d1f Redeploy Forwarder and all bridges 2020-01-06 22:12:05 -08:00
Lawrence Forman
b7b457b076
Generate (complete) solidity docs (#2391)
* `@0x/sol-doc`: New doc generator.

* `@0x/sol-compiler`: Be more tolerant of AST-only compilation targets.

* `@0x/contracts-exchange`: Add more devdoc comments.
`@0x/contracts-exchange-libs`: Add more devdoc comments.

* `@0x/sol-doc`: Update package script.

* `@0x/sol-doc`: Remove unused files and update package scripts to be easier to configure.

* Add more devdocs to contracts.

* `@0x/sol-doc`: Remove doc artifacts.

* `@0x/sol-doc`: Add `.gitignore` and `.npmignore`.

* `@0x/contracts-exchange`: Fix compilation errors.

* Fix more broken contracts.

* `@0x/contracts-erc20-bridge-sampler`: Fix failing tests.

* `@0x/contracts-asset-proxy`: Remove accidentally introduced hackathion file (lol).

* `@0x/sol-doc`: Prevent some inherited contracts from being included in docs unintentionally.

* `@0x/sol-doc`: Rename test file.

* `@0x/contracts-exchange`: Update `orderEpoch` devdoc.

* `@0x/sol-doc`: Tweak event and function docs.

* Update CODEOWNERS.

* `@0x/sol-doc` Tweak function md generation.

* `@0x/sol-doc`: add `transformDocs()` tests.

* `@0x/sol-doc`: add `extract_docs` tests.

* `@0x/sol-doc` Fix linter errors.

* `@0x/contracts-erc20-bridge-sampler`: Fix broken `ERC20BridgeSampler.sol` compile.

* `@0x/sol-doc` Fix mismatched `dev-utils` dep version.

* `@0x/sol-doc`: Add `gen_md` tests.

* `@0x/sol-doc`: Remove `fs.promises` calls.

* `@0x/sol-doc`: Fix linter errors.

* `@0x/sol-doc`: Export all relevant types and functions.

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-01-03 22:59:18 -05:00
Lawrence Forman
d55eea2239
ERC20BridgeSampler: Gas limits (#2405)
* `@0x/contracts-erc20-bridge-sampler`: Add gas limits to external quote calls.
`@0x/contract-addresses`: Point `erc20BridgeSampler` to new version.

* `@0x/contracts-utils`: Add kovan addresses to `DeploymentConstants`.
`@0x/contract-addresses`: Add kovan `ERC20BridgeSampler` address.

* `@0x/contracts-erc20-bridge-sampler`: Fix changelog.

* `@0x/contracts-erc20-bridge-contracts`: Fix invalid CHANGELOG json (I hope).
2019-12-20 00:08:39 -05:00
Greg Hysen
bec1f23616 Fixed merge conflicts 2019-12-13 11:06:16 -08:00
Greg Hysen
56cbb69401 DyDx bridge implementation using contract as maker with signature validation. 2019-12-13 10:56:54 -08:00
Lawrence Forman
70870ffcd2
Swallow reverts in ERC20BridgeSampler (#2395)
* `@0x/erc20-bridge-sampler`: Do not query empty/unsigned orders. Swallow revets on DEX quotes.

* `@0x/contracts-utils`: Add `DEV_UTILS_ADDRESS` and `KYBER_ETH_ADDRESS` to `DeploymentConstants`.

* `@0x/contracts-erc20-bridge-sampler`: Address review comments.
2019-12-13 10:53:25 -08:00
Amir Bandeali
a7c435adc4 Add mainnet deployment addresses for Dai, Chai, and ERC20BridgeProxy 2019-12-01 15:40:29 -08:00
Alex Towle
1fd92b6cbd Added unit tests for onlyAuthorized 2019-11-25 14:02:53 -06:00
Lawrence Forman
460d5f2517 @0x/contracts-utils: Add DeploymentConstants. 2019-11-20 05:50:15 -05:00
Alex Towle
41d99e77c7 @0x:contracts-utils Removed SafeMath and the use of the contract throughout contracts/ 2019-10-15 14:31:48 -07:00
Alex Towle
1cf8ae5909 @0x:contracts-utils Removed several functions from LibBytes 2019-10-14 11:54:02 -07:00
Alex Towle
65f2626544 @0x:contracts-utils Updated the OwnershipTransferred event to be closer to OpenZeppelin's event 2019-10-10 10:58:58 -07:00
Alex Towle
dc0a78434d @0x:contracts-utils Updated files 2019-10-08 19:27:39 -07:00
Alex Towle
d1b0384aef @0x:contracts-utils Added an event for ownership transfers 2019-10-08 19:22:27 -07:00
mzhu25
ee508f70bc
Merge pull request #2228 from 0xProject/fix/3.0/refundFinalBalanceNoReentry
refundFinalBalanceNoReentry
2019-10-06 13:39:04 -07:00