129 Commits

Author SHA1 Message Date
Lawrence Forman
4dac620156 @0x/contracts-asset-proxy: Update CurveBridge to support more varied curves.
`@0x/contracts-erc20-bridge-sampler`: Refactor.
`@0x/contracts-erc20-bridge-sampler`: Add support for more varied curves.
`@0x/contracts-integrations`: Update curve bridge tests.
2020-07-23 00:36:32 -04:00
mzhu25
ff9c9241d8
BalancerBridge (#2613)
* Add BalancerBridge and Sampler functions

* Update sampler artifacts/wrappers

* Add Balancer support to AssetSwapper + related refactoring

* Make use of GraphQL instead of sampler

* "fix" build and add mainnet BalancerBridge tests

* address some comments

* add balancer cache and fix DexSampler tests

* lint

* wip: tests for balancer sampler ops

* Fix market operation utils test

* balancer unit tests

* Return a buy quote of 0 if the buy amount exceeds the Balancer pool's balance

* Dynamic fee estimation

* Update contract addresses, export BalancerBridge wrapper

* Update changelogs

* Fix bugs discovered via simbot

* Fix issues in balancer_utils

* override `BigNumber.config` in configured_bignumber.ts

* Special case Balancer subops in  too

* Address some more comments

* Address Balancer performance issue

* Performance improvements

* Address comment

* Fix tests

Co-authored-by: xianny <xianny@gmail.com>
2020-07-14 19:18:50 -07:00
Lawrence Forman
845a42e73a @0x/asset-proxy: Fix DFB instability 2020-07-07 01:06:46 -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
Jacob Evans
a458e81f8d
ERC20BridgeSampler: Additional Buy support (#2551)
* ERC20BridgeSampler: Sample Curve Buy

* Fake Buy Kyber/PLP

* Deploy mainnet

* Add Kyber rates for buy tests

* CHANGELOGs

* Provide maxIterations and targetSlippage as options

* Cleanup ERC20BridgeSampler for re-use

* Redeploy Mainnet Kovan

* Feedback fixes

* Handle OOG/revert 0s

* Redeploy Mainnet refactor
2020-04-21 13:26:12 +10:00
Jacob Evans
cdbcada49b Authorize sender adddress 2020-04-07 12:35:18 -04:00
Jacob Evans
282930cb9b Add GST support to DFB 2020-04-07 12:35:18 -04:00
Lawrence Forman
0ccbc7d3d2 @0x/contracts-asset-proxy: Fix typos and remove BridgeTransferFromCallFailed event from DexForwarderBridge. 2020-03-27 16:39:57 -04:00
Lawrence Forman
338c358df2 @0x/contracts-asset-proxy: Address review comments. 2020-03-27 16:39:57 -04:00
Lawrence Forman
4bdaa48303 @0x/contracts-asset-proxy: Create DexForwarderBridge bridge contract. 2020-03-27 16:39:57 -04: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
ce96e35d7d @0x/contracts-asset-proxy: Rename ERC20BridgeTransfer event args to be less ambiguous. 2020-03-13 21:00:35 -04:00
Lawrence Forman
2d7cb63c7b @0x/contracts-asset-proxy: Address review comments. 2020-03-05 18:21:38 -05:00
Lawrence Forman
c3d4c13936 @0x/contracts-erc20: Switch LibERC20Token.approveIfBelowMax() to LibERC20Token.approveIfBelow().
`@0x/contracts-asset-proxy`: Use `LibERC20Token.approveIfBelow()` for bridge approvals.
2020-03-05 18:21:38 -05:00
Lawrence Forman
3f51b9322f @0x/contracts-asset-proxy: Emit ERC20BridgeTransfer events in bridges. 2020-03-05 18:21:38 -05:00
Lawrence Forman
b604e2bd4e @0x/contracts-erc20: Add LibERC20Token.approveIfBelowMax().
`@0x/contracts-asset-proxy`: Use `LibERC20Token.approveIfBelowMax` in all DEX bridges.
2020-03-05 18:21:38 -05:00
mzhu25
9a7c4b21a9
@0x/contracts-erc20-bridge-sampler: Generic liquidity provider sampling (#2487)
* Add methods to Sampler contract to plug into generic on-chain liquidity provider
2020-02-26 11:54:48 -08:00
Lawrence Forman
58f772c74e foo 2020-02-19 15:51:05 -05:00
Lawrence Forman
809885afd0 @0x/contracts-asset-proxy: Add getMarketMarginPremium() to IDydx.
`@0x/contracts-dev-utils`: Handle dydx market premiums.
2020-02-19 15:49:41 -05:00
Lawrence Forman
bf9b4b993f @0x/contracts-test-utils: Fix blockchainTests fork config to work with other tests. 2020-02-19 15:49:41 -05:00
Lawrence Forman
651e94bd94 @0x/asset-proxy: Add more functions to IDydx.
`@0x/dev-utils`: Fix all the weird dydx base unit madness.
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
Jacob Evans
e05a03a842
Curve ERC20Bridge (#2480)
* Curve ERC20Bridge

* ERC20BridgeSampler Curve (#2483)

* ERC20Sampler Curve

* Use Bridge Sources for each Curve

* Support multiple versions of the Curve contract

* CHANGELOG and redeployed Curve (mainnet)

* Fix Market ops utils test

* Added Curve DAI USDC USDT TUSD

* Bump sampler gas limit default

* Decode the Curve in tests

* Disable Curve in Buy tests

* blockchainTests.fork.resets Curve and Sampler
2020-02-15 17:02:19 +11:00
Amir
14ade737da Fix linting errors 2020-01-17 10:47:17 -08:00
Amir
5dd3b8cf9d Special case unlimited allowance for Chai 2020-01-17 09:59:03 -08:00
Amir
9a97401606 Add ChaiBridge allowance checks 2020-01-17 09:59:03 -08:00
Amir
410a3fef18 Add ChaiBridge balance checks to DevUtils 2020-01-17 09:59:03 -08:00
Lawrence Forman
9b7277d464
Fix Kyber and Uniswap ERC20Bridges (#2412)
* `@0x/contracts-asset-proxy`: Fix `UniswapBridge` token -> token transfer logic.
`@0x/contract-addresses`: Update `UniswapBridge` mainnet address.

* `@0x/asset-proxy`: Fix `KyberBridge` incorrect `minConversionRate` calculation.

* `@0x/contract-addresses`: Update `KyberBridge` mainnet address.
2019-12-20 13:41:52 -05:00
Greg Hysen
4415e00b38 Added more integration tests for DydxBridge with the Exchange (demonstrates use cases) 2019-12-19 21:32:03 -08:00
Greg Hysen
358d4d86a7 Added ERC20BridgeProxy.transferFrom tests for DydxBridge 2019-12-19 21:31:07 -08:00
Greg Hysen
410c95308a Updated dydx account encoding to assume that all actions are on partial balances 2019-12-13 12:02:23 -08:00
Greg Hysen
34596b7f83 Use safeGetPartialAmountFloor 2019-12-13 10:58:22 -08:00
Greg Hysen
5ca7169ee5 Reverted to version of dydx bridge that only allows from to be the account owner 2019-12-13 10:58:22 -08:00
Greg Hysen
3300aaa1b9 Refactored so that deposits are done from taker asset data and withdrawals from maker asset data. 2019-12-13 10:58:22 -08:00
Greg Hysen
54afc8a4a1 Fixed merge conflicts 2019-12-13 10:58:22 -08:00
Greg Hysen
f19f4310f4 Updating bridge to work w/o MultiAssetProxy 2019-12-13 10:57:57 -08:00
Greg Hysen
444125a7e1 Simplified the dydx bridge implememtation that does not use the bridge as the maker. 2019-12-13 10:57:57 -08:00
Greg Hysen
56cbb69401 DyDx bridge implementation using contract as maker with signature validation. 2019-12-13 10:56:54 -08:00
Amir Bandeali
b68acd101e Fix failing tests 2019-12-03 08:46:47 -08:00
Amir Bandeali
173ba9b2b5 Add ChaiBridge unit tests 2019-12-02 16:42:17 -08:00
Amir Bandeali
64ed1f87d3 Rethrow custom error string if draw call fails 2019-12-02 16:42:17 -08:00
Amir Bandeali
b8439598bc Remove redundant getters from bridges 2019-12-01 15:55:27 -08:00
Amir Bandeali
7fb0818923 Implement ChaiBridge 2019-12-01 15:54:58 -08:00
Lawrence Forman
27fb51d37f @0x/contracts-asset-proxy: Tweak IUniswapExchangeFactory. 2019-11-25 17:48:53 -05:00
Lawrence Forman
d02db3864e @0x/contracts-erc20-bridge-sampler: Fix kyber bug and add test contract. 2019-11-25 17:48:53 -05:00
Lawrence Forman
30ee456d4c @0x/contracts-asset-proxy: Use DeploymentConstants from @0x/contracts-utils in bridges.
`@0x/contracts-asset-proxy`: Add fallback function to `KyberBridge`.
`@0x/contracts-asset-proxy`: Minor changes to `KyberBridge` contracts based on feedback.
2019-11-20 05:50:15 -05:00
Lawrence Forman
5da1fc8445 @0x/contracts-asset-proxy: Add KyberBridge. 2019-11-20 05:50:15 -05:00
Lawrence Forman
8ba7b95e86 @0x/contracts-utils: Move LibERC20Token out.
`@0x/contracts-erc20`: Move `LibERC20Token` in.
`@0x/contracts-erc20`: Use `LibBytes` and `LibRichErrors` in `LibERC20Token`.
`@0x/contracts-erc20`: Use `verifyEventsFromLogs` in `LibERC20Token` unit tests.
2019-11-01 13:58:22 -04:00
Lawrence Forman
0f3610c92a @0x/contracts-asset-proxy: Use LibERC20Token in UniswapBridge and Eth2DaiBridge. 2019-11-01 13:36:07 -04:00
Amir Bandeali
281658ba34 Rename withdrawTo to bridgeTransferFrom 2019-10-23 09:42:37 -07:00