Compare commits

...

39 Commits

Author SHA1 Message Date
Github Actions
018e25345b Publish
- @0x/contracts-asset-proxy@3.6.6
 - @0x/contracts-broker@1.1.14
 - @0x/contracts-coordinator@3.1.15
 - @0x/contracts-dev-utils@1.3.13
 - @0x/contracts-erc1155@2.1.15
 - @0x/contracts-erc20@3.2.9
 - @0x/contracts-erc721@3.1.15
 - @0x/contracts-exchange-forwarder@4.2.15
 - @0x/contracts-exchange-libs@4.3.15
 - @0x/contracts-exchange@3.2.15
 - @0x/contracts-extensions@6.2.9
 - @0x/contracts-integrations@2.7.10
 - @0x/contracts-multisig@4.1.15
 - @0x/contracts-staking@2.0.22
 - @0x/contracts-test-utils@5.3.12
 - @0x/contracts-utils@4.6.0
 - @0x/contracts-zero-ex@0.10.0
 - @0x/asset-swapper@5.2.0
 - @0x/contract-addresses@5.4.0
 - @0x/contract-wrappers-test@12.2.25
 - @0x/contract-wrappers@13.10.1
 - @0x/migrations@6.5.1
 - @0x/order-utils@10.4.7
2020-11-19 05:32:03 +00:00
Github Actions
b60fa8a7d7 Updated CHANGELOGS & MD docs 2020-11-19 05:31:53 +00:00
Jacob Evans
048d8dee60 fix: [asset-swapper] disable off-chain sampling for Balancer and CREAM (#41)
* fix: [asset-swapper] disable off-chain sampling for Balancer and CREAM

* Modify  Balancer off-chain test to expect only pools

* CHANGELOG
2020-11-19 15:00:09 +10:00
Alex Kroeger
927fe2b58b Improved ComparisonPrice function (#32)
* separated comparison price function into a new file, accounted for backup orders

* removed scratch code

* Adjusted documentation, object naming

* Refactored comparisonPrice function to use adjusted rate from optimizer, used native order fee schedule to adjust for order fees

* Small fixes to function, added unit tests

* Adjusted fee calculation for comparisonPrice function

* use available OptimalPathRate object

* fix lint error in test, separate out fee calculation

* Fixed market operation utils test, added additional checks for fee schedule

* removed unused dep, prettier
2020-11-18 17:12:35 -08:00
mzhu25
89948b360c Add checkAllowance flag to LibTokenSpender.spendERC20Tokens (#39) 2020-11-18 12:23:13 -08: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
4f82543bdf feat: asset-swapper tweak the gas schedule + return decimals (#34)
* feat: asset-swapper Return decimals from sampler in quote

* feat: asset-swapper tweak the gas schedule

* fix lint

* CHANGELOG
2020-11-17 11:36:53 +10:00
Github Actions
3133c509f9 Publish
- @0x/contracts-integrations@2.7.9
 - @0x/asset-swapper@5.1.1
2020-11-14 02:19:41 +00:00
Github Actions
426c15692d Updated CHANGELOGS & MD docs 2020-11-14 02:19:33 +00:00
mzhu25
8c87a77faa Remove PLP VIP path from EP swap quote consumer (#36) 2020-11-13 17:49:30 -08:00
Github Actions
d2018f07a2 Publish
- @0x/contracts-asset-proxy@3.6.5
 - @0x/contracts-broker@1.1.13
 - @0x/contracts-coordinator@3.1.14
 - @0x/contracts-dev-utils@1.3.12
 - @0x/contracts-erc1155@2.1.14
 - @0x/contracts-erc20@3.2.8
 - @0x/contracts-erc721@3.1.14
 - @0x/contracts-exchange-forwarder@4.2.14
 - @0x/contracts-exchange-libs@4.3.14
 - @0x/contracts-exchange@3.2.14
 - @0x/contracts-extensions@6.2.8
 - @0x/contracts-integrations@2.7.8
 - @0x/contracts-multisig@4.1.14
 - @0x/contracts-staking@2.0.21
 - @0x/contracts-test-utils@5.3.11
 - @0x/contracts-utils@4.5.8
 - @0x/contracts-zero-ex@0.9.0
 - @0x/asset-swapper@5.1.0
 - @0x/contract-addresses@5.3.0
 - @0x/contract-artifacts@3.9.0
 - @0x/contract-wrappers-test@12.2.24
 - @0x/contract-wrappers@13.10.0
 - @0x/migrations@6.5.0
 - @0x/order-utils@10.4.6
2020-11-13 21:14:01 +00:00
Github Actions
d2e57d8163 Updated CHANGELOGS & MD docs 2020-11-13 21:13:51 +00:00
mzhu25
7403c0255a Feature/liquidity provider sandbox (#16)
* Update liquidity provider feature to use sandbox

* add support for liquidity provider feature in the exchange proxy swap quote consumer

* Move to off-chain liquidity provider registry

* Update ILiquidityProvider interface

* Remove some unused artifacts and wrappers

* Consolidate ILiquidityProvider

* prettier

* lint

* Address PR feedback

* Add failover to sandbox

* Add test for failover behavior in LiquidityProviderSandbox

* Update changelogs

* Emit events for the new LiquidityProvider scenarios

* Fix swap quote consumer bug

* post-rebase fixes

* `@0x/contracts-zero-ex`: bump feature versions

* Add default field to TokenAdjacencyGraph

* update addresses

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-11-13 12:22:21 -08:00
Steve Marx
75dcd687e2 better protocol fee tests (#25)
* better protocol fee tests
2020-11-09 12:44:52 -05:00
Steve Marx
afd4805421 rewrite ZeroEx in Yul (#23)
rewrite ZeroEx in Yul
2020-11-06 22:03:07 -05:00
Github Actions
6aa582d140 Publish
- @0x/contracts-integrations@2.7.7
 - @0x/asset-swapper@5.0.3
2020-11-05 23:57:34 +00:00
Github Actions
534d92fa00 Updated CHANGELOGS & MD docs 2020-11-05 23:57:28 +00:00
Romain Butteaud
37aae134ab feat: adding Curve pools: PAX, hBTC, metapools: gUSD, hUSD, USDn, mUSD, tBTC (#26)
* feat: adding Curve pools: PAX, hbtc, metapools: gusd, husd, usdn, musd, tbtc

* feat: CHANGELOG

* fix: bad import

* fix: curve_y address downcase, use POOLS addresses for names

* feat: add metaToken attribute to disable metapools for non-metaTokens in Curve

* fix: CHANGELOG
2020-11-05 15:27:45 -08:00
Daniel Pyrathon
36bd8f68c9 adds amendments to the rollout feature flag. Rollout indicative quote… (#30)
* adds amendments to the rollout feature flag. Rollout indicative quotes indipendently from firm quotes.

* Updates based on Brandon's feedback
2020-11-05 12:46:06 -08:00
Github Actions
c3ad42221e Publish
- @0x/contracts-asset-proxy@3.6.4
 - @0x/contracts-broker@1.1.12
 - @0x/contracts-coordinator@3.1.13
 - @0x/contracts-dev-utils@1.3.11
 - @0x/contracts-erc1155@2.1.13
 - @0x/contracts-erc20@3.2.7
 - @0x/contracts-erc721@3.1.13
 - @0x/contracts-exchange-forwarder@4.2.13
 - @0x/contracts-exchange-libs@4.3.13
 - @0x/contracts-exchange@3.2.13
 - @0x/contracts-extensions@6.2.7
 - @0x/contracts-integrations@2.7.6
 - @0x/contracts-multisig@4.1.13
 - @0x/contracts-staking@2.0.20
 - @0x/contracts-test-utils@5.3.10
 - @0x/contracts-utils@4.5.7
 - @0x/contracts-zero-ex@0.8.0
 - @0x/asset-swapper@5.0.2
 - @0x/contract-addresses@5.2.0
 - @0x/contract-wrappers-test@12.2.23
 - @0x/contract-wrappers@13.9.5
 - @0x/migrations@6.4.7
 - @0x/order-utils@10.4.5
2020-11-03 06:46:11 +00:00
Github Actions
602ac1f626 Updated CHANGELOGS & MD docs 2020-11-03 06:46:05 +00:00
Lawrence Forman
3126795efe @0x/contract-addresses: deploy FQT with CORRECT address (#29)
`@0x/contracts-zero-ex`: Trust `boughtAmount` returned by LP

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-11-03 01:12:57 -05:00
Github Actions
dbcb221a59 Publish
- @0x/contracts-asset-proxy@3.6.3
 - @0x/contracts-broker@1.1.11
 - @0x/contracts-coordinator@3.1.12
 - @0x/contracts-dev-utils@1.3.10
 - @0x/contracts-erc1155@2.1.12
 - @0x/contracts-erc20@3.2.6
 - @0x/contracts-erc721@3.1.12
 - @0x/contracts-exchange-forwarder@4.2.12
 - @0x/contracts-exchange-libs@4.3.12
 - @0x/contracts-exchange@3.2.12
 - @0x/contracts-extensions@6.2.6
 - @0x/contracts-integrations@2.7.5
 - @0x/contracts-multisig@4.1.12
 - @0x/contracts-staking@2.0.19
 - @0x/contracts-test-utils@5.3.9
 - @0x/contracts-utils@4.5.6
 - @0x/contracts-zero-ex@0.7.0
 - @0x/asset-swapper@5.0.1
 - @0x/contract-addresses@5.1.0
 - @0x/contract-artifacts@3.8.2
 - @0x/contract-wrappers-test@12.2.22
 - @0x/contract-wrappers@13.9.4
 - @0x/migrations@6.4.6
 - @0x/order-utils@10.4.4
2020-11-03 04:16:44 +00:00
Github Actions
6bbc179f52 Updated CHANGELOGS & MD docs 2020-11-03 04:16:37 +00:00
Lawrence Forman
48e7a391c8 Deploy new FQT (#28)
* `@0x/contracts-zero-ex`: Change `ProtocolFeeUnfunded` event in FQT
`@0x/contracts-zero-ex`: Use new PLP interface in FQT.

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

* fix failing FQT test

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-11-02 21:47:25 -05:00
Github Actions
2334e64d0c Publish
- @0x/contracts-asset-proxy@3.6.2
 - @0x/contracts-broker@1.1.10
 - @0x/contracts-coordinator@3.1.11
 - @0x/contracts-dev-utils@1.3.9
 - @0x/contracts-erc1155@2.1.11
 - @0x/contracts-erc20@3.2.5
 - @0x/contracts-erc721@3.1.11
 - @0x/contracts-exchange-forwarder@4.2.11
 - @0x/contracts-exchange-libs@4.3.11
 - @0x/contracts-exchange@3.2.11
 - @0x/contracts-extensions@6.2.5
 - @0x/contracts-integrations@2.7.4
 - @0x/contracts-multisig@4.1.11
 - @0x/contracts-staking@2.0.18
 - @0x/contracts-test-utils@5.3.8
 - @0x/contracts-utils@4.5.5
 - @0x/contracts-zero-ex@0.6.0
 - @0x/asset-swapper@5.0.0
 - @0x/contract-artifacts@3.8.1
 - @0x/contract-wrappers-test@12.2.21
 - @0x/contract-wrappers@13.9.3
 - @0x/migrations@6.4.5
 - @0x/order-utils@10.4.3
2020-11-02 22:21:36 +00:00
Github Actions
14f920ee84 Updated CHANGELOGS & MD docs 2020-11-02 22:21:30 +00:00
Jacob Evans
e10a81023a feat: [asset-swapper] more hops via token adjacency (#24)
* feat: [asset-swapper] more hops via token adjacency

* fix lint

* CHANGELOG
2020-11-03 07:48:37 +10:00
Lawrence Forman
f4709ed1cb EP: Add LibSignature library (#21)
* `@0x/contracts-zero-ex`: Add `LibSignature` library

* `@0x/contracts-zero-ex`: Update package.json scripts

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-10-29 17:47:17 -04:00
Daniel Pyrathon
e2e14a977a fix: [WIP] Adds RFQ price-aware comparison price to Quote Report (#18)
* Adds RFQ price-aware comparison price to Quote Report

* added linting fix

* added small lints

* better syntax
2020-10-29 08:48:01 -07:00
Jacob Evans
866f958a10 Update README.md 2020-10-29 17:12:23 +10:00
Jacob Evans
717db99b38 fix: Support Multiple Shells (#17)
* fix: Support Multiple Shells

* CHANGEGLOG
2020-10-29 17:09:23 +10:00
Lawrence Forman
02006118c7 Fix broken tools deps (#20)
* update tools deps to highest
add custom doc gen config

* remove phantom package in manifest

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-10-29 16:33:16 +10:00
Steve Marx
9816019bc5 add protocol fees fixin (#2) 2020-10-28 17:10:59 -04:00
Github Actions
9c821dbfc3 Publish
- @0x/contracts-asset-proxy@3.6.1
 - @0x/contracts-broker@1.1.9
 - @0x/contracts-coordinator@3.1.10
 - @0x/contracts-dev-utils@1.3.8
 - @0x/contracts-erc1155@2.1.10
 - @0x/contracts-erc20@3.2.4
 - @0x/contracts-erc721@3.1.10
 - @0x/contracts-exchange-forwarder@4.2.10
 - @0x/contracts-exchange-libs@4.3.10
 - @0x/contracts-exchange@3.2.10
 - @0x/contracts-extensions@6.2.4
 - @0x/contracts-integrations@2.7.3
 - @0x/contracts-multisig@4.1.10
 - @0x/contracts-staking@2.0.17
 - @0x/contracts-test-utils@5.3.7
 - @0x/contracts-utils@4.5.4
 - @0x/contracts-zero-ex@0.5.1
 - @0x/asset-swapper@4.8.1
 - @0x/contract-addresses@5.0.1
 - @0x/contract-wrappers-test@12.2.20
 - @0x/contract-wrappers@13.9.2
 - @0x/migrations@6.4.4
 - @0x/order-utils@10.4.2
2020-10-28 02:10:57 +00:00
Github Actions
af1b890423 Updated CHANGELOGS & MD docs 2020-10-28 02:10:51 +00:00
Romain Butteaud
673835d2de fix: update kovan erc20BridgeSampler (#14)
* fix: update kovan erc20BridgeSampler

* fix update CHANGELOG
2020-10-27 17:51:51 -07:00
Greg Hysz
500b57e935 Adds Template for Specs (#12)
* Adds `docs` directory, along with boilerplate code and templates for readthedocs.org.

* docs: update orders spec

Co-authored-by: Lawrence Forman <me@merklejerk.com>
2020-10-27 16:31:15 -07:00
Jacob Evans
3f7d0580c1 Set the FeeSchedule to Required (#15) 2020-10-28 09:26:14 +10:00
231 changed files with 10937 additions and 4955 deletions

View File

@@ -82,4 +82,5 @@ lib
/packages/asset-swapper/test/generated-wrappers
package.json
packages/*/docs
docs/
*.sol

View File

@@ -8,7 +8,7 @@ This repository is a monorepo including the 0x protocol smart contracts and nume
[website-url]: https://0x.org
[![CircleCI](https://circleci.com/gh/0xProject/0x-monorepo.svg?style=svg&circle-token=61bf7cd8c9b4e11b132089dfcffdd1be277d1e0c)](https://circleci.com/gh/0xProject/0x-monorepo)
[![CircleCI](https://circleci.com/gh/0xProject/protocol.svg?style=svg&circle-token=61bf7cd8c9b4e11b132089dfcffdd1be277d1e0c)](https://circleci.com/gh/0xProject/protocool)
[![Coverage Status](https://coveralls.io/repos/github/0xProject/0x-monorepo/badge.svg?branch=development)](https://coveralls.io/github/0xProject/0x-monorepo?branch=development)
[![Discord](https://img.shields.io/badge/chat-discord.chat-yellow.svg?style=flat)](https://discordapp.com/invite/d3FTX3M)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
@@ -92,7 +92,7 @@ yarn build
To build a specific package:
```bash
PKG=@0x/web3-wrapper yarn build
PKG=@0x/contract-wrappers yarn build
```
To build all contracts packages:
@@ -115,7 +115,7 @@ To watch a specific package and all it's dependent packages:
PKG=[NPM_PACKAGE_NAME] yarn watch
e.g
PKG=@0x/web3-wrapper yarn watch
PKG=@0x/contract-wrappers yarn watch
```
### Clean
@@ -143,7 +143,7 @@ yarn rebuild
To re-build (clean & build) a specific package & it's deps:
```bash
PKG=0x.js yarn rebuild
PKG=@0x/contract-wrappers yarn rebuild
```
### Lint
@@ -157,7 +157,7 @@ yarn lint
Lint a specific package:
```bash
PKG=0x.js yarn lint
PKG=@0x/contract-wrappers yarn lint
```
### Run Tests
@@ -171,7 +171,7 @@ yarn test
Run a specific package's test:
```bash
PKG=@0x/web3-wrapper yarn test
PKG=@0x/contract-wrappers yarn test
```
Run all contracts packages tests:

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "3.6.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "3.6.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "3.6.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "3.6.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "3.6.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "3.6.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.6.0",
"changes": [

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.6.6 - _November 19, 2020_
* Dependencies updated
## v3.6.5 - _November 13, 2020_
* Dependencies updated
## v3.6.4 - _November 3, 2020_
* Dependencies updated
## v3.6.3 - _November 3, 2020_
* Dependencies updated
## v3.6.2 - _November 2, 2020_
* Dependencies updated
## v3.6.1 - _October 28, 2020_
* Dependencies updated
## v3.6.0 - _October 27, 2020_
* Add `SwerveBridge` and `SnowSwapBridge` (duplicate of `CurveBridge`) (#2707)

View File

@@ -51,16 +51,15 @@ contract ShellBridge is
external
returns (bytes4 success)
{
// Decode the bridge data to get the `fromTokenAddress`.
(address fromTokenAddress) = abi.decode(bridgeData, (address));
// Decode the bridge data to get the `fromTokenAddress` and `pool`.
(address fromTokenAddress, address pool) = abi.decode(bridgeData, (address, address));
uint256 fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
IShell exchange = IShell(_getShellAddress());
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
LibERC20Token.approveIfBelow(fromTokenAddress, address(exchange), fromTokenBalance);
LibERC20Token.approveIfBelow(fromTokenAddress, pool, fromTokenBalance);
// Try to sell all of this contract's `fromTokenAddress` token balance.
uint256 boughtAmount = exchange.originSwap(
uint256 boughtAmount = IShell(pool).originSwap(
fromTokenAddress,
toTokenAddress,
fromTokenBalance,

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-asset-proxy",
"version": "3.6.0",
"version": "3.6.6",
"engines": {
"node": ">=6.12"
},
@@ -51,13 +51,13 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contract-wrappers": "^13.9.1",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contract-wrappers": "^13.10.1",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@types/lodash": "4.14.104",
@@ -79,16 +79,16 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-erc1155": "^2.1.9",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-erc721": "^3.1.9",
"@0x/contracts-exchange-libs": "^4.3.9",
"@0x/order-utils": "^10.4.1",
"@0x/types": "^3.2.4",
"@0x/base-contract": "^6.2.11",
"@0x/contracts-erc1155": "^2.1.15",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-erc721": "^3.1.15",
"@0x/contracts-exchange-libs": "^4.3.15",
"@0x/order-utils": "^10.4.7",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"ethereum-types": "^3.3.3",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "1.1.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "1.1.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "1.1.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "1.1.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "1.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "1.1.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "1.1.8",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.14 - _November 19, 2020_
* Dependencies updated
## v1.1.13 - _November 13, 2020_
* Dependencies updated
## v1.1.12 - _November 3, 2020_
* Dependencies updated
## v1.1.11 - _November 3, 2020_
* Dependencies updated
## v1.1.10 - _November 2, 2020_
* Dependencies updated
## v1.1.9 - _October 28, 2020_
* Dependencies updated
## v1.1.8 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-broker",
"version": "1.1.8",
"version": "1.1.14",
"engines": {
"node": ">=6.12"
},
@@ -51,20 +51,20 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-erc721": "^3.1.9",
"@0x/contracts-exchange": "^3.2.9",
"@0x/contracts-exchange-libs": "^4.3.9",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-erc721": "^3.1.15",
"@0x/contracts-exchange": "^3.2.15",
"@0x/contracts-exchange-libs": "^4.3.15",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/web3-wrapper": "^7.2.4",
"@0x/types": "^3.3.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -84,10 +84,10 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/order-utils": "^10.4.1",
"@0x/base-contract": "^6.2.11",
"@0x/order-utils": "^10.4.7",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/utils": "^6.1.0",
"ethereum-types": "^3.3.3"
},
"publishConfig": {

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "3.1.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "3.1.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "3.1.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "3.1.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "3.1.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "3.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.1.9",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.15 - _November 19, 2020_
* Dependencies updated
## v3.1.14 - _November 13, 2020_
* Dependencies updated
## v3.1.13 - _November 3, 2020_
* Dependencies updated
## v3.1.12 - _November 3, 2020_
* Dependencies updated
## v3.1.11 - _November 2, 2020_
* Dependencies updated
## v3.1.10 - _October 28, 2020_
* Dependencies updated
## v3.1.9 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-coordinator",
"version": "3.1.9",
"version": "3.1.15",
"engines": {
"node": ">=6.12"
},
@@ -52,17 +52,17 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-dev-utils": "^1.3.7",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-gen": "2.0.13",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.1",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-dev-utils": "^1.3.13",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-gen": "2.0.18",
"@0x/dev-utils": "^4.0.1",
"@0x/order-utils": "^10.4.7",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -82,16 +82,16 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/assert": "^3.0.13",
"@0x/base-contract": "^6.2.7",
"@0x/contract-addresses": "^5.0.0",
"@0x/contracts-exchange": "^3.2.9",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/json-schemas": "^5.2.3",
"@0x/types": "^3.2.4",
"@0x/assert": "^3.0.17",
"@0x/base-contract": "^6.2.11",
"@0x/contract-addresses": "^5.4.0",
"@0x/contracts-exchange": "^3.2.15",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/json-schemas": "^5.3.3",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/utils": "^6.1.0",
"ethereum-types": "^3.3.3",
"http-status-codes": "^1.3.2"
},

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "1.3.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "1.3.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "1.3.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "1.3.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "1.3.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "1.3.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "1.3.7",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.3.13 - _November 19, 2020_
* Dependencies updated
## v1.3.12 - _November 13, 2020_
* Dependencies updated
## v1.3.11 - _November 3, 2020_
* Dependencies updated
## v1.3.10 - _November 3, 2020_
* Dependencies updated
## v1.3.9 - _November 2, 2020_
* Dependencies updated
## v1.3.8 - _October 28, 2020_
* Dependencies updated
## v1.3.7 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-dev-utils",
"version": "1.3.7",
"version": "1.3.13",
"engines": {
"node": ">=6.12"
},
@@ -41,17 +41,17 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/assert": "^3.0.13",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/assert": "^3.0.17",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"@0x/types": "^3.3.0",
"@0x/utils": "^6.1.0",
"ethereum-types": "^3.3.3",
"ethers": "~4.0.4",
"npm-run-all": "^4.1.2",
@@ -63,7 +63,7 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/base-contract": "^6.2.11",
"@types/node": "12.12.54"
},
"publishConfig": {

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "2.1.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "2.1.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "2.1.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "2.1.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "2.1.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "2.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.1.9",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.15 - _November 19, 2020_
* Dependencies updated
## v2.1.14 - _November 13, 2020_
* Dependencies updated
## v2.1.13 - _November 3, 2020_
* Dependencies updated
## v2.1.12 - _November 3, 2020_
* Dependencies updated
## v2.1.11 - _November 2, 2020_
* Dependencies updated
## v2.1.10 - _October 28, 2020_
* Dependencies updated
## v2.1.9 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc1155",
"version": "2.1.9",
"version": "2.1.15",
"engines": {
"node": ">=6.12"
},
@@ -52,14 +52,14 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -80,10 +80,10 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/base-contract": "^6.2.11",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "3.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "3.2.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "3.2.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "3.2.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "3.2.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "3.2.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.2.3",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.9 - _November 19, 2020_
* Dependencies updated
## v3.2.8 - _November 13, 2020_
* Dependencies updated
## v3.2.7 - _November 3, 2020_
* Dependencies updated
## v3.2.6 - _November 3, 2020_
* Dependencies updated
## v3.2.5 - _November 2, 2020_
* Dependencies updated
## v3.2.4 - _October 28, 2020_
* Dependencies updated
## v3.2.3 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "3.2.3",
"version": "3.2.9",
"engines": {
"node": ">=6.12"
},
@@ -51,18 +51,18 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -82,7 +82,7 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7"
"@0x/base-contract": "^6.2.11"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "3.1.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "3.1.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "3.1.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "3.1.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "3.1.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "3.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.1.9",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.15 - _November 19, 2020_
* Dependencies updated
## v3.1.14 - _November 13, 2020_
* Dependencies updated
## v3.1.13 - _November 3, 2020_
* Dependencies updated
## v3.1.12 - _November 3, 2020_
* Dependencies updated
## v3.1.11 - _November 2, 2020_
* Dependencies updated
## v3.1.10 - _October 28, 2020_
* Dependencies updated
## v3.1.9 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc721",
"version": "3.1.9",
"version": "3.1.15",
"engines": {
"node": ">=6.12"
},
@@ -52,18 +52,18 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -84,7 +84,7 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7"
"@0x/base-contract": "^6.2.11"
},
"publishConfig": {
"access": "public"

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "4.2.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "4.2.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "4.2.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "4.2.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "4.2.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "4.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.2.9",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.2.15 - _November 19, 2020_
* Dependencies updated
## v4.2.14 - _November 13, 2020_
* Dependencies updated
## v4.2.13 - _November 3, 2020_
* Dependencies updated
## v4.2.12 - _November 3, 2020_
* Dependencies updated
## v4.2.11 - _November 2, 2020_
* Dependencies updated
## v4.2.10 - _October 28, 2020_
* Dependencies updated
## v4.2.9 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-forwarder",
"version": "4.2.9",
"version": "4.2.15",
"engines": {
"node": ">=6.12"
},
@@ -52,25 +52,25 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-dev-utils": "^1.3.7",
"@0x/contracts-erc1155": "^2.1.9",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-erc721": "^3.1.9",
"@0x/contracts-exchange": "^3.2.9",
"@0x/contracts-exchange-libs": "^4.3.9",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.1",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-dev-utils": "^1.3.13",
"@0x/contracts-erc1155": "^2.1.15",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-erc721": "^3.1.15",
"@0x/contracts-exchange": "^3.2.15",
"@0x/contracts-exchange-libs": "^4.3.15",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/order-utils": "^10.4.7",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/types": "^3.3.0",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -90,7 +90,7 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/base-contract": "^6.2.11",
"@0x/typescript-typings": "^5.1.5",
"ethereum-types": "^3.3.3"
},

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "4.3.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "4.3.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "4.3.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "4.3.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "4.3.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "4.3.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.3.9",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.3.15 - _November 19, 2020_
* Dependencies updated
## v4.3.14 - _November 13, 2020_
* Dependencies updated
## v4.3.13 - _November 3, 2020_
* Dependencies updated
## v4.3.12 - _November 3, 2020_
* Dependencies updated
## v4.3.11 - _November 2, 2020_
* Dependencies updated
## v4.3.10 - _October 28, 2020_
* Dependencies updated
## v4.3.9 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-libs",
"version": "4.3.9",
"version": "4.3.15",
"engines": {
"node": ">=6.12"
},
@@ -52,14 +52,14 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/subproviders": "^6.1.5",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-gen": "2.0.18",
"@0x/dev-utils": "^4.0.1",
"@0x/sol-compiler": "^4.2.7",
"@0x/subproviders": "^6.1.9",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -80,13 +80,13 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/order-utils": "^10.4.1",
"@0x/types": "^3.2.4",
"@0x/base-contract": "^6.2.11",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/order-utils": "^10.4.7",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/utils": "^6.1.0",
"ethereum-types": "^3.3.3"
},
"publishConfig": {

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "3.2.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "3.2.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "3.2.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "3.2.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "3.2.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "3.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "3.2.9",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.2.15 - _November 19, 2020_
* Dependencies updated
## v3.2.14 - _November 13, 2020_
* Dependencies updated
## v3.2.13 - _November 3, 2020_
* Dependencies updated
## v3.2.12 - _November 3, 2020_
* Dependencies updated
## v3.2.11 - _November 2, 2020_
* Dependencies updated
## v3.2.10 - _October 28, 2020_
* Dependencies updated
## v3.2.9 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange",
"version": "3.2.9",
"version": "3.2.15",
"engines": {
"node": ">=6.12"
},
@@ -52,21 +52,21 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-exchange-libs": "^4.3.9",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-multisig": "^4.1.9",
"@0x/contracts-staking": "^2.0.16",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-exchange-libs": "^4.3.15",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-multisig": "^4.1.15",
"@0x/contracts-staking": "^2.0.22",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/web3-wrapper": "^7.2.4",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -88,13 +88,13 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-dev-utils": "^1.3.7",
"@0x/contracts-erc1155": "^2.1.9",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-erc721": "^3.1.9",
"@0x/order-utils": "^10.4.1",
"@0x/utils": "^5.6.3",
"@0x/base-contract": "^6.2.11",
"@0x/contracts-dev-utils": "^1.3.13",
"@0x/contracts-erc1155": "^2.1.15",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-erc721": "^3.1.15",
"@0x/order-utils": "^10.4.7",
"@0x/utils": "^6.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "6.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "6.2.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "6.2.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "6.2.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "6.2.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "6.2.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "6.2.3",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.2.9 - _November 19, 2020_
* Dependencies updated
## v6.2.8 - _November 13, 2020_
* Dependencies updated
## v6.2.7 - _November 3, 2020_
* Dependencies updated
## v6.2.6 - _November 3, 2020_
* Dependencies updated
## v6.2.5 - _November 2, 2020_
* Dependencies updated
## v6.2.4 - _October 28, 2020_
* Dependencies updated
## v6.2.3 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "6.2.3",
"version": "6.2.9",
"engines": {
"node": ">=6.12"
},
@@ -52,23 +52,23 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-dev-utils": "^1.3.7",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-erc721": "^3.1.9",
"@0x/contracts-exchange": "^3.2.9",
"@0x/contracts-exchange-libs": "^4.3.9",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.1",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-dev-utils": "^1.3.13",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-erc721": "^3.1.15",
"@0x/contracts-exchange": "^3.2.15",
"@0x/contracts-exchange-libs": "^4.3.15",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/order-utils": "^10.4.7",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/types": "^3.3.0",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -90,8 +90,8 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/base-contract": "^6.2.11",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/typescript-typings": "^5.1.5",
"ethereum-types": "^3.3.3"
},

View File

@@ -1,4 +1,76 @@
[
{
"timestamp": 1605763885,
"version": "2.7.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605320370,
"version": "2.7.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "2.7.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604620645,
"version": "2.7.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "2.7.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "2.7.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "2.7.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "2.7.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.7.2",

View File

@@ -5,6 +5,38 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.7.10 - _November 19, 2020_
* Dependencies updated
## v2.7.9 - _November 14, 2020_
* Dependencies updated
## v2.7.8 - _November 13, 2020_
* Dependencies updated
## v2.7.7 - _November 5, 2020_
* Dependencies updated
## v2.7.6 - _November 3, 2020_
* Dependencies updated
## v2.7.5 - _November 3, 2020_
* Dependencies updated
## v2.7.4 - _November 2, 2020_
* Dependencies updated
## v2.7.3 - _October 28, 2020_
* Dependencies updated
## v2.7.2 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-integrations",
"version": "2.7.2",
"version": "2.7.10",
"engines": {
"node": ">=6.12"
},
@@ -51,24 +51,24 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contract-addresses": "^5.0.0",
"@0x/contract-wrappers": "^13.9.1",
"@0x/contracts-broker": "^1.1.8",
"@0x/contracts-coordinator": "^3.1.9",
"@0x/contracts-dev-utils": "^1.3.7",
"@0x/contracts-exchange-forwarder": "^4.2.9",
"@0x/contracts-exchange-libs": "^4.3.9",
"@0x/contracts-extensions": "^6.2.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contract-addresses": "^5.4.0",
"@0x/contract-wrappers": "^13.10.1",
"@0x/contracts-broker": "^1.1.14",
"@0x/contracts-coordinator": "^3.1.15",
"@0x/contracts-dev-utils": "^1.3.13",
"@0x/contracts-exchange-forwarder": "^4.2.15",
"@0x/contracts-exchange-libs": "^4.3.15",
"@0x/contracts-extensions": "^6.2.9",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-utils": "^4.6.0",
"@0x/coordinator-server": "^1.0.5",
"@0x/dev-utils": "^3.3.4",
"@0x/migrations": "^6.4.3",
"@0x/order-utils": "^10.4.1",
"@0x/sol-compiler": "^4.2.3",
"@0x/dev-utils": "^4.0.1",
"@0x/migrations": "^6.5.1",
"@0x/order-utils": "^10.4.7",
"@0x/sol-compiler": "^4.2.7",
"@0x/tslint-config": "^4.1.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/web3-wrapper": "^7.2.8",
"@azure/core-asynciterator-polyfill": "^1.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -91,21 +91,21 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/asset-swapper": "^4.8.0",
"@0x/base-contract": "^6.2.7",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-erc1155": "^2.1.9",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-erc721": "^3.1.9",
"@0x/contracts-exchange": "^3.2.9",
"@0x/contracts-multisig": "^4.1.9",
"@0x/contracts-staking": "^2.0.16",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-zero-ex": "^0.5.0",
"@0x/subproviders": "^6.1.5",
"@0x/types": "^3.2.4",
"@0x/asset-swapper": "^5.2.0",
"@0x/base-contract": "^6.2.11",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-erc1155": "^2.1.15",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-erc721": "^3.1.15",
"@0x/contracts-exchange": "^3.2.15",
"@0x/contracts-multisig": "^4.1.15",
"@0x/contracts-staking": "^2.0.22",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-zero-ex": "^0.10.0",
"@0x/subproviders": "^6.1.9",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/utils": "^6.1.0",
"ethereum-types": "^3.3.3",
"ethereumjs-util": "^6.2.0",
"lodash": "^4.17.11"

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "4.1.15",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "4.1.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "4.1.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "4.1.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "4.1.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "4.1.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.1.9",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.1.15 - _November 19, 2020_
* Dependencies updated
## v4.1.14 - _November 13, 2020_
* Dependencies updated
## v4.1.13 - _November 3, 2020_
* Dependencies updated
## v4.1.12 - _November 3, 2020_
* Dependencies updated
## v4.1.11 - _November 2, 2020_
* Dependencies updated
## v4.1.10 - _October 28, 2020_
* Dependencies updated
## v4.1.9 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "4.1.9",
"version": "4.1.15",
"engines": {
"node": ">=6.12"
},
@@ -49,18 +49,18 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/sol-compiler": "^4.2.7",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/types": "^3.3.0",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
@@ -78,7 +78,7 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/base-contract": "^6.2.11",
"@0x/typescript-typings": "^5.1.5",
"ethereum-types": "^3.3.3"
},

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "2.0.22",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "2.0.21",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "2.0.20",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "2.0.19",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "2.0.18",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "2.0.17",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "2.0.16",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.22 - _November 19, 2020_
* Dependencies updated
## v2.0.21 - _November 13, 2020_
* Dependencies updated
## v2.0.20 - _November 3, 2020_
* Dependencies updated
## v2.0.19 - _November 3, 2020_
* Dependencies updated
## v2.0.18 - _November 2, 2020_
* Dependencies updated
## v2.0.17 - _October 28, 2020_
* Dependencies updated
## v2.0.16 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-staking",
"version": "2.0.16",
"version": "2.0.22",
"engines": {
"node": ">=6.12"
},
@@ -53,20 +53,20 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-asset-proxy": "^3.6.0",
"@0x/contracts-dev-utils": "^1.3.7",
"@0x/contracts-erc20": "^3.2.3",
"@0x/contracts-exchange-libs": "^4.3.9",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-utils": "^4.5.3",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.1",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-asset-proxy": "^3.6.6",
"@0x/contracts-dev-utils": "^1.3.13",
"@0x/contracts-erc20": "^3.2.9",
"@0x/contracts-exchange-libs": "^4.3.15",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-utils": "^4.6.0",
"@0x/dev-utils": "^4.0.1",
"@0x/order-utils": "^10.4.7",
"@0x/sol-compiler": "^4.2.7",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/web3-wrapper": "^7.2.4",
"@0x/types": "^3.3.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/lodash": "4.14.104",
"@types/node": "12.12.54",
"chai": "^4.0.1",
@@ -87,10 +87,10 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/base-contract": "^6.2.11",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/utils": "^6.1.0",
"ethereum-types": "^3.3.3",
"ethereumjs-util": "^5.1.1"
},

View File

@@ -1,4 +1,58 @@
[
{
"timestamp": 1605763885,
"version": "5.3.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1605302002,
"version": "5.3.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "5.3.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "5.3.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "5.3.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "5.3.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "5.3.6",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.3.12 - _November 19, 2020_
* Dependencies updated
## v5.3.11 - _November 13, 2020_
* Dependencies updated
## v5.3.10 - _November 3, 2020_
* Dependencies updated
## v5.3.9 - _November 3, 2020_
* Dependencies updated
## v5.3.8 - _November 2, 2020_
* Dependencies updated
## v5.3.7 - _October 28, 2020_
* Dependencies updated
## v5.3.6 - _October 27, 2020_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.3.6",
"version": "5.3.12",
"engines": {
"node": ">=6.12"
},
@@ -34,7 +34,7 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
"devDependencies": {
"@0x/sol-compiler": "^4.2.3",
"@0x/sol-compiler": "^4.2.7",
"@0x/tslint-config": "^4.1.3",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
@@ -42,20 +42,20 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/assert": "^3.0.13",
"@0x/base-contract": "^6.2.7",
"@0x/contract-addresses": "^5.0.0",
"@0x/dev-utils": "^3.3.4",
"@0x/json-schemas": "^5.2.3",
"@0x/order-utils": "^10.4.1",
"@0x/sol-coverage": "^4.0.14",
"@0x/sol-profiler": "^4.1.4",
"@0x/sol-trace": "^3.0.14",
"@0x/subproviders": "^6.1.5",
"@0x/types": "^3.2.4",
"@0x/assert": "^3.0.17",
"@0x/base-contract": "^6.2.11",
"@0x/contract-addresses": "^5.4.0",
"@0x/dev-utils": "^4.0.1",
"@0x/json-schemas": "^5.3.3",
"@0x/order-utils": "^10.4.7",
"@0x/sol-coverage": "^4.0.18",
"@0x/sol-profiler": "^4.1.8",
"@0x/sol-trace": "^3.0.18",
"@0x/subproviders": "^6.1.9",
"@0x/types": "^3.3.0",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/web3-wrapper": "^7.2.4",
"@0x/utils": "^6.1.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/bn.js": "^4.11.0",
"@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104",

View File

@@ -1,4 +1,59 @@
[
{
"version": "4.6.0",
"changes": [
{
"note": "Add `uint128` functions to `LibSafeMathV06`",
"pr": 27
}
],
"timestamp": 1605763885
},
{
"timestamp": 1605302002,
"version": "4.5.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604385937,
"version": "4.5.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604376968,
"version": "4.5.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1604355662,
"version": "4.5.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603851023,
"version": "4.5.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1603833198,
"version": "4.5.3",

View File

@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.6.0 - _November 19, 2020_
* Add `uint128` functions to `LibSafeMathV06` (#27)
## v4.5.8 - _November 13, 2020_
* Dependencies updated
## v4.5.7 - _November 3, 2020_
* Dependencies updated
## v4.5.6 - _November 3, 2020_
* Dependencies updated
## v4.5.5 - _November 2, 2020_
* Dependencies updated
## v4.5.4 - _October 28, 2020_
* Dependencies updated
## v4.5.3 - _October 27, 2020_
* Dependencies updated

View File

@@ -56,8 +56,6 @@ contract DeploymentConstants {
address constant private MUSD_ADDRESS = 0xe2f2a5C287993345a840Db3B0845fbC70f5935a5;
/// @dev Mainnet address of the Mooniswap Registry contract
address constant private MOONISWAP_REGISTRY = 0x71CD6666064C3A1354a3B4dca5fA1E2D3ee7D303;
/// @dev Mainnet address of the Shell contract
address constant private SHELL_CONTRACT = 0x2E703D658f8dd21709a7B458967aB4081F8D3d05;
/// @dev Mainnet address of the DODO Registry (ZOO) contract
address constant private DODO_REGISTRY = 0x3A97247DF274a17C59A3bd12735ea3FcDFb49950;
/// @dev Mainnet address of the DODO Helper contract
@@ -303,16 +301,6 @@ contract DeploymentConstants {
return MOONISWAP_REGISTRY;
}
/// @dev An overridable way to retrieve the Shell contract address.
/// @return registry The Shell contract address.
function _getShellAddress()
internal
view
returns (address)
{
return SHELL_CONTRACT;
}
/// @dev An overridable way to retrieve the DODO Registry contract address.
/// @return registry The DODO Registry contract address.
function _getDODORegistryAddress()

View File

@@ -105,4 +105,86 @@ library LibSafeMathV06 {
{
return a < b ? a : b;
}
function safeMul128(uint128 a, uint128 b)
internal
pure
returns (uint128)
{
if (a == 0) {
return 0;
}
uint128 c = a * b;
if (c / a != b) {
LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
LibSafeMathRichErrorsV06.BinOpErrorCodes.MULTIPLICATION_OVERFLOW,
a,
b
));
}
return c;
}
function safeDiv128(uint128 a, uint128 b)
internal
pure
returns (uint128)
{
if (b == 0) {
LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
LibSafeMathRichErrorsV06.BinOpErrorCodes.DIVISION_BY_ZERO,
a,
b
));
}
uint128 c = a / b;
return c;
}
function safeSub128(uint128 a, uint128 b)
internal
pure
returns (uint128)
{
if (b > a) {
LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
LibSafeMathRichErrorsV06.BinOpErrorCodes.SUBTRACTION_UNDERFLOW,
a,
b
));
}
return a - b;
}
function safeAdd128(uint128 a, uint128 b)
internal
pure
returns (uint128)
{
uint128 c = a + b;
if (c < a) {
LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(
LibSafeMathRichErrorsV06.BinOpErrorCodes.ADDITION_OVERFLOW,
a,
b
));
}
return c;
}
function max128(uint128 a, uint128 b)
internal
pure
returns (uint128)
{
return a >= b ? a : b;
}
function min128(uint128 a, uint128 b)
internal
pure
returns (uint128)
{
return a < b ? a : b;
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.5.3",
"version": "4.6.0",
"engines": {
"node": ">=6.12"
},
@@ -50,15 +50,15 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
"devDependencies": {
"@0x/abi-gen": "^5.4.3",
"@0x/contracts-gen": "2.0.13",
"@0x/contracts-test-utils": "^5.3.6",
"@0x/dev-utils": "^3.3.4",
"@0x/order-utils": "^10.4.1",
"@0x/sol-compiler": "^4.2.3",
"@0x/abi-gen": "^5.4.7",
"@0x/contracts-gen": "2.0.18",
"@0x/contracts-test-utils": "^5.3.12",
"@0x/dev-utils": "^4.0.1",
"@0x/order-utils": "^10.4.7",
"@0x/sol-compiler": "^4.2.7",
"@0x/tslint-config": "^4.1.3",
"@0x/types": "^3.2.4",
"@0x/web3-wrapper": "^7.2.4",
"@0x/types": "^3.3.0",
"@0x/web3-wrapper": "^7.2.8",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
@@ -79,9 +79,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^6.2.7",
"@0x/base-contract": "^6.2.11",
"@0x/typescript-typings": "^5.1.5",
"@0x/utils": "^5.6.3",
"@0x/utils": "^6.1.0",
"bn.js": "^4.11.8",
"ethereum-types": "^3.3.3"
},

View File

@@ -1,4 +1,91 @@
[
{
"version": "0.10.0",
"changes": [
{
"note": "Add `checkAllowance` flag to LibTokenSpender.spendERC20Tokens",
"pr": 39
},
{
"note": "Use new `checkAllowance` flag in LiquidityProviderFeature, TransformERC20Feature, and MetaTransactionsFeature",
"pr": 39
}
],
"timestamp": 1605763885
},
{
"version": "0.9.0",
"changes": [
{
"note": "Rewrite the ZeroEx contract in Yul",
"pr": 23
},
{
"note": "Update LiquidityProviderFeature to use off-chain registry and sandbox",
"pr": 16
},
{
"note": "Update ILiquidityProvider interface",
"pr": 16
},
{
"note": "Update ProtocolFeeUnfunded event to emit order hash",
"pr": 16
}
],
"timestamp": 1605302002
},
{
"version": "0.8.0",
"changes": [
{
"note": "Trust LP boughtAmount return value",
"pr": 29
}
],
"timestamp": 1604385937
},
{
"version": "0.7.0",
"changes": [
{
"note": "Change `ProtocolFeeUnfunded` event in FQT",
"pr": 28
},
{
"note": "Use new PLP interface in FQT.",
"pr": 28
}
],
"timestamp": 1604376968
},
{
"version": "0.6.0",
"changes": [
{
"note": "Add support for collecting protocol fees in ETH or WETH",
"pr": 2
},
{
"note": "Add `LibSignature` library",
"pr": 21
},
{
"note": "Add `LimitOrdersFeature`",
"pr": 27
}
],
"timestamp": 1604355662
},
{
"timestamp": 1603851023,
"version": "0.5.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.5.0",
"changes": [

View File

@@ -5,6 +5,37 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.10.0 - _November 19, 2020_
* Add `checkAllowance` flag to LibTokenSpender.spendERC20Tokens (#39)
* Use new `checkAllowance` flag in LiquidityProviderFeature, TransformERC20Feature, and MetaTransactionsFeature (#39)
## v0.9.0 - _November 13, 2020_
* Rewrite the ZeroEx contract in Yul (#23)
* Update LiquidityProviderFeature to use off-chain registry and sandbox (#16)
* Update ILiquidityProvider interface (#16)
* Update ProtocolFeeUnfunded event to emit order hash (#16)
## v0.8.0 - _November 3, 2020_
* Trust LP boughtAmount return value (#29)
## v0.7.0 - _November 3, 2020_
* Change `ProtocolFeeUnfunded` event in FQT (#28)
* Use new PLP interface in FQT. (#28)
## v0.6.0 - _November 2, 2020_
* Add support for collecting protocol fees in ETH or WETH (#2)
* Add `LibSignature` library (#21)
* Add `LimitOrdersFeature` (#27)
## v0.5.1 - _October 28, 2020_
* Dependencies updated
## v0.5.0 - _October 27, 2020_
* Add `Swerve`, `SnowSwap`, `DODO` and `SushiSwap` into FQT (#7)

View File

@@ -19,7 +19,8 @@
"evm.bytecode.object",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.object",
"evm.deployedBytecode.sourceMap"
"evm.deployedBytecode.sourceMap",
"evm.methodIdentifiers"
]
}
}

View File

@@ -27,6 +27,7 @@ import "./features/ITransformERC20Feature.sol";
import "./features/IMetaTransactionsFeature.sol";
import "./features/IUniswapFeature.sol";
import "./features/ILiquidityProviderFeature.sol";
import "./features/INativeOrdersFeature.sol";
/// @dev Interface for a fully featured Exchange Proxy.
@@ -38,20 +39,11 @@ interface IZeroEx is
ITransformERC20Feature,
IMetaTransactionsFeature,
IUniswapFeature,
ILiquidityProviderFeature
ILiquidityProviderFeature,
INativeOrdersFeature
{
// solhint-disable state-visibility
/// @dev Fallback for just receiving ether.
receive() external payable;
// solhint-enable state-visibility
/// @dev Get the implementation contract of a registered function.
/// @param selector The function selector.
/// @return impl The implementation contract address.
function getFunctionImplementation(bytes4 selector)
external
view
returns (address impl);
}

View File

@@ -19,19 +19,12 @@
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
import "./migrations/LibBootstrap.sol";
import "./features/BootstrapFeature.sol";
import "./storage/LibProxyStorage.sol";
import "./errors/LibProxyRichErrors.sol";
/// @dev An extensible proxy contract that serves as a universal entry point for
/// interacting with the 0x protocol.
contract ZeroEx {
// solhint-disable separate-by-one-line-in-contract,indent,var-name-mixedcase
using LibBytesV06 for bytes;
/// @dev Construct this contract and register the `BootstrapFeature` feature.
/// After constructing this contract, `bootstrap()` should be called
/// by `bootstrap()` to seed the initial feature set.
@@ -44,48 +37,55 @@ contract ZeroEx {
address(bootstrap);
}
// solhint-disable state-visibility
/// @dev Forwards calls to the appropriate implementation contract.
fallback() external payable {
bytes4 selector = msg.data.readBytes4(0);
address impl = getFunctionImplementation(selector);
if (impl == address(0)) {
_revertWithData(LibProxyRichErrors.NotImplementedError(selector));
// This is used in assembly below as impls_slot.
mapping(bytes4 => address) storage impls =
LibProxyStorage.getStorage().impls;
assembly {
let cdlen := calldatasize()
// equivalent of receive() external payable {}
if iszero(cdlen) {
return(0, 0)
}
// Store at 0x40, to leave 0x00-0x3F for slot calculation below.
calldatacopy(0x40, 0, cdlen)
let selector := and(mload(0x40), 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
// Slot for impls[selector] is keccak256(selector . impls_slot).
mstore(0, selector)
mstore(0x20, impls_slot)
let slot := keccak256(0, 0x40)
let delegate := sload(slot)
if iszero(delegate) {
// Revert with:
// abi.encodeWithSelector(
// bytes4(keccak256("NotImplementedError(bytes4)")),
// selector)
mstore(0, 0x734e6e1c00000000000000000000000000000000000000000000000000000000)
mstore(4, selector)
revert(0, 0x24)
}
let success := delegatecall(
gas(),
delegate,
0x40, cdlen,
0, 0
)
let rdlen := returndatasize()
returndatacopy(0, 0, rdlen)
if success {
return(0, rdlen)
}
revert(0, rdlen)
}
(bool success, bytes memory resultData) = impl.delegatecall(msg.data);
if (!success) {
_revertWithData(resultData);
}
_returnWithData(resultData);
}
/// @dev Fallback for just receiving ether.
receive() external payable {}
// solhint-enable state-visibility
/// @dev Get the implementation contract of a registered function.
/// @param selector The function selector.
/// @return impl The implementation contract address.
function getFunctionImplementation(bytes4 selector)
public
view
returns (address impl)
{
return LibProxyStorage.getStorage().impls[selector];
}
/// @dev Revert with arbitrary bytes.
/// @param data Revert data.
function _revertWithData(bytes memory data) private pure {
assembly { revert(add(data, 32), mload(data)) }
}
/// @dev Return with arbitrary bytes.
/// @param data Return data.
function _returnWithData(bytes memory data) private pure {
assembly { return(add(data, 32), mload(data)) }
}
}

View File

@@ -45,19 +45,4 @@ library LibLiquidityProviderRichErrors {
minBuyAmount
);
}
function NoLiquidityProviderForMarketError(
address xAsset,
address yAsset
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("NoLiquidityProviderForMarketError(address,address)")),
xAsset,
yAsset
);
}
}

View File

@@ -0,0 +1,172 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
library LibNativeOrdersRichErrors {
// solhint-disable func-name-mixedcase
function ProtocolFeeRefundFailed(
address receiver,
uint256 refundAmount
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("ProtocolFeeRefundFailed(address,uint256)")),
receiver,
refundAmount
);
}
function OrderNotFillableByOriginError(
bytes32 orderHash,
address txOrigin,
address orderTxOrigin
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("OrderNotFillableByOriginError(bytes32,address,address)")),
orderHash,
txOrigin,
orderTxOrigin
);
}
function OrderNotFillableError(
bytes32 orderHash,
uint8 orderStatus
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("OrderNotFillableError(bytes32,uint8)")),
orderHash,
orderStatus
);
}
function OrderNotSignedByMakerError(
bytes32 orderHash,
address signer,
address maker
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("OrderNotSignedByMakerError(bytes32,address,address)")),
orderHash,
signer,
maker
);
}
function OrderNotFillableBySenderError(
bytes32 orderHash,
address sender,
address orderSender
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("OrderNotFillableBySenderError(bytes32,address,address)")),
orderHash,
sender,
orderSender
);
}
function OrderNotFillableByTakerError(
bytes32 orderHash,
address taker,
address orderTaker
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("OrderNotFillableByTakerError(bytes32,address,address)")),
orderHash,
taker,
orderTaker
);
}
function CancelSaltTooLowError(
uint256 minValidSalt,
uint256 oldMinValidSalt
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("CancelSaltTooLowError(uint256,uint256)")),
minValidSalt,
oldMinValidSalt
);
}
function FillOrKillFailedError(
bytes32 orderHash,
uint256 takerTokenFilledAmount,
uint256 takerTokenFillAmount
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("FillOrKillFailedError(bytes32,uint256,uint256)")),
orderHash,
takerTokenFilledAmount,
takerTokenFillAmount
);
}
function OnlyOrderMakerAllowed(
bytes32 orderHash,
address sender,
address maker
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("OnlyOrderMakerAllowed(bytes32,address,address)")),
orderHash,
sender,
maker
);
}
}

View File

@@ -26,7 +26,8 @@ library LibSignatureRichErrors {
INVALID_LENGTH,
UNSUPPORTED,
ILLEGAL,
WRONG_SIGNER
WRONG_SIGNER,
BAD_SIGNATURE_DATA
}
// solhint-disable func-name-mixedcase
@@ -49,4 +50,19 @@ library LibSignatureRichErrors {
signature
);
}
function SignatureValidationError(
SignatureValidationErrorCodes code,
bytes32 hash
)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("SignatureValidationError(uint8,bytes32)")),
code,
hash
);
}
}

View File

@@ -0,0 +1,65 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/AuthorizableV06.sol";
import "../vendor/v3/IStaking.sol";
/// @dev The collector contract for protocol fees
contract FeeCollector is AuthorizableV06 {
/// @dev Allow ether transfers to the collector.
receive() external payable { }
constructor() public {
_addAuthorizedAddress(msg.sender);
}
/// @dev Approve the staking contract and join a pool. Only an authority
/// can call this.
/// @param weth The WETH contract.
/// @param staking The staking contract.
/// @param poolId The pool ID this contract is collecting fees for.
function initialize(
IEtherTokenV06 weth,
IStaking staking,
bytes32 poolId
)
external
onlyAuthorized
{
weth.approve(address(staking), type(uint256).max);
staking.joinStakingPoolAsMaker(poolId);
}
/// @dev Convert all held ether to WETH. Only an authority can call this.
/// @param weth The WETH contract.
function convertToWeth(
IEtherTokenV06 weth
)
external
onlyAuthorized
{
// Leave 1 wei behind to avoid expensive zero-->non-zero state change.
if (address(this).balance > 0) {
weth.deposit{value: address(this).balance}();
}
}
}

View File

@@ -0,0 +1,74 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
interface ILiquidityProviderSandbox {
/// @dev Calls `sellTokenForToken` on the given `provider` contract to
/// trigger a trade.
/// @param provider The address of the on-chain liquidity provider.
/// @param inputToken The token being sold.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
function executeSellTokenForToken(
address provider,
address inputToken,
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external;
/// @dev Calls `sellEthForToken` on the given `provider` contract to
/// trigger a trade.
/// @param provider The address of the on-chain liquidity provider.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
function executeSellEthForToken(
address provider,
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external;
/// @dev Calls `sellTokenForEth` on the given `provider` contract to
/// trigger a trade.
/// @param provider The address of the on-chain liquidity provider.
/// @param inputToken The token being sold.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of ETH to buy.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
function executeSellTokenForEth(
address provider,
address inputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external;
}

View File

@@ -0,0 +1,139 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "@0x/contracts-utils/contracts/src/v06/errors/LibOwnableRichErrorsV06.sol";
import "../vendor/ILiquidityProvider.sol";
import "../vendor/v3/IERC20Bridge.sol";
import "./ILiquidityProviderSandbox.sol";
/// @dev A permissionless contract through which the ZeroEx contract can
/// safely trigger a trade on an external `ILiquidityProvider` contract.
contract LiquidityProviderSandbox is
ILiquidityProviderSandbox
{
using LibRichErrorsV06 for bytes;
/// @dev Store the owner as an immutable.
address public immutable owner;
constructor(address owner_)
public
{
owner = owner_;
}
/// @dev Allows only the (immutable) owner to call a function.
modifier onlyOwner() virtual {
if (msg.sender != owner) {
LibOwnableRichErrorsV06.OnlyOwnerError(
msg.sender,
owner
).rrevert();
}
_;
}
/// @dev Calls `sellTokenForToken` on the given `provider` contract to
/// trigger a trade.
/// @param provider The address of the on-chain liquidity provider.
/// @param inputToken The token being sold.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
function executeSellTokenForToken(
address provider,
address inputToken,
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
onlyOwner
override
{
try ILiquidityProvider(provider).sellTokenForToken(
inputToken,
outputToken,
recipient,
minBuyAmount,
auxiliaryData
) {} catch {
IERC20Bridge(provider).bridgeTransferFrom(
outputToken,
provider,
recipient,
minBuyAmount,
auxiliaryData
);
}
}
/// @dev Calls `sellEthForToken` on the given `provider` contract to
/// trigger a trade.
/// @param provider The address of the on-chain liquidity provider.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
function executeSellEthForToken(
address provider,
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
onlyOwner
override
{
ILiquidityProvider(provider).sellEthForToken(
outputToken,
recipient,
minBuyAmount,
auxiliaryData
);
}
/// @dev Calls `sellTokenForEth` on the given `provider` contract to
/// trigger a trade.
/// @param provider The address of the on-chain liquidity provider.
/// @param inputToken The token being sold.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of ETH to buy.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
function executeSellTokenForEth(
address provider,
address inputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
onlyOwner
override
{
ILiquidityProvider(provider).sellTokenForEth(
inputToken,
payable(recipient),
minBuyAmount,
auxiliaryData
);
}
}

View File

@@ -22,45 +22,30 @@ pragma experimental ABIEncoderV2;
/// @dev Feature to swap directly with an on-chain liquidity provider.
interface ILiquidityProviderFeature {
event LiquidityProviderForMarketUpdated(
address indexed xAsset,
address indexed yAsset,
address providerAddress
);
/// @dev Sells `sellAmount` of `inputToken` to the liquidity provider
/// at the given `provider` address.
/// @param inputToken The token being sold.
/// @param outputToken The token being bought.
/// @param provider The address of the on-chain liquidity provider
/// to trade with.
/// @param recipient The recipient of the bought tokens. If equal to
/// address(0), `msg.sender` is assumed to be the recipient.
/// @param sellAmount The amount of `inputToken` to sell.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to
/// buy. Reverts if this amount is not satisfied.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
/// @return boughtAmount The amount of `outputToken` bought.
function sellToLiquidityProvider(
address makerToken,
address takerToken,
address payable recipient,
address inputToken,
address outputToken,
address payable provider,
address recipient,
uint256 sellAmount,
uint256 minBuyAmount
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
payable
returns (uint256 boughtAmount);
/// @dev Sets address of the liquidity provider for a market given
/// (xAsset, yAsset).
/// @param xAsset First asset managed by the liquidity provider.
/// @param yAsset Second asset managed by the liquidity provider.
/// @param providerAddress Address of the liquidity provider.
function setLiquidityProviderForMarket(
address xAsset,
address yAsset,
address providerAddress
)
external;
/// @dev Returns the address of the liquidity provider for a market given
/// (xAsset, yAsset), or reverts if pool does not exist.
/// @param xAsset First asset managed by the liquidity provider.
/// @param yAsset Second asset managed by the liquidity provider.
/// @return providerAddress Address of the liquidity provider.
function getLiquidityProviderForMarket(
address xAsset,
address yAsset
)
external
view
returns (address providerAddress);
}

View File

@@ -0,0 +1,328 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "./libs/LibSignature.sol";
import "./libs/LibNativeOrder.sol";
/// @dev Feature for interacting with limit orders.
interface INativeOrdersFeature {
/// @dev Emitted whenever a `LimitOrder` is filled.
/// @param orderHash The canonical hash of the order.
/// @param maker The maker of the order.
/// @param taker The taker of the order.
/// @param feeRecipient Fee recipient of the order.
/// @param takerTokenFilledAmount How much taker token was filled.
/// @param makerTokenFilledAmount How much maker token was filled.
/// @param protocolFeePaid How much protocol fee was paid.
/// @param pool The fee pool associated with this order.
event LimitOrderFilled(
bytes32 orderHash,
address maker,
address taker,
address feeRecipient,
address makerToken,
address takerToken,
uint128 takerTokenFilledAmount,
uint128 makerTokenFilledAmount,
uint128 takerTokenFeeFilledAmount,
uint256 protocolFeePaid,
bytes32 pool
);
/// @dev Emitted whenever an `RfqOrder` is filled.
/// @param orderHash The canonical hash of the order.
/// @param maker The maker of the order.
/// @param taker The taker of the order.
/// @param takerTokenFilledAmount How much taker token was filled.
/// @param makerTokenFilledAmount How much maker token was filled.
/// @param protocolFeePaid How much protocol fee was paid.
/// @param pool The fee pool associated with this order.
event RfqOrderFilled(
bytes32 orderHash,
address maker,
address taker,
address makerToken,
address takerToken,
uint128 takerTokenFilledAmount,
uint128 makerTokenFilledAmount,
uint256 protocolFeePaid,
bytes32 pool
);
/// @dev Emitted whenever a limit or RFQ order is cancelled.
/// @param orderHash The canonical hash of the order.
/// @param maker The order maker.
event OrderCancelled(
bytes32 orderHash,
address maker
);
/// @dev Emitted whenever limit or RFQ orders are cancelled by pair by a maker.
/// @param maker The maker of the order.
/// @param makerToken The maker token in a pair for the orders cancelled.
/// @param takerToken The taker token in a pair for the orders cancelled.
/// @param minValidSalt The new minimum valid salt an order with this pair must
/// have.
event PairOrdersCancelled(
address maker,
address makerToken,
address takerToken,
uint256 minValidSalt
);
/// @dev Transfers protocol fees from the `FeeCollector` pools into
/// the staking contract.
/// @param poolIds Staking pool IDs
function transferProtocolFeesForPools(bytes32[] calldata poolIds)
external;
/// @dev Fill a limit order. The taker and sender will be the caller.
/// @param order The limit order. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// the caller.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token amount to fill this order with.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillLimitOrder(
LibNativeOrder.LimitOrder calldata order,
LibSignature.Signature calldata signature,
uint128 takerTokenFillAmount
)
external
payable
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);
/// @dev Fill an RFQ order for up to `takerTokenFillAmount` taker tokens.
/// The taker will be the caller. ETH should be attached to pay the
/// protocol fee.
/// @param order The RFQ order.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token amount to fill this order with.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillRfqOrder(
LibNativeOrder.RfqOrder calldata order,
LibSignature.Signature calldata signature,
uint128 takerTokenFillAmount
)
external
payable
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);
/// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.
/// The taker will be the caller. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// the caller.
/// @param order The limit order.
/// @param signature The order signature.
/// @param takerTokenFillAmount How much taker token to fill this order with.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillOrKillLimitOrder(
LibNativeOrder.LimitOrder calldata order,
LibSignature.Signature calldata signature,
uint128 takerTokenFillAmount
)
external
payable
returns (uint128 makerTokenFilledAmount);
/// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.
/// The taker will be the caller. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// the caller.
/// @param order The RFQ order.
/// @param signature The order signature.
/// @param takerTokenFillAmount How much taker token to fill this order with.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillOrKillRfqOrder(
LibNativeOrder.RfqOrder calldata order,
LibSignature.Signature calldata signature,
uint128 takerTokenFillAmount
)
external
payable
returns (uint128 makerTokenFilledAmount);
/// @dev Fill a limit order. Internal variant. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// `msg.sender` (not `sender`).
/// @param order The limit order.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token to fill this order with.
/// @param taker The order taker.
/// @param sender The order sender.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function _fillLimitOrder(
LibNativeOrder.LimitOrder calldata order,
LibSignature.Signature calldata signature,
uint128 takerTokenFillAmount,
address taker,
address sender
)
external
payable
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);
/// @dev Fill an RFQ order. Internal variant. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// `msg.sender` (not `sender`).
/// @param order The RFQ order.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token to fill this order with.
/// @param taker The order taker.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function _fillRfqOrder(
LibNativeOrder.RfqOrder calldata order,
LibSignature.Signature calldata signature,
uint128 takerTokenFillAmount,
address taker
)
external
payable
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);
/// @dev Cancel a single limit order. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param order The limit order.
function cancelLimitOrder(LibNativeOrder.LimitOrder calldata order)
external;
/// @dev Cancel a single RFQ order. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param order The RFQ order.
function cancelRfqOrder(LibNativeOrder.RfqOrder calldata order)
external;
/// @dev Cancel multiple limit orders. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The limit orders.
function batchCancelLimitOrders(LibNativeOrder.LimitOrder[] calldata orders)
external;
/// @dev Cancel multiple RFQ orders. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The RFQ orders.
function batchCancelRfqOrders(LibNativeOrder.RfqOrder[] calldata orders)
external;
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairLimitOrders(
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
external;
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairLimitOrders(
IERC20TokenV06[] calldata makerTokens,
IERC20TokenV06[] calldata takerTokens,
uint256[] calldata minValidSalts
)
external;
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairRfqOrders(
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
external;
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairRfqOrders(
IERC20TokenV06[] calldata makerTokens,
IERC20TokenV06[] calldata takerTokens,
uint256[] calldata minValidSalts
)
external;
/// @dev Get the order info for a limit order.
/// @param order The limit order.
/// @return orderInfo Info about the order.
function getLimitOrderInfo(LibNativeOrder.LimitOrder calldata order)
external
view
returns (LibNativeOrder.OrderInfo memory orderInfo);
/// @dev Get the order info for an RFQ order.
/// @param order The RFQ order.
/// @return orderInfo Info about the order.
function getRfqOrderInfo(LibNativeOrder.RfqOrder calldata order)
external
view
returns (LibNativeOrder.OrderInfo memory orderInfo);
/// @dev Get the canonical hash of a limit order.
/// @param order The limit order.
/// @return orderHash The order hash.
function getLimitOrderHash(LibNativeOrder.LimitOrder calldata order)
external
view
returns (bytes32 orderHash);
/// @dev Get the canonical hash of an RFQ order.
/// @param order The RFQ order.
/// @return orderHash The order hash.
function getRfqOrderHash(LibNativeOrder.RfqOrder calldata order)
external
view
returns (bytes32 orderHash);
/// @dev Get the protocol fee multiplier. This should be multiplied by the
/// gas price to arrive at the required protocol fee to fill a native order.
/// @return multiplier The protocol fee multiplier.
function getProtocolFeeMultiplier()
external
view
returns (uint32 multiplier);
}

View File

@@ -57,4 +57,12 @@ interface ISimpleFunctionRegistryFeature {
external
view
returns (address impl);
/// @dev Get the implementation contract of a registered function.
/// @param selector The function selector.
/// @return impl The implementation contract address.
function getFunctionImplementation(bytes4 selector)
external
view
returns (address impl);
}

View File

@@ -20,15 +20,13 @@ pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "../errors/LibLiquidityProviderRichErrors.sol";
import "../external/ILiquidityProviderSandbox.sol";
import "../external/LiquidityProviderSandbox.sol";
import "../fixins/FixinCommon.sol";
import "../migrations/LibMigrate.sol";
import "../storage/LibLiquidityProviderStorage.sol";
import "../vendor/v3/IERC20Bridge.sol";
import "./IFeature.sol";
import "./ILiquidityProviderFeature.sol";
import "./libs/LibTokenSpender.sol";
@@ -39,27 +37,34 @@ contract LiquidityProviderFeature is
ILiquidityProviderFeature,
FixinCommon
{
using LibERC20TokenV06 for IERC20TokenV06;
using LibSafeMathV06 for uint256;
using LibRichErrorsV06 for bytes;
/// @dev Name of this feature.
string public constant override FEATURE_NAME = "LiquidityProviderFeature";
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 1);
/// @dev ETH pseudo-token address.
address constant internal ETH_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/// @dev The WETH contract address.
IEtherTokenV06 public immutable weth;
/// @dev The sandbox contract address.
ILiquidityProviderSandbox public immutable sandbox;
/// @dev Store the WETH address in an immutable.
/// @param weth_ The weth token.
constructor(IEtherTokenV06 weth_)
/// @dev Event for data pipeline.
event LiquidityProviderSwap(
address inputToken,
address outputToken,
uint256 inputTokenAmount,
uint256 outputTokenAmount,
address provider,
address recipient
);
constructor(LiquidityProviderSandbox sandbox_)
public
FixinCommon()
{
weth = weth_;
sandbox = sandbox_;
}
/// @dev Initialize and register this feature.
@@ -70,131 +75,103 @@ contract LiquidityProviderFeature is
returns (bytes4 success)
{
_registerFeatureFunction(this.sellToLiquidityProvider.selector);
_registerFeatureFunction(this.setLiquidityProviderForMarket.selector);
_registerFeatureFunction(this.getLiquidityProviderForMarket.selector);
return LibMigrate.MIGRATE_SUCCESS;
}
/// @dev Sells `sellAmount` of `inputToken` to the liquidity provider
/// at the given `provider` address.
/// @param inputToken The token being sold.
/// @param outputToken The token being bought.
/// @param provider The address of the on-chain liquidity provider
/// to trade with.
/// @param recipient The recipient of the bought tokens. If equal to
/// address(0), `msg.sender` is assumed to be the recipient.
/// @param sellAmount The amount of `inputToken` to sell.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to
/// buy. Reverts if this amount is not satisfied.
/// @param auxiliaryData Auxiliary data supplied to the `provider` contract.
/// @return boughtAmount The amount of `outputToken` bought.
function sellToLiquidityProvider(
address makerToken,
address takerToken,
address payable recipient,
address inputToken,
address outputToken,
address payable provider,
address recipient,
uint256 sellAmount,
uint256 minBuyAmount
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
override
payable
returns (uint256 boughtAmount)
{
address providerAddress = getLiquidityProviderForMarket(makerToken, takerToken);
if (recipient == address(0)) {
recipient = msg.sender;
}
if (takerToken == ETH_TOKEN_ADDRESS) {
// Wrap ETH.
weth.deposit{value: sellAmount}();
weth.transfer(providerAddress, sellAmount);
if (inputToken == ETH_TOKEN_ADDRESS) {
provider.transfer(sellAmount);
} else {
LibTokenSpender.spendERC20Tokens(
IERC20TokenV06(takerToken),
IERC20TokenV06(inputToken),
msg.sender,
providerAddress,
sellAmount
provider,
sellAmount,
true
);
}
if (makerToken == ETH_TOKEN_ADDRESS) {
uint256 balanceBefore = weth.balanceOf(address(this));
IERC20Bridge(providerAddress).bridgeTransferFrom(
address(weth),
address(0),
address(this),
minBuyAmount,
""
);
boughtAmount = weth.balanceOf(address(this)).safeSub(balanceBefore);
// Unwrap wETH and send ETH to recipient.
weth.withdraw(boughtAmount);
recipient.transfer(boughtAmount);
} else {
uint256 balanceBefore = IERC20TokenV06(makerToken).balanceOf(recipient);
IERC20Bridge(providerAddress).bridgeTransferFrom(
makerToken,
address(0),
if (inputToken == ETH_TOKEN_ADDRESS) {
uint256 balanceBefore = IERC20TokenV06(outputToken).balanceOf(recipient);
sandbox.executeSellEthForToken(
provider,
outputToken,
recipient,
minBuyAmount,
""
auxiliaryData
);
boughtAmount = IERC20TokenV06(makerToken).balanceOf(recipient).safeSub(balanceBefore);
boughtAmount = IERC20TokenV06(outputToken).balanceOf(recipient).safeSub(balanceBefore);
} else if (outputToken == ETH_TOKEN_ADDRESS) {
uint256 balanceBefore = recipient.balance;
sandbox.executeSellTokenForEth(
provider,
inputToken,
recipient,
minBuyAmount,
auxiliaryData
);
boughtAmount = recipient.balance.safeSub(balanceBefore);
} else {
uint256 balanceBefore = IERC20TokenV06(outputToken).balanceOf(recipient);
sandbox.executeSellTokenForToken(
provider,
inputToken,
outputToken,
recipient,
minBuyAmount,
auxiliaryData
);
boughtAmount = IERC20TokenV06(outputToken).balanceOf(recipient).safeSub(balanceBefore);
}
if (boughtAmount < minBuyAmount) {
LibLiquidityProviderRichErrors.LiquidityProviderIncompleteSellError(
providerAddress,
makerToken,
takerToken,
provider,
outputToken,
inputToken,
sellAmount,
boughtAmount,
minBuyAmount
).rrevert();
}
}
/// @dev Sets address of the liquidity provider for a market given
/// (xAsset, yAsset).
/// @param xAsset First asset managed by the liquidity provider.
/// @param yAsset Second asset managed by the liquidity provider.
/// @param providerAddress Address of the liquidity provider.
function setLiquidityProviderForMarket(
address xAsset,
address yAsset,
address providerAddress
)
external
override
onlyOwner
{
LibLiquidityProviderStorage.getStorage()
.addressBook[xAsset][yAsset] = providerAddress;
LibLiquidityProviderStorage.getStorage()
.addressBook[yAsset][xAsset] = providerAddress;
emit LiquidityProviderForMarketUpdated(
xAsset,
yAsset,
providerAddress
emit LiquidityProviderSwap(
inputToken,
outputToken,
sellAmount,
boughtAmount,
provider,
recipient
);
}
/// @dev Returns the address of the liquidity provider for a market given
/// (xAsset, yAsset), or reverts if pool does not exist.
/// @param xAsset First asset managed by the liquidity provider.
/// @param yAsset Second asset managed by the liquidity provider.
/// @return providerAddress Address of the liquidity provider.
function getLiquidityProviderForMarket(
address xAsset,
address yAsset
)
public
view
override
returns (address providerAddress)
{
if (xAsset == ETH_TOKEN_ADDRESS) {
providerAddress = LibLiquidityProviderStorage.getStorage()
.addressBook[address(weth)][yAsset];
} else if (yAsset == ETH_TOKEN_ADDRESS) {
providerAddress = LibLiquidityProviderStorage.getStorage()
.addressBook[xAsset][address(weth)];
} else {
providerAddress = LibLiquidityProviderStorage.getStorage()
.addressBook[xAsset][yAsset];
}
if (providerAddress == address(0)) {
LibLiquidityProviderRichErrors.NoLiquidityProviderForMarketError(
xAsset,
yAsset
).rrevert();
}
}
}

View File

@@ -78,7 +78,7 @@ contract MetaTransactionsFeature is
/// @dev Name of this feature.
string public constant override FEATURE_NAME = "MetaTransactions";
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 1, 0);
/// @dev EIP712 typehash of the `MetaTransactionData` struct.
bytes32 public immutable MTX_EIP712_TYPEHASH = keccak256(
"MetaTransactionData("
@@ -283,7 +283,8 @@ contract MetaTransactionsFeature is
mtx.feeToken,
mtx.signer,
sender,
mtx.feeAmount
mtx.feeAmount,
true
);
}

View File

@@ -0,0 +1,987 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibMathV06.sol";
import "../fixins/FixinCommon.sol";
import "../fixins/FixinProtocolFees.sol";
import "../fixins/FixinEIP712.sol";
import "../errors/LibNativeOrdersRichErrors.sol";
import "../migrations/LibMigrate.sol";
import "../storage/LibNativeOrdersStorage.sol";
import "../vendor/v3/IStaking.sol";
import "./libs/LibTokenSpender.sol";
import "./libs/LibSignature.sol";
import "./libs/LibNativeOrder.sol";
import "./INativeOrdersFeature.sol";
import "./IFeature.sol";
/// @dev Feature for interacting with limit orders.
contract NativeOrdersFeature is
IFeature,
INativeOrdersFeature,
FixinCommon,
FixinProtocolFees,
FixinEIP712
{
using LibSafeMathV06 for uint256;
using LibSafeMathV06 for uint128;
using LibRichErrorsV06 for bytes;
/// @dev Params for `_settleOrder()`.
struct SettleOrderInfo {
// Order hash.
bytes32 orderHash;
// Maker of the order.
address maker;
// Taker of the order.
address taker;
// Maker token.
IERC20TokenV06 makerToken;
// Taker token.
IERC20TokenV06 takerToken;
// Maker token amount.
uint128 makerAmount;
// Taker token amount.
uint128 takerAmount;
// Maximum taker token amount to fill.
uint128 takerTokenFillAmount;
// How much taker token amount has already been filled in this order.
uint128 takerTokenFilledAmount;
}
/// @dev Params for `_fillLimitOrderPrivate()`
struct FillLimitOrderPrivateParams {
// The limit order.
LibNativeOrder.LimitOrder order;
// The order signature.
LibSignature.Signature signature;
// Maximum taker token to fill this order with.
uint128 takerTokenFillAmount;
// The order taker.
address taker;
// The order sender.
address sender;
}
// @dev Fill results returned by `_fillLimitOrderPrivate()` and
/// `_fillRfqOrderPrivate()`.
struct FillNativeOrderResults {
uint256 ethProtocolFeePaid;
uint128 takerTokenFilledAmount;
uint128 makerTokenFilledAmount;
uint128 takerTokenFeeFilledAmount;
}
/// @dev Name of this feature.
string public constant override FEATURE_NAME = "LimitOrders";
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);
/// @dev Highest bit of a uint256, used to flag cancelled orders.
uint256 private constant HIGH_BIT = 1 << 255;
constructor(
address zeroExAddress,
IEtherTokenV06 weth,
IStaking staking,
uint32 protocolFeeMultiplier
)
public
FixinEIP712(zeroExAddress)
FixinProtocolFees(weth, staking, protocolFeeMultiplier)
{
// solhint-disable no-empty-blocks
}
/// @dev Initialize and register this feature.
/// Should be delegatecalled by `Migrate.migrate()`.
/// @return success `LibMigrate.SUCCESS` on success.
function migrate()
external
returns (bytes4 success)
{
_registerFeatureFunction(this.transferProtocolFeesForPools.selector);
_registerFeatureFunction(this.fillLimitOrder.selector);
_registerFeatureFunction(this.fillRfqOrder.selector);
_registerFeatureFunction(this.fillOrKillLimitOrder.selector);
_registerFeatureFunction(this.fillOrKillRfqOrder.selector);
_registerFeatureFunction(this._fillLimitOrder.selector);
_registerFeatureFunction(this._fillRfqOrder.selector);
_registerFeatureFunction(this.cancelLimitOrder.selector);
_registerFeatureFunction(this.cancelRfqOrder.selector);
_registerFeatureFunction(this.batchCancelLimitOrders.selector);
_registerFeatureFunction(this.batchCancelRfqOrders.selector);
_registerFeatureFunction(this.cancelPairLimitOrders.selector);
_registerFeatureFunction(this.batchCancelPairLimitOrders.selector);
_registerFeatureFunction(this.cancelPairRfqOrders.selector);
_registerFeatureFunction(this.batchCancelPairRfqOrders.selector);
_registerFeatureFunction(this.getLimitOrderInfo.selector);
_registerFeatureFunction(this.getRfqOrderInfo.selector);
_registerFeatureFunction(this.getLimitOrderHash.selector);
_registerFeatureFunction(this.getRfqOrderHash.selector);
_registerFeatureFunction(this.getProtocolFeeMultiplier.selector);
return LibMigrate.MIGRATE_SUCCESS;
}
/// @dev Transfers protocol fees from the `FeeCollector` pools into
/// the staking contract.
/// @param poolIds Staking pool IDs
function transferProtocolFeesForPools(bytes32[] calldata poolIds)
external
override
{
for (uint256 i = 0; i < poolIds.length; ++i) {
_transferFeesForPool(poolIds[i]);
}
}
/// @dev Fill a limit order. The taker and sender will be the caller.
/// @param order The limit order. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// the caller.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token amount to fill this order with.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillLimitOrder(
LibNativeOrder.LimitOrder memory order,
LibSignature.Signature memory signature,
uint128 takerTokenFillAmount
)
public
override
payable
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
{
FillNativeOrderResults memory results =
_fillLimitOrderPrivate(FillLimitOrderPrivateParams({
order: order,
signature: signature,
takerTokenFillAmount: takerTokenFillAmount,
taker: msg.sender,
sender: msg.sender
}));
_refundExcessProtocolFeeToSender(results.ethProtocolFeePaid);
(takerTokenFilledAmount, makerTokenFilledAmount) = (
results.takerTokenFilledAmount,
results.makerTokenFilledAmount
);
}
/// @dev Fill an RFQ order for up to `takerTokenFillAmount` taker tokens.
/// The taker will be the caller. ETH should be attached to pay the
/// protocol fee.
/// @param order The RFQ order.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token amount to fill this order with.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillRfqOrder(
LibNativeOrder.RfqOrder memory order,
LibSignature.Signature memory signature,
uint128 takerTokenFillAmount
)
public
override
payable
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
{
FillNativeOrderResults memory results =
_fillRfqOrderPrivate(
order,
signature,
takerTokenFillAmount,
msg.sender
);
_refundExcessProtocolFeeToSender(results.ethProtocolFeePaid);
(takerTokenFilledAmount, makerTokenFilledAmount) = (
results.takerTokenFilledAmount,
results.makerTokenFilledAmount
);
}
/// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.
/// The taker will be the caller. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// the caller.
/// @param order The limit order.
/// @param signature The order signature.
/// @param takerTokenFillAmount How much taker token to fill this order with.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillOrKillLimitOrder(
LibNativeOrder.LimitOrder memory order,
LibSignature.Signature memory signature,
uint128 takerTokenFillAmount
)
public
override
payable
returns (uint128 makerTokenFilledAmount)
{
FillNativeOrderResults memory results =
_fillLimitOrderPrivate(FillLimitOrderPrivateParams({
order: order,
signature: signature,
takerTokenFillAmount: takerTokenFillAmount,
taker: msg.sender,
sender: msg.sender
}));
// Must have filled exactly the amount requested.
if (results.takerTokenFilledAmount < takerTokenFillAmount) {
LibNativeOrdersRichErrors.FillOrKillFailedError(
getLimitOrderHash(order),
results.takerTokenFilledAmount,
takerTokenFillAmount
).rrevert();
}
_refundExcessProtocolFeeToSender(results.ethProtocolFeePaid);
makerTokenFilledAmount = results.makerTokenFilledAmount;
}
/// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.
/// The taker will be the caller. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// the caller.
/// @param order The RFQ order.
/// @param signature The order signature.
/// @param takerTokenFillAmount How much taker token to fill this order with.
/// @return makerTokenFilledAmount How much maker token was filled.
function fillOrKillRfqOrder(
LibNativeOrder.RfqOrder memory order,
LibSignature.Signature memory signature,
uint128 takerTokenFillAmount
)
public
override
payable
returns (uint128 makerTokenFilledAmount)
{
FillNativeOrderResults memory results =
_fillRfqOrderPrivate(
order,
signature,
takerTokenFillAmount,
msg.sender
);
// Must have filled exactly the amount requested.
if (results.takerTokenFilledAmount < takerTokenFillAmount) {
LibNativeOrdersRichErrors.FillOrKillFailedError(
getRfqOrderHash(order),
results.takerTokenFilledAmount,
takerTokenFillAmount
).rrevert();
}
_refundExcessProtocolFeeToSender(results.ethProtocolFeePaid);
makerTokenFilledAmount = results.makerTokenFilledAmount;
}
/// @dev Fill a limit order. Internal variant. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// `msg.sender` (not `sender`).
/// @param order The limit order.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token to fill this order with.
/// @param taker The order taker.
/// @param sender The order sender.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function _fillLimitOrder(
LibNativeOrder.LimitOrder memory order,
LibSignature.Signature memory signature,
uint128 takerTokenFillAmount,
address taker,
address sender
)
public
override
payable
onlySelf
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
{
FillNativeOrderResults memory results =
_fillLimitOrderPrivate(FillLimitOrderPrivateParams({
order: order,
signature: signature,
takerTokenFillAmount: takerTokenFillAmount,
taker: taker,
sender: sender
}));
_refundExcessProtocolFeeToSender(results.ethProtocolFeePaid);
(takerTokenFilledAmount, makerTokenFilledAmount) = (
results.takerTokenFilledAmount,
results.makerTokenFilledAmount
);
}
/// @dev Fill an RFQ order. Internal variant. ETH protocol fees can be
/// attached to this call. Any unspent ETH will be refunded to
/// `msg.sender` (not `sender`).
/// @param order The RFQ order.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token to fill this order with.
/// @param taker The order taker.
/// @return takerTokenFilledAmount How much maker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function _fillRfqOrder(
LibNativeOrder.RfqOrder memory order,
LibSignature.Signature memory signature,
uint128 takerTokenFillAmount,
address taker
)
public
override
payable
onlySelf
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
{
FillNativeOrderResults memory results =
_fillRfqOrderPrivate(
order,
signature,
takerTokenFillAmount,
taker
);
_refundExcessProtocolFeeToSender(results.ethProtocolFeePaid);
(takerTokenFilledAmount, makerTokenFilledAmount) = (
results.takerTokenFilledAmount,
results.makerTokenFilledAmount
);
}
/// @dev Cancel a single limit order. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param order The limit order.
function cancelLimitOrder(LibNativeOrder.LimitOrder memory order)
public
override
{
bytes32 orderHash = getLimitOrderHash(order);
if (msg.sender != order.maker) {
LibNativeOrdersRichErrors.OnlyOrderMakerAllowed(
orderHash,
msg.sender,
order.maker
).rrevert();
}
_cancelOrderHash(orderHash, order.maker);
}
/// @dev Cancel a single RFQ order. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param order The RFQ order.
function cancelRfqOrder(LibNativeOrder.RfqOrder memory order)
public
override
{
bytes32 orderHash = getRfqOrderHash(order);
if (msg.sender != order.maker) {
LibNativeOrdersRichErrors.OnlyOrderMakerAllowed(
orderHash,
msg.sender,
order.maker
).rrevert();
}
_cancelOrderHash(orderHash, order.maker);
}
/// @dev Cancel multiple limit orders. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The limit orders.
function batchCancelLimitOrders(LibNativeOrder.LimitOrder[] memory orders)
public
override
{
for (uint256 i = 0; i < orders.length; ++i) {
cancelLimitOrder(orders[i]);
}
}
/// @dev Cancel multiple RFQ orders. The caller must be the maker.
/// Silently succeeds if the order has already been cancelled.
/// @param orders The RFQ orders.
function batchCancelRfqOrders(LibNativeOrder.RfqOrder[] memory orders)
public
override
{
for (uint256 i = 0; i < orders.length; ++i) {
cancelRfqOrder(orders[i]);
}
}
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairLimitOrders(
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
public
override
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
uint256 oldMinValidSalt =
stor.limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)];
// New min salt must >= the old one.
if (oldMinValidSalt > minValidSalt) {
LibNativeOrdersRichErrors.
CancelSaltTooLowError(minValidSalt, oldMinValidSalt)
.rrevert();
}
stor.limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)] = minValidSalt;
emit PairOrdersCancelled(
msg.sender,
address(makerToken),
address(takerToken),
minValidSalt
);
}
/// @dev Cancel all limit orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairLimitOrders(
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
public
override
{
require(
makerTokens.length == takerTokens.length &&
makerTokens.length == minValidSalts.length,
"LimitOrdersFeature/MISMATCHED_PAIR_ORDERS_ARRAY_LENGTHS"
);
for (uint256 i = 0; i < makerTokens.length; ++i) {
cancelPairLimitOrders(
makerTokens[i],
takerTokens[i],
minValidSalts[i]
);
}
}
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerToken The maker token.
/// @param takerToken The taker token.
/// @param minValidSalt The new minimum valid salt.
function cancelPairRfqOrders(
IERC20TokenV06 makerToken,
IERC20TokenV06 takerToken,
uint256 minValidSalt
)
public
override
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
uint256 oldMinValidSalt =
stor.rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)];
// New min salt must >= the old one.
if (oldMinValidSalt > minValidSalt) {
LibNativeOrdersRichErrors.
CancelSaltTooLowError(minValidSalt, oldMinValidSalt)
.rrevert();
}
stor.rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[msg.sender]
[address(makerToken)]
[address(takerToken)] = minValidSalt;
emit PairOrdersCancelled(
msg.sender,
address(makerToken),
address(takerToken),
minValidSalt
);
}
/// @dev Cancel all RFQ orders for a given maker and pair with a salt less
/// than the value provided. The caller must be the maker. Subsequent
/// calls to this function with the same caller and pair require the
/// new salt to be >= the old salt.
/// @param makerTokens The maker tokens.
/// @param takerTokens The taker tokens.
/// @param minValidSalts The new minimum valid salts.
function batchCancelPairRfqOrders(
IERC20TokenV06[] memory makerTokens,
IERC20TokenV06[] memory takerTokens,
uint256[] memory minValidSalts
)
public
override
{
require(
makerTokens.length == takerTokens.length &&
makerTokens.length == minValidSalts.length,
"LimitOrdersFeature/MISMATCHED_PAIR_ORDERS_ARRAY_LENGTHS"
);
for (uint256 i = 0; i < makerTokens.length; ++i) {
cancelPairRfqOrders(
makerTokens[i],
takerTokens[i],
minValidSalts[i]
);
}
}
/// @dev Get the order info for a limit order.
/// @param order The limit order.
/// @return orderInfo Info about the order.
function getLimitOrderInfo(LibNativeOrder.LimitOrder memory order)
public
override
view
returns (LibNativeOrder.OrderInfo memory orderInfo)
{
// Recover maker and compute order hash.
orderInfo.orderHash = getLimitOrderHash(order);
uint256 minValidSalt = LibNativeOrdersStorage.getStorage()
.limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[order.maker]
[address(order.makerToken)]
[address(order.takerToken)];
_populateCommonOrderInfoFields(
orderInfo,
order.takerAmount,
order.expiry,
order.salt,
minValidSalt
);
}
/// @dev Get the order info for an RFQ order.
/// @param order The RFQ order.
/// @return orderInfo Info about the order.
function getRfqOrderInfo(LibNativeOrder.RfqOrder memory order)
public
override
view
returns (LibNativeOrder.OrderInfo memory orderInfo)
{
// Recover maker and compute order hash.
orderInfo.orderHash = getRfqOrderHash(order);
uint256 minValidSalt = LibNativeOrdersStorage.getStorage()
.rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt
[order.maker]
[address(order.makerToken)]
[address(order.takerToken)];
_populateCommonOrderInfoFields(
orderInfo,
order.takerAmount,
order.expiry,
order.salt,
minValidSalt
);
}
/// @dev Get the canonical hash of a limit order.
/// @param order The limit order.
/// @return orderHash The order hash.
function getLimitOrderHash(LibNativeOrder.LimitOrder memory order)
public
override
view
returns (bytes32 orderHash)
{
return _getEIP712Hash(
LibNativeOrder.getLimitOrderStructHash(order)
);
}
/// @dev Get the canonical hash of an RFQ order.
/// @param order The RFQ order.
/// @return orderHash The order hash.
function getRfqOrderHash(LibNativeOrder.RfqOrder memory order)
public
override
view
returns (bytes32 orderHash)
{
return _getEIP712Hash(
LibNativeOrder.getRfqOrderStructHash(order)
);
}
/// @dev Get the protocol fee multiplier. This should be multiplied by the
/// gas price to arrive at the required protocol fee to fill a native order.
/// @return multiplier The protocol fee multiplier.
function getProtocolFeeMultiplier()
external
override
view
returns (uint32 multiplier)
{
return PROTOCOL_FEE_MULTIPLIER;
}
/// @dev Populate `status` and `takerTokenFilledAmount` fields in
/// `orderInfo`, which use the same code path for both limit and
/// RFQ orders.
/// @param orderInfo `OrderInfo` with `orderHash` and `maker` filled.
/// @param takerAmount The order's taker token amount..
/// @param expiry The order's expiry.
/// @param salt The order's salt.
/// @param salt The minimum valid salt for the maker and pair combination.
function _populateCommonOrderInfoFields(
LibNativeOrder.OrderInfo memory orderInfo,
uint128 takerAmount,
uint64 expiry,
uint256 salt,
uint256 minValidSalt
)
private
view
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
// Get the filled and direct cancel state.
{
// The high bit of the raw taker token filled amount will be set
// if the order was cancelled.
uint256 rawTakerTokenFilledAmount =
stor.orderHashToTakerTokenFilledAmount[orderInfo.orderHash];
orderInfo.takerTokenFilledAmount = uint128(rawTakerTokenFilledAmount);
if (orderInfo.takerTokenFilledAmount >= takerAmount) {
orderInfo.status = LibNativeOrder.OrderStatus.FILLED;
return;
}
if (rawTakerTokenFilledAmount & HIGH_BIT != 0) {
orderInfo.status = LibNativeOrder.OrderStatus.CANCELLED;
return;
}
}
// Check for expiration.
if (expiry <= uint64(block.timestamp)) {
orderInfo.status = LibNativeOrder.OrderStatus.EXPIRED;
return;
}
// Check if the order was cancelled by salt.
if (minValidSalt > salt) {
orderInfo.status = LibNativeOrder.OrderStatus.CANCELLED;
return;
}
orderInfo.status = LibNativeOrder.OrderStatus.FILLABLE;
}
/// @dev Cancel a limit or RFQ order directly by its order hash.
/// @param orderHash The order's order hash.
/// @param maker The order's maker.
function _cancelOrderHash(bytes32 orderHash, address maker)
private
{
LibNativeOrdersStorage.Storage storage stor =
LibNativeOrdersStorage.getStorage();
// Set the high bit on the raw taker token fill amount to indicate
// a cancel. It's OK to cancel twice.
stor.orderHashToTakerTokenFilledAmount[orderHash] |= HIGH_BIT;
emit OrderCancelled(orderHash, msg.sender);
}
/// @dev Fill a limit order. Private variant. Does not refund protocol fees.
/// @param params Function params.
/// @return results Results of the fill.
function _fillLimitOrderPrivate(FillLimitOrderPrivateParams memory params)
private
returns (FillNativeOrderResults memory results)
{
LibNativeOrder.OrderInfo memory orderInfo = getLimitOrderInfo(params.order);
// Must be fillable.
if (orderInfo.status != LibNativeOrder.OrderStatus.FILLABLE) {
LibNativeOrdersRichErrors.OrderNotFillableError(
orderInfo.orderHash,
uint8(orderInfo.status)
).rrevert();
}
// Must be fillable by the taker.
if (params.order.taker != address(0) && params.order.taker != params.taker) {
LibNativeOrdersRichErrors.OrderNotFillableByTakerError(
orderInfo.orderHash,
params.taker,
params.order.taker
).rrevert();
}
// Must be fillable by the sender.
if (params.order.sender != address(0) && params.order.sender != params.sender) {
LibNativeOrdersRichErrors.OrderNotFillableBySenderError(
orderInfo.orderHash,
params.sender,
params.order.sender
).rrevert();
}
// Signature must be valid for the order.
{
address signer = LibSignature.getSignerOfHash(
orderInfo.orderHash,
params.signature
);
if (signer != params.order.maker) {
LibNativeOrdersRichErrors.OrderNotSignedByMakerError(
orderInfo.orderHash,
signer,
params.order.maker
).rrevert();
}
}
// Pay the protocol fee.
results.ethProtocolFeePaid = _collectProtocolFee(params.order.pool);
// Settle between the maker and taker.
(results.takerTokenFilledAmount, results.makerTokenFilledAmount) = _settleOrder(
SettleOrderInfo({
orderHash: orderInfo.orderHash,
maker: params.order.maker,
taker: params.taker,
makerToken: IERC20TokenV06(params.order.makerToken),
takerToken: IERC20TokenV06(params.order.takerToken),
makerAmount: params.order.makerAmount,
takerAmount: params.order.takerAmount,
takerTokenFillAmount: params.takerTokenFillAmount,
takerTokenFilledAmount: orderInfo.takerTokenFilledAmount
})
);
// Pay the fee recipient.
if (params.order.takerTokenFeeAmount > 0) {
results.takerTokenFeeFilledAmount = uint128(LibMathV06.getPartialAmountFloor(
results.takerTokenFilledAmount,
params.order.takerAmount,
params.order.takerTokenFeeAmount
));
LibTokenSpender.spendERC20Tokens(
params.order.takerToken,
params.taker,
params.order.feeRecipient,
uint256(results.takerTokenFeeFilledAmount),
false
);
}
emit LimitOrderFilled(
orderInfo.orderHash,
params.order.maker,
params.taker,
params.order.feeRecipient,
address(params.order.makerToken),
address(params.order.takerToken),
results.takerTokenFilledAmount,
results.makerTokenFilledAmount,
results.takerTokenFeeFilledAmount,
results.ethProtocolFeePaid,
params.order.pool
);
}
/// @dev Fill an RFQ order. Private variant. Does not refund protocol fees.
/// @param order The RFQ order.
/// @param signature The order signature.
/// @param takerTokenFillAmount Maximum taker token to fill this order with.
/// @param taker The order taker.
/// @return results Results of the fill.
function _fillRfqOrderPrivate(
LibNativeOrder.RfqOrder memory order,
LibSignature.Signature memory signature,
uint128 takerTokenFillAmount,
address taker
)
private
returns (FillNativeOrderResults memory results)
{
LibNativeOrder.OrderInfo memory orderInfo = getRfqOrderInfo(order);
// Must be fillable.
if (orderInfo.status != LibNativeOrder.OrderStatus.FILLABLE) {
LibNativeOrdersRichErrors.OrderNotFillableError(
orderInfo.orderHash,
uint8(orderInfo.status)
).rrevert();
}
// Must be fillable by the tx.origin.
if (order.txOrigin != address(0) && order.txOrigin != tx.origin) {
LibNativeOrdersRichErrors.OrderNotFillableByOriginError(
orderInfo.orderHash,
tx.origin,
order.txOrigin
).rrevert();
}
// Signature must be valid for the order.
{
address signer = LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
if (signer != order.maker) {
LibNativeOrdersRichErrors.OrderNotSignedByMakerError(
orderInfo.orderHash,
signer,
order.maker
).rrevert();
}
}
// Pay the protocol fee.
results.ethProtocolFeePaid = _collectProtocolFee(order.pool);
// Settle between the maker and taker.
(results.takerTokenFilledAmount, results.makerTokenFilledAmount) = _settleOrder(
SettleOrderInfo({
orderHash: orderInfo.orderHash,
maker: order.maker,
taker: taker,
makerToken: IERC20TokenV06(order.makerToken),
takerToken: IERC20TokenV06(order.takerToken),
makerAmount: order.makerAmount,
takerAmount: order.takerAmount,
takerTokenFillAmount: takerTokenFillAmount,
takerTokenFilledAmount: orderInfo.takerTokenFilledAmount
})
);
emit RfqOrderFilled(
orderInfo.orderHash,
order.maker,
taker,
address(order.makerToken),
address(order.takerToken),
results.takerTokenFilledAmount,
results.makerTokenFilledAmount,
results.ethProtocolFeePaid,
order.pool
);
}
/// @dev Settle the trade between an order's maker and taker.
/// @param settleInfo Information needed to execute the settlement.
/// @return takerTokenFilledAmount How much taker token was filled.
/// @return makerTokenFilledAmount How much maker token was filled.
function _settleOrder(SettleOrderInfo memory settleInfo)
private
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
{
// Clamp the taker token fill amount to the fillable amount.
takerTokenFilledAmount = LibSafeMathV06.min128(
settleInfo.takerTokenFillAmount,
settleInfo.takerAmount.safeSub128(settleInfo.takerTokenFilledAmount)
);
// Compute the maker token amount.
// This should never overflow because the values are all clamped to
// (2^128-1).
makerTokenFilledAmount = uint128(LibMathV06.getPartialAmountFloor(
uint256(takerTokenFilledAmount),
uint256(settleInfo.takerAmount),
uint256(settleInfo.makerAmount)
));
if (takerTokenFilledAmount == 0 || makerTokenFilledAmount == 0) {
// Nothing to do.
return (0, 0);
}
// Update filled state for the order.
LibNativeOrdersStorage
.getStorage()
.orderHashToTakerTokenFilledAmount[settleInfo.orderHash] =
// OK to overwrite the whole word because we shouldn't get to this
// function if the order is cancelled.
settleInfo.takerTokenFilledAmount.safeAdd128(takerTokenFilledAmount);
// Transfer taker -> maker.
LibTokenSpender.spendERC20Tokens(
settleInfo.takerToken,
settleInfo.taker,
settleInfo.maker,
takerTokenFilledAmount,
false
);
// Transfer maker -> taker.
LibTokenSpender.spendERC20Tokens(
settleInfo.makerToken,
settleInfo.maker,
settleInfo.taker,
makerTokenFilledAmount,
false
);
}
/// @dev Refund any leftover protocol fees in `msg.value` to `msg.sender`.
/// @param ethProtocolFeePaid How much ETH was paid in protocol fees.
function _refundExcessProtocolFeeToSender(uint256 ethProtocolFeePaid)
private
{
if (msg.value > ethProtocolFeePaid && msg.sender != address(this)) {
uint256 refundAmount = msg.value.safeSub(ethProtocolFeePaid);
(bool success,) = msg
.sender
.call{value: refundAmount}("");
if (!success) {
LibNativeOrdersRichErrors.ProtocolFeeRefundFailed(
msg.sender,
refundAmount
).rrevert();
}
}
}
}

View File

@@ -56,6 +56,7 @@ contract SimpleFunctionRegistryFeature is
// Register getters.
_extend(this.getRollbackLength.selector, _implementation);
_extend(this.getRollbackEntryAtIndex.selector, _implementation);
_extend(this.getFunctionImplementation.selector, _implementation);
return LibBootstrap.BOOTSTRAP_SUCCESS;
}
@@ -151,6 +152,18 @@ contract SimpleFunctionRegistryFeature is
return LibSimpleFunctionRegistryStorage.getStorage().implHistory[selector][idx];
}
/// @dev Get the implementation contract of a registered function.
/// @param selector The function selector.
/// @return impl The implementation contract address.
function getFunctionImplementation(bytes4 selector)
external
override
view
returns (address impl)
{
return LibProxyStorage.getStorage().impls[selector];
}
/// @dev Register or replace a function.
/// @param selector The function selector.
/// @param impl The implementation contract for the function.

View File

@@ -58,7 +58,7 @@ contract TransformERC20Feature is
/// @dev Name of this feature.
string public constant override FEATURE_NAME = "TransformERC20";
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 2, 0);
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 3, 1);
/// @dev Initialize and register this feature.
/// Should be delegatecalled by `Migrate.migrate()`.
@@ -317,7 +317,13 @@ contract TransformERC20Feature is
// Transfer input tokens.
if (!LibERC20Transformer.isTokenETH(inputToken)) {
// Token is not ETH, so pull ERC20 tokens.
LibTokenSpender.spendERC20Tokens(inputToken, from, to, amount);
LibTokenSpender.spendERC20Tokens(
inputToken,
from,
to,
amount,
true
);
} else if (msg.value < amount) {
// Token is ETH, so the caller must attach enough ETH to the call.
LibTransformERC20RichErrors.InsufficientEthAttachedError(

View File

@@ -37,7 +37,7 @@ contract UniswapFeature is
/// @dev Name of this feature.
string public constant override FEATURE_NAME = "UniswapFeature";
/// @dev Version of this feature.
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 1, 0);
/// @dev WETH contract.
IEtherTokenV06 private immutable WETH;
/// @dev AllowanceTarget instance.

View File

@@ -0,0 +1,213 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
/// @dev A library for common native order operations.
library LibNativeOrder {
enum OrderStatus {
INVALID,
FILLABLE,
FILLED,
CANCELLED,
EXPIRED
}
/// @dev A standard OTC or OO limit order.
struct LimitOrder {
IERC20TokenV06 makerToken;
IERC20TokenV06 takerToken;
uint128 makerAmount;
uint128 takerAmount;
uint128 takerTokenFeeAmount;
address maker;
address taker;
address sender;
address feeRecipient;
bytes32 pool;
uint64 expiry;
uint256 salt;
}
/// @dev An RFQ limit order.
struct RfqOrder {
IERC20TokenV06 makerToken;
IERC20TokenV06 takerToken;
uint128 makerAmount;
uint128 takerAmount;
address maker;
address txOrigin;
bytes32 pool;
uint64 expiry;
uint256 salt;
}
/// @dev Info on a limit or RFQ order.
struct OrderInfo {
bytes32 orderHash;
OrderStatus status;
uint128 takerTokenFilledAmount;
}
uint256 private constant UINT_128_MASK = (1 << 128) - 1;
uint256 private constant UINT_64_MASK = (1 << 64) - 1;
uint256 private constant ADDRESS_MASK = (1 << 160) - 1;
// The type hash for limit orders, which is:
// keccak256(abi.encodePacked(
// "LimitOrder(",
// "address makerToken,",
// "address takerToken,",
// "uint128 makerAmount,",
// "uint128 takerAmount,",
// "uint128 takerTokenFeeAmount,",
// "address maker,",
// "address taker,",
// "address sender,",
// "address feeRecipient,",
// "bytes32 pool,",
// "uint64 expiry,",
// "uint256 salt"
// ")"
// ))
uint256 private constant _LIMIT_ORDER_TYPEHASH =
0xce918627cb55462ddbb85e73de69a8b322f2bc88f4507c52fcad6d4c33c29d49;
// The type hash for RFQ orders, which is:
// keccak256(abi.encodePacked(
// "RfqOrder(",
// "address makerToken,",
// "address takerToken,",
// "uint128 makerAmount,",
// "uint128 takerAmount,",
// "address maker,",
// "address txOrigin,",
// "bytes32 pool,",
// "uint64 expiry,",
// "uint256 salt"
// ")"
// ))
uint256 private constant _RFQ_ORDER_TYPEHASH =
0xc6b3034376598bc7f28b05e81db7ed88486dcdb6b4a6c7300353fffc5f31f382;
/// @dev Get the struct hash of a limit order.
/// @param order The limit order.
/// @return structHash The struct hash of the order.
function getLimitOrderStructHash(LimitOrder memory order)
internal
pure
returns (bytes32 structHash)
{
// The struct hash is:
// keccak256(abi.encode(
// TYPE_HASH,
// order.makerToken,
// order.takerToken,
// order.makerAmount,
// order.takerAmount,
// order.takerTokenFeeAmount,
// order.maker,
// order.taker,
// order.sender,
// order.feeRecipient,
// order.pool,
// order.expiry,
// order.salt,
// ))
assembly {
let mem := mload(0x40)
mstore(mem, _LIMIT_ORDER_TYPEHASH)
// order.makerToken;
mstore(add(mem, 0x20), and(ADDRESS_MASK, mload(order)))
// order.takerToken;
mstore(add(mem, 0x40), and(ADDRESS_MASK, mload(add(order, 0x20))))
// order.makerAmount;
mstore(add(mem, 0x60), and(UINT_128_MASK, mload(add(order, 0x40))))
// order.takerAmount;
mstore(add(mem, 0x80), and(UINT_128_MASK, mload(add(order, 0x60))))
// order.takerTokenFeeAmount;
mstore(add(mem, 0xA0), and(UINT_128_MASK, mload(add(order, 0x80))))
// order.maker;
mstore(add(mem, 0xC0), and(ADDRESS_MASK, mload(add(order, 0xA0))))
// order.taker;
mstore(add(mem, 0xE0), and(ADDRESS_MASK, mload(add(order, 0xC0))))
// order.sender;
mstore(add(mem, 0x100), and(ADDRESS_MASK, mload(add(order, 0xE0))))
// order.feeRecipient;
mstore(add(mem, 0x120), and(ADDRESS_MASK, mload(add(order, 0x100))))
// order.pool;
mstore(add(mem, 0x140), mload(add(order, 0x120)))
// order.expiry;
mstore(add(mem, 0x160), and(UINT_64_MASK, mload(add(order, 0x140))))
// order.salt;
mstore(add(mem, 0x180), mload(add(order, 0x160)))
structHash := keccak256(mem, 0x1A0)
}
}
/// @dev Get the struct hash of a RFQ order.
/// @param order The RFQ order.
/// @return structHash The struct hash of the order.
function getRfqOrderStructHash(RfqOrder memory order)
internal
pure
returns (bytes32 structHash)
{
// The struct hash is:
// keccak256(abi.encode(
// TYPE_HASH,
// order.makerToken,
// order.takerToken,
// order.makerAmount,
// order.takerAmount,
// order.maker,
// order.txOrigin,
// order.pool,
// order.expiry,
// order.salt,
// ))
assembly {
let mem := mload(0x40)
mstore(mem, _RFQ_ORDER_TYPEHASH)
// order.makerToken;
mstore(add(mem, 0x20), and(ADDRESS_MASK, mload(order)))
// order.takerToken;
mstore(add(mem, 0x40), and(ADDRESS_MASK, mload(add(order, 0x20))))
// order.makerAmount;
mstore(add(mem, 0x60), and(UINT_128_MASK, mload(add(order, 0x40))))
// order.takerAmount;
mstore(add(mem, 0x80), and(UINT_128_MASK, mload(add(order, 0x60))))
// order.maker;
mstore(add(mem, 0xA0), and(ADDRESS_MASK, mload(add(order, 0x80))))
// order.txOrigin;
mstore(add(mem, 0xC0), and(ADDRESS_MASK, mload(add(order, 0xA0))))
// order.pool;
mstore(add(mem, 0xE0), mload(add(order, 0xC0)))
// order.expiry;
mstore(add(mem, 0x100), and(UINT_64_MASK, mload(add(order, 0xE0))))
// order.salt;
mstore(add(mem, 0x120), mload(add(order, 0x100)))
structHash := keccak256(mem, 0x140)
}
}
}

View File

@@ -0,0 +1,151 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
import "../../errors/LibSignatureRichErrors.sol";
/// @dev A library for validating signatures.
library LibSignature {
using LibRichErrorsV06 for bytes;
// '\x19Ethereum Signed Message:\n32\x00\x00\x00\x00' in a word.
uint256 private constant ETH_SIGN_HASH_PREFIX =
0x19457468657265756d205369676e6564204d6573736167653a0a333200000000;
/// @dev Exclusive upper limit on ECDSA signatures 'R' values.
/// The valid range is given by fig (282) of the yellow paper.
uint256 private constant ECDSA_SIGNATURE_R_LIMIT =
uint256(0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141);
/// @dev Exclusive upper limit on ECDSA signatures 'S' values.
/// The valid range is given by fig (283) of the yellow paper.
uint256 private constant ECDSA_SIGNATURE_S_LIMIT = ECDSA_SIGNATURE_R_LIMIT / 2 + 1;
/// @dev Allowed signature types.
enum SignatureType {
ILLEGAL,
INVALID,
EIP712,
ETHSIGN
}
/// @dev Encoded EC signature.
struct Signature {
// How to validate the signature.
SignatureType signatureType;
// EC Signature data.
uint8 v;
// EC Signature data.
bytes32 r;
// EC Signature data.
bytes32 s;
}
/// @dev Retrieve the signer of a signature.
/// Throws if the signature can't be validated.
/// @param hash The hash that was signed.
/// @param signature The signature.
/// @return recovered The recovered signer address.
function getSignerOfHash(
bytes32 hash,
Signature memory signature
)
internal
pure
returns (address recovered)
{
// Ensure this is a signature type that can be validated against a hash.
_validateHashCompatibleSignature(hash, signature);
if (signature.signatureType == SignatureType.EIP712) {
// Signed using EIP712
recovered = ecrecover(
hash,
signature.v,
signature.r,
signature.s
);
} else if (signature.signatureType == SignatureType.ETHSIGN) {
// Signed using `eth_sign`
// Need to hash `hash` with "\x19Ethereum Signed Message:\n32" prefix
// in packed encoding.
bytes32 ethSignHash;
assembly {
// Use scratch space
mstore(0, ETH_SIGN_HASH_PREFIX) // length of 28 bytes
mstore(28, hash) // length of 32 bytes
ethSignHash := keccak256(0, 60)
}
recovered = ecrecover(
ethSignHash,
signature.v,
signature.r,
signature.s
);
}
// `recovered` can be null if the signature values are out of range.
if (recovered == address(0)) {
LibSignatureRichErrors.SignatureValidationError(
LibSignatureRichErrors.SignatureValidationErrorCodes.BAD_SIGNATURE_DATA,
hash
).rrevert();
}
}
/// @dev Validates that a signature is compatible with a hash signee.
/// @param hash The hash that was signed.
/// @param signature The signature.
function _validateHashCompatibleSignature(
bytes32 hash,
Signature memory signature
)
private
pure
{
// Ensure the r and s are within malleability limits.
if (uint256(signature.r) >= ECDSA_SIGNATURE_R_LIMIT ||
uint256(signature.s) >= ECDSA_SIGNATURE_S_LIMIT)
{
LibSignatureRichErrors.SignatureValidationError(
LibSignatureRichErrors.SignatureValidationErrorCodes.BAD_SIGNATURE_DATA,
hash
).rrevert();
}
// Always illegal signature.
if (signature.signatureType == SignatureType.ILLEGAL) {
LibSignatureRichErrors.SignatureValidationError(
LibSignatureRichErrors.SignatureValidationErrorCodes.ILLEGAL,
hash
).rrevert();
}
// Always invalid.
if (signature.signatureType == SignatureType.INVALID) {
LibSignatureRichErrors.SignatureValidationError(
LibSignatureRichErrors.SignatureValidationErrorCodes.ALWAYS_INVALID,
hash
).rrevert();
}
// Solidity should check that the signature type is within enum range for us
// when abi-decoding.
}
}

View File

@@ -27,16 +27,22 @@ import "../ITokenSpenderFeature.sol";
library LibTokenSpender {
using LibRichErrorsV06 for bytes;
// Mask of the lower 20 bytes of a bytes32.
uint256 constant private ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
/// @dev Transfers ERC20 tokens from `owner` to `to`.
/// @param token The token to spend.
/// @param owner The owner of the tokens.
/// @param to The recipient of the tokens.
/// @param amount The amount of `token` to transfer.
/// @param checkAllowance Whether or not to check the owner's allowance
/// prior to attempting the transfer.
function spendERC20Tokens(
IERC20TokenV06 token,
address owner,
address to,
uint256 amount
uint256 amount,
bool checkAllowance
)
internal
{
@@ -45,16 +51,29 @@ library LibTokenSpender {
require(address(token) != address(this), "LibTokenSpender/CANNOT_INVOKE_SELF");
if (checkAllowance) {
// If the owner doesn't have a sufficient allowance set on `address(this)`,
// try the old AllowanceTarget.
if (token.allowance(owner, address(this)) < amount) {
return ITokenSpenderFeature(address(this))._spendERC20Tokens(
token,
owner,
to,
amount
);
}
}
assembly {
let ptr := mload(0x40) // free memory pointer
// selector for transferFrom(address,address,uint256)
mstore(ptr, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
mstore(add(ptr, 0x04), owner)
mstore(add(ptr, 0x24), to)
mstore(add(ptr, 0x04), and(owner, ADDRESS_MASK))
mstore(add(ptr, 0x24), and(to, ADDRESS_MASK))
mstore(add(ptr, 0x44), amount)
success := call(gas(), token, 0, ptr, 0x64, 0, 0)
success := call(gas(), and(token, ADDRESS_MASK), 0, ptr, 0x64, 0, 0)
let rdsize := returndatasize()

View File

@@ -0,0 +1,129 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
import "../external/FeeCollector.sol";
import "../features/libs/LibTokenSpender.sol";
import "../vendor/v3/IStaking.sol";
/// @dev Helpers for collecting protocol fees.
abstract contract FixinProtocolFees {
/// @dev The protocol fee multiplier.
uint32 public immutable PROTOCOL_FEE_MULTIPLIER;
/// @dev Hash of the fee collector init code.
bytes32 private immutable FEE_COLLECTOR_INIT_CODE_HASH;
/// @dev The WETH token contract.
IEtherTokenV06 private immutable WETH;
/// @dev The staking contract.
IStaking private immutable STAKING;
constructor(
IEtherTokenV06 weth,
IStaking staking,
uint32 protocolFeeMultiplier
)
internal
{
FEE_COLLECTOR_INIT_CODE_HASH = keccak256(type(FeeCollector).creationCode);
WETH = weth;
STAKING = staking;
PROTOCOL_FEE_MULTIPLIER = protocolFeeMultiplier;
}
/// @dev Collect the specified protocol fee in ETH.
/// The fee is stored in a per-pool fee collector contract.
/// @param poolId The pool ID for which a fee is being collected.
/// @return ethProtocolFeePaid How much protocol fee was collected in ETH.
function _collectProtocolFee(bytes32 poolId)
internal
returns (uint256 ethProtocolFeePaid)
{
uint256 protocolFeePaid = _getSingleProtocolFee();
if (protocolFeePaid == 0) {
// Nothing to do.
return 0;
}
FeeCollector feeCollector = _getFeeCollector(poolId);
(bool success,) = address(feeCollector).call{value: protocolFeePaid}("");
require(success, "FixinProtocolFees/ETHER_TRANSFER_FALIED");
return protocolFeePaid;
}
/// @dev Transfer fees for a given pool to the staking contract.
/// @param poolId Identifies the pool whose fees are being paid.
function _transferFeesForPool(bytes32 poolId)
internal
{
FeeCollector feeCollector = _getFeeCollector(poolId);
uint256 codeSize;
assembly {
codeSize := extcodesize(feeCollector)
}
if (codeSize == 0) {
// Create and initialize the contract if necessary.
new FeeCollector{salt: bytes32(poolId)}();
feeCollector.initialize(WETH, STAKING, poolId);
}
if (address(feeCollector).balance > 1) {
feeCollector.convertToWeth(WETH);
}
uint256 bal = WETH.balanceOf(address(feeCollector));
if (bal > 1) {
// Leave 1 wei behind to avoid high SSTORE cost of zero-->non-zero.
STAKING.payProtocolFee(
address(feeCollector),
address(feeCollector),
bal - 1);
}
}
/// @dev Compute the CREATE2 address for a fee collector.
/// @param poolId The fee collector's pool ID.
function _getFeeCollector(bytes32 poolId)
internal
view
returns (FeeCollector)
{
// Compute the CREATE2 address for the fee collector.
address payable addr = address(uint256(keccak256(abi.encodePacked(
byte(0xff),
address(this),
poolId, // pool ID is salt
FEE_COLLECTOR_INIT_CODE_HASH
))));
return FeeCollector(addr);
}
/// @dev Get the cost of a single protocol fee.
/// @return protocolFeeAmount The protocol fee amount, in ETH/WETH.
function _getSingleProtocolFee()
internal
view
returns (uint256 protocolFeeAmount)
{
return uint256(PROTOCOL_FEE_MULTIPLIER) * tx.gasprice;
}
}

View File

@@ -25,6 +25,7 @@ import "../features/TokenSpenderFeature.sol";
import "../features/TransformERC20Feature.sol";
import "../features/SignatureValidatorFeature.sol";
import "../features/MetaTransactionsFeature.sol";
import "../features/NativeOrdersFeature.sol";
import "../external/AllowanceTarget.sol";
import "./InitialMigration.sol";
@@ -42,6 +43,7 @@ contract FullMigration {
TransformERC20Feature transformERC20;
SignatureValidatorFeature signatureValidator;
MetaTransactionsFeature metaTransactions;
NativeOrdersFeature nativeOrders;
}
/// @dev Parameters needed to initialize features.
@@ -84,7 +86,7 @@ contract FullMigration {
/// @param features Features to add to the proxy.
/// @return _zeroEx The configured ZeroEx contract. Same as the `zeroEx` parameter.
/// @param migrateOpts Parameters needed to initialize features.
function initializeZeroEx(
function migrateZeroEx(
address payable owner,
ZeroEx zeroEx,
Features memory features,
@@ -195,5 +197,16 @@ contract FullMigration {
address(this)
);
}
// NativeOrdersFeature
{
// Register the feature.
ownable.migrate(
address(features.nativeOrders),
abi.encodeWithSelector(
NativeOrdersFeature.migrate.selector
),
address(this)
);
}
}
}

View File

@@ -22,20 +22,29 @@ pragma experimental ABIEncoderV2;
import "./LibStorage.sol";
/// @dev Storage helpers for `LiquidityProviderFeature`.
library LibLiquidityProviderStorage {
/// @dev Storage helpers for `NativeOrdersFeature`.
library LibNativeOrdersStorage {
/// @dev Storage bucket for this feature.
struct Storage {
// Mapping of taker token -> maker token -> liquidity provider address
// Note that addressBook[x][y] == addressBook[y][x] will always hold.
mapping (address => mapping (address => address)) addressBook;
// How much taker token has been filled in order.
// The lower `uint128` is the taker token fill amount.
// The high bit will be `1` if the order was directly cancelled.
mapping(bytes32 => uint256) orderHashToTakerTokenFilledAmount;
// The minimum valid order salt for a given maker and order pair (maker, taker)
// for limit orders.
mapping(address => mapping(address => mapping(address => uint256)))
limitOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt;
// The minimum valid order salt for a given maker and order pair (maker, taker)
// for RFQ orders.
mapping(address => mapping(address => mapping(address => uint256)))
rfqOrdersMakerToMakerTokenToTakerTokenToMinValidOrderSalt;
}
/// @dev Get the storage bucket for this contract.
function getStorage() internal pure returns (Storage storage stor) {
uint256 storageSlot = LibStorage.getStorageSlot(
LibStorage.StorageId.LiquidityProvider
LibStorage.StorageId.NativeOrders
);
// Dip into assembly to change the slot pointed to by the local
// variable `stor`.

View File

@@ -37,7 +37,7 @@ library LibStorage {
TransformERC20,
MetaTransactions,
ReentrancyGuard,
LiquidityProvider
NativeOrders
}
/// @dev Get the storage slot given a storage ID. We assign unique, well-spaced

View File

@@ -27,6 +27,7 @@ import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibMathV06.sol";
import "../errors/LibTransformERC20RichErrors.sol";
import "../vendor/v3/IExchange.sol";
import "../vendor/v3/LibOrderHash.sol";
import "./bridges/IBridgeAdapter.sol";
import "./Transformer.sol";
import "./LibERC20Transformer.sol";
@@ -104,13 +105,8 @@ contract FillQuoteTransformer is
/// @dev Emitted when a trade is skipped due to a lack of funds
/// to pay the 0x Protocol fee.
/// @param ethBalance The current eth balance.
/// @param ethNeeded The current eth balance required to pay
/// the protocol fee.
event ProtocolFeeUnfunded(
uint256 ethBalance,
uint256 ethNeeded
);
/// @param orderHash The hash of the order that was skipped.
event ProtocolFeeUnfunded(bytes32 orderHash);
/// @dev The Exchange ERC20Proxy ID.
bytes4 private constant ERC20_ASSET_PROXY_ID = 0xf47261b0;
@@ -450,7 +446,11 @@ contract FillQuoteTransformer is
}
// Emit an event if we do not have sufficient ETH to cover the protocol fee.
if (state.ethRemaining < state.protocolFee) {
emit ProtocolFeeUnfunded(state.ethRemaining, state.protocolFee);
bytes32 orderHash = LibOrderHash.getTypedDataHash(
order,
exchange.EIP712_EXCHANGE_DOMAIN_HASH()
);
emit ProtocolFeeUnfunded(orderHash);
return results;
}
try

View File

@@ -64,22 +64,6 @@ contract BridgeAdapter is
address private immutable UNISWAP_BRIDGE_ADDRESS;
address private immutable UNISWAP_V2_BRIDGE_ADDRESS;
/// @dev Emitted when a trade occurs.
/// @param inputToken The token the bridge is converting from.
/// @param outputToken The token the bridge is converting to.
/// @param inputTokenAmount Amount of input token.
/// @param outputTokenAmount Amount of output token.
/// @param from The bridge address, indicating the underlying source of the fill.
/// @param to The `to` address, currrently `address(this)`
event ERC20BridgeTransfer(
IERC20TokenV06 inputToken,
IERC20TokenV06 outputToken,
uint256 inputTokenAmount,
uint256 outputTokenAmount,
address from,
address to
);
constructor(AdapterAddresses memory addresses)
public
MixinBalancer()
@@ -89,7 +73,7 @@ contract BridgeAdapter is
MixinMooniswap(addresses)
MixinMStable(addresses)
MixinOasis(addresses)
MixinShell(addresses)
MixinShell()
MixinSushiswap(addresses)
MixinUniswap(addresses)
MixinUniswapV2(addresses)
@@ -209,7 +193,8 @@ contract BridgeAdapter is
sellAmount,
bridgeData
);
// Do not emit an event. The bridge contract should emit one itself.
// Old bridge contracts should emit an `ERC20BridgeTransfer` themselves,
// otherwise an event will be emitted from `_tradeZeroExBridge`.
return boughtAmount;
}

View File

@@ -44,7 +44,6 @@ contract MixinAdapterAddresses
address uniswapV2Router;
address uniswapExchangeFactory;
address mStable;
address shell;
address dodoHelper;
// Other
address weth;

View File

@@ -37,22 +37,11 @@ interface IShell {
returns (uint256 toAmount);
}
contract MixinShell is
MixinAdapterAddresses
{
using LibERC20TokenV06 for IERC20TokenV06;
/// @dev Mainnet address of the `Shell` contract.
IShell private immutable SHELL;
constructor(AdapterAddresses memory addresses)
public
{
SHELL = IShell(addresses.shell);
}
function _tradeShell(
IERC20TokenV06 buyToken,
uint256 sellAmount,
@@ -61,15 +50,15 @@ contract MixinShell is
internal
returns (uint256 boughtAmount)
{
(address fromTokenAddress) = abi.decode(bridgeData, (address));
(address fromTokenAddress, address pool) = abi.decode(bridgeData, (address, address));
// Grant the Shell contract an allowance to sell the first token.
IERC20TokenV06(fromTokenAddress).approveIfBelow(
address(SHELL),
pool,
sellAmount
);
boughtAmount = SHELL.originSwap(
boughtAmount = IShell(pool).originSwap(
fromTokenAddress,
address(buyToken),
// Sell all tokens we hold.

View File

@@ -21,32 +21,31 @@ pragma solidity ^0.6.5;
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "../../../vendor/ILiquidityProvider.sol";
import "../../../vendor/v3/IERC20Bridge.sol";
interface IERC20Bridge {
/// @dev Transfers `amount` of the ERC20 `buyToken` from `from` to `to`.
/// @param buyToken The address of the ERC20 token to transfer.
/// @param from Address to transfer asset from.
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
/// @param bridgeData Arbitrary asset data needed by the bridge contract.
/// @return success The magic bytes `0xdc1600f3` if successful.
function bridgeTransferFrom(
IERC20TokenV06 buyToken,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
)
external
returns (bytes4 success);
}
contract MixinZeroExBridge {
using LibERC20TokenV06 for IERC20TokenV06;
using LibSafeMathV06 for uint256;
/// @dev Emitted when a trade occurs.
/// @param inputToken The token the bridge is converting from.
/// @param outputToken The token the bridge is converting to.
/// @param inputTokenAmount Amount of input token.
/// @param outputTokenAmount Amount of output token.
/// @param from The bridge address, indicating the underlying source of the fill.
/// @param to The `to` address, currrently `address(this)`
event ERC20BridgeTransfer(
IERC20TokenV06 inputToken,
IERC20TokenV06 outputToken,
uint256 inputTokenAmount,
uint256 outputTokenAmount,
address from,
address to
);
function _tradeZeroExBridge(
address bridgeAddress,
IERC20TokenV06 sellToken,
@@ -57,19 +56,37 @@ contract MixinZeroExBridge {
internal
returns (uint256 boughtAmount)
{
uint256 balanceBefore = buyToken.balanceOf(address(this));
// Trade the good old fashioned way
sellToken.compatTransfer(
bridgeAddress,
sellAmount
);
IERC20Bridge(bridgeAddress).bridgeTransferFrom(
buyToken,
address(bridgeAddress),
address(this),
1, // amount to transfer back from the bridge
bridgeData
);
boughtAmount = buyToken.balanceOf(address(this)).safeSub(balanceBefore);
try ILiquidityProvider(bridgeAddress).sellTokenForToken(
address(sellToken),
address(buyToken),
address(this), // recipient
1, // minBuyAmount
bridgeData
) returns (uint256 _boughtAmount) {
boughtAmount = _boughtAmount;
emit ERC20BridgeTransfer(
sellToken,
buyToken,
sellAmount,
boughtAmount,
bridgeAddress,
address(this)
);
} catch {
uint256 balanceBefore = buyToken.balanceOf(address(this));
IERC20Bridge(bridgeAddress).bridgeTransferFrom(
address(buyToken),
bridgeAddress,
address(this), // recipient
1, // minBuyAmount
bridgeData
);
boughtAmount = buyToken.balanceOf(address(this)).safeSub(balanceBefore);
}
}
}

View File

@@ -0,0 +1,92 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
interface ILiquidityProvider {
/// @dev Trades `inputToken` for `outputToken`. The amount of `inputToken`
/// to sell must be transferred to the contract prior to calling this
/// function to trigger the trade.
/// @param inputToken The token being sold.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
/// @return boughtAmount The amount of `outputToken` bought.
function sellTokenForToken(
address inputToken,
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
returns (uint256 boughtAmount);
/// @dev Trades ETH for token. ETH must either be attached to this function
/// call or sent to the contract prior to calling this function to
/// trigger the trade.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
/// @return boughtAmount The amount of `outputToken` bought.
function sellEthForToken(
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
payable
returns (uint256 boughtAmount);
/// @dev Trades token for ETH. The token must be sent to the contract prior
/// to calling this function to trigger the trade.
/// @param inputToken The token being sold.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of ETH to buy.
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
/// @return boughtAmount The amount of ETH bought.
function sellTokenForEth(
address inputToken,
address payable recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
returns (uint256 boughtAmount);
/// @dev Quotes the amount of `outputToken` that would be obtained by
/// selling `sellAmount` of `inputToken`.
/// @param inputToken Address of the taker token (what to sell). Use
/// the wETH address if selling ETH.
/// @param outputToken Address of the maker token (what to buy). Use
/// the wETH address if buying ETH.
/// @param sellAmount Amount of `inputToken` to sell.
/// @return outputTokenAmount Amount of `outputToken` that would be obtained.
function getSellQuote(
address inputToken,
address outputToken,
uint256 sellAmount
)
external
view
returns (uint256 outputTokenAmount);
}

View File

@@ -104,4 +104,9 @@ interface IExchange {
external
view
returns (address proxyAddress);
function EIP712_EXCHANGE_DOMAIN_HASH()
external
view
returns (bytes32 domainHash);
}

View File

@@ -0,0 +1,24 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
interface IStaking {
function joinStakingPoolAsMaker(bytes32) external;
function payProtocolFee(address, address, uint256) external payable;
}

View File

@@ -0,0 +1,167 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
import "./IExchange.sol";
library LibOrderHash {
using LibOrderHash for IExchange.Order;
// Hash for the EIP712 Order Schema:
// keccak256(abi.encodePacked(
// "Order(",
// "address makerAddress,",
// "address takerAddress,",
// "address feeRecipientAddress,",
// "address senderAddress,",
// "uint256 makerAssetAmount,",
// "uint256 takerAssetAmount,",
// "uint256 makerFee,",
// "uint256 takerFee,",
// "uint256 expirationTimeSeconds,",
// "uint256 salt,",
// "bytes makerAssetData,",
// "bytes takerAssetData,",
// "bytes makerFeeAssetData,",
// "bytes takerFeeAssetData",
// ")"
// ))
bytes32 constant internal _EIP712_ORDER_SCHEMA_HASH =
0xf80322eb8376aafb64eadf8f0d7623f22130fd9491a221e902b713cb984a7534;
/// @dev Calculates the EIP712 typed data hash of an order with a given domain separator.
/// @param order The order structure.
/// @param eip712ExchangeDomainHash Domain hash for the Exchange.
/// @return orderHash EIP712 typed data hash of the order.
function getTypedDataHash(IExchange.Order memory order, bytes32 eip712ExchangeDomainHash)
internal
pure
returns (bytes32 orderHash)
{
orderHash = _hashEIP712Message(
eip712ExchangeDomainHash,
order.getStructHash()
);
return orderHash;
}
/// @dev Calculates EIP712 hash of the order struct.
/// @param order The order structure.
/// @return result EIP712 hash of the order struct.
function getStructHash(IExchange.Order memory order)
internal
pure
returns (bytes32 result)
{
bytes32 schemaHash = _EIP712_ORDER_SCHEMA_HASH;
bytes memory makerAssetData = order.makerAssetData;
bytes memory takerAssetData = order.takerAssetData;
bytes memory makerFeeAssetData = order.makerFeeAssetData;
bytes memory takerFeeAssetData = order.takerFeeAssetData;
// Assembly for more efficiently computing:
// keccak256(abi.encodePacked(
// EIP712_ORDER_SCHEMA_HASH,
// uint256(order.makerAddress),
// uint256(order.takerAddress),
// uint256(order.feeRecipientAddress),
// uint256(order.senderAddress),
// order.makerAssetAmount,
// order.takerAssetAmount,
// order.makerFee,
// order.takerFee,
// order.expirationTimeSeconds,
// order.salt,
// keccak256(order.makerAssetData),
// keccak256(order.takerAssetData),
// keccak256(order.makerFeeAssetData),
// keccak256(order.takerFeeAssetData)
// ));
assembly {
// Assert order offset (this is an internal error that should never be triggered)
if lt(order, 32) {
invalid()
}
// Calculate memory addresses that will be swapped out before hashing
let pos1 := sub(order, 32)
let pos2 := add(order, 320)
let pos3 := add(order, 352)
let pos4 := add(order, 384)
let pos5 := add(order, 416)
// Backup
let temp1 := mload(pos1)
let temp2 := mload(pos2)
let temp3 := mload(pos3)
let temp4 := mload(pos4)
let temp5 := mload(pos5)
// Hash in place
mstore(pos1, schemaHash)
mstore(pos2, keccak256(add(makerAssetData, 32), mload(makerAssetData))) // store hash of makerAssetData
mstore(pos3, keccak256(add(takerAssetData, 32), mload(takerAssetData))) // store hash of takerAssetData
mstore(pos4, keccak256(add(makerFeeAssetData, 32), mload(makerFeeAssetData))) // store hash of makerFeeAssetData
mstore(pos5, keccak256(add(takerFeeAssetData, 32), mload(takerFeeAssetData))) // store hash of takerFeeAssetData
result := keccak256(pos1, 480)
// Restore
mstore(pos1, temp1)
mstore(pos2, temp2)
mstore(pos3, temp3)
mstore(pos4, temp4)
mstore(pos5, temp5)
}
return result;
}
/// @dev Calculates EIP712 encoding for a hash struct with a given domain hash.
/// @param eip712DomainHash Hash of the domain domain separator data, computed
/// with getDomainHash().
/// @param hashStruct The EIP712 hash struct.
/// @return result EIP712 hash applied to the given EIP712 Domain.
function _hashEIP712Message(bytes32 eip712DomainHash, bytes32 hashStruct)
internal
pure
returns (bytes32 result)
{
// Assembly for more efficient computing:
// keccak256(abi.encodePacked(
// EIP191_HEADER,
// EIP712_DOMAIN_HASH,
// hashStruct
// ));
assembly {
// Load free memory pointer
let memPtr := mload(64)
mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header
mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash
mstore(add(memPtr, 34), hashStruct) // Hash of struct
// Compute hash
result := keccak256(memPtr, 66)
}
return result;
}
}

View File

@@ -1,19 +1,15 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
@@ -41,14 +37,13 @@ contract TestBridge is
/// @param from Address to transfer asset from.
/// @param to Address to transfer asset to.
/// @param amount Amount of asset to transfer.
/// @param bridgeData Arbitrary asset data needed by the bridge contract.
/// @return success The magic bytes `0xdc1600f3` if successful.
function bridgeTransferFrom(
address tokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
bytes calldata /* bridgeData */
)
external
override

View File

@@ -32,28 +32,26 @@ contract TestFillQuoteTransformerBridge {
uint256 amount;
}
bytes4 private constant ERC20_BRIDGE_PROXY_ID = 0xdc1600f3;
function bridgeTransferFrom(
address tokenAddress,
address from,
address to,
uint256 amount,
bytes calldata bridgeData
function sellTokenForToken(
address takerToken,
address makerToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
returns (bytes4 success)
returns (uint256 boughtAmount)
{
FillBehavior memory behavior = abi.decode(bridgeData, (FillBehavior));
TestMintableERC20Token(tokenAddress).mint(
to,
LibMathV06.getPartialAmountFloor(
behavior.makerAssetMintRatio,
1e18,
behavior.amount
)
FillBehavior memory behavior = abi.decode(auxiliaryData, (FillBehavior));
boughtAmount = LibMathV06.getPartialAmountFloor(
behavior.makerAssetMintRatio,
1e18,
behavior.amount
);
TestMintableERC20Token(makerToken).mint(
recipient,
boughtAmount
);
return ERC20_BRIDGE_PROXY_ID;
}
function encodeBehaviorData(FillBehavior calldata behavior)

View File

@@ -35,6 +35,8 @@ contract TestFillQuoteTransformerExchange {
uint256 makerAssetMintRatio;
}
bytes32 public constant EIP712_EXCHANGE_DOMAIN_HASH = 0xaa81d881b1adbbf115e15b849cb9cdc643cad3c6a90f30eb505954af943247e6;
uint256 private constant PROTOCOL_FEE_MULTIPLIER = 1337;
using LibSafeMathV06 for uint256;

View File

@@ -0,0 +1,68 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "../src/fixins/FixinProtocolFees.sol";
contract TestFixinProtocolFees is
FixinProtocolFees
{
constructor(
IEtherTokenV06 weth,
IStaking staking,
uint32 protocolFeeMultiplier
)
public
FixinProtocolFees(weth, staking, protocolFeeMultiplier)
{
// solhint-disalbe no-empty-blocks
}
function collectProtocolFee(bytes32 poolId)
external
payable
{
_collectProtocolFee(poolId);
}
function transferFeesForPool(bytes32 poolId)
external
{
_transferFeesForPool(poolId);
}
function getFeeCollector(
bytes32 poolId
)
external
view
returns (FeeCollector)
{
return _getFeeCollector(poolId);
}
function getSingleProtocolFee()
external
view
returns (uint256 protocolFeeAmount)
{
return _getSingleProtocolFee();
}
}

View File

@@ -22,6 +22,7 @@ pragma experimental ABIEncoderV2;
import "../src/ZeroEx.sol";
import "../src/features/IBootstrapFeature.sol";
import "../src/migrations/InitialMigration.sol";
import "../src/features/SimpleFunctionRegistryFeature.sol";
contract TestInitialMigration is
@@ -44,7 +45,8 @@ contract TestInitialMigration is
{
success = InitialMigration.bootstrap(owner, features);
// Snoop the bootstrap feature contract.
bootstrapFeature = ZeroEx(address(uint160(address(this))))
bootstrapFeature =
SimpleFunctionRegistryFeature(address(uint160(address(this))))
.getFunctionImplementation(IBootstrapFeature.bootstrap.selector);
}

View File

@@ -0,0 +1,24 @@
pragma solidity ^0.6;
pragma experimental ABIEncoderV2;
import "../src/features/libs/LibNativeOrder.sol";
contract TestLibNativeOrder {
function getLimitOrderStructHash(LibNativeOrder.LimitOrder calldata order)
external
pure
returns (bytes32 structHash)
{
return LibNativeOrder.getLimitOrderStructHash(order);
}
function getRfqOrderStructHash(LibNativeOrder.RfqOrder calldata order)
external
pure
returns (bytes32 structHash)
{
return LibNativeOrder.getRfqOrderStructHash(order);
}
}

View File

@@ -16,21 +16,19 @@
*/
pragma solidity ^0.6;
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "../src/features/libs/LibSignature.sol";
interface ILiquidityProviderRegistry {
contract TestLibSignature {
/// @dev Returns the address of a liquidity provider for the given market
/// (takerToken, makerToken), reverting if the pool does not exist.
/// @param takerToken Taker asset managed by liquidity provider.
/// @param makerToken Maker asset managed by liquidity provider.
/// @return providerAddress Address of the liquidity provider.
function getLiquidityProviderForMarket(
address takerToken,
address makerToken
)
function getSignerOfHash(bytes32 hash, LibSignature.Signature calldata signature)
external
view
returns (address providerAddress);
pure
returns (address signer)
{
return LibSignature.getSignerOfHash(hash, signature);
}
}

View File

@@ -34,7 +34,13 @@ contract TestLibTokenSpender {
)
external
{
LibTokenSpender.spendERC20Tokens(token, owner, to, amount);
LibTokenSpender.spendERC20Tokens(
token,
owner,
to,
amount,
false
);
}
event FallbackCalled(

View File

@@ -0,0 +1,135 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
contract TestLiquidityProvider {
event SellTokenForToken(
address inputToken,
address outputToken,
address recipient,
uint256 minBuyAmount,
uint256 inputTokenBalance
);
event SellEthForToken(
address outputToken,
address recipient,
uint256 minBuyAmount,
uint256 ethBalance
);
event SellTokenForEth(
address inputToken,
address recipient,
uint256 minBuyAmount,
uint256 inputTokenBalance
);
IERC20TokenV06 public immutable xAsset;
IERC20TokenV06 public immutable yAsset;
constructor(IERC20TokenV06 xAsset_, IERC20TokenV06 yAsset_)
public
{
xAsset = xAsset_;
yAsset = yAsset_;
}
receive() external payable {}
/// @dev Trades `inputToken` for `outputToken`. The amount of `inputToken`
/// to sell must be transferred to the contract prior to calling this
/// function to trigger the trade.
/// @param inputToken The token being sold.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
/// @return boughtAmount The amount of `outputToken` bought.
function sellTokenForToken(
address inputToken,
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
returns (uint256 boughtAmount)
{
emit SellTokenForToken(
inputToken,
outputToken,
recipient,
minBuyAmount,
IERC20TokenV06(inputToken).balanceOf(address(this))
);
}
/// @dev Trades ETH for token. ETH must be sent to the contract prior to
/// calling this function to trigger the trade.
/// @param outputToken The token being bought.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
/// @return boughtAmount The amount of `outputToken` bought.
function sellEthForToken(
address outputToken,
address recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
returns (uint256 boughtAmount)
{
emit SellEthForToken(
outputToken,
recipient,
minBuyAmount,
address(this).balance
);
}
/// @dev Trades token for ETH. The token must be sent to the contract prior
/// to calling this function to trigger the trade.
/// @param inputToken The token being sold.
/// @param recipient The recipient of the bought tokens.
/// @param minBuyAmount The minimum acceptable amount of ETH to buy.
/// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.
/// @return boughtAmount The amount of ETH bought.
function sellTokenForEth(
address inputToken,
address payable recipient,
uint256 minBuyAmount,
bytes calldata auxiliaryData
)
external
returns (uint256 boughtAmount)
{
emit SellTokenForEth(
inputToken,
recipient,
minBuyAmount,
IERC20TokenV06(inputToken).balanceOf(address(this))
);
}
}

View File

@@ -0,0 +1,24 @@
pragma solidity ^0.6;
pragma experimental ABIEncoderV2;
import "../src/features/NativeOrdersFeature.sol";
contract TestNativeOrdersFeature is
NativeOrdersFeature
{
constructor(
address zeroExAddress,
IEtherTokenV06 weth,
IStaking staking,
uint32 protocolFeeMultiplier
)
public
NativeOrdersFeature(zeroExAddress, weth, staking, protocolFeeMultiplier)
{
// solhint-disable no-empty-blocks
}
modifier onlySelf() override {
_;
}
}

View File

@@ -0,0 +1,49 @@
/*
Copyright 2020 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.6.5;
pragma experimental ABIEncoderV2;
import "@0x/contracts-erc20/contracts/src/v06/IEtherTokenV06.sol";
contract TestStaking {
mapping(address => bytes32) public poolForMaker;
mapping(bytes32 => uint256) public balanceForPool;
IEtherTokenV06 immutable weth;
constructor(IEtherTokenV06 _weth) public {
weth = _weth;
}
function joinStakingPoolAsMaker(bytes32 poolId) external {
poolForMaker[msg.sender] = poolId;
}
function payProtocolFee(
address makerAddress,
address payerAddress,
uint256 amount
)
external
payable
{
require(weth.transferFrom(payerAddress, address(this), amount));
balanceForPool[poolForMaker[makerAddress]] += amount;
}
}

Some files were not shown because too many files have changed in this diff Show More