Compare commits
29 Commits
@0x/contra
...
@0x/contra
Author | SHA1 | Date | |
---|---|---|---|
|
d2018f07a2 | ||
|
d2e57d8163 | ||
|
7403c0255a | ||
|
75dcd687e2 | ||
|
afd4805421 | ||
|
6aa582d140 | ||
|
534d92fa00 | ||
|
37aae134ab | ||
|
36bd8f68c9 | ||
|
c3ad42221e | ||
|
602ac1f626 | ||
|
3126795efe | ||
|
dbcb221a59 | ||
|
6bbc179f52 | ||
|
48e7a391c8 | ||
|
2334e64d0c | ||
|
14f920ee84 | ||
|
e10a81023a | ||
|
f4709ed1cb | ||
|
e2e14a977a | ||
|
866f958a10 | ||
|
717db99b38 | ||
|
02006118c7 | ||
|
9816019bc5 | ||
|
9c821dbfc3 | ||
|
af1b890423 | ||
|
673835d2de | ||
|
500b57e935 | ||
|
3f7d0580c1 |
@@ -82,4 +82,5 @@ lib
|
|||||||
/packages/asset-swapper/test/generated-wrappers
|
/packages/asset-swapper/test/generated-wrappers
|
||||||
package.json
|
package.json
|
||||||
packages/*/docs
|
packages/*/docs
|
||||||
|
docs/
|
||||||
*.sol
|
*.sol
|
||||||
|
12
README.md
12
README.md
@@ -8,7 +8,7 @@ This repository is a monorepo including the 0x protocol smart contracts and nume
|
|||||||
|
|
||||||
[website-url]: https://0x.org
|
[website-url]: https://0x.org
|
||||||
|
|
||||||
[](https://circleci.com/gh/0xProject/0x-monorepo)
|
[](https://circleci.com/gh/0xProject/protocool)
|
||||||
[](https://coveralls.io/github/0xProject/0x-monorepo?branch=development)
|
[](https://coveralls.io/github/0xProject/0x-monorepo?branch=development)
|
||||||
[](https://discordapp.com/invite/d3FTX3M)
|
[](https://discordapp.com/invite/d3FTX3M)
|
||||||
[](https://opensource.org/licenses/Apache-2.0)
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
@@ -92,7 +92,7 @@ yarn build
|
|||||||
To build a specific package:
|
To build a specific package:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/web3-wrapper yarn build
|
PKG=@0x/contract-wrappers yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
To build all contracts packages:
|
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
|
PKG=[NPM_PACKAGE_NAME] yarn watch
|
||||||
|
|
||||||
e.g
|
e.g
|
||||||
PKG=@0x/web3-wrapper yarn watch
|
PKG=@0x/contract-wrappers yarn watch
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean
|
### Clean
|
||||||
@@ -143,7 +143,7 @@ yarn rebuild
|
|||||||
To re-build (clean & build) a specific package & it's deps:
|
To re-build (clean & build) a specific package & it's deps:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=0x.js yarn rebuild
|
PKG=@0x/contract-wrappers yarn rebuild
|
||||||
```
|
```
|
||||||
|
|
||||||
### Lint
|
### Lint
|
||||||
@@ -157,7 +157,7 @@ yarn lint
|
|||||||
Lint a specific package:
|
Lint a specific package:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=0x.js yarn lint
|
PKG=@0x/contract-wrappers yarn lint
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run Tests
|
### Run Tests
|
||||||
@@ -171,7 +171,7 @@ yarn test
|
|||||||
Run a specific package's test:
|
Run a specific package's test:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=@0x/web3-wrapper yarn test
|
PKG=@0x/contract-wrappers yarn test
|
||||||
```
|
```
|
||||||
|
|
||||||
Run all contracts packages tests:
|
Run all contracts packages tests:
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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",
|
"version": "3.6.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v3.6.0 - _October 27, 2020_
|
||||||
|
|
||||||
* Add `SwerveBridge` and `SnowSwapBridge` (duplicate of `CurveBridge`) (#2707)
|
* Add `SwerveBridge` and `SnowSwapBridge` (duplicate of `CurveBridge`) (#2707)
|
||||||
|
@@ -51,16 +51,15 @@ contract ShellBridge is
|
|||||||
external
|
external
|
||||||
returns (bytes4 success)
|
returns (bytes4 success)
|
||||||
{
|
{
|
||||||
// Decode the bridge data to get the `fromTokenAddress`.
|
// Decode the bridge data to get the `fromTokenAddress` and `pool`.
|
||||||
(address fromTokenAddress) = abi.decode(bridgeData, (address));
|
(address fromTokenAddress, address pool) = abi.decode(bridgeData, (address, address));
|
||||||
|
|
||||||
uint256 fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
|
uint256 fromTokenBalance = IERC20Token(fromTokenAddress).balanceOf(address(this));
|
||||||
IShell exchange = IShell(_getShellAddress());
|
|
||||||
// Grant an allowance to the exchange to spend `fromTokenAddress` token.
|
// 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.
|
// Try to sell all of this contract's `fromTokenAddress` token balance.
|
||||||
uint256 boughtAmount = exchange.originSwap(
|
uint256 boughtAmount = IShell(pool).originSwap(
|
||||||
fromTokenAddress,
|
fromTokenAddress,
|
||||||
toTokenAddress,
|
toTokenAddress,
|
||||||
fromTokenBalance,
|
fromTokenBalance,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-asset-proxy",
|
"name": "@0x/contracts-asset-proxy",
|
||||||
"version": "3.6.0",
|
"version": "3.6.5",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -51,13 +51,13 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contract-wrappers": "^13.9.1",
|
"@0x/contract-wrappers": "^13.10.0",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
@@ -79,16 +79,16 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contracts-erc1155": "^2.1.9",
|
"@0x/contracts-erc1155": "^2.1.14",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-erc721": "^3.1.9",
|
"@0x/contracts-erc721": "^3.1.14",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.9",
|
"@0x/contracts-exchange-libs": "^4.3.14",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"ethereum-types": "^3.3.3",
|
"ethereum-types": "^3.3.3",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "1.1.8",
|
"version": "1.1.8",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v1.1.8 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-broker",
|
"name": "@0x/contracts-broker",
|
||||||
"version": "1.1.8",
|
"version": "1.1.13",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -51,20 +51,20 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-erc721": "^3.1.9",
|
"@0x/contracts-erc721": "^3.1.14",
|
||||||
"@0x/contracts-exchange": "^3.2.9",
|
"@0x/contracts-exchange": "^3.2.14",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.9",
|
"@0x/contracts-exchange-libs": "^4.3.14",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -84,10 +84,10 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"ethereum-types": "^3.3.3"
|
"ethereum-types": "^3.3.3"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "3.1.9",
|
"version": "3.1.9",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v3.1.9 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-coordinator",
|
"name": "@0x/contracts-coordinator",
|
||||||
"version": "3.1.9",
|
"version": "3.1.14",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,17 +52,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-dev-utils": "^1.3.7",
|
"@0x/contracts-dev-utils": "^1.3.12",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -82,16 +82,16 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.13",
|
"@0x/assert": "^3.0.17",
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contract-addresses": "^5.0.0",
|
"@0x/contract-addresses": "^5.3.0",
|
||||||
"@0x/contracts-exchange": "^3.2.9",
|
"@0x/contracts-exchange": "^3.2.14",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/json-schemas": "^5.2.3",
|
"@0x/json-schemas": "^5.3.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"ethereum-types": "^3.3.3",
|
"ethereum-types": "^3.3.3",
|
||||||
"http-status-codes": "^1.3.2"
|
"http-status-codes": "^1.3.2"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "1.3.7",
|
"version": "1.3.7",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v1.3.7 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-dev-utils",
|
"name": "@0x/contracts-dev-utils",
|
||||||
"version": "1.3.7",
|
"version": "1.3.12",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -41,17 +41,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/assert": "^3.0.13",
|
"@0x/assert": "^3.0.17",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"ethereum-types": "^3.3.3",
|
"ethereum-types": "^3.3.3",
|
||||||
"ethers": "~4.0.4",
|
"ethers": "~4.0.4",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@types/node": "12.12.54"
|
"@types/node": "12.12.54"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "2.1.9",
|
"version": "2.1.9",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v2.1.9 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-erc1155",
|
"name": "@0x/contracts-erc1155",
|
||||||
"version": "2.1.9",
|
"version": "2.1.14",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,14 +52,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
@@ -80,10 +80,10 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "3.2.3",
|
"version": "3.2.3",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v3.2.3 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-erc20",
|
"name": "@0x/contracts-erc20",
|
||||||
"version": "3.2.3",
|
"version": "3.2.8",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -51,18 +51,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7"
|
"@0x/base-contract": "^6.2.11"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "3.1.9",
|
"version": "3.1.9",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v3.1.9 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-erc721",
|
"name": "@0x/contracts-erc721",
|
||||||
"version": "3.1.9",
|
"version": "3.1.14",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,18 +52,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7"
|
"@0x/base-contract": "^6.2.11"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "4.2.9",
|
"version": "4.2.9",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v4.2.9 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-exchange-forwarder",
|
"name": "@0x/contracts-exchange-forwarder",
|
||||||
"version": "4.2.9",
|
"version": "4.2.14",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,25 +52,25 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-dev-utils": "^1.3.7",
|
"@0x/contracts-dev-utils": "^1.3.12",
|
||||||
"@0x/contracts-erc1155": "^2.1.9",
|
"@0x/contracts-erc1155": "^2.1.14",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-erc721": "^3.1.9",
|
"@0x/contracts-erc721": "^3.1.14",
|
||||||
"@0x/contracts-exchange": "^3.2.9",
|
"@0x/contracts-exchange": "^3.2.14",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.9",
|
"@0x/contracts-exchange-libs": "^4.3.14",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"ethereum-types": "^3.3.3"
|
"ethereum-types": "^3.3.3"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "4.3.9",
|
"version": "4.3.9",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v4.3.9 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-exchange-libs",
|
"name": "@0x/contracts-exchange-libs",
|
||||||
"version": "4.3.9",
|
"version": "4.3.14",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,14 +52,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/subproviders": "^6.1.5",
|
"@0x/subproviders": "^6.1.9",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -80,13 +80,13 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"ethereum-types": "^3.3.3"
|
"ethereum-types": "^3.3.3"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "3.2.9",
|
"version": "3.2.9",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v3.2.9 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-exchange",
|
"name": "@0x/contracts-exchange",
|
||||||
"version": "3.2.9",
|
"version": "3.2.14",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,21 +52,21 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.9",
|
"@0x/contracts-exchange-libs": "^4.3.14",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-multisig": "^4.1.9",
|
"@0x/contracts-multisig": "^4.1.14",
|
||||||
"@0x/contracts-staking": "^2.0.16",
|
"@0x/contracts-staking": "^2.0.21",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -88,13 +88,13 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contracts-dev-utils": "^1.3.7",
|
"@0x/contracts-dev-utils": "^1.3.12",
|
||||||
"@0x/contracts-erc1155": "^2.1.9",
|
"@0x/contracts-erc1155": "^2.1.14",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-erc721": "^3.1.9",
|
"@0x/contracts-erc721": "^3.1.14",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "6.2.3",
|
"version": "6.2.3",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v6.2.3 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-extensions",
|
"name": "@0x/contracts-extensions",
|
||||||
"version": "6.2.3",
|
"version": "6.2.8",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,23 +52,23 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-dev-utils": "^1.3.7",
|
"@0x/contracts-dev-utils": "^1.3.12",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-erc721": "^3.1.9",
|
"@0x/contracts-erc721": "^3.1.14",
|
||||||
"@0x/contracts-exchange": "^3.2.9",
|
"@0x/contracts-exchange": "^3.2.14",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.9",
|
"@0x/contracts-exchange-libs": "^4.3.14",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -90,8 +90,8 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"ethereum-types": "^3.3.3"
|
"ethereum-types": "^3.3.3"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,58 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "2.7.2",
|
"version": "2.7.2",
|
||||||
|
@@ -5,6 +5,30 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v2.7.2 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-integrations",
|
"name": "@0x/contracts-integrations",
|
||||||
"version": "2.7.2",
|
"version": "2.7.8",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -51,24 +51,24 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contract-addresses": "^5.0.0",
|
"@0x/contract-addresses": "^5.3.0",
|
||||||
"@0x/contract-wrappers": "^13.9.1",
|
"@0x/contract-wrappers": "^13.10.0",
|
||||||
"@0x/contracts-broker": "^1.1.8",
|
"@0x/contracts-broker": "^1.1.13",
|
||||||
"@0x/contracts-coordinator": "^3.1.9",
|
"@0x/contracts-coordinator": "^3.1.14",
|
||||||
"@0x/contracts-dev-utils": "^1.3.7",
|
"@0x/contracts-dev-utils": "^1.3.12",
|
||||||
"@0x/contracts-exchange-forwarder": "^4.2.9",
|
"@0x/contracts-exchange-forwarder": "^4.2.14",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.9",
|
"@0x/contracts-exchange-libs": "^4.3.14",
|
||||||
"@0x/contracts-extensions": "^6.2.3",
|
"@0x/contracts-extensions": "^6.2.8",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/coordinator-server": "^1.0.5",
|
"@0x/coordinator-server": "^1.0.5",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/migrations": "^6.4.3",
|
"@0x/migrations": "^6.5.0",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@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",
|
"@azure/core-asynciterator-polyfill": "^1.0.0",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
@@ -91,21 +91,21 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/asset-swapper": "^4.8.0",
|
"@0x/asset-swapper": "^5.1.0",
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-erc1155": "^2.1.9",
|
"@0x/contracts-erc1155": "^2.1.14",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-erc721": "^3.1.9",
|
"@0x/contracts-erc721": "^3.1.14",
|
||||||
"@0x/contracts-exchange": "^3.2.9",
|
"@0x/contracts-exchange": "^3.2.14",
|
||||||
"@0x/contracts-multisig": "^4.1.9",
|
"@0x/contracts-multisig": "^4.1.14",
|
||||||
"@0x/contracts-staking": "^2.0.16",
|
"@0x/contracts-staking": "^2.0.21",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-zero-ex": "^0.5.0",
|
"@0x/contracts-zero-ex": "^0.9.0",
|
||||||
"@0x/subproviders": "^6.1.5",
|
"@0x/subproviders": "^6.1.9",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"ethereum-types": "^3.3.3",
|
"ethereum-types": "^3.3.3",
|
||||||
"ethereumjs-util": "^6.2.0",
|
"ethereumjs-util": "^6.2.0",
|
||||||
"lodash": "^4.17.11"
|
"lodash": "^4.17.11"
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "4.1.9",
|
"version": "4.1.9",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v4.1.9 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-multisig",
|
"name": "@0x/contracts-multisig",
|
||||||
"version": "4.1.9",
|
"version": "4.1.14",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -49,18 +49,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
@@ -78,7 +78,7 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"ethereum-types": "^3.3.3"
|
"ethereum-types": "^3.3.3"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "2.0.16",
|
"version": "2.0.16",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v2.0.16 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-staking",
|
"name": "@0x/contracts-staking",
|
||||||
"version": "2.0.16",
|
"version": "2.0.21",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -53,20 +53,20 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-asset-proxy": "^3.6.0",
|
"@0x/contracts-asset-proxy": "^3.6.5",
|
||||||
"@0x/contracts-dev-utils": "^1.3.7",
|
"@0x/contracts-dev-utils": "^1.3.12",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.9",
|
"@0x/contracts-exchange-libs": "^4.3.14",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-utils": "^4.5.3",
|
"@0x/contracts-utils": "^4.5.8",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/node": "12.12.54",
|
"@types/node": "12.12.54",
|
||||||
"chai": "^4.0.1",
|
"chai": "^4.0.1",
|
||||||
@@ -87,10 +87,10 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"ethereum-types": "^3.3.3",
|
"ethereum-types": "^3.3.3",
|
||||||
"ethereumjs-util": "^5.1.1"
|
"ethereumjs-util": "^5.1.1"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "5.3.6",
|
"version": "5.3.6",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v5.3.6 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-test-utils",
|
"name": "@0x/contracts-test-utils",
|
||||||
"version": "5.3.6",
|
"version": "5.3.11",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
"shx": "^0.2.2",
|
"shx": "^0.2.2",
|
||||||
@@ -42,20 +42,20 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.13",
|
"@0x/assert": "^3.0.17",
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/contract-addresses": "^5.0.0",
|
"@0x/contract-addresses": "^5.3.0",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/json-schemas": "^5.2.3",
|
"@0x/json-schemas": "^5.3.3",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/sol-coverage": "^4.0.14",
|
"@0x/sol-coverage": "^4.0.18",
|
||||||
"@0x/sol-profiler": "^4.1.4",
|
"@0x/sol-profiler": "^4.1.8",
|
||||||
"@0x/sol-trace": "^3.0.14",
|
"@0x/sol-trace": "^3.0.18",
|
||||||
"@0x/subproviders": "^6.1.5",
|
"@0x/subproviders": "^6.1.9",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/bn.js": "^4.11.0",
|
"@types/bn.js": "^4.11.0",
|
||||||
"@types/js-combinatorics": "^0.5.29",
|
"@types/js-combinatorics": "^0.5.29",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
|
@@ -1,4 +1,49 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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,
|
"timestamp": 1603833198,
|
||||||
"version": "4.5.3",
|
"version": "4.5.3",
|
||||||
|
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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_
|
## v4.5.3 - _October 27, 2020_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
@@ -56,8 +56,6 @@ contract DeploymentConstants {
|
|||||||
address constant private MUSD_ADDRESS = 0xe2f2a5C287993345a840Db3B0845fbC70f5935a5;
|
address constant private MUSD_ADDRESS = 0xe2f2a5C287993345a840Db3B0845fbC70f5935a5;
|
||||||
/// @dev Mainnet address of the Mooniswap Registry contract
|
/// @dev Mainnet address of the Mooniswap Registry contract
|
||||||
address constant private MOONISWAP_REGISTRY = 0x71CD6666064C3A1354a3B4dca5fA1E2D3ee7D303;
|
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
|
/// @dev Mainnet address of the DODO Registry (ZOO) contract
|
||||||
address constant private DODO_REGISTRY = 0x3A97247DF274a17C59A3bd12735ea3FcDFb49950;
|
address constant private DODO_REGISTRY = 0x3A97247DF274a17C59A3bd12735ea3FcDFb49950;
|
||||||
/// @dev Mainnet address of the DODO Helper contract
|
/// @dev Mainnet address of the DODO Helper contract
|
||||||
@@ -303,16 +301,6 @@ contract DeploymentConstants {
|
|||||||
return MOONISWAP_REGISTRY;
|
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.
|
/// @dev An overridable way to retrieve the DODO Registry contract address.
|
||||||
/// @return registry The DODO Registry contract address.
|
/// @return registry The DODO Registry contract address.
|
||||||
function _getDODORegistryAddress()
|
function _getDODORegistryAddress()
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-utils",
|
"name": "@0x/contracts-utils",
|
||||||
"version": "4.5.3",
|
"version": "4.5.8",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -50,15 +50,15 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"@types/bn.js": "^4.11.0",
|
"@types/bn.js": "^4.11.0",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
@@ -79,9 +79,9 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"bn.js": "^4.11.8",
|
"bn.js": "^4.11.8",
|
||||||
"ethereum-types": "^3.3.3"
|
"ethereum-types": "^3.3.3"
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,73 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1604355662
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"timestamp": 1603851023,
|
||||||
|
"version": "0.5.1",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.5.0",
|
"version": "0.5.0",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
@@ -5,6 +5,31 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
## v0.5.1 - _October 28, 2020_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v0.5.0 - _October 27, 2020_
|
## v0.5.0 - _October 27, 2020_
|
||||||
|
|
||||||
* Add `Swerve`, `SnowSwap`, `DODO` and `SushiSwap` into FQT (#7)
|
* Add `Swerve`, `SnowSwap`, `DODO` and `SushiSwap` into FQT (#7)
|
||||||
|
@@ -44,14 +44,4 @@ interface IZeroEx is
|
|||||||
|
|
||||||
/// @dev Fallback for just receiving ether.
|
/// @dev Fallback for just receiving ether.
|
||||||
receive() external payable;
|
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);
|
|
||||||
}
|
}
|
||||||
|
@@ -19,19 +19,12 @@
|
|||||||
pragma solidity ^0.6.5;
|
pragma solidity ^0.6.5;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
|
|
||||||
import "./migrations/LibBootstrap.sol";
|
|
||||||
import "./features/BootstrapFeature.sol";
|
import "./features/BootstrapFeature.sol";
|
||||||
import "./storage/LibProxyStorage.sol";
|
import "./storage/LibProxyStorage.sol";
|
||||||
import "./errors/LibProxyRichErrors.sol";
|
|
||||||
|
|
||||||
|
|
||||||
/// @dev An extensible proxy contract that serves as a universal entry point for
|
/// @dev An extensible proxy contract that serves as a universal entry point for
|
||||||
/// interacting with the 0x protocol.
|
/// interacting with the 0x protocol.
|
||||||
contract ZeroEx {
|
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.
|
/// @dev Construct this contract and register the `BootstrapFeature` feature.
|
||||||
/// After constructing this contract, `bootstrap()` should be called
|
/// After constructing this contract, `bootstrap()` should be called
|
||||||
/// by `bootstrap()` to seed the initial feature set.
|
/// by `bootstrap()` to seed the initial feature set.
|
||||||
@@ -44,48 +37,55 @@ contract ZeroEx {
|
|||||||
address(bootstrap);
|
address(bootstrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// solhint-disable state-visibility
|
// solhint-disable state-visibility
|
||||||
|
|
||||||
/// @dev Forwards calls to the appropriate implementation contract.
|
/// @dev Forwards calls to the appropriate implementation contract.
|
||||||
fallback() external payable {
|
fallback() external payable {
|
||||||
bytes4 selector = msg.data.readBytes4(0);
|
// This is used in assembly below as impls_slot.
|
||||||
address impl = getFunctionImplementation(selector);
|
mapping(bytes4 => address) storage impls =
|
||||||
if (impl == address(0)) {
|
LibProxyStorage.getStorage().impls;
|
||||||
_revertWithData(LibProxyRichErrors.NotImplementedError(selector));
|
|
||||||
|
assembly {
|
||||||
|
let cdlen := calldatasize()
|
||||||
|
|
||||||
|
// equivalent of receive() external payable {}
|
||||||
|
if iszero(cdlen) {
|
||||||
|
return(0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
(bool success, bytes memory resultData) = impl.delegatecall(msg.data);
|
// Store at 0x40, to leave 0x00-0x3F for slot calculation below.
|
||||||
if (!success) {
|
calldatacopy(0x40, 0, cdlen)
|
||||||
_revertWithData(resultData);
|
let selector := and(mload(0x40), 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
|
||||||
}
|
|
||||||
_returnWithData(resultData);
|
// 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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Fallback for just receiving ether.
|
let success := delegatecall(
|
||||||
receive() external payable {}
|
gas(),
|
||||||
|
delegate,
|
||||||
// solhint-enable state-visibility
|
0x40, cdlen,
|
||||||
|
0, 0
|
||||||
/// @dev Get the implementation contract of a registered function.
|
)
|
||||||
/// @param selector The function selector.
|
let rdlen := returndatasize()
|
||||||
/// @return impl The implementation contract address.
|
returndatacopy(0, 0, rdlen)
|
||||||
function getFunctionImplementation(bytes4 selector)
|
if success {
|
||||||
public
|
return(0, rdlen)
|
||||||
view
|
|
||||||
returns (address impl)
|
|
||||||
{
|
|
||||||
return LibProxyStorage.getStorage().impls[selector];
|
|
||||||
}
|
}
|
||||||
|
revert(0, rdlen)
|
||||||
/// @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)) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,19 +45,4 @@ library LibLiquidityProviderRichErrors {
|
|||||||
minBuyAmount
|
minBuyAmount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function NoLiquidityProviderForMarketError(
|
|
||||||
address xAsset,
|
|
||||||
address yAsset
|
|
||||||
)
|
|
||||||
internal
|
|
||||||
pure
|
|
||||||
returns (bytes memory)
|
|
||||||
{
|
|
||||||
return abi.encodeWithSelector(
|
|
||||||
bytes4(keccak256("NoLiquidityProviderForMarketError(address,address)")),
|
|
||||||
xAsset,
|
|
||||||
yAsset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,8 @@ library LibSignatureRichErrors {
|
|||||||
INVALID_LENGTH,
|
INVALID_LENGTH,
|
||||||
UNSUPPORTED,
|
UNSUPPORTED,
|
||||||
ILLEGAL,
|
ILLEGAL,
|
||||||
WRONG_SIGNER
|
WRONG_SIGNER,
|
||||||
|
BAD_SIGNATURE_DATA
|
||||||
}
|
}
|
||||||
|
|
||||||
// solhint-disable func-name-mixedcase
|
// solhint-disable func-name-mixedcase
|
||||||
@@ -49,4 +50,19 @@ library LibSignatureRichErrors {
|
|||||||
signature
|
signature
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SignatureValidationError(
|
||||||
|
SignatureValidationErrorCodes code,
|
||||||
|
bytes32 hash
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
pure
|
||||||
|
returns (bytes memory)
|
||||||
|
{
|
||||||
|
return abi.encodeWithSelector(
|
||||||
|
bytes4(keccak256("SignatureValidationError(uint8,bytes32)")),
|
||||||
|
code,
|
||||||
|
hash
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
65
contracts/zero-ex/contracts/src/external/FeeCollector.sol
vendored
Normal file
65
contracts/zero-ex/contracts/src/external/FeeCollector.sol
vendored
Normal 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 > 1) {
|
||||||
|
weth.deposit{value: address(this).balance - 1}();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
74
contracts/zero-ex/contracts/src/external/ILiquidityProviderSandbox.sol
vendored
Normal file
74
contracts/zero-ex/contracts/src/external/ILiquidityProviderSandbox.sol
vendored
Normal 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;
|
||||||
|
}
|
139
contracts/zero-ex/contracts/src/external/LiquidityProviderSandbox.sol
vendored
Normal file
139
contracts/zero-ex/contracts/src/external/LiquidityProviderSandbox.sol
vendored
Normal 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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -22,45 +22,30 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
/// @dev Feature to swap directly with an on-chain liquidity provider.
|
/// @dev Feature to swap directly with an on-chain liquidity provider.
|
||||||
interface ILiquidityProviderFeature {
|
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(
|
function sellToLiquidityProvider(
|
||||||
address makerToken,
|
address inputToken,
|
||||||
address takerToken,
|
address outputToken,
|
||||||
address payable recipient,
|
address payable provider,
|
||||||
|
address recipient,
|
||||||
uint256 sellAmount,
|
uint256 sellAmount,
|
||||||
uint256 minBuyAmount
|
uint256 minBuyAmount,
|
||||||
|
bytes calldata auxiliaryData
|
||||||
)
|
)
|
||||||
external
|
external
|
||||||
payable
|
payable
|
||||||
returns (uint256 boughtAmount);
|
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);
|
|
||||||
}
|
}
|
||||||
|
@@ -57,4 +57,12 @@ interface ISimpleFunctionRegistryFeature {
|
|||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (address impl);
|
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);
|
||||||
}
|
}
|
||||||
|
@@ -20,15 +20,13 @@ pragma solidity ^0.6.5;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
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/errors/LibRichErrorsV06.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
||||||
import "../errors/LibLiquidityProviderRichErrors.sol";
|
import "../errors/LibLiquidityProviderRichErrors.sol";
|
||||||
|
import "../external/ILiquidityProviderSandbox.sol";
|
||||||
|
import "../external/LiquidityProviderSandbox.sol";
|
||||||
import "../fixins/FixinCommon.sol";
|
import "../fixins/FixinCommon.sol";
|
||||||
import "../migrations/LibMigrate.sol";
|
import "../migrations/LibMigrate.sol";
|
||||||
import "../storage/LibLiquidityProviderStorage.sol";
|
|
||||||
import "../vendor/v3/IERC20Bridge.sol";
|
|
||||||
import "./IFeature.sol";
|
import "./IFeature.sol";
|
||||||
import "./ILiquidityProviderFeature.sol";
|
import "./ILiquidityProviderFeature.sol";
|
||||||
import "./libs/LibTokenSpender.sol";
|
import "./libs/LibTokenSpender.sol";
|
||||||
@@ -39,7 +37,6 @@ contract LiquidityProviderFeature is
|
|||||||
ILiquidityProviderFeature,
|
ILiquidityProviderFeature,
|
||||||
FixinCommon
|
FixinCommon
|
||||||
{
|
{
|
||||||
using LibERC20TokenV06 for IERC20TokenV06;
|
|
||||||
using LibSafeMathV06 for uint256;
|
using LibSafeMathV06 for uint256;
|
||||||
using LibRichErrorsV06 for bytes;
|
using LibRichErrorsV06 for bytes;
|
||||||
|
|
||||||
@@ -50,16 +47,24 @@ contract LiquidityProviderFeature is
|
|||||||
|
|
||||||
/// @dev ETH pseudo-token address.
|
/// @dev ETH pseudo-token address.
|
||||||
address constant internal ETH_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
|
address constant internal ETH_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
|
||||||
/// @dev The WETH contract address.
|
/// @dev The sandbox contract address.
|
||||||
IEtherTokenV06 public immutable weth;
|
ILiquidityProviderSandbox public immutable sandbox;
|
||||||
|
|
||||||
/// @dev Store the WETH address in an immutable.
|
/// @dev Event for data pipeline.
|
||||||
/// @param weth_ The weth token.
|
event LiquidityProviderSwap(
|
||||||
constructor(IEtherTokenV06 weth_)
|
address inputToken,
|
||||||
|
address outputToken,
|
||||||
|
uint256 inputTokenAmount,
|
||||||
|
uint256 outputTokenAmount,
|
||||||
|
address provider,
|
||||||
|
address recipient
|
||||||
|
);
|
||||||
|
|
||||||
|
constructor(address zeroEx)
|
||||||
public
|
public
|
||||||
FixinCommon()
|
FixinCommon()
|
||||||
{
|
{
|
||||||
weth = weth_;
|
sandbox = new LiquidityProviderSandbox(zeroEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Initialize and register this feature.
|
/// @dev Initialize and register this feature.
|
||||||
@@ -70,131 +75,102 @@ contract LiquidityProviderFeature is
|
|||||||
returns (bytes4 success)
|
returns (bytes4 success)
|
||||||
{
|
{
|
||||||
_registerFeatureFunction(this.sellToLiquidityProvider.selector);
|
_registerFeatureFunction(this.sellToLiquidityProvider.selector);
|
||||||
_registerFeatureFunction(this.setLiquidityProviderForMarket.selector);
|
|
||||||
_registerFeatureFunction(this.getLiquidityProviderForMarket.selector);
|
|
||||||
return LibMigrate.MIGRATE_SUCCESS;
|
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(
|
function sellToLiquidityProvider(
|
||||||
address makerToken,
|
address inputToken,
|
||||||
address takerToken,
|
address outputToken,
|
||||||
address payable recipient,
|
address payable provider,
|
||||||
|
address recipient,
|
||||||
uint256 sellAmount,
|
uint256 sellAmount,
|
||||||
uint256 minBuyAmount
|
uint256 minBuyAmount,
|
||||||
|
bytes calldata auxiliaryData
|
||||||
)
|
)
|
||||||
external
|
external
|
||||||
override
|
override
|
||||||
payable
|
payable
|
||||||
returns (uint256 boughtAmount)
|
returns (uint256 boughtAmount)
|
||||||
{
|
{
|
||||||
address providerAddress = getLiquidityProviderForMarket(makerToken, takerToken);
|
|
||||||
if (recipient == address(0)) {
|
if (recipient == address(0)) {
|
||||||
recipient = msg.sender;
|
recipient = msg.sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (takerToken == ETH_TOKEN_ADDRESS) {
|
if (inputToken == ETH_TOKEN_ADDRESS) {
|
||||||
// Wrap ETH.
|
provider.transfer(sellAmount);
|
||||||
weth.deposit{value: sellAmount}();
|
|
||||||
weth.transfer(providerAddress, sellAmount);
|
|
||||||
} else {
|
} else {
|
||||||
LibTokenSpender.spendERC20Tokens(
|
LibTokenSpender.spendERC20Tokens(
|
||||||
IERC20TokenV06(takerToken),
|
IERC20TokenV06(inputToken),
|
||||||
msg.sender,
|
msg.sender,
|
||||||
providerAddress,
|
provider,
|
||||||
sellAmount
|
sellAmount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (makerToken == ETH_TOKEN_ADDRESS) {
|
if (inputToken == ETH_TOKEN_ADDRESS) {
|
||||||
uint256 balanceBefore = weth.balanceOf(address(this));
|
uint256 balanceBefore = IERC20TokenV06(outputToken).balanceOf(recipient);
|
||||||
IERC20Bridge(providerAddress).bridgeTransferFrom(
|
sandbox.executeSellEthForToken(
|
||||||
address(weth),
|
provider,
|
||||||
address(0),
|
outputToken,
|
||||||
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),
|
|
||||||
recipient,
|
recipient,
|
||||||
minBuyAmount,
|
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) {
|
if (boughtAmount < minBuyAmount) {
|
||||||
LibLiquidityProviderRichErrors.LiquidityProviderIncompleteSellError(
|
LibLiquidityProviderRichErrors.LiquidityProviderIncompleteSellError(
|
||||||
providerAddress,
|
provider,
|
||||||
makerToken,
|
outputToken,
|
||||||
takerToken,
|
inputToken,
|
||||||
sellAmount,
|
sellAmount,
|
||||||
boughtAmount,
|
boughtAmount,
|
||||||
minBuyAmount
|
minBuyAmount
|
||||||
).rrevert();
|
).rrevert();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// @dev Sets address of the liquidity provider for a market given
|
emit LiquidityProviderSwap(
|
||||||
/// (xAsset, yAsset).
|
inputToken,
|
||||||
/// @param xAsset First asset managed by the liquidity provider.
|
outputToken,
|
||||||
/// @param yAsset Second asset managed by the liquidity provider.
|
sellAmount,
|
||||||
/// @param providerAddress Address of the liquidity provider.
|
boughtAmount,
|
||||||
function setLiquidityProviderForMarket(
|
provider,
|
||||||
address xAsset,
|
recipient
|
||||||
address yAsset,
|
|
||||||
address providerAddress
|
|
||||||
)
|
|
||||||
external
|
|
||||||
override
|
|
||||||
onlyOwner
|
|
||||||
{
|
|
||||||
LibLiquidityProviderStorage.getStorage()
|
|
||||||
.addressBook[xAsset][yAsset] = providerAddress;
|
|
||||||
LibLiquidityProviderStorage.getStorage()
|
|
||||||
.addressBook[yAsset][xAsset] = providerAddress;
|
|
||||||
emit LiquidityProviderForMarketUpdated(
|
|
||||||
xAsset,
|
|
||||||
yAsset,
|
|
||||||
providerAddress
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -56,6 +56,7 @@ contract SimpleFunctionRegistryFeature is
|
|||||||
// Register getters.
|
// Register getters.
|
||||||
_extend(this.getRollbackLength.selector, _implementation);
|
_extend(this.getRollbackLength.selector, _implementation);
|
||||||
_extend(this.getRollbackEntryAtIndex.selector, _implementation);
|
_extend(this.getRollbackEntryAtIndex.selector, _implementation);
|
||||||
|
_extend(this.getFunctionImplementation.selector, _implementation);
|
||||||
return LibBootstrap.BOOTSTRAP_SUCCESS;
|
return LibBootstrap.BOOTSTRAP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +152,18 @@ contract SimpleFunctionRegistryFeature is
|
|||||||
return LibSimpleFunctionRegistryStorage.getStorage().implHistory[selector][idx];
|
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.
|
/// @dev Register or replace a function.
|
||||||
/// @param selector The function selector.
|
/// @param selector The function selector.
|
||||||
/// @param impl The implementation contract for the function.
|
/// @param impl The implementation contract for the function.
|
||||||
|
@@ -58,7 +58,7 @@ contract TransformERC20Feature is
|
|||||||
/// @dev Name of this feature.
|
/// @dev Name of this feature.
|
||||||
string public constant override FEATURE_NAME = "TransformERC20";
|
string public constant override FEATURE_NAME = "TransformERC20";
|
||||||
/// @dev Version of this feature.
|
/// @dev Version of this feature.
|
||||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 2, 0);
|
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 3, 0);
|
||||||
|
|
||||||
/// @dev Initialize and register this feature.
|
/// @dev Initialize and register this feature.
|
||||||
/// Should be delegatecalled by `Migrate.migrate()`.
|
/// Should be delegatecalled by `Migrate.migrate()`.
|
||||||
|
@@ -37,7 +37,7 @@ contract UniswapFeature is
|
|||||||
/// @dev Name of this feature.
|
/// @dev Name of this feature.
|
||||||
string public constant override FEATURE_NAME = "UniswapFeature";
|
string public constant override FEATURE_NAME = "UniswapFeature";
|
||||||
/// @dev Version of this feature.
|
/// @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.
|
/// @dev WETH contract.
|
||||||
IEtherTokenV06 private immutable WETH;
|
IEtherTokenV06 private immutable WETH;
|
||||||
/// @dev AllowanceTarget instance.
|
/// @dev AllowanceTarget instance.
|
||||||
|
151
contracts/zero-ex/contracts/src/features/libs/LibSignature.sol
Normal file
151
contracts/zero-ex/contracts/src/features/libs/LibSignature.sol
Normal 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.
|
||||||
|
}
|
||||||
|
}
|
@@ -27,6 +27,9 @@ import "../ITokenSpenderFeature.sol";
|
|||||||
library LibTokenSpender {
|
library LibTokenSpender {
|
||||||
using LibRichErrorsV06 for bytes;
|
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`.
|
/// @dev Transfers ERC20 tokens from `owner` to `to`.
|
||||||
/// @param token The token to spend.
|
/// @param token The token to spend.
|
||||||
/// @param owner The owner of the tokens.
|
/// @param owner The owner of the tokens.
|
||||||
@@ -50,11 +53,11 @@ library LibTokenSpender {
|
|||||||
|
|
||||||
// selector for transferFrom(address,address,uint256)
|
// selector for transferFrom(address,address,uint256)
|
||||||
mstore(ptr, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
|
mstore(ptr, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
|
||||||
mstore(add(ptr, 0x04), owner)
|
mstore(add(ptr, 0x04), and(owner, ADDRESS_MASK))
|
||||||
mstore(add(ptr, 0x24), to)
|
mstore(add(ptr, 0x24), and(to, ADDRESS_MASK))
|
||||||
mstore(add(ptr, 0x44), amount)
|
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()
|
let rdsize := returndatasize()
|
||||||
|
|
||||||
|
114
contracts/zero-ex/contracts/src/fixins/FixinProtocolFees.sol
Normal file
114
contracts/zero-ex/contracts/src/fixins/FixinProtocolFees.sol
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
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";
|
||||||
|
|
||||||
|
/// @dev Helpers for collecting protocol fees.
|
||||||
|
abstract contract FixinProtocolFees {
|
||||||
|
bytes32 immutable feeCollectorCodeHash;
|
||||||
|
|
||||||
|
constructor() internal {
|
||||||
|
feeCollectorCodeHash = keccak256(type(FeeCollector).creationCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @dev Collect the specified protocol fee in either WETH or ETH. If
|
||||||
|
/// msg.value is non-zero, the fee will be paid in ETH. Otherwise,
|
||||||
|
/// this function attempts to transfer the fee in WETH. Either way,
|
||||||
|
/// The fee is stored in a per-pool fee collector contract.
|
||||||
|
/// @param poolId The pool ID for which a fee is being collected.
|
||||||
|
/// @param amount The amount of ETH/WETH to be collected.
|
||||||
|
/// @param weth The WETH token contract.
|
||||||
|
function _collectProtocolFee(
|
||||||
|
bytes32 poolId,
|
||||||
|
uint256 amount,
|
||||||
|
IERC20TokenV06 weth
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
|
FeeCollector feeCollector = _getFeeCollector(poolId);
|
||||||
|
|
||||||
|
if (msg.value == 0) {
|
||||||
|
// WETH
|
||||||
|
LibTokenSpender.spendERC20Tokens(weth, msg.sender, address(feeCollector), amount);
|
||||||
|
} else {
|
||||||
|
// ETH
|
||||||
|
(bool success,) = address(feeCollector).call{value: amount}("");
|
||||||
|
require(success, "FixinProtocolFees/ETHER_TRANSFER_FALIED");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @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,
|
||||||
|
IStaking staking,
|
||||||
|
IEtherTokenV06 weth
|
||||||
|
)
|
||||||
|
internal
|
||||||
|
{
|
||||||
|
FeeCollector feeCollector = _getFeeCollector(poolId);
|
||||||
|
|
||||||
|
uint256 codeSize;
|
||||||
|
assembly {
|
||||||
|
codeSize := extcodesize(feeCollector)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (codeSize == 0) {
|
||||||
|
// Create and initialize the contract if necessary.
|
||||||
|
new FeeCollector{salt: 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
|
||||||
|
feeCollectorCodeHash
|
||||||
|
))));
|
||||||
|
return FeeCollector(addr);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
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 "./LibStorage.sol";
|
|
||||||
|
|
||||||
|
|
||||||
/// @dev Storage helpers for `LiquidityProviderFeature`.
|
|
||||||
library LibLiquidityProviderStorage {
|
|
||||||
|
|
||||||
/// @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @dev Get the storage bucket for this contract.
|
|
||||||
function getStorage() internal pure returns (Storage storage stor) {
|
|
||||||
uint256 storageSlot = LibStorage.getStorageSlot(
|
|
||||||
LibStorage.StorageId.LiquidityProvider
|
|
||||||
);
|
|
||||||
// Dip into assembly to change the slot pointed to by the local
|
|
||||||
// variable `stor`.
|
|
||||||
// See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries
|
|
||||||
assembly { stor_slot := storageSlot }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -36,8 +36,7 @@ library LibStorage {
|
|||||||
TokenSpender,
|
TokenSpender,
|
||||||
TransformERC20,
|
TransformERC20,
|
||||||
MetaTransactions,
|
MetaTransactions,
|
||||||
ReentrancyGuard,
|
ReentrancyGuard
|
||||||
LiquidityProvider
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Get the storage slot given a storage ID. We assign unique, well-spaced
|
/// @dev Get the storage slot given a storage ID. We assign unique, well-spaced
|
||||||
|
@@ -27,6 +27,7 @@ import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
|
|||||||
import "@0x/contracts-utils/contracts/src/v06/LibMathV06.sol";
|
import "@0x/contracts-utils/contracts/src/v06/LibMathV06.sol";
|
||||||
import "../errors/LibTransformERC20RichErrors.sol";
|
import "../errors/LibTransformERC20RichErrors.sol";
|
||||||
import "../vendor/v3/IExchange.sol";
|
import "../vendor/v3/IExchange.sol";
|
||||||
|
import "../vendor/v3/LibOrderHash.sol";
|
||||||
import "./bridges/IBridgeAdapter.sol";
|
import "./bridges/IBridgeAdapter.sol";
|
||||||
import "./Transformer.sol";
|
import "./Transformer.sol";
|
||||||
import "./LibERC20Transformer.sol";
|
import "./LibERC20Transformer.sol";
|
||||||
@@ -104,13 +105,8 @@ contract FillQuoteTransformer is
|
|||||||
|
|
||||||
/// @dev Emitted when a trade is skipped due to a lack of funds
|
/// @dev Emitted when a trade is skipped due to a lack of funds
|
||||||
/// to pay the 0x Protocol fee.
|
/// to pay the 0x Protocol fee.
|
||||||
/// @param ethBalance The current eth balance.
|
/// @param orderHash The hash of the order that was skipped.
|
||||||
/// @param ethNeeded The current eth balance required to pay
|
event ProtocolFeeUnfunded(bytes32 orderHash);
|
||||||
/// the protocol fee.
|
|
||||||
event ProtocolFeeUnfunded(
|
|
||||||
uint256 ethBalance,
|
|
||||||
uint256 ethNeeded
|
|
||||||
);
|
|
||||||
|
|
||||||
/// @dev The Exchange ERC20Proxy ID.
|
/// @dev The Exchange ERC20Proxy ID.
|
||||||
bytes4 private constant ERC20_ASSET_PROXY_ID = 0xf47261b0;
|
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.
|
// Emit an event if we do not have sufficient ETH to cover the protocol fee.
|
||||||
if (state.ethRemaining < state.protocolFee) {
|
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;
|
return results;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
@@ -64,22 +64,6 @@ contract BridgeAdapter is
|
|||||||
address private immutable UNISWAP_BRIDGE_ADDRESS;
|
address private immutable UNISWAP_BRIDGE_ADDRESS;
|
||||||
address private immutable UNISWAP_V2_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)
|
constructor(AdapterAddresses memory addresses)
|
||||||
public
|
public
|
||||||
MixinBalancer()
|
MixinBalancer()
|
||||||
@@ -89,7 +73,7 @@ contract BridgeAdapter is
|
|||||||
MixinMooniswap(addresses)
|
MixinMooniswap(addresses)
|
||||||
MixinMStable(addresses)
|
MixinMStable(addresses)
|
||||||
MixinOasis(addresses)
|
MixinOasis(addresses)
|
||||||
MixinShell(addresses)
|
MixinShell()
|
||||||
MixinSushiswap(addresses)
|
MixinSushiswap(addresses)
|
||||||
MixinUniswap(addresses)
|
MixinUniswap(addresses)
|
||||||
MixinUniswapV2(addresses)
|
MixinUniswapV2(addresses)
|
||||||
@@ -209,7 +193,8 @@ contract BridgeAdapter is
|
|||||||
sellAmount,
|
sellAmount,
|
||||||
bridgeData
|
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;
|
return boughtAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,6 @@ contract MixinAdapterAddresses
|
|||||||
address uniswapV2Router;
|
address uniswapV2Router;
|
||||||
address uniswapExchangeFactory;
|
address uniswapExchangeFactory;
|
||||||
address mStable;
|
address mStable;
|
||||||
address shell;
|
|
||||||
address dodoHelper;
|
address dodoHelper;
|
||||||
// Other
|
// Other
|
||||||
address weth;
|
address weth;
|
||||||
|
@@ -37,22 +37,11 @@ interface IShell {
|
|||||||
returns (uint256 toAmount);
|
returns (uint256 toAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
contract MixinShell is
|
contract MixinShell is
|
||||||
MixinAdapterAddresses
|
MixinAdapterAddresses
|
||||||
{
|
{
|
||||||
using LibERC20TokenV06 for IERC20TokenV06;
|
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(
|
function _tradeShell(
|
||||||
IERC20TokenV06 buyToken,
|
IERC20TokenV06 buyToken,
|
||||||
uint256 sellAmount,
|
uint256 sellAmount,
|
||||||
@@ -61,15 +50,15 @@ contract MixinShell is
|
|||||||
internal
|
internal
|
||||||
returns (uint256 boughtAmount)
|
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.
|
// Grant the Shell contract an allowance to sell the first token.
|
||||||
IERC20TokenV06(fromTokenAddress).approveIfBelow(
|
IERC20TokenV06(fromTokenAddress).approveIfBelow(
|
||||||
address(SHELL),
|
pool,
|
||||||
sellAmount
|
sellAmount
|
||||||
);
|
);
|
||||||
|
|
||||||
boughtAmount = SHELL.originSwap(
|
boughtAmount = IShell(pool).originSwap(
|
||||||
fromTokenAddress,
|
fromTokenAddress,
|
||||||
address(buyToken),
|
address(buyToken),
|
||||||
// Sell all tokens we hold.
|
// Sell all tokens we hold.
|
||||||
|
@@ -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/LibERC20TokenV06.sol";
|
||||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||||
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.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 {
|
contract MixinZeroExBridge {
|
||||||
|
|
||||||
using LibERC20TokenV06 for IERC20TokenV06;
|
using LibERC20TokenV06 for IERC20TokenV06;
|
||||||
using LibSafeMathV06 for uint256;
|
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(
|
function _tradeZeroExBridge(
|
||||||
address bridgeAddress,
|
address bridgeAddress,
|
||||||
IERC20TokenV06 sellToken,
|
IERC20TokenV06 sellToken,
|
||||||
@@ -57,19 +56,37 @@ contract MixinZeroExBridge {
|
|||||||
internal
|
internal
|
||||||
returns (uint256 boughtAmount)
|
returns (uint256 boughtAmount)
|
||||||
{
|
{
|
||||||
uint256 balanceBefore = buyToken.balanceOf(address(this));
|
|
||||||
// Trade the good old fashioned way
|
// Trade the good old fashioned way
|
||||||
sellToken.compatTransfer(
|
sellToken.compatTransfer(
|
||||||
bridgeAddress,
|
bridgeAddress,
|
||||||
sellAmount
|
sellAmount
|
||||||
);
|
);
|
||||||
IERC20Bridge(bridgeAddress).bridgeTransferFrom(
|
try ILiquidityProvider(bridgeAddress).sellTokenForToken(
|
||||||
|
address(sellToken),
|
||||||
|
address(buyToken),
|
||||||
|
address(this), // recipient
|
||||||
|
1, // minBuyAmount
|
||||||
|
bridgeData
|
||||||
|
) returns (uint256 _boughtAmount) {
|
||||||
|
boughtAmount = _boughtAmount;
|
||||||
|
emit ERC20BridgeTransfer(
|
||||||
|
sellToken,
|
||||||
buyToken,
|
buyToken,
|
||||||
address(bridgeAddress),
|
sellAmount,
|
||||||
address(this),
|
boughtAmount,
|
||||||
1, // amount to transfer back from the bridge
|
bridgeAddress,
|
||||||
|
address(this)
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
uint256 balanceBefore = buyToken.balanceOf(address(this));
|
||||||
|
IERC20Bridge(bridgeAddress).bridgeTransferFrom(
|
||||||
|
address(buyToken),
|
||||||
|
bridgeAddress,
|
||||||
|
address(this), // recipient
|
||||||
|
1, // minBuyAmount
|
||||||
bridgeData
|
bridgeData
|
||||||
);
|
);
|
||||||
boughtAmount = buyToken.balanceOf(address(this)).safeSub(balanceBefore);
|
boughtAmount = buyToken.balanceOf(address(this)).safeSub(balanceBefore);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
92
contracts/zero-ex/contracts/src/vendor/ILiquidityProvider.sol
vendored
Normal file
92
contracts/zero-ex/contracts/src/vendor/ILiquidityProvider.sol
vendored
Normal 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);
|
||||||
|
}
|
@@ -104,4 +104,9 @@ interface IExchange {
|
|||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (address proxyAddress);
|
returns (address proxyAddress);
|
||||||
|
|
||||||
|
function EIP712_EXCHANGE_DOMAIN_HASH()
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (bytes32 domainHash);
|
||||||
}
|
}
|
||||||
|
24
contracts/zero-ex/contracts/src/vendor/v3/IStaking.sol
vendored
Normal file
24
contracts/zero-ex/contracts/src/vendor/v3/IStaking.sol
vendored
Normal 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;
|
||||||
|
}
|
167
contracts/zero-ex/contracts/src/vendor/v3/LibOrderHash.sol
vendored
Normal file
167
contracts/zero-ex/contracts/src/vendor/v3/LibOrderHash.sol
vendored
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,19 +1,15 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright 2020 ZeroEx Intl.
|
Copyright 2020 ZeroEx Intl.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pragma solidity ^0.6.5;
|
pragma solidity ^0.6.5;
|
||||||
|
@@ -32,28 +32,26 @@ contract TestFillQuoteTransformerBridge {
|
|||||||
uint256 amount;
|
uint256 amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes4 private constant ERC20_BRIDGE_PROXY_ID = 0xdc1600f3;
|
function sellTokenForToken(
|
||||||
|
address takerToken,
|
||||||
function bridgeTransferFrom(
|
address makerToken,
|
||||||
address tokenAddress,
|
address recipient,
|
||||||
address from,
|
uint256 minBuyAmount,
|
||||||
address to,
|
bytes calldata auxiliaryData
|
||||||
uint256 amount,
|
|
||||||
bytes calldata bridgeData
|
|
||||||
)
|
)
|
||||||
external
|
external
|
||||||
returns (bytes4 success)
|
returns (uint256 boughtAmount)
|
||||||
{
|
{
|
||||||
FillBehavior memory behavior = abi.decode(bridgeData, (FillBehavior));
|
FillBehavior memory behavior = abi.decode(auxiliaryData, (FillBehavior));
|
||||||
TestMintableERC20Token(tokenAddress).mint(
|
boughtAmount = LibMathV06.getPartialAmountFloor(
|
||||||
to,
|
|
||||||
LibMathV06.getPartialAmountFloor(
|
|
||||||
behavior.makerAssetMintRatio,
|
behavior.makerAssetMintRatio,
|
||||||
1e18,
|
1e18,
|
||||||
behavior.amount
|
behavior.amount
|
||||||
)
|
|
||||||
);
|
);
|
||||||
return ERC20_BRIDGE_PROXY_ID;
|
TestMintableERC20Token(makerToken).mint(
|
||||||
|
recipient,
|
||||||
|
boughtAmount
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeBehaviorData(FillBehavior calldata behavior)
|
function encodeBehaviorData(FillBehavior calldata behavior)
|
||||||
|
@@ -35,6 +35,8 @@ contract TestFillQuoteTransformerExchange {
|
|||||||
uint256 makerAssetMintRatio;
|
uint256 makerAssetMintRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bytes32 public constant EIP712_EXCHANGE_DOMAIN_HASH = 0xaa81d881b1adbbf115e15b849cb9cdc643cad3c6a90f30eb505954af943247e6;
|
||||||
|
|
||||||
uint256 private constant PROTOCOL_FEE_MULTIPLIER = 1337;
|
uint256 private constant PROTOCOL_FEE_MULTIPLIER = 1337;
|
||||||
|
|
||||||
using LibSafeMathV06 for uint256;
|
using LibSafeMathV06 for uint256;
|
||||||
|
@@ -22,6 +22,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
import "../src/ZeroEx.sol";
|
import "../src/ZeroEx.sol";
|
||||||
import "../src/features/IBootstrapFeature.sol";
|
import "../src/features/IBootstrapFeature.sol";
|
||||||
import "../src/migrations/InitialMigration.sol";
|
import "../src/migrations/InitialMigration.sol";
|
||||||
|
import "../src/features/SimpleFunctionRegistryFeature.sol";
|
||||||
|
|
||||||
|
|
||||||
contract TestInitialMigration is
|
contract TestInitialMigration is
|
||||||
@@ -44,7 +45,8 @@ contract TestInitialMigration is
|
|||||||
{
|
{
|
||||||
success = InitialMigration.bootstrap(owner, features);
|
success = InitialMigration.bootstrap(owner, features);
|
||||||
// Snoop the bootstrap feature contract.
|
// Snoop the bootstrap feature contract.
|
||||||
bootstrapFeature = ZeroEx(address(uint160(address(this))))
|
bootstrapFeature =
|
||||||
|
SimpleFunctionRegistryFeature(address(uint160(address(this))))
|
||||||
.getFunctionImplementation(IBootstrapFeature.bootstrap.selector);
|
.getFunctionImplementation(IBootstrapFeature.bootstrap.selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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
|
function getSignerOfHash(bytes32 hash, LibSignature.Signature calldata signature)
|
||||||
/// (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
|
|
||||||
)
|
|
||||||
external
|
external
|
||||||
view
|
pure
|
||||||
returns (address providerAddress);
|
returns (address signer)
|
||||||
|
{
|
||||||
|
return LibSignature.getSignerOfHash(hash, signature);
|
||||||
|
}
|
||||||
}
|
}
|
135
contracts/zero-ex/contracts/test/TestLiquidityProvider.sol
Normal file
135
contracts/zero-ex/contracts/test/TestLiquidityProvider.sol
Normal 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))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
55
contracts/zero-ex/contracts/test/TestProtocolFees.sol
Normal file
55
contracts/zero-ex/contracts/test/TestProtocolFees.sol
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
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 TestProtocolFees is FixinProtocolFees {
|
||||||
|
function collectProtocolFee(
|
||||||
|
bytes32 poolId,
|
||||||
|
uint256 amount,
|
||||||
|
IERC20TokenV06 weth
|
||||||
|
)
|
||||||
|
external
|
||||||
|
payable
|
||||||
|
{
|
||||||
|
_collectProtocolFee(poolId, amount, weth);
|
||||||
|
}
|
||||||
|
|
||||||
|
function transferFeesForPool(
|
||||||
|
bytes32 poolId,
|
||||||
|
IStaking staking,
|
||||||
|
IEtherTokenV06 weth
|
||||||
|
)
|
||||||
|
external
|
||||||
|
{
|
||||||
|
_transferFeesForPool(poolId, staking, weth);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFeeCollector(
|
||||||
|
bytes32 poolId
|
||||||
|
)
|
||||||
|
external
|
||||||
|
view
|
||||||
|
returns (FeeCollector)
|
||||||
|
{
|
||||||
|
return _getFeeCollector(poolId);
|
||||||
|
}
|
||||||
|
}
|
49
contracts/zero-ex/contracts/test/TestStaking.sol
Normal file
49
contracts/zero-ex/contracts/test/TestStaking.sol
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-zero-ex",
|
"name": "@0x/contracts-zero-ex",
|
||||||
"version": "0.5.0",
|
"version": "0.9.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -10,8 +10,9 @@
|
|||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "yarn pre_build && tsc -b",
|
"build": "yarn pre_build && yarn build:ts",
|
||||||
"build:ci": "yarn build",
|
"build:ci": "yarn build",
|
||||||
|
"build:ts": "tsc -b",
|
||||||
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
|
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
|
||||||
"test": "yarn run_mocha",
|
"test": "yarn run_mocha",
|
||||||
"rebuild_and_test": "run-s build test",
|
"rebuild_and_test": "run-s build test",
|
||||||
@@ -39,9 +40,9 @@
|
|||||||
"publish:private": "yarn build && gitpkg publish"
|
"publish:private": "yarn build && gitpkg publish"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITokenSpenderFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,TokenSpenderFeature,AffiliateFeeTransformer,SignatureValidatorFeature,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature",
|
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IAllowanceTarget,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITokenSpenderFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,TokenSpenderFeature,AffiliateFeeTransformer,SignatureValidatorFeature,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature,ILiquidityProvider",
|
||||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||||
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|BootstrapFeature|BridgeAdapter|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinReentrancyGuard|FlashWallet|FullMigration|IAllowanceTarget|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IExchange|IFeature|IFlashWallet|IGasToken|ILiquidityProviderFeature|IMetaTransactionsFeature|IOwnableFeature|ISignatureValidatorFeature|ISimpleFunctionRegistryFeature|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibLiquidityProviderRichErrors|LibLiquidityProviderStorage|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignatureRichErrors|LibSignedCallData|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibSpenderRichErrors|LibStorage|LibTokenSpender|LibTokenSpenderStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LogMetadataTransformer|MetaTransactionsFeature|MixinAdapterAddresses|MixinBalancer|MixinCurve|MixinDodo|MixinKyber|MixinMStable|MixinMooniswap|MixinOasis|MixinShell|MixinSushiswap|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|OwnableFeature|PayTakerTransformer|SignatureValidatorFeature|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestDelegateCaller|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFullMigration|TestInitialMigration|TestLibTokenSpender|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestTokenSpender|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TokenSpenderFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx).json"
|
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|AllowanceTarget|BootstrapFeature|BridgeAdapter|FeeCollector|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FlashWallet|FullMigration|IAllowanceTarget|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IExchange|IFeature|IFlashWallet|IGasToken|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IOwnableFeature|ISignatureValidatorFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibOrderHash|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSignedCallData|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibSpenderRichErrors|LibStorage|LibTokenSpender|LibTokenSpenderStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAdapterAddresses|MixinBalancer|MixinCurve|MixinDodo|MixinKyber|MixinMStable|MixinMooniswap|MixinOasis|MixinShell|MixinSushiswap|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|OwnableFeature|PayTakerTransformer|SignatureValidatorFeature|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestDelegateCaller|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFullMigration|TestInitialMigration|TestLibSignature|TestLibTokenSpender|TestLiquidityProvider|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestProtocolFees|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpender|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TokenSpenderFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx).json"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -53,13 +54,12 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.4.3",
|
"@0x/abi-gen": "^5.4.7",
|
||||||
"@0x/contracts-erc20": "^3.2.3",
|
"@0x/contracts-erc20": "^3.2.8",
|
||||||
"@0x/contracts-gen": "2.0.13",
|
"@0x/contracts-gen": "2.0.18",
|
||||||
"@0x/contracts-test-utils": "^5.3.6",
|
"@0x/contracts-test-utils": "^5.3.11",
|
||||||
"@0x/dev-utils": "^3.3.4",
|
"@0x/dev-utils": "^4.0.1",
|
||||||
"@0x/order-utils": "^10.4.1",
|
"@0x/sol-compiler": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.2.3",
|
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.3",
|
"@0x/tslint-config": "^4.1.3",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
@@ -75,12 +75,13 @@
|
|||||||
"typescript": "3.0.1"
|
"typescript": "3.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.2.7",
|
"@0x/base-contract": "^6.2.11",
|
||||||
"@0x/subproviders": "^6.1.5",
|
"@0x/order-utils": "^10.4.6",
|
||||||
"@0x/types": "^3.2.4",
|
"@0x/subproviders": "^6.1.9",
|
||||||
|
"@0x/types": "^3.3.0",
|
||||||
"@0x/typescript-typings": "^5.1.5",
|
"@0x/typescript-typings": "^5.1.5",
|
||||||
"@0x/utils": "^5.6.3",
|
"@0x/utils": "^6.1.0",
|
||||||
"@0x/web3-wrapper": "^7.2.4",
|
"@0x/web3-wrapper": "^7.2.8",
|
||||||
"ethereum-types": "^3.3.3",
|
"ethereum-types": "^3.3.3",
|
||||||
"ethereumjs-util": "^5.1.1"
|
"ethereumjs-util": "^5.1.1"
|
||||||
},
|
},
|
||||||
|
@@ -12,6 +12,7 @@ import * as FullMigration from '../generated-artifacts/FullMigration.json';
|
|||||||
import * as IAllowanceTarget from '../generated-artifacts/IAllowanceTarget.json';
|
import * as IAllowanceTarget from '../generated-artifacts/IAllowanceTarget.json';
|
||||||
import * as IERC20Transformer from '../generated-artifacts/IERC20Transformer.json';
|
import * as IERC20Transformer from '../generated-artifacts/IERC20Transformer.json';
|
||||||
import * as IFlashWallet from '../generated-artifacts/IFlashWallet.json';
|
import * as IFlashWallet from '../generated-artifacts/IFlashWallet.json';
|
||||||
|
import * as ILiquidityProvider from '../generated-artifacts/ILiquidityProvider.json';
|
||||||
import * as InitialMigration from '../generated-artifacts/InitialMigration.json';
|
import * as InitialMigration from '../generated-artifacts/InitialMigration.json';
|
||||||
import * as IOwnableFeature from '../generated-artifacts/IOwnableFeature.json';
|
import * as IOwnableFeature from '../generated-artifacts/IOwnableFeature.json';
|
||||||
import * as ISimpleFunctionRegistryFeature from '../generated-artifacts/ISimpleFunctionRegistryFeature.json';
|
import * as ISimpleFunctionRegistryFeature from '../generated-artifacts/ISimpleFunctionRegistryFeature.json';
|
||||||
@@ -54,4 +55,5 @@ export const artifacts = {
|
|||||||
LogMetadataTransformer: LogMetadataTransformer as ContractArtifact,
|
LogMetadataTransformer: LogMetadataTransformer as ContractArtifact,
|
||||||
BridgeAdapter: BridgeAdapter as ContractArtifact,
|
BridgeAdapter: BridgeAdapter as ContractArtifact,
|
||||||
LiquidityProviderFeature: LiquidityProviderFeature as ContractArtifact,
|
LiquidityProviderFeature: LiquidityProviderFeature as ContractArtifact,
|
||||||
|
ILiquidityProvider: ILiquidityProvider as ContractArtifact,
|
||||||
};
|
};
|
||||||
|
@@ -32,6 +32,7 @@ export { artifacts } from './artifacts';
|
|||||||
export * from './migration';
|
export * from './migration';
|
||||||
export * from './nonce_utils';
|
export * from './nonce_utils';
|
||||||
export * from './signed_call_data';
|
export * from './signed_call_data';
|
||||||
|
export * from './signature_utils';
|
||||||
export {
|
export {
|
||||||
AffiliateFeeTransformerContract,
|
AffiliateFeeTransformerContract,
|
||||||
BridgeAdapterContract,
|
BridgeAdapterContract,
|
||||||
@@ -48,3 +49,6 @@ export {
|
|||||||
WethTransformerContract,
|
WethTransformerContract,
|
||||||
ZeroExContract,
|
ZeroExContract,
|
||||||
} from './wrappers';
|
} from './wrappers';
|
||||||
|
export * from './revert_errors';
|
||||||
|
export { EIP712TypedData } from '@0x/types';
|
||||||
|
export { SupportedProvider } from '@0x/subproviders';
|
||||||
|
30
contracts/zero-ex/src/revert_errors.ts
Normal file
30
contracts/zero-ex/src/revert_errors.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// TODO(dorothy-zbornak): Move these into `@0x/protocol-utils` whenever that
|
||||||
|
// becomes a thing.
|
||||||
|
// tslint:disable:max-classes-per-file
|
||||||
|
import { RevertError } from '@0x/utils';
|
||||||
|
|
||||||
|
export enum SignatureValidationErrorCodes {
|
||||||
|
AlwaysInvalid = 0,
|
||||||
|
InvalidLength = 1,
|
||||||
|
Unsupported = 2,
|
||||||
|
Illegal = 3,
|
||||||
|
WrongSigner = 4,
|
||||||
|
BadSignatureData = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
// tslint:disable:max-classes-per-file
|
||||||
|
export class SignatureValidationError extends RevertError {
|
||||||
|
constructor(code?: SignatureValidationErrorCodes, hash?: string) {
|
||||||
|
super('SignatureValidationError', 'SignatureValidationError(uint8 code, bytes32 hash)', {
|
||||||
|
code,
|
||||||
|
hash,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const types = [SignatureValidationError];
|
||||||
|
|
||||||
|
// Register the types we've defined.
|
||||||
|
for (const type of types) {
|
||||||
|
RevertError.registerType(type);
|
||||||
|
}
|
113
contracts/zero-ex/src/signature_utils.ts
Normal file
113
contracts/zero-ex/src/signature_utils.ts
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
import { signatureUtils } from '@0x/order-utils';
|
||||||
|
import { SupportedProvider } from '@0x/subproviders';
|
||||||
|
import { EIP712TypedData } from '@0x/types';
|
||||||
|
import { hexUtils, signTypedDataUtils } from '@0x/utils';
|
||||||
|
import * as ethjs from 'ethereumjs-util';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valid signature types on the Exchange Proxy.
|
||||||
|
*/
|
||||||
|
export enum SignatureType {
|
||||||
|
Illegal = 0,
|
||||||
|
Invalid = 1,
|
||||||
|
EIP712 = 2,
|
||||||
|
EthSign = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a raw EC signature.
|
||||||
|
*/
|
||||||
|
export interface ECSignature {
|
||||||
|
v: number;
|
||||||
|
r: string;
|
||||||
|
s: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A complete signature on the Exchange Proxy.
|
||||||
|
*/
|
||||||
|
export interface Signature extends ECSignature {
|
||||||
|
signatureType: SignatureType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign a hash with the EthSign signature type on a provider.
|
||||||
|
*/
|
||||||
|
export async function ethSignHashFromProviderAsync(
|
||||||
|
signer: string,
|
||||||
|
hash: string,
|
||||||
|
provider: SupportedProvider,
|
||||||
|
): Promise<Signature> {
|
||||||
|
const signatureBytes = await signatureUtils.ecSignHashAsync(provider, hash, signer);
|
||||||
|
const parsed = parsePackedSignatureBytes(signatureBytes);
|
||||||
|
assertSignatureType(parsed, SignatureType.EthSign);
|
||||||
|
return parsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign a hash with the EthSign signature type, given a private key.
|
||||||
|
*/
|
||||||
|
export function ethSignHashWithKey(hash: string, key: string): Signature {
|
||||||
|
const ethHash = hexUtils.toHex(
|
||||||
|
ethjs.sha3(hexUtils.concat(ethjs.toBuffer('\x19Ethereum Signed Message:\n32'), hash)),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...ecSignHashWithKey(ethHash, key),
|
||||||
|
signatureType: SignatureType.EthSign,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign a typed data object with the EIP712 signature type, given a private key.
|
||||||
|
*/
|
||||||
|
export function eip712SignTypedDataWithKey(typedData: EIP712TypedData, key: string): Signature {
|
||||||
|
const hash = hexUtils.toHex(signTypedDataUtils.generateTypedDataHash(typedData));
|
||||||
|
return {
|
||||||
|
...ecSignHashWithKey(hash, key),
|
||||||
|
signatureType: SignatureType.EIP712,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign an EIP712 hash with the EIP712 signature type, given a private key.
|
||||||
|
*/
|
||||||
|
export function eip712SignHashWithKey(hash: string, key: string): Signature {
|
||||||
|
return {
|
||||||
|
...ecSignHashWithKey(hash, key),
|
||||||
|
signatureType: SignatureType.EIP712,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the EC signature for a hash given a private key.
|
||||||
|
*/
|
||||||
|
export function ecSignHashWithKey(hash: string, key: string): ECSignature {
|
||||||
|
const { v, r, s } = ethjs.ecsign(ethjs.toBuffer(hash), ethjs.toBuffer(key));
|
||||||
|
return {
|
||||||
|
v,
|
||||||
|
r: ethjs.bufferToHex(r),
|
||||||
|
s: ethjs.bufferToHex(s),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertSignatureType(signature: Signature, expectedType: SignatureType): void {
|
||||||
|
if (signature.signatureType !== expectedType) {
|
||||||
|
throw new Error(`Expected signature type to be ${expectedType} but received ${signature.signatureType}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parsePackedSignatureBytes(signatureBytes: string): Signature {
|
||||||
|
if (hexUtils.size(signatureBytes) !== 66) {
|
||||||
|
throw new Error(`Expected packed signatureBytes to be 66 bytes long: ${signatureBytes}`);
|
||||||
|
}
|
||||||
|
const typeId = parseInt(signatureBytes.slice(-2), 16) as SignatureType;
|
||||||
|
if (!Object.values(SignatureType).includes(typeId)) {
|
||||||
|
throw new Error(`Invalid signatureBytes type ID detected: ${typeId}`);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
signatureType: typeId,
|
||||||
|
v: parseInt(signatureBytes.slice(2, 4), 16),
|
||||||
|
r: hexUtils.slice(signatureBytes, 1, 33),
|
||||||
|
s: hexUtils.slice(signatureBytes, 33),
|
||||||
|
};
|
||||||
|
}
|
@@ -10,6 +10,7 @@ export * from '../generated-wrappers/full_migration';
|
|||||||
export * from '../generated-wrappers/i_allowance_target';
|
export * from '../generated-wrappers/i_allowance_target';
|
||||||
export * from '../generated-wrappers/i_erc20_transformer';
|
export * from '../generated-wrappers/i_erc20_transformer';
|
||||||
export * from '../generated-wrappers/i_flash_wallet';
|
export * from '../generated-wrappers/i_flash_wallet';
|
||||||
|
export * from '../generated-wrappers/i_liquidity_provider';
|
||||||
export * from '../generated-wrappers/i_ownable_feature';
|
export * from '../generated-wrappers/i_ownable_feature';
|
||||||
export * from '../generated-wrappers/i_simple_function_registry_feature';
|
export * from '../generated-wrappers/i_simple_function_registry_feature';
|
||||||
export * from '../generated-wrappers/i_token_spender_feature';
|
export * from '../generated-wrappers/i_token_spender_feature';
|
||||||
|
@@ -9,9 +9,11 @@ import * as AffiliateFeeTransformer from '../test/generated-artifacts/AffiliateF
|
|||||||
import * as AllowanceTarget from '../test/generated-artifacts/AllowanceTarget.json';
|
import * as AllowanceTarget from '../test/generated-artifacts/AllowanceTarget.json';
|
||||||
import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature.json';
|
import * as BootstrapFeature from '../test/generated-artifacts/BootstrapFeature.json';
|
||||||
import * as BridgeAdapter from '../test/generated-artifacts/BridgeAdapter.json';
|
import * as BridgeAdapter from '../test/generated-artifacts/BridgeAdapter.json';
|
||||||
|
import * as FeeCollector from '../test/generated-artifacts/FeeCollector.json';
|
||||||
import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json';
|
import * as FillQuoteTransformer from '../test/generated-artifacts/FillQuoteTransformer.json';
|
||||||
import * as FixinCommon from '../test/generated-artifacts/FixinCommon.json';
|
import * as FixinCommon from '../test/generated-artifacts/FixinCommon.json';
|
||||||
import * as FixinEIP712 from '../test/generated-artifacts/FixinEIP712.json';
|
import * as FixinEIP712 from '../test/generated-artifacts/FixinEIP712.json';
|
||||||
|
import * as FixinProtocolFees from '../test/generated-artifacts/FixinProtocolFees.json';
|
||||||
import * as FixinReentrancyGuard from '../test/generated-artifacts/FixinReentrancyGuard.json';
|
import * as FixinReentrancyGuard from '../test/generated-artifacts/FixinReentrancyGuard.json';
|
||||||
import * as FlashWallet from '../test/generated-artifacts/FlashWallet.json';
|
import * as FlashWallet from '../test/generated-artifacts/FlashWallet.json';
|
||||||
import * as FullMigration from '../test/generated-artifacts/FullMigration.json';
|
import * as FullMigration from '../test/generated-artifacts/FullMigration.json';
|
||||||
@@ -24,12 +26,15 @@ import * as IExchange from '../test/generated-artifacts/IExchange.json';
|
|||||||
import * as IFeature from '../test/generated-artifacts/IFeature.json';
|
import * as IFeature from '../test/generated-artifacts/IFeature.json';
|
||||||
import * as IFlashWallet from '../test/generated-artifacts/IFlashWallet.json';
|
import * as IFlashWallet from '../test/generated-artifacts/IFlashWallet.json';
|
||||||
import * as IGasToken from '../test/generated-artifacts/IGasToken.json';
|
import * as IGasToken from '../test/generated-artifacts/IGasToken.json';
|
||||||
|
import * as ILiquidityProvider from '../test/generated-artifacts/ILiquidityProvider.json';
|
||||||
import * as ILiquidityProviderFeature from '../test/generated-artifacts/ILiquidityProviderFeature.json';
|
import * as ILiquidityProviderFeature from '../test/generated-artifacts/ILiquidityProviderFeature.json';
|
||||||
|
import * as ILiquidityProviderSandbox from '../test/generated-artifacts/ILiquidityProviderSandbox.json';
|
||||||
import * as IMetaTransactionsFeature from '../test/generated-artifacts/IMetaTransactionsFeature.json';
|
import * as IMetaTransactionsFeature from '../test/generated-artifacts/IMetaTransactionsFeature.json';
|
||||||
import * as InitialMigration from '../test/generated-artifacts/InitialMigration.json';
|
import * as InitialMigration from '../test/generated-artifacts/InitialMigration.json';
|
||||||
import * as IOwnableFeature from '../test/generated-artifacts/IOwnableFeature.json';
|
import * as IOwnableFeature from '../test/generated-artifacts/IOwnableFeature.json';
|
||||||
import * as ISignatureValidatorFeature from '../test/generated-artifacts/ISignatureValidatorFeature.json';
|
import * as ISignatureValidatorFeature from '../test/generated-artifacts/ISignatureValidatorFeature.json';
|
||||||
import * as ISimpleFunctionRegistryFeature from '../test/generated-artifacts/ISimpleFunctionRegistryFeature.json';
|
import * as ISimpleFunctionRegistryFeature from '../test/generated-artifacts/ISimpleFunctionRegistryFeature.json';
|
||||||
|
import * as IStaking from '../test/generated-artifacts/IStaking.json';
|
||||||
import * as ITestSimpleFunctionRegistryFeature from '../test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json';
|
import * as ITestSimpleFunctionRegistryFeature from '../test/generated-artifacts/ITestSimpleFunctionRegistryFeature.json';
|
||||||
import * as ITokenSpenderFeature from '../test/generated-artifacts/ITokenSpenderFeature.json';
|
import * as ITokenSpenderFeature from '../test/generated-artifacts/ITokenSpenderFeature.json';
|
||||||
import * as ITransformERC20Feature from '../test/generated-artifacts/ITransformERC20Feature.json';
|
import * as ITransformERC20Feature from '../test/generated-artifacts/ITransformERC20Feature.json';
|
||||||
@@ -39,15 +44,16 @@ import * as LibBootstrap from '../test/generated-artifacts/LibBootstrap.json';
|
|||||||
import * as LibCommonRichErrors from '../test/generated-artifacts/LibCommonRichErrors.json';
|
import * as LibCommonRichErrors from '../test/generated-artifacts/LibCommonRichErrors.json';
|
||||||
import * as LibERC20Transformer from '../test/generated-artifacts/LibERC20Transformer.json';
|
import * as LibERC20Transformer from '../test/generated-artifacts/LibERC20Transformer.json';
|
||||||
import * as LibLiquidityProviderRichErrors from '../test/generated-artifacts/LibLiquidityProviderRichErrors.json';
|
import * as LibLiquidityProviderRichErrors from '../test/generated-artifacts/LibLiquidityProviderRichErrors.json';
|
||||||
import * as LibLiquidityProviderStorage from '../test/generated-artifacts/LibLiquidityProviderStorage.json';
|
|
||||||
import * as LibMetaTransactionsRichErrors from '../test/generated-artifacts/LibMetaTransactionsRichErrors.json';
|
import * as LibMetaTransactionsRichErrors from '../test/generated-artifacts/LibMetaTransactionsRichErrors.json';
|
||||||
import * as LibMetaTransactionsStorage from '../test/generated-artifacts/LibMetaTransactionsStorage.json';
|
import * as LibMetaTransactionsStorage from '../test/generated-artifacts/LibMetaTransactionsStorage.json';
|
||||||
import * as LibMigrate from '../test/generated-artifacts/LibMigrate.json';
|
import * as LibMigrate from '../test/generated-artifacts/LibMigrate.json';
|
||||||
|
import * as LibOrderHash from '../test/generated-artifacts/LibOrderHash.json';
|
||||||
import * as LibOwnableRichErrors from '../test/generated-artifacts/LibOwnableRichErrors.json';
|
import * as LibOwnableRichErrors from '../test/generated-artifacts/LibOwnableRichErrors.json';
|
||||||
import * as LibOwnableStorage from '../test/generated-artifacts/LibOwnableStorage.json';
|
import * as LibOwnableStorage from '../test/generated-artifacts/LibOwnableStorage.json';
|
||||||
import * as LibProxyRichErrors from '../test/generated-artifacts/LibProxyRichErrors.json';
|
import * as LibProxyRichErrors from '../test/generated-artifacts/LibProxyRichErrors.json';
|
||||||
import * as LibProxyStorage from '../test/generated-artifacts/LibProxyStorage.json';
|
import * as LibProxyStorage from '../test/generated-artifacts/LibProxyStorage.json';
|
||||||
import * as LibReentrancyGuardStorage from '../test/generated-artifacts/LibReentrancyGuardStorage.json';
|
import * as LibReentrancyGuardStorage from '../test/generated-artifacts/LibReentrancyGuardStorage.json';
|
||||||
|
import * as LibSignature from '../test/generated-artifacts/LibSignature.json';
|
||||||
import * as LibSignatureRichErrors from '../test/generated-artifacts/LibSignatureRichErrors.json';
|
import * as LibSignatureRichErrors from '../test/generated-artifacts/LibSignatureRichErrors.json';
|
||||||
import * as LibSignedCallData from '../test/generated-artifacts/LibSignedCallData.json';
|
import * as LibSignedCallData from '../test/generated-artifacts/LibSignedCallData.json';
|
||||||
import * as LibSimpleFunctionRegistryRichErrors from '../test/generated-artifacts/LibSimpleFunctionRegistryRichErrors.json';
|
import * as LibSimpleFunctionRegistryRichErrors from '../test/generated-artifacts/LibSimpleFunctionRegistryRichErrors.json';
|
||||||
@@ -60,6 +66,7 @@ import * as LibTransformERC20RichErrors from '../test/generated-artifacts/LibTra
|
|||||||
import * as LibTransformERC20Storage from '../test/generated-artifacts/LibTransformERC20Storage.json';
|
import * as LibTransformERC20Storage from '../test/generated-artifacts/LibTransformERC20Storage.json';
|
||||||
import * as LibWalletRichErrors from '../test/generated-artifacts/LibWalletRichErrors.json';
|
import * as LibWalletRichErrors from '../test/generated-artifacts/LibWalletRichErrors.json';
|
||||||
import * as LiquidityProviderFeature from '../test/generated-artifacts/LiquidityProviderFeature.json';
|
import * as LiquidityProviderFeature from '../test/generated-artifacts/LiquidityProviderFeature.json';
|
||||||
|
import * as LiquidityProviderSandbox from '../test/generated-artifacts/LiquidityProviderSandbox.json';
|
||||||
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
|
import * as LogMetadataTransformer from '../test/generated-artifacts/LogMetadataTransformer.json';
|
||||||
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
|
import * as MetaTransactionsFeature from '../test/generated-artifacts/MetaTransactionsFeature.json';
|
||||||
import * as MixinAdapterAddresses from '../test/generated-artifacts/MixinAdapterAddresses.json';
|
import * as MixinAdapterAddresses from '../test/generated-artifacts/MixinAdapterAddresses.json';
|
||||||
@@ -87,13 +94,17 @@ import * as TestFillQuoteTransformerExchange from '../test/generated-artifacts/T
|
|||||||
import * as TestFillQuoteTransformerHost from '../test/generated-artifacts/TestFillQuoteTransformerHost.json';
|
import * as TestFillQuoteTransformerHost from '../test/generated-artifacts/TestFillQuoteTransformerHost.json';
|
||||||
import * as TestFullMigration from '../test/generated-artifacts/TestFullMigration.json';
|
import * as TestFullMigration from '../test/generated-artifacts/TestFullMigration.json';
|
||||||
import * as TestInitialMigration from '../test/generated-artifacts/TestInitialMigration.json';
|
import * as TestInitialMigration from '../test/generated-artifacts/TestInitialMigration.json';
|
||||||
|
import * as TestLibSignature from '../test/generated-artifacts/TestLibSignature.json';
|
||||||
import * as TestLibTokenSpender from '../test/generated-artifacts/TestLibTokenSpender.json';
|
import * as TestLibTokenSpender from '../test/generated-artifacts/TestLibTokenSpender.json';
|
||||||
|
import * as TestLiquidityProvider from '../test/generated-artifacts/TestLiquidityProvider.json';
|
||||||
import * as TestMetaTransactionsTransformERC20Feature from '../test/generated-artifacts/TestMetaTransactionsTransformERC20Feature.json';
|
import * as TestMetaTransactionsTransformERC20Feature from '../test/generated-artifacts/TestMetaTransactionsTransformERC20Feature.json';
|
||||||
import * as TestMigrator from '../test/generated-artifacts/TestMigrator.json';
|
import * as TestMigrator from '../test/generated-artifacts/TestMigrator.json';
|
||||||
import * as TestMintableERC20Token from '../test/generated-artifacts/TestMintableERC20Token.json';
|
import * as TestMintableERC20Token from '../test/generated-artifacts/TestMintableERC20Token.json';
|
||||||
import * as TestMintTokenERC20Transformer from '../test/generated-artifacts/TestMintTokenERC20Transformer.json';
|
import * as TestMintTokenERC20Transformer from '../test/generated-artifacts/TestMintTokenERC20Transformer.json';
|
||||||
|
import * as TestProtocolFees from '../test/generated-artifacts/TestProtocolFees.json';
|
||||||
import * as TestSimpleFunctionRegistryFeatureImpl1 from '../test/generated-artifacts/TestSimpleFunctionRegistryFeatureImpl1.json';
|
import * as TestSimpleFunctionRegistryFeatureImpl1 from '../test/generated-artifacts/TestSimpleFunctionRegistryFeatureImpl1.json';
|
||||||
import * as TestSimpleFunctionRegistryFeatureImpl2 from '../test/generated-artifacts/TestSimpleFunctionRegistryFeatureImpl2.json';
|
import * as TestSimpleFunctionRegistryFeatureImpl2 from '../test/generated-artifacts/TestSimpleFunctionRegistryFeatureImpl2.json';
|
||||||
|
import * as TestStaking from '../test/generated-artifacts/TestStaking.json';
|
||||||
import * as TestTokenSpender from '../test/generated-artifacts/TestTokenSpender.json';
|
import * as TestTokenSpender from '../test/generated-artifacts/TestTokenSpender.json';
|
||||||
import * as TestTokenSpenderERC20Token from '../test/generated-artifacts/TestTokenSpenderERC20Token.json';
|
import * as TestTokenSpenderERC20Token from '../test/generated-artifacts/TestTokenSpenderERC20Token.json';
|
||||||
import * as TestTransformerBase from '../test/generated-artifacts/TestTransformerBase.json';
|
import * as TestTransformerBase from '../test/generated-artifacts/TestTransformerBase.json';
|
||||||
@@ -124,9 +135,12 @@ export const artifacts = {
|
|||||||
LibTransformERC20RichErrors: LibTransformERC20RichErrors as ContractArtifact,
|
LibTransformERC20RichErrors: LibTransformERC20RichErrors as ContractArtifact,
|
||||||
LibWalletRichErrors: LibWalletRichErrors as ContractArtifact,
|
LibWalletRichErrors: LibWalletRichErrors as ContractArtifact,
|
||||||
AllowanceTarget: AllowanceTarget as ContractArtifact,
|
AllowanceTarget: AllowanceTarget as ContractArtifact,
|
||||||
|
FeeCollector: FeeCollector as ContractArtifact,
|
||||||
FlashWallet: FlashWallet as ContractArtifact,
|
FlashWallet: FlashWallet as ContractArtifact,
|
||||||
IAllowanceTarget: IAllowanceTarget as ContractArtifact,
|
IAllowanceTarget: IAllowanceTarget as ContractArtifact,
|
||||||
IFlashWallet: IFlashWallet as ContractArtifact,
|
IFlashWallet: IFlashWallet as ContractArtifact,
|
||||||
|
ILiquidityProviderSandbox: ILiquidityProviderSandbox as ContractArtifact,
|
||||||
|
LiquidityProviderSandbox: LiquidityProviderSandbox as ContractArtifact,
|
||||||
TransformerDeployer: TransformerDeployer as ContractArtifact,
|
TransformerDeployer: TransformerDeployer as ContractArtifact,
|
||||||
BootstrapFeature: BootstrapFeature as ContractArtifact,
|
BootstrapFeature: BootstrapFeature as ContractArtifact,
|
||||||
IBootstrapFeature: IBootstrapFeature as ContractArtifact,
|
IBootstrapFeature: IBootstrapFeature as ContractArtifact,
|
||||||
@@ -147,16 +161,17 @@ export const artifacts = {
|
|||||||
TokenSpenderFeature: TokenSpenderFeature as ContractArtifact,
|
TokenSpenderFeature: TokenSpenderFeature as ContractArtifact,
|
||||||
TransformERC20Feature: TransformERC20Feature as ContractArtifact,
|
TransformERC20Feature: TransformERC20Feature as ContractArtifact,
|
||||||
UniswapFeature: UniswapFeature as ContractArtifact,
|
UniswapFeature: UniswapFeature as ContractArtifact,
|
||||||
|
LibSignature: LibSignature as ContractArtifact,
|
||||||
LibSignedCallData: LibSignedCallData as ContractArtifact,
|
LibSignedCallData: LibSignedCallData as ContractArtifact,
|
||||||
LibTokenSpender: LibTokenSpender as ContractArtifact,
|
LibTokenSpender: LibTokenSpender as ContractArtifact,
|
||||||
FixinCommon: FixinCommon as ContractArtifact,
|
FixinCommon: FixinCommon as ContractArtifact,
|
||||||
FixinEIP712: FixinEIP712 as ContractArtifact,
|
FixinEIP712: FixinEIP712 as ContractArtifact,
|
||||||
|
FixinProtocolFees: FixinProtocolFees as ContractArtifact,
|
||||||
FixinReentrancyGuard: FixinReentrancyGuard as ContractArtifact,
|
FixinReentrancyGuard: FixinReentrancyGuard as ContractArtifact,
|
||||||
FullMigration: FullMigration as ContractArtifact,
|
FullMigration: FullMigration as ContractArtifact,
|
||||||
InitialMigration: InitialMigration as ContractArtifact,
|
InitialMigration: InitialMigration as ContractArtifact,
|
||||||
LibBootstrap: LibBootstrap as ContractArtifact,
|
LibBootstrap: LibBootstrap as ContractArtifact,
|
||||||
LibMigrate: LibMigrate as ContractArtifact,
|
LibMigrate: LibMigrate as ContractArtifact,
|
||||||
LibLiquidityProviderStorage: LibLiquidityProviderStorage as ContractArtifact,
|
|
||||||
LibMetaTransactionsStorage: LibMetaTransactionsStorage as ContractArtifact,
|
LibMetaTransactionsStorage: LibMetaTransactionsStorage as ContractArtifact,
|
||||||
LibOwnableStorage: LibOwnableStorage as ContractArtifact,
|
LibOwnableStorage: LibOwnableStorage as ContractArtifact,
|
||||||
LibProxyStorage: LibProxyStorage as ContractArtifact,
|
LibProxyStorage: LibProxyStorage as ContractArtifact,
|
||||||
@@ -188,9 +203,12 @@ export const artifacts = {
|
|||||||
MixinUniswap: MixinUniswap as ContractArtifact,
|
MixinUniswap: MixinUniswap as ContractArtifact,
|
||||||
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
|
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
|
||||||
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
|
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
|
||||||
|
ILiquidityProvider: ILiquidityProvider as ContractArtifact,
|
||||||
IERC20Bridge: IERC20Bridge as ContractArtifact,
|
IERC20Bridge: IERC20Bridge as ContractArtifact,
|
||||||
IExchange: IExchange as ContractArtifact,
|
IExchange: IExchange as ContractArtifact,
|
||||||
IGasToken: IGasToken as ContractArtifact,
|
IGasToken: IGasToken as ContractArtifact,
|
||||||
|
IStaking: IStaking as ContractArtifact,
|
||||||
|
LibOrderHash: LibOrderHash as ContractArtifact,
|
||||||
ITestSimpleFunctionRegistryFeature: ITestSimpleFunctionRegistryFeature as ContractArtifact,
|
ITestSimpleFunctionRegistryFeature: ITestSimpleFunctionRegistryFeature as ContractArtifact,
|
||||||
TestBridge: TestBridge as ContractArtifact,
|
TestBridge: TestBridge as ContractArtifact,
|
||||||
TestCallTarget: TestCallTarget as ContractArtifact,
|
TestCallTarget: TestCallTarget as ContractArtifact,
|
||||||
@@ -200,13 +218,17 @@ export const artifacts = {
|
|||||||
TestFillQuoteTransformerHost: TestFillQuoteTransformerHost as ContractArtifact,
|
TestFillQuoteTransformerHost: TestFillQuoteTransformerHost as ContractArtifact,
|
||||||
TestFullMigration: TestFullMigration as ContractArtifact,
|
TestFullMigration: TestFullMigration as ContractArtifact,
|
||||||
TestInitialMigration: TestInitialMigration as ContractArtifact,
|
TestInitialMigration: TestInitialMigration as ContractArtifact,
|
||||||
|
TestLibSignature: TestLibSignature as ContractArtifact,
|
||||||
TestLibTokenSpender: TestLibTokenSpender as ContractArtifact,
|
TestLibTokenSpender: TestLibTokenSpender as ContractArtifact,
|
||||||
|
TestLiquidityProvider: TestLiquidityProvider as ContractArtifact,
|
||||||
TestMetaTransactionsTransformERC20Feature: TestMetaTransactionsTransformERC20Feature as ContractArtifact,
|
TestMetaTransactionsTransformERC20Feature: TestMetaTransactionsTransformERC20Feature as ContractArtifact,
|
||||||
TestMigrator: TestMigrator as ContractArtifact,
|
TestMigrator: TestMigrator as ContractArtifact,
|
||||||
TestMintTokenERC20Transformer: TestMintTokenERC20Transformer as ContractArtifact,
|
TestMintTokenERC20Transformer: TestMintTokenERC20Transformer as ContractArtifact,
|
||||||
TestMintableERC20Token: TestMintableERC20Token as ContractArtifact,
|
TestMintableERC20Token: TestMintableERC20Token as ContractArtifact,
|
||||||
|
TestProtocolFees: TestProtocolFees as ContractArtifact,
|
||||||
TestSimpleFunctionRegistryFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1 as ContractArtifact,
|
TestSimpleFunctionRegistryFeatureImpl1: TestSimpleFunctionRegistryFeatureImpl1 as ContractArtifact,
|
||||||
TestSimpleFunctionRegistryFeatureImpl2: TestSimpleFunctionRegistryFeatureImpl2 as ContractArtifact,
|
TestSimpleFunctionRegistryFeatureImpl2: TestSimpleFunctionRegistryFeatureImpl2 as ContractArtifact,
|
||||||
|
TestStaking: TestStaking as ContractArtifact,
|
||||||
TestTokenSpender: TestTokenSpender as ContractArtifact,
|
TestTokenSpender: TestTokenSpender as ContractArtifact,
|
||||||
TestTokenSpenderERC20Token: TestTokenSpenderERC20Token as ContractArtifact,
|
TestTokenSpenderERC20Token: TestTokenSpenderERC20Token as ContractArtifact,
|
||||||
TestTransformERC20: TestTransformERC20 as ContractArtifact,
|
TestTransformERC20: TestTransformERC20 as ContractArtifact,
|
||||||
|
@@ -1,16 +1,25 @@
|
|||||||
import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contracts-erc20';
|
import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contracts-erc20';
|
||||||
import { blockchainTests, constants, expect, randomAddress, verifyEventsFromLogs } from '@0x/contracts-test-utils';
|
import { blockchainTests, constants, expect, verifyEventsFromLogs } from '@0x/contracts-test-utils';
|
||||||
import { BigNumber, OwnableRevertErrors, ZeroExRevertErrors } from '@0x/utils';
|
import { BigNumber, OwnableRevertErrors, ZeroExRevertErrors } from '@0x/utils';
|
||||||
|
|
||||||
import { IOwnableFeatureContract, IZeroExContract, LiquidityProviderFeatureContract } from '../../src/wrappers';
|
import { IOwnableFeatureContract, IZeroExContract, LiquidityProviderFeatureContract } from '../../src/wrappers';
|
||||||
import { artifacts } from '../artifacts';
|
import { artifacts } from '../artifacts';
|
||||||
import { abis } from '../utils/abis';
|
import { abis } from '../utils/abis';
|
||||||
import { fullMigrateAsync } from '../utils/migration';
|
import { fullMigrateAsync } from '../utils/migration';
|
||||||
import { IERC20BridgeEvents, TestBridgeContract, TestWethContract } from '../wrappers';
|
import {
|
||||||
|
LiquidityProviderSandboxContract,
|
||||||
|
TestBridgeContract,
|
||||||
|
TestBridgeEvents,
|
||||||
|
TestLiquidityProviderContract,
|
||||||
|
TestLiquidityProviderEvents,
|
||||||
|
TestWethContract,
|
||||||
|
} from '../wrappers';
|
||||||
|
|
||||||
blockchainTests('LiquidityProvider feature', env => {
|
blockchainTests('LiquidityProvider feature', env => {
|
||||||
let zeroEx: IZeroExContract;
|
let zeroEx: IZeroExContract;
|
||||||
let feature: LiquidityProviderFeatureContract;
|
let feature: LiquidityProviderFeatureContract;
|
||||||
|
let sandbox: LiquidityProviderSandboxContract;
|
||||||
|
let liquidityProvider: TestLiquidityProviderContract;
|
||||||
let token: DummyERC20TokenContract;
|
let token: DummyERC20TokenContract;
|
||||||
let weth: TestWethContract;
|
let weth: TestWethContract;
|
||||||
let owner: string;
|
let owner: string;
|
||||||
@@ -47,102 +56,112 @@ blockchainTests('LiquidityProvider feature', env => {
|
|||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
weth.address,
|
zeroEx.address,
|
||||||
|
);
|
||||||
|
sandbox = new LiquidityProviderSandboxContract(
|
||||||
|
await featureImpl.sandbox().callAsync(),
|
||||||
|
env.provider,
|
||||||
|
env.txDefaults,
|
||||||
);
|
);
|
||||||
await new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults, abis)
|
await new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults, abis)
|
||||||
.migrate(featureImpl.address, featureImpl.migrate().getABIEncodedTransactionData(), owner)
|
.migrate(featureImpl.address, featureImpl.migrate().getABIEncodedTransactionData(), owner)
|
||||||
.awaitTransactionSuccessAsync();
|
.awaitTransactionSuccessAsync();
|
||||||
});
|
|
||||||
describe('Registry', () => {
|
|
||||||
it('`getLiquidityProviderForMarket` reverts if address is not set', async () => {
|
|
||||||
const [xAsset, yAsset] = [randomAddress(), randomAddress()];
|
|
||||||
let tx = feature.getLiquidityProviderForMarket(xAsset, yAsset).awaitTransactionSuccessAsync();
|
|
||||||
expect(tx).to.revertWith(
|
|
||||||
new ZeroExRevertErrors.LiquidityProvider.NoLiquidityProviderForMarketError(xAsset, yAsset),
|
|
||||||
);
|
|
||||||
tx = feature.getLiquidityProviderForMarket(yAsset, xAsset).awaitTransactionSuccessAsync();
|
|
||||||
return expect(tx).to.revertWith(
|
|
||||||
new ZeroExRevertErrors.LiquidityProvider.NoLiquidityProviderForMarketError(yAsset, xAsset),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('can set/get a liquidity provider address for a given market', async () => {
|
|
||||||
const expectedAddress = randomAddress();
|
|
||||||
await feature
|
|
||||||
.setLiquidityProviderForMarket(token.address, weth.address, expectedAddress)
|
|
||||||
.awaitTransactionSuccessAsync();
|
|
||||||
let actualAddress = await feature.getLiquidityProviderForMarket(token.address, weth.address).callAsync();
|
|
||||||
expect(actualAddress).to.equal(expectedAddress);
|
|
||||||
actualAddress = await feature.getLiquidityProviderForMarket(weth.address, token.address).callAsync();
|
|
||||||
expect(actualAddress).to.equal(expectedAddress);
|
|
||||||
});
|
|
||||||
it('can update a liquidity provider address for a given market', async () => {
|
|
||||||
const expectedAddress = randomAddress();
|
|
||||||
await feature
|
|
||||||
.setLiquidityProviderForMarket(token.address, weth.address, expectedAddress)
|
|
||||||
.awaitTransactionSuccessAsync();
|
|
||||||
let actualAddress = await feature.getLiquidityProviderForMarket(token.address, weth.address).callAsync();
|
|
||||||
expect(actualAddress).to.equal(expectedAddress);
|
|
||||||
actualAddress = await feature.getLiquidityProviderForMarket(weth.address, token.address).callAsync();
|
|
||||||
expect(actualAddress).to.equal(expectedAddress);
|
|
||||||
});
|
|
||||||
it('can effectively remove a liquidity provider for a market by setting the address to 0', async () => {
|
|
||||||
await feature
|
|
||||||
.setLiquidityProviderForMarket(token.address, weth.address, constants.NULL_ADDRESS)
|
|
||||||
.awaitTransactionSuccessAsync();
|
|
||||||
const tx = feature
|
|
||||||
.getLiquidityProviderForMarket(token.address, weth.address)
|
|
||||||
.awaitTransactionSuccessAsync();
|
|
||||||
return expect(tx).to.revertWith(
|
|
||||||
new ZeroExRevertErrors.LiquidityProvider.NoLiquidityProviderForMarketError(token.address, weth.address),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('reverts if non-owner attempts to set an address', async () => {
|
|
||||||
const tx = feature
|
|
||||||
.setLiquidityProviderForMarket(randomAddress(), randomAddress(), randomAddress())
|
|
||||||
.awaitTransactionSuccessAsync({ from: taker });
|
|
||||||
return expect(tx).to.revertWith(new OwnableRevertErrors.OnlyOwnerError(taker, owner));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
blockchainTests.resets('Swap', () => {
|
|
||||||
let liquidityProvider: TestBridgeContract;
|
|
||||||
const ETH_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
||||||
|
|
||||||
before(async () => {
|
liquidityProvider = await TestLiquidityProviderContract.deployFrom0xArtifactAsync(
|
||||||
liquidityProvider = await TestBridgeContract.deployFrom0xArtifactAsync(
|
artifacts.TestLiquidityProvider,
|
||||||
artifacts.TestBridge,
|
|
||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
artifacts,
|
artifacts,
|
||||||
token.address,
|
token.address,
|
||||||
weth.address,
|
weth.address,
|
||||||
);
|
);
|
||||||
await feature
|
|
||||||
.setLiquidityProviderForMarket(token.address, weth.address, liquidityProvider.address)
|
|
||||||
.awaitTransactionSuccessAsync();
|
|
||||||
});
|
});
|
||||||
it('Cannot execute a swap for a market without a liquidity provider set', async () => {
|
blockchainTests.resets('Sandbox', () => {
|
||||||
const [xAsset, yAsset] = [randomAddress(), randomAddress()];
|
it('Cannot call sandbox `executeSellTokenForToken` function directly', async () => {
|
||||||
const tx = feature
|
const tx = sandbox
|
||||||
.sellToLiquidityProvider(
|
.executeSellTokenForToken(
|
||||||
xAsset,
|
liquidityProvider.address,
|
||||||
yAsset,
|
token.address,
|
||||||
constants.NULL_ADDRESS,
|
weth.address,
|
||||||
constants.ONE_ETHER,
|
taker,
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
|
constants.NULL_BYTES,
|
||||||
)
|
)
|
||||||
.awaitTransactionSuccessAsync({ from: taker });
|
.awaitTransactionSuccessAsync({ from: taker });
|
||||||
return expect(tx).to.revertWith(
|
return expect(tx).to.revertWith(new OwnableRevertErrors.OnlyOwnerError(taker));
|
||||||
new ZeroExRevertErrors.LiquidityProvider.NoLiquidityProviderForMarketError(xAsset, yAsset),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
it('Cannot call sandbox `executeSellEthForToken` function directly', async () => {
|
||||||
|
const tx = sandbox
|
||||||
|
.executeSellEthForToken(
|
||||||
|
liquidityProvider.address,
|
||||||
|
token.address,
|
||||||
|
taker,
|
||||||
|
constants.ZERO_AMOUNT,
|
||||||
|
constants.NULL_BYTES,
|
||||||
|
)
|
||||||
|
.awaitTransactionSuccessAsync({ from: taker });
|
||||||
|
return expect(tx).to.revertWith(new OwnableRevertErrors.OnlyOwnerError(taker));
|
||||||
|
});
|
||||||
|
it('Cannot call sandbox `executeSellTokenForEth` function directly', async () => {
|
||||||
|
const tx = sandbox
|
||||||
|
.executeSellTokenForEth(
|
||||||
|
liquidityProvider.address,
|
||||||
|
token.address,
|
||||||
|
taker,
|
||||||
|
constants.ZERO_AMOUNT,
|
||||||
|
constants.NULL_BYTES,
|
||||||
|
)
|
||||||
|
.awaitTransactionSuccessAsync({ from: taker });
|
||||||
|
return expect(tx).to.revertWith(new OwnableRevertErrors.OnlyOwnerError(taker));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
blockchainTests.resets('Swap', () => {
|
||||||
|
const ETH_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||||
|
|
||||||
it('Successfully executes an ERC20-ERC20 swap', async () => {
|
it('Successfully executes an ERC20-ERC20 swap', async () => {
|
||||||
const tx = await feature
|
const tx = await feature
|
||||||
.sellToLiquidityProvider(
|
.sellToLiquidityProvider(
|
||||||
weth.address,
|
|
||||||
token.address,
|
token.address,
|
||||||
|
weth.address,
|
||||||
|
liquidityProvider.address,
|
||||||
constants.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
constants.ONE_ETHER,
|
constants.ONE_ETHER,
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
|
constants.NULL_BYTES,
|
||||||
|
)
|
||||||
|
.awaitTransactionSuccessAsync({ from: taker });
|
||||||
|
verifyEventsFromLogs(
|
||||||
|
tx.logs,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
inputToken: token.address,
|
||||||
|
outputToken: weth.address,
|
||||||
|
recipient: taker,
|
||||||
|
minBuyAmount: constants.ZERO_AMOUNT,
|
||||||
|
inputTokenBalance: constants.ONE_ETHER,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
TestLiquidityProviderEvents.SellTokenForToken,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('Successfully executes an ERC20-ERC20 swap (backwards-compatibility)', async () => {
|
||||||
|
const bridge = await TestBridgeContract.deployFrom0xArtifactAsync(
|
||||||
|
artifacts.TestBridge,
|
||||||
|
env.provider,
|
||||||
|
env.txDefaults,
|
||||||
|
artifacts,
|
||||||
|
weth.address,
|
||||||
|
token.address,
|
||||||
|
);
|
||||||
|
const tx = await feature
|
||||||
|
.sellToLiquidityProvider(
|
||||||
|
token.address,
|
||||||
|
weth.address,
|
||||||
|
bridge.address,
|
||||||
|
constants.NULL_ADDRESS,
|
||||||
|
constants.ONE_ETHER,
|
||||||
|
constants.ZERO_AMOUNT,
|
||||||
|
constants.NULL_BYTES,
|
||||||
)
|
)
|
||||||
.awaitTransactionSuccessAsync({ from: taker });
|
.awaitTransactionSuccessAsync({ from: taker });
|
||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
@@ -153,22 +172,24 @@ blockchainTests('LiquidityProvider feature', env => {
|
|||||||
outputToken: weth.address,
|
outputToken: weth.address,
|
||||||
inputTokenAmount: constants.ONE_ETHER,
|
inputTokenAmount: constants.ONE_ETHER,
|
||||||
outputTokenAmount: constants.ZERO_AMOUNT,
|
outputTokenAmount: constants.ZERO_AMOUNT,
|
||||||
from: constants.NULL_ADDRESS,
|
from: bridge.address,
|
||||||
to: taker,
|
to: taker,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
IERC20BridgeEvents.ERC20BridgeTransfer,
|
TestBridgeEvents.ERC20BridgeTransfer,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Reverts if cannot fulfill the minimum buy amount', async () => {
|
it('Reverts if cannot fulfill the minimum buy amount', async () => {
|
||||||
const minBuyAmount = new BigNumber(1);
|
const minBuyAmount = new BigNumber(1);
|
||||||
const tx = feature
|
const tx = feature
|
||||||
.sellToLiquidityProvider(
|
.sellToLiquidityProvider(
|
||||||
weth.address,
|
|
||||||
token.address,
|
token.address,
|
||||||
|
weth.address,
|
||||||
|
liquidityProvider.address,
|
||||||
constants.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
constants.ONE_ETHER,
|
constants.ONE_ETHER,
|
||||||
minBuyAmount,
|
minBuyAmount,
|
||||||
|
constants.NULL_BYTES,
|
||||||
)
|
)
|
||||||
.awaitTransactionSuccessAsync({ from: taker });
|
.awaitTransactionSuccessAsync({ from: taker });
|
||||||
return expect(tx).to.revertWith(
|
return expect(tx).to.revertWith(
|
||||||
@@ -185,36 +206,38 @@ blockchainTests('LiquidityProvider feature', env => {
|
|||||||
it('Successfully executes an ETH-ERC20 swap', async () => {
|
it('Successfully executes an ETH-ERC20 swap', async () => {
|
||||||
const tx = await feature
|
const tx = await feature
|
||||||
.sellToLiquidityProvider(
|
.sellToLiquidityProvider(
|
||||||
token.address,
|
|
||||||
ETH_TOKEN_ADDRESS,
|
ETH_TOKEN_ADDRESS,
|
||||||
|
token.address,
|
||||||
|
liquidityProvider.address,
|
||||||
constants.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
constants.ONE_ETHER,
|
constants.ONE_ETHER,
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
|
constants.NULL_BYTES,
|
||||||
)
|
)
|
||||||
.awaitTransactionSuccessAsync({ from: taker, value: constants.ONE_ETHER });
|
.awaitTransactionSuccessAsync({ from: taker, value: constants.ONE_ETHER });
|
||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
tx.logs,
|
tx.logs,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
inputToken: weth.address,
|
|
||||||
outputToken: token.address,
|
outputToken: token.address,
|
||||||
inputTokenAmount: constants.ONE_ETHER,
|
recipient: taker,
|
||||||
outputTokenAmount: constants.ZERO_AMOUNT,
|
minBuyAmount: constants.ZERO_AMOUNT,
|
||||||
from: constants.NULL_ADDRESS,
|
ethBalance: constants.ONE_ETHER,
|
||||||
to: taker,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
IERC20BridgeEvents.ERC20BridgeTransfer,
|
TestLiquidityProviderEvents.SellEthForToken,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Successfully executes an ERC20-ETH swap', async () => {
|
it('Successfully executes an ERC20-ETH swap', async () => {
|
||||||
const tx = await feature
|
const tx = await feature
|
||||||
.sellToLiquidityProvider(
|
.sellToLiquidityProvider(
|
||||||
ETH_TOKEN_ADDRESS,
|
|
||||||
token.address,
|
token.address,
|
||||||
|
ETH_TOKEN_ADDRESS,
|
||||||
|
liquidityProvider.address,
|
||||||
constants.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
constants.ONE_ETHER,
|
constants.ONE_ETHER,
|
||||||
constants.ZERO_AMOUNT,
|
constants.ZERO_AMOUNT,
|
||||||
|
constants.NULL_BYTES,
|
||||||
)
|
)
|
||||||
.awaitTransactionSuccessAsync({ from: taker });
|
.awaitTransactionSuccessAsync({ from: taker });
|
||||||
verifyEventsFromLogs(
|
verifyEventsFromLogs(
|
||||||
@@ -222,14 +245,12 @@ blockchainTests('LiquidityProvider feature', env => {
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
inputToken: token.address,
|
inputToken: token.address,
|
||||||
outputToken: weth.address,
|
recipient: taker,
|
||||||
inputTokenAmount: constants.ONE_ETHER,
|
minBuyAmount: constants.ZERO_AMOUNT,
|
||||||
outputTokenAmount: constants.ZERO_AMOUNT,
|
inputTokenBalance: constants.ONE_ETHER,
|
||||||
from: constants.NULL_ADDRESS,
|
|
||||||
to: zeroEx.address,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
IERC20BridgeEvents.ERC20BridgeTransfer,
|
TestLiquidityProviderEvents.SellTokenForEth,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -66,7 +66,7 @@ blockchainTests.resets('SimpleFunctionRegistry feature', env => {
|
|||||||
|
|
||||||
it('`rollback()` to zero impl succeeds for unregistered function', async () => {
|
it('`rollback()` to zero impl succeeds for unregistered function', async () => {
|
||||||
await registry.rollback(testFnSelector, NULL_ADDRESS).awaitTransactionSuccessAsync();
|
await registry.rollback(testFnSelector, NULL_ADDRESS).awaitTransactionSuccessAsync();
|
||||||
const impl = await zeroEx.getFunctionImplementation(testFnSelector).callAsync();
|
const impl = await registry.getFunctionImplementation(testFnSelector).callAsync();
|
||||||
expect(impl).to.eq(NULL_ADDRESS);
|
expect(impl).to.eq(NULL_ADDRESS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ import {
|
|||||||
IMetaTransactionsFeatureContract,
|
IMetaTransactionsFeatureContract,
|
||||||
IOwnableFeatureContract,
|
IOwnableFeatureContract,
|
||||||
ISignatureValidatorFeatureContract,
|
ISignatureValidatorFeatureContract,
|
||||||
|
ISimpleFunctionRegistryFeatureContract,
|
||||||
ITokenSpenderFeatureContract,
|
ITokenSpenderFeatureContract,
|
||||||
ITransformERC20FeatureContract,
|
ITransformERC20FeatureContract,
|
||||||
TestFullMigrationContract,
|
TestFullMigrationContract,
|
||||||
@@ -25,6 +26,7 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
let zeroEx: ZeroExContract;
|
let zeroEx: ZeroExContract;
|
||||||
let features: FullFeatures;
|
let features: FullFeatures;
|
||||||
let migrator: TestFullMigrationContract;
|
let migrator: TestFullMigrationContract;
|
||||||
|
let registry: ISimpleFunctionRegistryFeatureContract;
|
||||||
const transformerDeployer = randomAddress();
|
const transformerDeployer = randomAddress();
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
@@ -47,6 +49,7 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
await migrator
|
await migrator
|
||||||
.initializeZeroEx(owner, zeroEx.address, features, { transformerDeployer })
|
.initializeZeroEx(owner, zeroEx.address, features, { transformerDeployer })
|
||||||
.awaitTransactionSuccessAsync();
|
.awaitTransactionSuccessAsync();
|
||||||
|
registry = new ISimpleFunctionRegistryFeatureContract(zeroEx.address, env.provider, env.txDefaults);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ZeroEx has the correct owner', async () => {
|
it('ZeroEx has the correct owner', async () => {
|
||||||
@@ -157,7 +160,7 @@ blockchainTests.resets('Full migration', env => {
|
|||||||
for (const fn of featureInfo.fns) {
|
for (const fn of featureInfo.fns) {
|
||||||
it(`${fn} is registered`, async () => {
|
it(`${fn} is registered`, async () => {
|
||||||
const selector = contract.getSelector(fn);
|
const selector = contract.getSelector(fn);
|
||||||
const impl = await zeroEx.getFunctionImplementation(selector).callAsync();
|
const impl = await registry.getFunctionImplementation(selector).callAsync();
|
||||||
expect(impl).to.not.eq(NULL_ADDRESS);
|
expect(impl).to.not.eq(NULL_ADDRESS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
98
contracts/zero-ex/test/lib_signature_test.ts
Normal file
98
contracts/zero-ex/test/lib_signature_test.ts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import { blockchainTests, expect } from '@0x/contracts-test-utils';
|
||||||
|
import { hexUtils } from '@0x/utils';
|
||||||
|
import * as ethjs from 'ethereumjs-util';
|
||||||
|
|
||||||
|
import { SignatureValidationError, SignatureValidationErrorCodes } from '../src/revert_errors';
|
||||||
|
import { eip712SignHashWithKey, ethSignHashWithKey, SignatureType } from '../src/signature_utils';
|
||||||
|
|
||||||
|
import { artifacts } from './artifacts';
|
||||||
|
import { TestLibSignatureContract } from './wrappers';
|
||||||
|
|
||||||
|
const EMPTY_REVERT = 'reverted with no data';
|
||||||
|
|
||||||
|
blockchainTests.resets('LibSignature library', env => {
|
||||||
|
let testLib: TestLibSignatureContract;
|
||||||
|
let signerKey: string;
|
||||||
|
let signer: string;
|
||||||
|
|
||||||
|
before(async () => {
|
||||||
|
signerKey = hexUtils.random();
|
||||||
|
signer = ethjs.bufferToHex(ethjs.privateToAddress(ethjs.toBuffer(signerKey)));
|
||||||
|
testLib = await TestLibSignatureContract.deployFrom0xArtifactAsync(
|
||||||
|
artifacts.TestLibSignature,
|
||||||
|
env.provider,
|
||||||
|
env.txDefaults,
|
||||||
|
artifacts,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getSignerOfHash()', () => {
|
||||||
|
it('can recover the signer of an EIP712 signature', async () => {
|
||||||
|
const hash = hexUtils.random();
|
||||||
|
const sig = eip712SignHashWithKey(hash, signerKey);
|
||||||
|
const recovered = await testLib.getSignerOfHash(hash, sig).callAsync();
|
||||||
|
expect(recovered).to.eq(signer);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can recover the signer of an EthSign signature', async () => {
|
||||||
|
const hash = hexUtils.random();
|
||||||
|
const sig = ethSignHashWithKey(hash, signerKey);
|
||||||
|
const recovered = await testLib.getSignerOfHash(hash, sig).callAsync();
|
||||||
|
expect(recovered).to.eq(signer);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if the signature type is out of range', async () => {
|
||||||
|
const hash = hexUtils.random();
|
||||||
|
const badType = (Object.values(SignatureType).slice(-1)[0] as number) + 1;
|
||||||
|
const sig = {
|
||||||
|
...ethSignHashWithKey(hash, signerKey),
|
||||||
|
signatureType: badType,
|
||||||
|
};
|
||||||
|
return expect(testLib.getSignerOfHash(hash, sig).callAsync()).to.be.rejectedWith(EMPTY_REVERT);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if the signature data is malformed', async () => {
|
||||||
|
const hash = hexUtils.random();
|
||||||
|
const sig = {
|
||||||
|
...ethSignHashWithKey(hash, signerKey),
|
||||||
|
v: 1,
|
||||||
|
};
|
||||||
|
return expect(testLib.getSignerOfHash(hash, sig).callAsync()).to.revertWith(
|
||||||
|
new SignatureValidationError(SignatureValidationErrorCodes.BadSignatureData, hash),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if an EC value is out of range', async () => {
|
||||||
|
const hash = hexUtils.random();
|
||||||
|
const sig = {
|
||||||
|
...ethSignHashWithKey(hash, signerKey),
|
||||||
|
r: '0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141',
|
||||||
|
};
|
||||||
|
return expect(testLib.getSignerOfHash(hash, sig).callAsync()).to.revertWith(
|
||||||
|
new SignatureValidationError(SignatureValidationErrorCodes.BadSignatureData, hash),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if the type is Illegal', async () => {
|
||||||
|
const hash = hexUtils.random();
|
||||||
|
const sig = {
|
||||||
|
...ethSignHashWithKey(hash, signerKey),
|
||||||
|
signatureType: SignatureType.Illegal,
|
||||||
|
};
|
||||||
|
return expect(testLib.getSignerOfHash(hash, sig).callAsync()).to.revertWith(
|
||||||
|
new SignatureValidationError(SignatureValidationErrorCodes.Illegal, hash),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws if the type is Invalid', async () => {
|
||||||
|
const hash = hexUtils.random();
|
||||||
|
const sig = {
|
||||||
|
...ethSignHashWithKey(hash, signerKey),
|
||||||
|
signatureType: SignatureType.Invalid,
|
||||||
|
};
|
||||||
|
return expect(testLib.getSignerOfHash(hash, sig).callAsync()).to.revertWith(
|
||||||
|
new SignatureValidationError(SignatureValidationErrorCodes.AlwaysInvalid, hash),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user