Compare commits
11 Commits
@0x/contra
...
@0x/contra
Author | SHA1 | Date | |
---|---|---|---|
|
03ecc530c3 | ||
|
d52b1d24d0 | ||
|
5083fab06a | ||
|
1249bf9ccc | ||
|
681f6b3f07 | ||
|
d3ca1fe96b | ||
|
9e4f5815e4 | ||
|
c3c27eaedc | ||
|
4bf6a23d23 | ||
|
aaaf0d02de | ||
|
825cc4d035 |
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "3.7.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "3.7.2",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.7.3 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.7.2 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-asset-proxy",
|
||||
"version": "3.7.2",
|
||||
"version": "3.7.3",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,10 +52,10 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contract-wrappers": "^13.11.2",
|
||||
"@0x/contract-wrappers": "^13.12.0",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
@@ -80,11 +80,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-erc1155": "^2.1.20",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc721": "^3.1.20",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/contracts-erc1155": "^2.1.21",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-erc721": "^3.1.21",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.1.1",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "1.1.21",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "1.1.20",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.1.21 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.1.20 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-broker",
|
||||
"version": "1.1.20",
|
||||
"version": "1.1.21",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,14 +52,14 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc721": "^3.1.20",
|
||||
"@0x/contracts-exchange": "^3.2.21",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-erc721": "^3.1.21",
|
||||
"@0x/contracts-exchange": "^3.2.22",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
@@ -85,7 +85,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.1.1",
|
||||
"ethereum-types": "^3.4.0"
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "3.1.22",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "3.1.21",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.22 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.21 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-coordinator",
|
||||
"version": "3.1.21",
|
||||
"version": "3.1.22",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -53,12 +53,12 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-dev-utils": "^1.3.19",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-dev-utils": "^1.3.20",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
@@ -85,9 +85,9 @@
|
||||
"@0x/assert": "^3.0.19",
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/contracts-exchange": "^3.2.21",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-exchange": "^3.2.22",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/json-schemas": "^5.3.4",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "1.3.20",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "1.3.19",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.3.20 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.3.19 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-dev-utils",
|
||||
"version": "1.3.19",
|
||||
"version": "1.3.20",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -43,10 +43,10 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/assert": "^3.0.19",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "2.1.21",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "2.1.20",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.21 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.20 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc1155",
|
||||
"version": "2.1.20",
|
||||
"version": "2.1.21",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -54,7 +54,7 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
@@ -81,7 +81,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/utils": "^6.1.1",
|
||||
"@0x/web3-wrapper": "^7.3.0",
|
||||
"lodash": "^4.17.11"
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "3.3.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Allow for excess return data in `LibERC20TokenV06` compat* functions",
|
||||
"pr": 97
|
||||
}
|
||||
],
|
||||
"timestamp": 1609802516
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "3.2.14",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.3.0 - _January 4, 2021_
|
||||
|
||||
* Allow for excess return data in `LibERC20TokenV06` compat* functions (#97)
|
||||
|
||||
## v3.2.14 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -118,7 +118,7 @@ library LibERC20TokenV06 {
|
||||
{
|
||||
tokenDecimals = 18;
|
||||
(bool didSucceed, bytes memory resultData) = address(token).staticcall(DECIMALS_CALL_DATA);
|
||||
if (didSucceed && resultData.length == 32) {
|
||||
if (didSucceed && resultData.length >= 32) {
|
||||
tokenDecimals = uint8(LibBytesV06.readUint256(resultData, 0));
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ library LibERC20TokenV06 {
|
||||
spender
|
||||
)
|
||||
);
|
||||
if (didSucceed && resultData.length == 32) {
|
||||
if (didSucceed && resultData.length >= 32) {
|
||||
allowance_ = LibBytesV06.readUint256(resultData, 0);
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ library LibERC20TokenV06 {
|
||||
owner
|
||||
)
|
||||
);
|
||||
if (didSucceed && resultData.length == 32) {
|
||||
if (didSucceed && resultData.length >= 32) {
|
||||
balance = LibBytesV06.readUint256(resultData, 0);
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ library LibERC20TokenV06 {
|
||||
if (resultData.length == 0) {
|
||||
return true;
|
||||
}
|
||||
if (resultData.length == 32) {
|
||||
if (resultData.length >= 32) {
|
||||
uint256 result = LibBytesV06.readUint256(resultData, 0);
|
||||
if (result == 1) {
|
||||
return true;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "3.2.14",
|
||||
"version": "3.3.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -53,8 +53,8 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "3.1.21",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "3.1.20",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.1.21 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.1.20 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc721",
|
||||
"version": "3.1.20",
|
||||
"version": "3.1.21",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -54,8 +54,8 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "4.2.22",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "4.2.21",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.2.22 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.2.21 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange-forwarder",
|
||||
"version": "4.2.21",
|
||||
"version": "4.2.22",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -53,18 +53,18 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-dev-utils": "^1.3.19",
|
||||
"@0x/contracts-erc1155": "^2.1.20",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc721": "^3.1.20",
|
||||
"@0x/contracts-exchange": "^3.2.21",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-dev-utils": "^1.3.20",
|
||||
"@0x/contracts-erc1155": "^2.1.21",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-erc721": "^3.1.21",
|
||||
"@0x/contracts-exchange": "^3.2.22",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "4.3.21",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "4.3.20",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.3.21 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.3.20 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange-libs",
|
||||
"version": "4.3.20",
|
||||
"version": "4.3.21",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -81,9 +81,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.1.1",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "3.2.22",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "3.2.21",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.2.22 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.2.21 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange",
|
||||
"version": "3.2.21",
|
||||
"version": "3.2.22",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -53,13 +53,13 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-multisig": "^4.1.21",
|
||||
"@0x/contracts-staking": "^2.0.28",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-multisig": "^4.1.22",
|
||||
"@0x/contracts-staking": "^2.0.29",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
@@ -89,11 +89,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-dev-utils": "^1.3.19",
|
||||
"@0x/contracts-erc1155": "^2.1.20",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc721": "^3.1.20",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/contracts-dev-utils": "^1.3.20",
|
||||
"@0x/contracts-erc1155": "^2.1.21",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-erc721": "^3.1.21",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/utils": "^6.1.1",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "6.2.16",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "6.2.15",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.2.16 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.2.15 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-extensions",
|
||||
"version": "6.2.15",
|
||||
"version": "6.2.16",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -53,16 +53,16 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-dev-utils": "^1.3.19",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc721": "^3.1.20",
|
||||
"@0x/contracts-exchange": "^3.2.21",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-dev-utils": "^1.3.20",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-erc721": "^3.1.21",
|
||||
"@0x/contracts-exchange": "^3.2.22",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
@@ -91,7 +91,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"ethereum-types": "^3.4.0"
|
||||
},
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-integrations",
|
||||
"version": "2.7.19",
|
||||
"version": "2.7.22",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
@@ -54,20 +54,20 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/contract-wrappers": "^13.11.2",
|
||||
"@0x/contracts-broker": "^1.1.20",
|
||||
"@0x/contracts-coordinator": "^3.1.21",
|
||||
"@0x/contracts-dev-utils": "^1.3.19",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.21",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/contracts-extensions": "^6.2.15",
|
||||
"@0x/contract-wrappers": "^13.12.0",
|
||||
"@0x/contracts-broker": "^1.1.21",
|
||||
"@0x/contracts-coordinator": "^3.1.22",
|
||||
"@0x/contracts-dev-utils": "^1.3.20",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.22",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/contracts-extensions": "^6.2.16",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/coordinator-server": "^1.0.5",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/migrations": "^6.5.8",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/protocol-utils": "^1.1.2",
|
||||
"@0x/migrations": "^6.5.9",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/protocol-utils": "^1.1.3",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/web3-wrapper": "^7.3.0",
|
||||
@@ -93,17 +93,17 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/asset-swapper": "^5.5.3",
|
||||
"@0x/asset-swapper": "^5.6.2",
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-erc1155": "^2.1.20",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc721": "^3.1.20",
|
||||
"@0x/contracts-exchange": "^3.2.21",
|
||||
"@0x/contracts-multisig": "^4.1.21",
|
||||
"@0x/contracts-staking": "^2.0.28",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-zero-ex": "^0.16.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-erc1155": "^2.1.21",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-erc721": "^3.1.21",
|
||||
"@0x/contracts-exchange": "^3.2.22",
|
||||
"@0x/contracts-multisig": "^4.1.22",
|
||||
"@0x/contracts-staking": "^2.0.29",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-zero-ex": "^0.17.0",
|
||||
"@0x/subproviders": "^6.2.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "4.1.22",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "4.1.21",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.1.22 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.1.21 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-multisig",
|
||||
"version": "4.1.21",
|
||||
"version": "4.1.22",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -50,11 +50,11 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "2.0.29",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "2.0.28",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.0.29 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.0.28 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-staking",
|
||||
"version": "2.0.28",
|
||||
"version": "2.0.29",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -54,14 +54,14 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-dev-utils": "^1.3.19",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-dev-utils": "^1.3.20",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
@@ -88,7 +88,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
"@0x/utils": "^6.1.1",
|
||||
"ethereum-types": "^3.4.0",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "5.3.18",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "5.3.17",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.3.18 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.3.17 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "5.3.17",
|
||||
"version": "5.3.18",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -47,7 +47,7 @@
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/json-schemas": "^5.3.4",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/sol-coverage": "^4.0.24",
|
||||
"@0x/sol-profiler": "^4.1.14",
|
||||
"@0x/sol-trace": "^3.0.24",
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "4.7.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add `LibSafeMathV06.safeDowncastToUint128()`",
|
||||
"pr": 97
|
||||
}
|
||||
],
|
||||
"timestamp": 1609802516
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "4.6.5",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.7.0 - _January 4, 2021_
|
||||
|
||||
* Add `LibSafeMathV06.safeDowncastToUint128()` (#97)
|
||||
|
||||
## v4.6.5 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -187,4 +187,18 @@ library LibSafeMathV06 {
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
function safeDowncastToUint128(uint256 a)
|
||||
internal
|
||||
pure
|
||||
returns (uint128)
|
||||
{
|
||||
if (a > type(uint128).max) {
|
||||
LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256DowncastError(
|
||||
LibSafeMathRichErrorsV06.DowncastErrorCodes.VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128,
|
||||
a
|
||||
));
|
||||
}
|
||||
return uint128(a);
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,8 @@ library LibSafeMathRichErrorsV06 {
|
||||
enum DowncastErrorCodes {
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT32,
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT64,
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96,
|
||||
VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128
|
||||
}
|
||||
|
||||
// solhint-disable func-name-mixedcase
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "4.6.5",
|
||||
"version": "4.7.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,9 +52,9 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "0.17.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add DevUtils-like functions to `NativeOrdersFeature`",
|
||||
"pr": 97
|
||||
}
|
||||
],
|
||||
"timestamp": 1609802516
|
||||
},
|
||||
{
|
||||
"version": "0.16.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.17.0 - _January 4, 2021_
|
||||
|
||||
* Add DevUtils-like functions to `NativeOrdersFeature` (#97)
|
||||
|
||||
## v0.16.0 - _December 23, 2020_
|
||||
|
||||
* Fix CryptoCom rollup
|
||||
|
@@ -346,4 +346,81 @@ interface INativeOrdersFeature {
|
||||
view
|
||||
returns (uint32 multiplier);
|
||||
|
||||
/// @dev Get order info, fillable amount, and signature validity for a limit order.
|
||||
/// Fillable amount is determined using balances and allowances of the maker.
|
||||
/// @param order The limit order.
|
||||
/// @param signature The order signature.
|
||||
/// @return orderInfo Info about the order.
|
||||
/// @return actualFillableTakerTokenAmount How much of the order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValid Whether the signature is valid.
|
||||
function getLimitOrderRelevantState(
|
||||
LibNativeOrder.LimitOrder calldata order,
|
||||
LibSignature.Signature calldata signature
|
||||
)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo memory orderInfo,
|
||||
uint128 actualFillableTakerTokenAmount,
|
||||
bool isSignatureValid
|
||||
);
|
||||
|
||||
/// @dev Get order info, fillable amount, and signature validity for an RFQ order.
|
||||
/// Fillable amount is determined using balances and allowances of the maker.
|
||||
/// @param order The RFQ order.
|
||||
/// @param signature The order signature.
|
||||
/// @return orderInfo Info about the order.
|
||||
/// @return actualFillableTakerTokenAmount How much of the order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValid Whether the signature is valid.
|
||||
function getRfqOrderRelevantState(
|
||||
LibNativeOrder.RfqOrder calldata order,
|
||||
LibSignature.Signature calldata signature
|
||||
)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo memory orderInfo,
|
||||
uint128 actualFillableTakerTokenAmount,
|
||||
bool isSignatureValid
|
||||
);
|
||||
|
||||
/// @dev Batch version of `getLimitOrderRelevantState()`.
|
||||
/// @param orders The limit orders.
|
||||
/// @param signatures The order signatures.
|
||||
/// @return orderInfos Info about the orders.
|
||||
/// @return actualFillableTakerTokenAmounts How much of each order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValids Whether each signature is valid for the order.
|
||||
function batchGetLimitOrderRelevantStates(
|
||||
LibNativeOrder.LimitOrder[] calldata orders,
|
||||
LibSignature.Signature[] calldata signatures
|
||||
)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo[] memory orderInfos,
|
||||
uint128[] memory actualFillableTakerTokenAmounts,
|
||||
bool[] memory isSignatureValids
|
||||
);
|
||||
|
||||
/// @dev Batch version of `getRfqOrderRelevantState()`.
|
||||
/// @param orders The RFQ orders.
|
||||
/// @param signatures The order signatures.
|
||||
/// @return orderInfos Info about the orders.
|
||||
/// @return actualFillableTakerTokenAmounts How much of each order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValids Whether each signature is valid for the order.
|
||||
function batchGetRfqOrderRelevantStates(
|
||||
LibNativeOrder.RfqOrder[] calldata orders,
|
||||
LibSignature.Signature[] calldata signatures
|
||||
)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo[] memory orderInfos,
|
||||
uint128[] memory actualFillableTakerTokenAmounts,
|
||||
bool[] memory isSignatureValids
|
||||
);
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@ contract NativeOrdersFeature is
|
||||
using LibSafeMathV06 for uint256;
|
||||
using LibSafeMathV06 for uint128;
|
||||
using LibRichErrorsV06 for bytes;
|
||||
using LibERC20TokenV06 for IERC20TokenV06;
|
||||
|
||||
/// @dev Params for `_settleOrder()`.
|
||||
struct SettleOrderInfo {
|
||||
@@ -97,6 +98,15 @@ contract NativeOrdersFeature is
|
||||
uint128 takerTokenFeeFilledAmount;
|
||||
}
|
||||
|
||||
// @dev Params for `_getActualFillableTakerTokenAmount()`.
|
||||
struct GetActualFillableTakerTokenAmountParams {
|
||||
address maker;
|
||||
IERC20TokenV06 makerToken;
|
||||
uint128 orderMakerAmount;
|
||||
uint128 orderTakerAmount;
|
||||
LibNativeOrder.OrderInfo orderInfo;
|
||||
}
|
||||
|
||||
/// @dev Name of this feature.
|
||||
string public constant override FEATURE_NAME = "LimitOrders";
|
||||
/// @dev Version of this feature.
|
||||
@@ -148,6 +158,10 @@ contract NativeOrdersFeature is
|
||||
_registerFeatureFunction(this.getRfqOrderHash.selector);
|
||||
_registerFeatureFunction(this.getProtocolFeeMultiplier.selector);
|
||||
_registerFeatureFunction(this.registerAllowedRfqOrigins.selector);
|
||||
_registerFeatureFunction(this.getLimitOrderRelevantState.selector);
|
||||
_registerFeatureFunction(this.getRfqOrderRelevantState.selector);
|
||||
_registerFeatureFunction(this.batchGetLimitOrderRelevantStates.selector);
|
||||
_registerFeatureFunction(this.batchGetRfqOrderRelevantStates.selector);
|
||||
return LibMigrate.MIGRATE_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -687,6 +701,148 @@ contract NativeOrdersFeature is
|
||||
);
|
||||
}
|
||||
|
||||
/// @dev Get order info, fillable amount, and signature validity for a limit order.
|
||||
/// Fillable amount is determined using balances and allowances of the maker.
|
||||
/// @param order The limit order.
|
||||
/// @param signature The order signature.
|
||||
/// @return orderInfo Info about the order.
|
||||
/// @return actualFillableTakerTokenAmount How much of the order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValid Whether the signature is valid.
|
||||
function getLimitOrderRelevantState(
|
||||
LibNativeOrder.LimitOrder memory order,
|
||||
LibSignature.Signature calldata signature
|
||||
)
|
||||
public
|
||||
override
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo memory orderInfo,
|
||||
uint128 actualFillableTakerTokenAmount,
|
||||
bool isSignatureValid
|
||||
)
|
||||
{
|
||||
orderInfo = getLimitOrderInfo(order);
|
||||
actualFillableTakerTokenAmount = _getActualFillableTakerTokenAmount(
|
||||
GetActualFillableTakerTokenAmountParams({
|
||||
maker: order.maker,
|
||||
makerToken: order.makerToken,
|
||||
orderMakerAmount: order.makerAmount,
|
||||
orderTakerAmount: order.takerAmount,
|
||||
orderInfo: orderInfo
|
||||
})
|
||||
);
|
||||
isSignatureValid = order.maker ==
|
||||
LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
|
||||
}
|
||||
|
||||
/// @dev Get order info, fillable amount, and signature validity for an RFQ order.
|
||||
/// Fillable amount is determined using balances and allowances of the maker.
|
||||
/// @param order The RFQ order.
|
||||
/// @param signature The order signature.
|
||||
/// @return orderInfo Info about the order.
|
||||
/// @return actualFillableTakerTokenAmount How much of the order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValid Whether the signature is valid.
|
||||
function getRfqOrderRelevantState(
|
||||
LibNativeOrder.RfqOrder memory order,
|
||||
LibSignature.Signature memory signature
|
||||
)
|
||||
public
|
||||
override
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo memory orderInfo,
|
||||
uint128 actualFillableTakerTokenAmount,
|
||||
bool isSignatureValid
|
||||
)
|
||||
{
|
||||
orderInfo = getRfqOrderInfo(order);
|
||||
actualFillableTakerTokenAmount = _getActualFillableTakerTokenAmount(
|
||||
GetActualFillableTakerTokenAmountParams({
|
||||
maker: order.maker,
|
||||
makerToken: order.makerToken,
|
||||
orderMakerAmount: order.makerAmount,
|
||||
orderTakerAmount: order.takerAmount,
|
||||
orderInfo: orderInfo
|
||||
})
|
||||
);
|
||||
isSignatureValid = order.maker ==
|
||||
LibSignature.getSignerOfHash(orderInfo.orderHash, signature);
|
||||
}
|
||||
|
||||
/// @dev Batch version of `getLimitOrderRelevantState()`.
|
||||
/// @param orders The limit orders.
|
||||
/// @param signatures The order signatures.
|
||||
/// @return orderInfos Info about the orders.
|
||||
/// @return actualFillableTakerTokenAmounts How much of each order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValids Whether each signature is valid for the order.
|
||||
function batchGetLimitOrderRelevantStates(
|
||||
LibNativeOrder.LimitOrder[] calldata orders,
|
||||
LibSignature.Signature[] calldata signatures
|
||||
)
|
||||
external
|
||||
override
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo[] memory orderInfos,
|
||||
uint128[] memory actualFillableTakerTokenAmounts,
|
||||
bool[] memory isSignatureValids
|
||||
)
|
||||
{
|
||||
require(
|
||||
orders.length == signatures.length,
|
||||
"NativeOrdersFeature/MISMATCHED_ARRAY_LENGTHS"
|
||||
);
|
||||
orderInfos = new LibNativeOrder.OrderInfo[](orders.length);
|
||||
actualFillableTakerTokenAmounts = new uint128[](orders.length);
|
||||
isSignatureValids = new bool[](orders.length);
|
||||
for (uint256 i = 0; i < orders.length; ++i) {
|
||||
(
|
||||
orderInfos[i],
|
||||
actualFillableTakerTokenAmounts[i],
|
||||
isSignatureValids[i]
|
||||
) = getLimitOrderRelevantState(orders[i], signatures[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Batch version of `getRfqOrderRelevantState()`.
|
||||
/// @param orders The RFQ orders.
|
||||
/// @param signatures The order signatures.
|
||||
/// @return orderInfos Info about the orders.
|
||||
/// @return actualFillableTakerTokenAmounts How much of each order is fillable
|
||||
/// based on maker funds, in taker tokens.
|
||||
/// @return isSignatureValids Whether each signature is valid for the order.
|
||||
function batchGetRfqOrderRelevantStates(
|
||||
LibNativeOrder.RfqOrder[] calldata orders,
|
||||
LibSignature.Signature[] calldata signatures
|
||||
)
|
||||
external
|
||||
override
|
||||
view
|
||||
returns (
|
||||
LibNativeOrder.OrderInfo[] memory orderInfos,
|
||||
uint128[] memory actualFillableTakerTokenAmounts,
|
||||
bool[] memory isSignatureValids
|
||||
)
|
||||
{
|
||||
require(
|
||||
orders.length == signatures.length,
|
||||
"NativeOrdersFeature/MISMATCHED_ARRAY_LENGTHS"
|
||||
);
|
||||
orderInfos = new LibNativeOrder.OrderInfo[](orders.length);
|
||||
actualFillableTakerTokenAmounts = new uint128[](orders.length);
|
||||
isSignatureValids = new bool[](orders.length);
|
||||
for (uint256 i = 0; i < orders.length; ++i) {
|
||||
(
|
||||
orderInfos[i],
|
||||
actualFillableTakerTokenAmounts[i],
|
||||
isSignatureValids[i]
|
||||
) = getRfqOrderRelevantState(orders[i], signatures[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Get the protocol fee multiplier. This should be multiplied by the
|
||||
/// gas price to arrive at the required protocol fee to fill a native order.
|
||||
/// @return multiplier The protocol fee multiplier.
|
||||
@@ -751,6 +907,48 @@ contract NativeOrdersFeature is
|
||||
orderInfo.status = LibNativeOrder.OrderStatus.FILLABLE;
|
||||
}
|
||||
|
||||
/// @dev Calculate the actual fillable taker token amount of an order
|
||||
/// based on maker allowance and balances.
|
||||
function _getActualFillableTakerTokenAmount(
|
||||
GetActualFillableTakerTokenAmountParams memory params
|
||||
)
|
||||
private
|
||||
view
|
||||
returns (uint128 actualFillableTakerTokenAmount)
|
||||
{
|
||||
if (params.orderMakerAmount == 0 || params.orderTakerAmount == 0) {
|
||||
// Empty order.
|
||||
return 0;
|
||||
}
|
||||
if (params.orderInfo.status != LibNativeOrder.OrderStatus.FILLABLE) {
|
||||
// Not fillable.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get the fillable maker amount based on the order quantities and
|
||||
// previously filled amount
|
||||
uint256 fillableMakerTokenAmount = LibMathV06.getPartialAmountFloor(
|
||||
uint256(
|
||||
params.orderTakerAmount
|
||||
- params.orderInfo.takerTokenFilledAmount
|
||||
),
|
||||
uint256(params.orderTakerAmount),
|
||||
uint256(params.orderMakerAmount)
|
||||
);
|
||||
// Clamp it to the amount of maker tokens we can spend on behalf of the
|
||||
// maker.
|
||||
fillableMakerTokenAmount = LibSafeMathV06.min256(
|
||||
fillableMakerTokenAmount,
|
||||
_getSpendableERC20BalanceOf(params.makerToken, params.maker)
|
||||
);
|
||||
// Convert to taker token amount.
|
||||
return LibMathV06.getPartialAmountCeil(
|
||||
fillableMakerTokenAmount,
|
||||
uint256(params.orderMakerAmount),
|
||||
uint256(params.orderTakerAmount)
|
||||
).safeDowncastToUint128();
|
||||
}
|
||||
|
||||
/// @dev Cancel a limit or RFQ order directly by its order hash.
|
||||
/// @param orderHash The order's order hash.
|
||||
/// @param maker The order's maker.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.16.0",
|
||||
"version": "0.17.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -57,11 +57,11 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.4.13",
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
@@ -83,7 +83,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/protocol-utils": "^1.1.2",
|
||||
"@0x/protocol-utils": "^1.1.3",
|
||||
"@0x/subproviders": "^6.2.3",
|
||||
"@0x/types": "^3.3.1",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
|
@@ -1366,14 +1366,332 @@ blockchainTests.resets('NativeOrdersFeature', env => {
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('RFQ gas benchmark', async () => {
|
||||
const orders = [...new Array(2)].map(() =>
|
||||
getTestRfqOrder({ pool: '0x0000000000000000000000000000000000000000000000000000000000000000' }),
|
||||
);
|
||||
// Fill one to warm up the fee pool.
|
||||
await fillRfqOrderAsync(orders[0]);
|
||||
const receipt = await fillRfqOrderAsync(orders[1]);
|
||||
// tslint:disable-next-line: no-console
|
||||
console.log(receipt.gasUsed);
|
||||
async function fundOrderMakerAsync(
|
||||
order: LimitOrder | RfqOrder,
|
||||
balance: BigNumber = order.makerAmount,
|
||||
allowance: BigNumber = order.makerAmount,
|
||||
): Promise<void> {
|
||||
await makerToken.burn(maker, await makerToken.balanceOf(maker).callAsync()).awaitTransactionSuccessAsync();
|
||||
await makerToken.mint(maker, balance).awaitTransactionSuccessAsync();
|
||||
await makerToken.approve(zeroEx.address, allowance).awaitTransactionSuccessAsync({ from: maker });
|
||||
}
|
||||
|
||||
function getFillableMakerTokenAmount(
|
||||
order: LimitOrder | RfqOrder,
|
||||
takerTokenFilledAmount: BigNumber = ZERO_AMOUNT,
|
||||
): BigNumber {
|
||||
return order.takerAmount
|
||||
.minus(takerTokenFilledAmount)
|
||||
.times(order.makerAmount)
|
||||
.div(order.takerAmount)
|
||||
.integerValue(BigNumber.ROUND_DOWN);
|
||||
}
|
||||
|
||||
function getActualFillableTakerTokenAmount(
|
||||
order: LimitOrder | RfqOrder,
|
||||
makerBalance: BigNumber = order.makerAmount,
|
||||
makerAllowance: BigNumber = order.makerAmount,
|
||||
takerTokenFilledAmount: BigNumber = ZERO_AMOUNT,
|
||||
): BigNumber {
|
||||
const fillableMakerTokenAmount = getFillableMakerTokenAmount(order, takerTokenFilledAmount);
|
||||
return BigNumber.min(fillableMakerTokenAmount, makerBalance, makerAllowance)
|
||||
.times(order.takerAmount)
|
||||
.div(order.makerAmount)
|
||||
.integerValue(BigNumber.ROUND_UP);
|
||||
}
|
||||
|
||||
function getRandomFraction(precision: number = 2): string {
|
||||
return Math.random().toPrecision(precision);
|
||||
}
|
||||
|
||||
describe('getLimitOrderRelevantState()', () => {
|
||||
it('works with an empty order', async () => {
|
||||
const order = getTestLimitOrder({
|
||||
takerAmount: ZERO_AMOUNT,
|
||||
});
|
||||
await fundOrderMakerAsync(order);
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getLimitOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Filled,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(0);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with cancelled order', async () => {
|
||||
const order = getTestLimitOrder();
|
||||
await fundOrderMakerAsync(order);
|
||||
await zeroEx.cancelLimitOrder(order).awaitTransactionSuccessAsync({ from: maker });
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getLimitOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Cancelled,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(0);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with a bad signature', async () => {
|
||||
const order = getTestLimitOrder();
|
||||
await fundOrderMakerAsync(order);
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getLimitOrderRelevantState(
|
||||
order,
|
||||
await order.clone({ maker: notMaker }).getSignatureWithProviderAsync(env.provider),
|
||||
)
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(order.takerAmount);
|
||||
expect(isSignatureValid).to.eq(false);
|
||||
});
|
||||
|
||||
it('works with an unfilled order', async () => {
|
||||
const order = getTestLimitOrder();
|
||||
await fundOrderMakerAsync(order);
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getLimitOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(order.takerAmount);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with a fully filled order', async () => {
|
||||
const order = getTestLimitOrder();
|
||||
// Fully Fund maker and taker.
|
||||
await fundOrderMakerAsync(order);
|
||||
await takerToken
|
||||
.mint(taker, order.takerAmount.plus(order.takerTokenFeeAmount))
|
||||
.awaitTransactionSuccessAsync();
|
||||
await fillLimitOrderAsync(order);
|
||||
// Partially fill the order.
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getLimitOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Filled,
|
||||
takerTokenFilledAmount: order.takerAmount,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(0);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with an under-funded, partially-filled order', async () => {
|
||||
const order = getTestLimitOrder();
|
||||
// Fully Fund maker and taker.
|
||||
await fundOrderMakerAsync(order);
|
||||
await takerToken
|
||||
.mint(taker, order.takerAmount.plus(order.takerTokenFeeAmount))
|
||||
.awaitTransactionSuccessAsync();
|
||||
// Partially fill the order.
|
||||
const fillAmount = order.takerAmount.times(getRandomFraction()).integerValue();
|
||||
await fillLimitOrderAsync(order, { fillAmount });
|
||||
// Reduce maker funds to be < remaining.
|
||||
const remainingMakerAmount = getFillableMakerTokenAmount(order, fillAmount);
|
||||
const balance = remainingMakerAmount.times(getRandomFraction()).integerValue();
|
||||
const allowance = remainingMakerAmount.times(getRandomFraction()).integerValue();
|
||||
await fundOrderMakerAsync(order, balance, allowance);
|
||||
// Get order state.
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getLimitOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: fillAmount,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(
|
||||
getActualFillableTakerTokenAmount(order, balance, allowance, fillAmount),
|
||||
);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRfqOrderRelevantState()', () => {
|
||||
it('works with an empty order', async () => {
|
||||
const order = getTestRfqOrder({
|
||||
takerAmount: ZERO_AMOUNT,
|
||||
});
|
||||
await fundOrderMakerAsync(order);
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getRfqOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Filled,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(0);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with cancelled order', async () => {
|
||||
const order = getTestRfqOrder();
|
||||
await fundOrderMakerAsync(order);
|
||||
await zeroEx.cancelRfqOrder(order).awaitTransactionSuccessAsync({ from: maker });
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getRfqOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Cancelled,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(0);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with a bad signature', async () => {
|
||||
const order = getTestRfqOrder();
|
||||
await fundOrderMakerAsync(order);
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getRfqOrderRelevantState(
|
||||
order,
|
||||
await order.clone({ maker: notMaker }).getSignatureWithProviderAsync(env.provider),
|
||||
)
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(order.takerAmount);
|
||||
expect(isSignatureValid).to.eq(false);
|
||||
});
|
||||
|
||||
it('works with an unfilled order', async () => {
|
||||
const order = getTestRfqOrder();
|
||||
await fundOrderMakerAsync(order);
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getRfqOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(order.takerAmount);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with a fully filled order', async () => {
|
||||
const order = getTestRfqOrder();
|
||||
// Fully Fund maker and taker.
|
||||
await fundOrderMakerAsync(order);
|
||||
await takerToken.mint(taker, order.takerAmount);
|
||||
await fillRfqOrderAsync(order);
|
||||
// Partially fill the order.
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getRfqOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Filled,
|
||||
takerTokenFilledAmount: order.takerAmount,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(0);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
|
||||
it('works with an under-funded, partially-filled order', async () => {
|
||||
const order = getTestRfqOrder();
|
||||
// Fully Fund maker and taker.
|
||||
await fundOrderMakerAsync(order);
|
||||
await takerToken.mint(taker, order.takerAmount).awaitTransactionSuccessAsync();
|
||||
// Partially fill the order.
|
||||
const fillAmount = order.takerAmount.times(getRandomFraction()).integerValue();
|
||||
await fillRfqOrderAsync(order, fillAmount);
|
||||
// Reduce maker funds to be < remaining.
|
||||
const remainingMakerAmount = getFillableMakerTokenAmount(order, fillAmount);
|
||||
const balance = remainingMakerAmount.times(getRandomFraction()).integerValue();
|
||||
const allowance = remainingMakerAmount.times(getRandomFraction()).integerValue();
|
||||
await fundOrderMakerAsync(order, balance, allowance);
|
||||
// Get order state.
|
||||
const [orderInfo, fillableTakerAmount, isSignatureValid] = await zeroEx
|
||||
.getRfqOrderRelevantState(order, await order.getSignatureWithProviderAsync(env.provider))
|
||||
.callAsync();
|
||||
expect(orderInfo).to.deep.eq({
|
||||
orderHash: order.getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: fillAmount,
|
||||
});
|
||||
expect(fillableTakerAmount).to.bignumber.eq(
|
||||
getActualFillableTakerTokenAmount(order, balance, allowance, fillAmount),
|
||||
);
|
||||
expect(isSignatureValid).to.eq(true);
|
||||
});
|
||||
});
|
||||
|
||||
async function batchFundOrderMakerAsync(orders: Array<LimitOrder | RfqOrder>): Promise<void> {
|
||||
await makerToken.burn(maker, await makerToken.balanceOf(maker).callAsync()).awaitTransactionSuccessAsync();
|
||||
const balance = BigNumber.sum(...orders.map(o => o.makerAmount));
|
||||
await makerToken.mint(maker, balance).awaitTransactionSuccessAsync();
|
||||
await makerToken.approve(zeroEx.address, balance).awaitTransactionSuccessAsync({ from: maker });
|
||||
}
|
||||
|
||||
describe('batchGetLimitOrderRelevantStates()', () => {
|
||||
it('works with multiple orders', async () => {
|
||||
const orders = new Array(3).fill(0).map(() => getTestLimitOrder());
|
||||
await batchFundOrderMakerAsync(orders);
|
||||
const [orderInfos, fillableTakerAmounts, isSignatureValids] = await zeroEx
|
||||
.batchGetLimitOrderRelevantStates(
|
||||
orders,
|
||||
await Promise.all(orders.map(async o => o.getSignatureWithProviderAsync(env.provider))),
|
||||
)
|
||||
.callAsync();
|
||||
expect(orderInfos).to.be.length(orders.length);
|
||||
expect(fillableTakerAmounts).to.be.length(orders.length);
|
||||
expect(isSignatureValids).to.be.length(orders.length);
|
||||
for (let i = 0; i < orders.length; ++i) {
|
||||
expect(orderInfos[i]).to.deep.eq({
|
||||
orderHash: orders[i].getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmounts[i]).to.bignumber.eq(orders[i].takerAmount);
|
||||
expect(isSignatureValids[i]).to.eq(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('batchGetRfqOrderRelevantStates()', () => {
|
||||
it('works with multiple orders', async () => {
|
||||
const orders = new Array(3).fill(0).map(() => getTestRfqOrder());
|
||||
await batchFundOrderMakerAsync(orders);
|
||||
const [orderInfos, fillableTakerAmounts, isSignatureValids] = await zeroEx
|
||||
.batchGetRfqOrderRelevantStates(
|
||||
orders,
|
||||
await Promise.all(orders.map(async o => o.getSignatureWithProviderAsync(env.provider))),
|
||||
)
|
||||
.callAsync();
|
||||
expect(orderInfos).to.be.length(orders.length);
|
||||
expect(fillableTakerAmounts).to.be.length(orders.length);
|
||||
expect(isSignatureValids).to.be.length(orders.length);
|
||||
for (let i = 0; i < orders.length; ++i) {
|
||||
expect(orderInfos[i]).to.deep.eq({
|
||||
orderHash: orders[i].getHash(),
|
||||
status: OrderStatus.Fillable,
|
||||
takerTokenFilledAmount: ZERO_AMOUNT,
|
||||
});
|
||||
expect(fillableTakerAmounts[i]).to.bignumber.eq(orders[i].takerAmount);
|
||||
expect(isSignatureValids[i]).to.eq(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,4 +1,32 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "5.6.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "5.6.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Fix fillAmount `ExchangeProxySwapQuoteConsumer` encoding when quote is a BuyQuote"
|
||||
}
|
||||
],
|
||||
"timestamp": 1609387311
|
||||
},
|
||||
{
|
||||
"version": "5.6.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added Mooniswap V2 factory address",
|
||||
"pr": 100
|
||||
}
|
||||
],
|
||||
"timestamp": 1609113560
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "5.5.3",
|
||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.6.2 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.6.1 - _December 31, 2020_
|
||||
|
||||
* Fix fillAmount `ExchangeProxySwapQuoteConsumer` encoding when quote is a BuyQuote
|
||||
|
||||
## v5.6.0 - _December 27, 2020_
|
||||
|
||||
* Added Mooniswap V2 factory address (#100)
|
||||
|
||||
## v5.5.3 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -34,6 +34,7 @@ contract MooniswapSampler is
|
||||
uint256 constant private MOONISWAP_CALL_GAS = 150e3; // 150k
|
||||
|
||||
/// @dev Sample sell quotes from Mooniswap.
|
||||
/// @param registry Address of the Mooniswap Registry.
|
||||
/// @param takerToken Address of the taker token (what to sell).
|
||||
/// @param makerToken Address of the maker token (what to buy).
|
||||
/// @param takerTokenAmounts Taker token sell amount for each sample.
|
||||
@@ -41,6 +42,7 @@ contract MooniswapSampler is
|
||||
/// @return makerTokenAmounts Maker amounts bought at each taker token
|
||||
/// amount.
|
||||
function sampleSellsFromMooniswap(
|
||||
address registry,
|
||||
address takerToken,
|
||||
address makerToken,
|
||||
uint256[] memory takerTokenAmounts
|
||||
@@ -58,6 +60,7 @@ contract MooniswapSampler is
|
||||
|
||||
for (uint256 i = 0; i < numSamples; i++) {
|
||||
uint256 buyAmount = sampleSingleSellFromMooniswapPool(
|
||||
registry,
|
||||
mooniswapTakerToken,
|
||||
mooniswapMakerToken,
|
||||
takerTokenAmounts[i]
|
||||
@@ -70,11 +73,12 @@ contract MooniswapSampler is
|
||||
}
|
||||
|
||||
pool = IMooniswap(
|
||||
IMooniswapRegistry(_getMooniswapAddress()).pools(mooniswapTakerToken, mooniswapMakerToken)
|
||||
IMooniswapRegistry(registry).pools(mooniswapTakerToken, mooniswapMakerToken)
|
||||
);
|
||||
}
|
||||
|
||||
function sampleSingleSellFromMooniswapPool(
|
||||
address registry,
|
||||
address mooniswapTakerToken,
|
||||
address mooniswapMakerToken,
|
||||
uint256 takerTokenAmount
|
||||
@@ -85,7 +89,7 @@ contract MooniswapSampler is
|
||||
{
|
||||
// Find the pool for the pair.
|
||||
IMooniswap pool = IMooniswap(
|
||||
IMooniswapRegistry(_getMooniswapAddress()).pools(mooniswapTakerToken, mooniswapMakerToken)
|
||||
IMooniswapRegistry(registry).pools(mooniswapTakerToken, mooniswapMakerToken)
|
||||
);
|
||||
// If there is no pool then return early
|
||||
if (address(pool) == address(0)) {
|
||||
@@ -113,6 +117,7 @@ contract MooniswapSampler is
|
||||
}
|
||||
|
||||
/// @dev Sample buy quotes from Mooniswap.
|
||||
/// @param registry Address of the Mooniswap Registry.
|
||||
/// @param takerToken Address of the taker token (what to sell).
|
||||
/// @param makerToken Address of the maker token (what to buy).
|
||||
/// @param makerTokenAmounts Maker token sell amount for each sample.
|
||||
@@ -120,6 +125,7 @@ contract MooniswapSampler is
|
||||
/// @return takerTokenAmounts Taker amounts sold at each maker token
|
||||
/// amount.
|
||||
function sampleBuysFromMooniswap(
|
||||
address registry,
|
||||
address takerToken,
|
||||
address makerToken,
|
||||
uint256[] memory makerTokenAmounts
|
||||
@@ -137,15 +143,15 @@ contract MooniswapSampler is
|
||||
|
||||
takerTokenAmounts = _sampleApproximateBuys(
|
||||
ApproximateBuyQuoteOpts({
|
||||
makerTokenData: abi.encode(mooniswapMakerToken),
|
||||
takerTokenData: abi.encode(mooniswapTakerToken),
|
||||
makerTokenData: abi.encode(registry, mooniswapMakerToken),
|
||||
takerTokenData: abi.encode(registry, mooniswapTakerToken),
|
||||
getSellQuoteCallback: _sampleSellForApproximateBuyFromMooniswap
|
||||
}),
|
||||
makerTokenAmounts
|
||||
);
|
||||
|
||||
pool = IMooniswap(
|
||||
IMooniswapRegistry(_getMooniswapAddress()).pools(mooniswapTakerToken, mooniswapMakerToken)
|
||||
IMooniswapRegistry(registry).pools(mooniswapTakerToken, mooniswapMakerToken)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -158,9 +164,10 @@ contract MooniswapSampler is
|
||||
view
|
||||
returns (uint256 buyAmount)
|
||||
{
|
||||
address mooniswapTakerToken = abi.decode(takerTokenData, (address));
|
||||
address mooniswapMakerToken = abi.decode(makerTokenData, (address));
|
||||
(address registry, address mooniswapTakerToken) = abi.decode(takerTokenData, (address, address));
|
||||
(address _registry, address mooniswapMakerToken) = abi.decode(makerTokenData, (address, address));
|
||||
return sampleSingleSellFromMooniswapPool(
|
||||
registry,
|
||||
mooniswapTakerToken,
|
||||
mooniswapMakerToken,
|
||||
sellAmount
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/asset-swapper",
|
||||
"version": "5.5.3",
|
||||
"version": "5.6.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -60,10 +60,10 @@
|
||||
"@0x/assert": "^3.0.19",
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/contract-wrappers": "^13.11.2",
|
||||
"@0x/contract-wrappers": "^13.12.0",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/json-schemas": "^5.3.4",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/orderbook": "0xProject/gitpkg-registry#0x-orderbook-v2.2.7-e10a81023",
|
||||
"@0x/quote-server": "^3.1.0",
|
||||
"@0x/types": "^3.3.1",
|
||||
@@ -87,16 +87,16 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-exchange": "^3.2.21",
|
||||
"@0x/contracts-exchange-libs": "^4.3.20",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-exchange": "^3.2.22",
|
||||
"@0x/contracts-exchange-libs": "^4.3.21",
|
||||
"@0x/contracts-gen": "^2.0.24",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-zero-ex": "^0.16.0",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/contracts-zero-ex": "^0.17.0",
|
||||
"@0x/mesh-rpc-client": "^9.4.2",
|
||||
"@0x/migrations": "^6.5.8",
|
||||
"@0x/migrations": "^6.5.9",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/subproviders": "^6.2.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -205,7 +205,7 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
|
||||
buyToken,
|
||||
refundReceiver: refundReceiver || NULL_ADDRESS,
|
||||
side: isBuyQuote(quote) ? FillQuoteTransformerSide.Buy : FillQuoteTransformerSide.Sell,
|
||||
fillAmount: shouldSellEntireBalance ? MAX_UINT256 : fillAmount,
|
||||
fillAmount: !isBuyQuote(quote) && shouldSellEntireBalance ? MAX_UINT256 : fillAmount,
|
||||
maxOrderFillAmounts: [],
|
||||
rfqtTakerAddress: NULL_ADDRESS,
|
||||
orders: quote.orders,
|
||||
|
@@ -105,36 +105,55 @@ export const TOKENS = {
|
||||
HUSD: '0xdf574c24545e5ffecb9a659c229253d4111d87e1',
|
||||
mUSD: '0xe2f2a5c287993345a840db3b0845fbc70f5935a5',
|
||||
USDN: '0x674c6ad92fd080e4004b2312b45f796a192d27a0',
|
||||
dUSD: '0x5bc25f649fc4e26069ddf4cf4010f9f706c23831',
|
||||
UST: '0xa47c8bf37f92abed4a126bda807a7b7498661acd',
|
||||
// Bitcoins
|
||||
WBTC: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
|
||||
RenBTC: '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d',
|
||||
sBTC: '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6',
|
||||
tBTC: '0x8daebade922df735c38c80c7ebd708af50815faa',
|
||||
hBTC: '0x0316eb71485b0ab14103307bf65a021042c6d380',
|
||||
pBTC: '0xde5331ac4b3630f94853ff322b66407e0d6331e8',
|
||||
bBTC: '0x9be89d2a4cd102d8fecc6bf9da793be995c22541',
|
||||
oBTC: '0x8064d9ae6cdf087b1bcd5bdf3531bd5d8c537a68',
|
||||
// aTokens (Aave)
|
||||
aDAI: '0x028171bca77440897b824ca71d1c56cac55b68a3',
|
||||
aUSDC: '0xbcca60bb61934080951369a648fb03df4f96263c',
|
||||
aUSDT: '0x3ed3b47dd13ec9a98b44e6204a523e766b225811',
|
||||
// Other
|
||||
MKR: '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2',
|
||||
EURS: '0xdb25f211ab05b1c97d595516f45794528a807ad8',
|
||||
sEUR: '0xd71ecff9342a5ced620049e616c5035f1db98620',
|
||||
sETH: '0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb',
|
||||
};
|
||||
|
||||
export const POOLS = {
|
||||
// following the same order in curve.fi:
|
||||
curve_compound: '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56',
|
||||
// curve_USDT: '0x52ea46506b9cc5ef470c5bf89f17dc28bb35d85c',
|
||||
curve_PAX: '0x06364f10b501e868329afbc005b3492902d6c763',
|
||||
curve_y: '0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51',
|
||||
curve_BUSD: '0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27',
|
||||
curve_sUSD: '0xa5407eae9ba41422680e2e00537571bcc53efbfd',
|
||||
curve_renBTC: '0x93054188d876f558f4a66b2ef1d97d16edf0895b',
|
||||
curve_sBTC: '0x7fc77b5c7614e1533320ea6ddc2eb61fa00a9714',
|
||||
curve_HBTC: '0x4ca9b3063ec5866a4b82e437059d2c43d1be596f',
|
||||
curve_TRI: '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7',
|
||||
curve_GUSD: '0x4f062658eaaf2c1ccf8c8e36d6824cdf41167956',
|
||||
curve_HUSD: '0x3ef6a01a0f81d6046290f3e2a8c5b843e738e604',
|
||||
curve_compound: '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56', // 0.Compound
|
||||
// 1.USDT is dead
|
||||
curve_PAX: '0x06364f10b501e868329afbc005b3492902d6c763', // 2.PAX
|
||||
curve_y: '0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51', // 3.Y
|
||||
curve_BUSD: '0x79a8c46dea5ada233abaffd40f3a0a2b1e5a4f27', // 4.BUSD
|
||||
curve_sUSD: '0xa5407eae9ba41422680e2e00537571bcc53efbfd', // 5.sUSD
|
||||
curve_renBTC: '0x93054188d876f558f4a66b2ef1d97d16edf0895b', // 6.ren
|
||||
curve_sBTC: '0x7fc77b5c7614e1533320ea6ddc2eb61fa00a9714', // 7.sbtc
|
||||
curve_HBTC: '0x4ca9b3063ec5866a4b82e437059d2c43d1be596f', // 8.hbtc
|
||||
curve_TRI: '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7', // 9.3pool
|
||||
curve_GUSD: '0x4f062658eaaf2c1ccf8c8e36d6824cdf41167956', // 10.gusd
|
||||
curve_HUSD: '0x3ef6a01a0f81d6046290f3e2a8c5b843e738e604', // 11.husd
|
||||
// 12.usdk is dead
|
||||
curve_USDN: '0x0f9cb53ebe405d49a0bbdbd291a65ff571bc83e1',
|
||||
curve_USDN: '0x0f9cb53ebe405d49a0bbdbd291a65ff571bc83e1', // 13.usdn
|
||||
// 14.linkusd is dead
|
||||
curve_mUSD: '0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6',
|
||||
curve_mUSD: '0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6', // 15.musd
|
||||
// 16.rsv is dead
|
||||
curve_tBTC: '0xc25099792e9349c7dd09759744ea681c7de2cb66',
|
||||
curve_tBTC: '0xc25099792e9349c7dd09759744ea681c7de2cb66', // 17.tbtc
|
||||
curve_dUSD: '0x8038c01a0390a8c547446a0b2c18fc9aefecc10c', // 18.dusd
|
||||
curve_pBTC: '0x5228a22e72ccc52d415ecfd199f99d0665e7733b', // 19.pbtc
|
||||
curve_bBTC: '0x071c661b4deefb59e2a3ddb20db036821eee8f4b', // 20.bbtc
|
||||
curve_oBTC: '0xd81da8d904b52208541bade1bd6595d8a251f8dd', // 21.obtc
|
||||
curve_UST: '0x890f4e345b1daed0367a877a1612f86a1f86985f', // 22.ust
|
||||
curve_eurs: '0x0ce6a5ff5217e38315f87032cf90686c96627caa', // 23.eurs
|
||||
// curve_seth: '0xc5424b857f758e906013f3555dad202e4bdb4567', // 24.seth
|
||||
curve_aave: '0xdebf20617708857ebe4f679508e7b7863a8a8eee', // 25.aave
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -151,17 +170,6 @@ export const MAINNET_CURVE_INFOS: { [name: string]: CurveInfo } = {
|
||||
tokens: [TOKENS.DAI, TOKENS.USDC],
|
||||
metaToken: undefined,
|
||||
},
|
||||
// USDT: {
|
||||
// exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
// sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
// buyQuoteFunctionSelector: CurveFunctionSelectors.get_dx_underlying,
|
||||
// poolAddress: '0x52ea46506b9cc5ef470c5bf89f17dc28bb35d85c',
|
||||
// tokens: [
|
||||
// TOKENS.DAI,
|
||||
// TOKENS.USDC,
|
||||
// TOKENS.USDT,
|
||||
// ],
|
||||
// },
|
||||
[POOLS.curve_PAX]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
@@ -226,7 +234,6 @@ export const MAINNET_CURVE_INFOS: { [name: string]: CurveInfo } = {
|
||||
tokens: [TOKENS.DAI, TOKENS.USDC, TOKENS.USDT],
|
||||
metaToken: undefined,
|
||||
},
|
||||
// Metapools
|
||||
[POOLS.curve_GUSD]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
@@ -267,6 +274,78 @@ export const MAINNET_CURVE_INFOS: { [name: string]: CurveInfo } = {
|
||||
tokens: [TOKENS.tBTC, TOKENS.RenBTC, TOKENS.WBTC, TOKENS.sBTC],
|
||||
metaToken: TOKENS.tBTC,
|
||||
},
|
||||
[POOLS.curve_dUSD]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_dUSD,
|
||||
tokens: [TOKENS.dUSD, TOKENS.DAI, TOKENS.USDC, TOKENS.USDT],
|
||||
metaToken: TOKENS.dUSD,
|
||||
},
|
||||
[POOLS.curve_pBTC]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_pBTC,
|
||||
tokens: [TOKENS.pBTC, TOKENS.RenBTC, TOKENS.WBTC, TOKENS.sBTC],
|
||||
metaToken: TOKENS.pBTC,
|
||||
},
|
||||
[POOLS.curve_bBTC]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_bBTC,
|
||||
tokens: [TOKENS.bBTC, TOKENS.RenBTC, TOKENS.WBTC, TOKENS.sBTC],
|
||||
metaToken: TOKENS.bBTC,
|
||||
},
|
||||
[POOLS.curve_oBTC]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_oBTC,
|
||||
tokens: [TOKENS.oBTC, TOKENS.RenBTC, TOKENS.WBTC, TOKENS.sBTC],
|
||||
metaToken: TOKENS.oBTC,
|
||||
},
|
||||
[POOLS.curve_UST]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_UST,
|
||||
tokens: [TOKENS.UST, TOKENS.DAI, TOKENS.USDC, TOKENS.USDT],
|
||||
metaToken: TOKENS.UST,
|
||||
},
|
||||
[POOLS.curve_eurs]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_eurs,
|
||||
tokens: [TOKENS.EURS, TOKENS.sEUR],
|
||||
metaToken: undefined,
|
||||
},
|
||||
// [POOLS.curve_seth]: {
|
||||
// exchangeFunctionSelector: CurveFunctionSelectors.exchange,
|
||||
// sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy,
|
||||
// buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
// poolAddress: POOLS.curve_seth,
|
||||
// tokens: [TOKENS.ETH, TOKENS.sETH],
|
||||
// metaToken: undefined,
|
||||
// },
|
||||
[POOLS.curve_aave]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_aave,
|
||||
tokens: [TOKENS.DAI, TOKENS.USDC, TOKENS.USDT],
|
||||
metaToken: undefined,
|
||||
},
|
||||
[POOLS.curve_aave]: {
|
||||
exchangeFunctionSelector: CurveFunctionSelectors.exchange,
|
||||
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy,
|
||||
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
|
||||
poolAddress: POOLS.curve_aave,
|
||||
tokens: [TOKENS.aDAI, TOKENS.aUSDC, TOKENS.aUSDT],
|
||||
metaToken: undefined,
|
||||
},
|
||||
};
|
||||
|
||||
export const MAINNET_SWERVE_INFOS: { [name: string]: CurveInfo } = {
|
||||
@@ -357,13 +436,16 @@ export const LIQUIDITY_PROVIDER_REGISTRY: LiquidityProviderRegistry = {};
|
||||
export const MAINNET_SUSHI_SWAP_ROUTER = '0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F';
|
||||
export const MAINNET_CRYPTO_COM_ROUTER = '0xCeB90E4C17d626BE0fACd78b79c9c87d7ca181b3';
|
||||
|
||||
export const MAINNET_MOONISWAP_REGISTRY = '0x71CD6666064C3A1354a3B4dca5fA1E2D3ee7D303';
|
||||
export const MAINNET_MOONISWAP_V2_REGISTRY = '0xc4a8b7e29e3c8ec560cd4945c1cf3461a85a148d';
|
||||
|
||||
export const MAINNET_SHELL_POOLS = {
|
||||
StableCoins: {
|
||||
poolAddress: '0x2E703D658f8dd21709a7B458967aB4081F8D3d05',
|
||||
poolAddress: '0x8f26d7bab7a73309141a291525c965ecdea7bf42',
|
||||
tokens: [TOKENS.USDC, TOKENS.USDT, TOKENS.sUSD, TOKENS.DAI],
|
||||
},
|
||||
Bitcoin: {
|
||||
poolAddress: '0x02Af7C867d6Ddd2c87dEcec2E4AFF809ee118FBb',
|
||||
poolAddress: '0xc2d019b901f8d4fdb2b9a65b5d226ad88c66ee8d',
|
||||
tokens: [TOKENS.RenBTC, TOKENS.WBTC, TOKENS.sBTC],
|
||||
},
|
||||
};
|
||||
@@ -460,13 +542,6 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
|
||||
case POOLS.curve_HBTC:
|
||||
case POOLS.curve_TRI:
|
||||
return 150e3;
|
||||
case POOLS.curve_compound:
|
||||
return 750e3;
|
||||
case POOLS.curve_PAX:
|
||||
case POOLS.curve_y:
|
||||
case POOLS.curve_BUSD:
|
||||
return 850e3;
|
||||
// Metapools
|
||||
case POOLS.curve_USDN:
|
||||
case POOLS.curve_mUSD:
|
||||
return 300e3;
|
||||
@@ -475,6 +550,22 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
|
||||
return 310e3;
|
||||
case POOLS.curve_tBTC:
|
||||
return 370e3;
|
||||
case POOLS.curve_UST:
|
||||
return 500e3;
|
||||
case POOLS.curve_dUSD:
|
||||
case POOLS.curve_bBTC:
|
||||
case POOLS.curve_oBTC:
|
||||
case POOLS.curve_eurs:
|
||||
return 600e3;
|
||||
case POOLS.curve_compound:
|
||||
return 750e3;
|
||||
case POOLS.curve_aave:
|
||||
return 800e3;
|
||||
case POOLS.curve_PAX:
|
||||
case POOLS.curve_y:
|
||||
case POOLS.curve_BUSD:
|
||||
return 850e3;
|
||||
// case POOLS.curve_seth:
|
||||
default:
|
||||
throw new Error(`Unrecognized Curve address: ${poolAddress}`);
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import { BancorService } from './bancor_service';
|
||||
import {
|
||||
LIQUIDITY_PROVIDER_REGISTRY,
|
||||
MAINNET_CRYPTO_COM_ROUTER,
|
||||
MAINNET_MOONISWAP_REGISTRY,
|
||||
MAINNET_MOONISWAP_V2_REGISTRY,
|
||||
MAINNET_SUSHI_SWAP_ROUTER,
|
||||
MAX_UINT256,
|
||||
ZERO_AMOUNT,
|
||||
@@ -623,6 +625,7 @@ export class SamplerOperations {
|
||||
}
|
||||
|
||||
public getMooniswapSellQuotes(
|
||||
registry: string,
|
||||
makerToken: string,
|
||||
takerToken: string,
|
||||
takerFillAmounts: BigNumber[],
|
||||
@@ -631,7 +634,7 @@ export class SamplerOperations {
|
||||
source: ERC20BridgeSource.Mooniswap,
|
||||
contract: this._samplerContract,
|
||||
function: this._samplerContract.sampleSellsFromMooniswap,
|
||||
params: [takerToken, makerToken, takerFillAmounts],
|
||||
params: [registry, takerToken, makerToken, takerFillAmounts],
|
||||
callback: (callResults: string, fillData: MooniswapFillData): BigNumber[] => {
|
||||
const [poolAddress, samples] = this._samplerContract.getABIDecodedReturnData<[string, BigNumber[]]>(
|
||||
'sampleSellsFromMooniswap',
|
||||
@@ -644,6 +647,7 @@ export class SamplerOperations {
|
||||
}
|
||||
|
||||
public getMooniswapBuyQuotes(
|
||||
registry: string,
|
||||
makerToken: string,
|
||||
takerToken: string,
|
||||
makerFillAmounts: BigNumber[],
|
||||
@@ -652,7 +656,7 @@ export class SamplerOperations {
|
||||
source: ERC20BridgeSource.Mooniswap,
|
||||
contract: this._samplerContract,
|
||||
function: this._samplerContract.sampleBuysFromMooniswap,
|
||||
params: [takerToken, makerToken, makerFillAmounts],
|
||||
params: [registry, takerToken, makerToken, makerFillAmounts],
|
||||
callback: (callResults: string, fillData: MooniswapFillData): BigNumber[] => {
|
||||
const [poolAddress, samples] = this._samplerContract.getABIDecodedReturnData<[string, BigNumber[]]>(
|
||||
'sampleBuysFromMooniswap',
|
||||
@@ -1093,7 +1097,20 @@ export class SamplerOperations {
|
||||
case ERC20BridgeSource.MStable:
|
||||
return this.getMStableSellQuotes(makerToken, takerToken, takerFillAmounts);
|
||||
case ERC20BridgeSource.Mooniswap:
|
||||
return this.getMooniswapSellQuotes(makerToken, takerToken, takerFillAmounts);
|
||||
return [
|
||||
this.getMooniswapSellQuotes(
|
||||
MAINNET_MOONISWAP_REGISTRY,
|
||||
makerToken,
|
||||
takerToken,
|
||||
takerFillAmounts,
|
||||
),
|
||||
this.getMooniswapSellQuotes(
|
||||
MAINNET_MOONISWAP_V2_REGISTRY,
|
||||
makerToken,
|
||||
takerToken,
|
||||
takerFillAmounts,
|
||||
),
|
||||
];
|
||||
case ERC20BridgeSource.Balancer:
|
||||
return this.balancerPoolsCache
|
||||
.getCachedPoolAddressesForPair(takerToken, makerToken)!
|
||||
@@ -1218,7 +1235,20 @@ export class SamplerOperations {
|
||||
case ERC20BridgeSource.MStable:
|
||||
return this.getMStableBuyQuotes(makerToken, takerToken, makerFillAmounts);
|
||||
case ERC20BridgeSource.Mooniswap:
|
||||
return this.getMooniswapBuyQuotes(makerToken, takerToken, makerFillAmounts);
|
||||
return [
|
||||
this.getMooniswapBuyQuotes(
|
||||
MAINNET_MOONISWAP_REGISTRY,
|
||||
makerToken,
|
||||
takerToken,
|
||||
makerFillAmounts,
|
||||
),
|
||||
this.getMooniswapBuyQuotes(
|
||||
MAINNET_MOONISWAP_V2_REGISTRY,
|
||||
makerToken,
|
||||
takerToken,
|
||||
makerFillAmounts,
|
||||
),
|
||||
];
|
||||
case ERC20BridgeSource.Balancer:
|
||||
return this.balancerPoolsCache
|
||||
.getCachedPoolAddressesForPair(takerToken, makerToken)!
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "3.11.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Update IZeroEx artifact",
|
||||
"pr": 97
|
||||
}
|
||||
],
|
||||
"timestamp": 1609802516
|
||||
},
|
||||
{
|
||||
"version": "3.10.0",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.11.0 - _January 4, 2021_
|
||||
|
||||
* Update IZeroEx artifact (#97)
|
||||
|
||||
## v3.10.0 - _December 9, 2020_
|
||||
|
||||
* Update artifacts (#76)
|
||||
|
@@ -457,6 +457,114 @@
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "makerToken", "type": "address" },
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "takerToken", "type": "address" },
|
||||
{ "internalType": "uint128", "name": "makerAmount", "type": "uint128" },
|
||||
{ "internalType": "uint128", "name": "takerAmount", "type": "uint128" },
|
||||
{ "internalType": "uint128", "name": "takerTokenFeeAmount", "type": "uint128" },
|
||||
{ "internalType": "address", "name": "maker", "type": "address" },
|
||||
{ "internalType": "address", "name": "taker", "type": "address" },
|
||||
{ "internalType": "address", "name": "sender", "type": "address" },
|
||||
{ "internalType": "address", "name": "feeRecipient", "type": "address" },
|
||||
{ "internalType": "bytes32", "name": "pool", "type": "bytes32" },
|
||||
{ "internalType": "uint64", "name": "expiry", "type": "uint64" },
|
||||
{ "internalType": "uint256", "name": "salt", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.LimitOrder[]",
|
||||
"name": "orders",
|
||||
"type": "tuple[]"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "enum LibSignature.SignatureType",
|
||||
"name": "signatureType",
|
||||
"type": "uint8"
|
||||
},
|
||||
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
||||
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
||||
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
||||
],
|
||||
"internalType": "struct LibSignature.Signature[]",
|
||||
"name": "signatures",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"name": "batchGetLimitOrderRelevantStates",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "bytes32", "name": "orderHash", "type": "bytes32" },
|
||||
{ "internalType": "enum LibNativeOrder.OrderStatus", "name": "status", "type": "uint8" },
|
||||
{ "internalType": "uint128", "name": "takerTokenFilledAmount", "type": "uint128" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.OrderInfo[]",
|
||||
"name": "orderInfos",
|
||||
"type": "tuple[]"
|
||||
},
|
||||
{ "internalType": "uint128[]", "name": "actualFillableTakerTokenAmounts", "type": "uint128[]" },
|
||||
{ "internalType": "bool[]", "name": "isSignatureValids", "type": "bool[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "makerToken", "type": "address" },
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "takerToken", "type": "address" },
|
||||
{ "internalType": "uint128", "name": "makerAmount", "type": "uint128" },
|
||||
{ "internalType": "uint128", "name": "takerAmount", "type": "uint128" },
|
||||
{ "internalType": "address", "name": "maker", "type": "address" },
|
||||
{ "internalType": "address", "name": "taker", "type": "address" },
|
||||
{ "internalType": "address", "name": "txOrigin", "type": "address" },
|
||||
{ "internalType": "bytes32", "name": "pool", "type": "bytes32" },
|
||||
{ "internalType": "uint64", "name": "expiry", "type": "uint64" },
|
||||
{ "internalType": "uint256", "name": "salt", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.RfqOrder[]",
|
||||
"name": "orders",
|
||||
"type": "tuple[]"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "enum LibSignature.SignatureType",
|
||||
"name": "signatureType",
|
||||
"type": "uint8"
|
||||
},
|
||||
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
||||
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
||||
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
||||
],
|
||||
"internalType": "struct LibSignature.Signature[]",
|
||||
"name": "signatures",
|
||||
"type": "tuple[]"
|
||||
}
|
||||
],
|
||||
"name": "batchGetRfqOrderRelevantStates",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "bytes32", "name": "orderHash", "type": "bytes32" },
|
||||
{ "internalType": "enum LibNativeOrder.OrderStatus", "name": "status", "type": "uint8" },
|
||||
{ "internalType": "uint128", "name": "takerTokenFilledAmount", "type": "uint128" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.OrderInfo[]",
|
||||
"name": "orderInfos",
|
||||
"type": "tuple[]"
|
||||
},
|
||||
{ "internalType": "uint128[]", "name": "actualFillableTakerTokenAmounts", "type": "uint128[]" },
|
||||
{ "internalType": "bool[]", "name": "isSignatureValids", "type": "bool[]" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
@@ -834,6 +942,61 @@
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "makerToken", "type": "address" },
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "takerToken", "type": "address" },
|
||||
{ "internalType": "uint128", "name": "makerAmount", "type": "uint128" },
|
||||
{ "internalType": "uint128", "name": "takerAmount", "type": "uint128" },
|
||||
{ "internalType": "uint128", "name": "takerTokenFeeAmount", "type": "uint128" },
|
||||
{ "internalType": "address", "name": "maker", "type": "address" },
|
||||
{ "internalType": "address", "name": "taker", "type": "address" },
|
||||
{ "internalType": "address", "name": "sender", "type": "address" },
|
||||
{ "internalType": "address", "name": "feeRecipient", "type": "address" },
|
||||
{ "internalType": "bytes32", "name": "pool", "type": "bytes32" },
|
||||
{ "internalType": "uint64", "name": "expiry", "type": "uint64" },
|
||||
{ "internalType": "uint256", "name": "salt", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.LimitOrder",
|
||||
"name": "order",
|
||||
"type": "tuple"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "enum LibSignature.SignatureType",
|
||||
"name": "signatureType",
|
||||
"type": "uint8"
|
||||
},
|
||||
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
||||
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
||||
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
||||
],
|
||||
"internalType": "struct LibSignature.Signature",
|
||||
"name": "signature",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"name": "getLimitOrderRelevantState",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "bytes32", "name": "orderHash", "type": "bytes32" },
|
||||
{ "internalType": "enum LibNativeOrder.OrderStatus", "name": "status", "type": "uint8" },
|
||||
{ "internalType": "uint128", "name": "takerTokenFilledAmount", "type": "uint128" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.OrderInfo",
|
||||
"name": "orderInfo",
|
||||
"type": "tuple"
|
||||
},
|
||||
{ "internalType": "uint128", "name": "actualFillableTakerTokenAmount", "type": "uint128" },
|
||||
{ "internalType": "bool", "name": "isSignatureValid", "type": "bool" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
@@ -966,6 +1129,59 @@
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "makerToken", "type": "address" },
|
||||
{ "internalType": "contract IERC20TokenV06", "name": "takerToken", "type": "address" },
|
||||
{ "internalType": "uint128", "name": "makerAmount", "type": "uint128" },
|
||||
{ "internalType": "uint128", "name": "takerAmount", "type": "uint128" },
|
||||
{ "internalType": "address", "name": "maker", "type": "address" },
|
||||
{ "internalType": "address", "name": "taker", "type": "address" },
|
||||
{ "internalType": "address", "name": "txOrigin", "type": "address" },
|
||||
{ "internalType": "bytes32", "name": "pool", "type": "bytes32" },
|
||||
{ "internalType": "uint64", "name": "expiry", "type": "uint64" },
|
||||
{ "internalType": "uint256", "name": "salt", "type": "uint256" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.RfqOrder",
|
||||
"name": "order",
|
||||
"type": "tuple"
|
||||
},
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"internalType": "enum LibSignature.SignatureType",
|
||||
"name": "signatureType",
|
||||
"type": "uint8"
|
||||
},
|
||||
{ "internalType": "uint8", "name": "v", "type": "uint8" },
|
||||
{ "internalType": "bytes32", "name": "r", "type": "bytes32" },
|
||||
{ "internalType": "bytes32", "name": "s", "type": "bytes32" }
|
||||
],
|
||||
"internalType": "struct LibSignature.Signature",
|
||||
"name": "signature",
|
||||
"type": "tuple"
|
||||
}
|
||||
],
|
||||
"name": "getRfqOrderRelevantState",
|
||||
"outputs": [
|
||||
{
|
||||
"components": [
|
||||
{ "internalType": "bytes32", "name": "orderHash", "type": "bytes32" },
|
||||
{ "internalType": "enum LibNativeOrder.OrderStatus", "name": "status", "type": "uint8" },
|
||||
{ "internalType": "uint128", "name": "takerTokenFilledAmount", "type": "uint128" }
|
||||
],
|
||||
"internalType": "struct LibNativeOrder.OrderInfo",
|
||||
"name": "orderInfo",
|
||||
"type": "tuple"
|
||||
},
|
||||
{ "internalType": "uint128", "name": "actualFillableTakerTokenAmount", "type": "uint128" },
|
||||
{ "internalType": "bool", "name": "isSignatureValid", "type": "bool" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{ "internalType": "bytes4", "name": "selector", "type": "bytes4" },
|
||||
@@ -1230,6 +1446,24 @@
|
||||
},
|
||||
"returns": { "returnResults": "The ABI-encoded results of the underlying calls." }
|
||||
},
|
||||
"batchGetLimitOrderRelevantStates((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": {
|
||||
"details": "Batch version of `getLimitOrderRelevantState()`.",
|
||||
"params": { "orders": "The limit orders.", "signatures": "The order signatures." },
|
||||
"returns": {
|
||||
"actualFillableTakerTokenAmounts": "How much of each order is fillable based on maker funds, in taker tokens.",
|
||||
"isSignatureValids": "Whether each signature is valid for the order.",
|
||||
"orderInfos": "Info about the orders."
|
||||
}
|
||||
},
|
||||
"batchGetRfqOrderRelevantStates((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": {
|
||||
"details": "Batch version of `getRfqOrderRelevantState()`.",
|
||||
"params": { "orders": "The RFQ orders.", "signatures": "The order signatures." },
|
||||
"returns": {
|
||||
"actualFillableTakerTokenAmounts": "How much of each order is fillable based on maker funds, in taker tokens.",
|
||||
"isSignatureValids": "Whether each signature is valid for the order.",
|
||||
"orderInfos": "Info about the orders."
|
||||
}
|
||||
},
|
||||
"cancelLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": {
|
||||
"details": "Cancel a single limit order. The caller must be the maker. Silently succeeds if the order has already been cancelled.",
|
||||
"params": { "order": "The limit order." }
|
||||
@@ -1326,6 +1560,15 @@
|
||||
"params": { "order": "The limit order." },
|
||||
"returns": { "orderInfo": "Info about the order." }
|
||||
},
|
||||
"getLimitOrderRelevantState((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": {
|
||||
"details": "Get order info, fillable amount, and signature validity for a limit order. Fillable amount is determined using balances and allowances of the maker.",
|
||||
"params": { "order": "The limit order.", "signature": "The order signature." },
|
||||
"returns": {
|
||||
"actualFillableTakerTokenAmount": "How much of the order is fillable based on maker funds, in taker tokens.",
|
||||
"isSignatureValid": "Whether the signature is valid.",
|
||||
"orderInfo": "Info about the order."
|
||||
}
|
||||
},
|
||||
"getMetaTransactionExecutedBlock((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256))": {
|
||||
"details": "Get the block at which a meta-transaction has been executed.",
|
||||
"params": { "mtx": "The meta-transaction." },
|
||||
@@ -1359,6 +1602,15 @@
|
||||
"params": { "order": "The RFQ order." },
|
||||
"returns": { "orderInfo": "Info about the order." }
|
||||
},
|
||||
"getRfqOrderRelevantState((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": {
|
||||
"details": "Get order info, fillable amount, and signature validity for an RFQ order. Fillable amount is determined using balances and allowances of the maker.",
|
||||
"params": { "order": "The RFQ order.", "signature": "The order signature." },
|
||||
"returns": {
|
||||
"actualFillableTakerTokenAmount": "How much of the order is fillable based on maker funds, in taker tokens.",
|
||||
"isSignatureValid": "Whether the signature is valid.",
|
||||
"orderInfo": "Info about the order."
|
||||
}
|
||||
},
|
||||
"getRollbackEntryAtIndex(bytes4,uint256)": {
|
||||
"details": "Retrieve an entry in the rollback history for a function.",
|
||||
"params": { "idx": "The index in the rollback history.", "selector": "The function selector." },
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-artifacts",
|
||||
"version": "3.10.0",
|
||||
"version": "3.11.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers-test",
|
||||
"version": "12.2.32",
|
||||
"version": "12.2.33",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -31,11 +31,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-wrappers-test",
|
||||
"devDependencies": {
|
||||
"@0x/contract-wrappers": "^13.11.2",
|
||||
"@0x/contracts-test-utils": "^5.3.17",
|
||||
"@0x/contract-wrappers": "^13.12.0",
|
||||
"@0x/contracts-test-utils": "^5.3.18",
|
||||
"@0x/dev-utils": "^4.1.3",
|
||||
"@0x/migrations": "^6.5.8",
|
||||
"@0x/order-utils": "^10.4.12",
|
||||
"@0x/migrations": "^6.5.9",
|
||||
"@0x/order-utils": "^10.4.13",
|
||||
"@0x/subproviders": "^6.2.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.3",
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "13.12.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Update IZeroExContract wrapper",
|
||||
"pr": 97
|
||||
}
|
||||
],
|
||||
"timestamp": 1609802516
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "13.11.2",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v13.12.0 - _January 4, 2021_
|
||||
|
||||
* Update IZeroExContract wrapper (#97)
|
||||
|
||||
## v13.11.2 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers",
|
||||
"version": "13.11.2",
|
||||
"version": "13.12.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -1229,6 +1229,220 @@ export class IZeroExContract extends BaseContract {
|
||||
stateMutability: 'payable',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
name: 'orders',
|
||||
type: 'tuple[]',
|
||||
components: [
|
||||
{
|
||||
name: 'makerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'takerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'makerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'takerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'takerTokenFeeAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'maker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'taker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'sender',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'feeRecipient',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'pool',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'expiry',
|
||||
type: 'uint64',
|
||||
},
|
||||
{
|
||||
name: 'salt',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'signatures',
|
||||
type: 'tuple[]',
|
||||
components: [
|
||||
{
|
||||
name: 'signatureType',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'v',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'r',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 's',
|
||||
type: 'bytes32',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
name: 'batchGetLimitOrderRelevantStates',
|
||||
outputs: [
|
||||
{
|
||||
name: 'orderInfos',
|
||||
type: 'tuple[]',
|
||||
components: [
|
||||
{
|
||||
name: 'orderHash',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'takerTokenFilledAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'actualFillableTakerTokenAmounts',
|
||||
type: 'uint128[]',
|
||||
},
|
||||
{
|
||||
name: 'isSignatureValids',
|
||||
type: 'bool[]',
|
||||
},
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
name: 'orders',
|
||||
type: 'tuple[]',
|
||||
components: [
|
||||
{
|
||||
name: 'makerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'takerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'makerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'takerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'maker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'taker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'txOrigin',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'pool',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'expiry',
|
||||
type: 'uint64',
|
||||
},
|
||||
{
|
||||
name: 'salt',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'signatures',
|
||||
type: 'tuple[]',
|
||||
components: [
|
||||
{
|
||||
name: 'signatureType',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'v',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'r',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 's',
|
||||
type: 'bytes32',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
name: 'batchGetRfqOrderRelevantStates',
|
||||
outputs: [
|
||||
{
|
||||
name: 'orderInfos',
|
||||
type: 'tuple[]',
|
||||
components: [
|
||||
{
|
||||
name: 'orderHash',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'takerTokenFilledAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'actualFillableTakerTokenAmounts',
|
||||
type: 'uint128[]',
|
||||
},
|
||||
{
|
||||
name: 'isSignatureValids',
|
||||
type: 'bool[]',
|
||||
},
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
@@ -2018,6 +2232,117 @@ export class IZeroExContract extends BaseContract {
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
name: 'order',
|
||||
type: 'tuple',
|
||||
components: [
|
||||
{
|
||||
name: 'makerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'takerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'makerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'takerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'takerTokenFeeAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'maker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'taker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'sender',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'feeRecipient',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'pool',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'expiry',
|
||||
type: 'uint64',
|
||||
},
|
||||
{
|
||||
name: 'salt',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'signature',
|
||||
type: 'tuple',
|
||||
components: [
|
||||
{
|
||||
name: 'signatureType',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'v',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'r',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 's',
|
||||
type: 'bytes32',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
name: 'getLimitOrderRelevantState',
|
||||
outputs: [
|
||||
{
|
||||
name: 'orderInfo',
|
||||
type: 'tuple',
|
||||
components: [
|
||||
{
|
||||
name: 'orderHash',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'takerTokenFilledAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'actualFillableTakerTokenAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'isSignatureValid',
|
||||
type: 'bool',
|
||||
},
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
@@ -2309,6 +2634,109 @@ export class IZeroExContract extends BaseContract {
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
name: 'order',
|
||||
type: 'tuple',
|
||||
components: [
|
||||
{
|
||||
name: 'makerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'takerToken',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'makerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'takerAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'maker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'taker',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'txOrigin',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'pool',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'expiry',
|
||||
type: 'uint64',
|
||||
},
|
||||
{
|
||||
name: 'salt',
|
||||
type: 'uint256',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'signature',
|
||||
type: 'tuple',
|
||||
components: [
|
||||
{
|
||||
name: 'signatureType',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'v',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'r',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 's',
|
||||
type: 'bytes32',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
name: 'getRfqOrderRelevantState',
|
||||
outputs: [
|
||||
{
|
||||
name: 'orderInfo',
|
||||
type: 'tuple',
|
||||
components: [
|
||||
{
|
||||
name: 'orderHash',
|
||||
type: 'bytes32',
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
type: 'uint8',
|
||||
},
|
||||
{
|
||||
name: 'takerTokenFilledAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'actualFillableTakerTokenAmount',
|
||||
type: 'uint128',
|
||||
},
|
||||
{
|
||||
name: 'isSignatureValid',
|
||||
type: 'bool',
|
||||
},
|
||||
],
|
||||
stateMutability: 'view',
|
||||
type: 'function',
|
||||
},
|
||||
{
|
||||
inputs: [
|
||||
{
|
||||
@@ -3429,6 +3857,178 @@ export class IZeroExContract extends BaseContract {
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Batch version of `getLimitOrderRelevantState()`.
|
||||
* @param orders The limit orders.
|
||||
* @param signatures The order signatures.
|
||||
*/
|
||||
public batchGetLimitOrderRelevantStates(
|
||||
orders: Array<{
|
||||
makerToken: string;
|
||||
takerToken: string;
|
||||
makerAmount: BigNumber;
|
||||
takerAmount: BigNumber;
|
||||
takerTokenFeeAmount: BigNumber;
|
||||
maker: string;
|
||||
taker: string;
|
||||
sender: string;
|
||||
feeRecipient: string;
|
||||
pool: string;
|
||||
expiry: BigNumber;
|
||||
salt: BigNumber;
|
||||
}>,
|
||||
signatures: Array<{ signatureType: number | BigNumber; v: number | BigNumber; r: string; s: string }>,
|
||||
): ContractTxFunctionObj<
|
||||
[Array<{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }>, BigNumber[], boolean[]]
|
||||
> {
|
||||
const self = (this as any) as IZeroExContract;
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('signatures', signatures);
|
||||
const functionSignature =
|
||||
'batchGetLimitOrderRelevantStates((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])';
|
||||
|
||||
return {
|
||||
async sendTransactionAsync(
|
||||
txData?: Partial<TxData> | undefined,
|
||||
opts: SendTransactionOpts = { shouldValidate: true },
|
||||
): Promise<string> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...txData },
|
||||
this.estimateGasAsync.bind(this),
|
||||
);
|
||||
if (opts.shouldValidate !== false) {
|
||||
await this.callAsync(txDataWithDefaults);
|
||||
}
|
||||
return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
txData?: Partial<TxData>,
|
||||
opts: AwaitTransactionSuccessOpts = { shouldValidate: true },
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts);
|
||||
},
|
||||
async estimateGasAsync(txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({
|
||||
data: this.getABIEncodedTransactionData(),
|
||||
...txData,
|
||||
});
|
||||
return self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
},
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<
|
||||
[
|
||||
Array<{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }>,
|
||||
BigNumber[],
|
||||
boolean[]
|
||||
]
|
||||
> {
|
||||
BaseContract._assertCallParams(callData, defaultBlock);
|
||||
const rawCallResult = await self._performCallAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...callData },
|
||||
defaultBlock,
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
BaseContract._throwIfUnexpectedEmptyCallResult(rawCallResult, abiEncoder);
|
||||
return abiEncoder.strictDecodeReturnValue<
|
||||
[
|
||||
Array<{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }>,
|
||||
BigNumber[],
|
||||
boolean[]
|
||||
]
|
||||
>(rawCallResult);
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
return self._strictEncodeArguments(functionSignature, [orders, signatures]);
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Batch version of `getRfqOrderRelevantState()`.
|
||||
* @param orders The RFQ orders.
|
||||
* @param signatures The order signatures.
|
||||
*/
|
||||
public batchGetRfqOrderRelevantStates(
|
||||
orders: Array<{
|
||||
makerToken: string;
|
||||
takerToken: string;
|
||||
makerAmount: BigNumber;
|
||||
takerAmount: BigNumber;
|
||||
maker: string;
|
||||
taker: string;
|
||||
txOrigin: string;
|
||||
pool: string;
|
||||
expiry: BigNumber;
|
||||
salt: BigNumber;
|
||||
}>,
|
||||
signatures: Array<{ signatureType: number | BigNumber; v: number | BigNumber; r: string; s: string }>,
|
||||
): ContractTxFunctionObj<
|
||||
[Array<{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }>, BigNumber[], boolean[]]
|
||||
> {
|
||||
const self = (this as any) as IZeroExContract;
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('signatures', signatures);
|
||||
const functionSignature =
|
||||
'batchGetRfqOrderRelevantStates((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])';
|
||||
|
||||
return {
|
||||
async sendTransactionAsync(
|
||||
txData?: Partial<TxData> | undefined,
|
||||
opts: SendTransactionOpts = { shouldValidate: true },
|
||||
): Promise<string> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...txData },
|
||||
this.estimateGasAsync.bind(this),
|
||||
);
|
||||
if (opts.shouldValidate !== false) {
|
||||
await this.callAsync(txDataWithDefaults);
|
||||
}
|
||||
return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
txData?: Partial<TxData>,
|
||||
opts: AwaitTransactionSuccessOpts = { shouldValidate: true },
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts);
|
||||
},
|
||||
async estimateGasAsync(txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({
|
||||
data: this.getABIEncodedTransactionData(),
|
||||
...txData,
|
||||
});
|
||||
return self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
},
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<
|
||||
[
|
||||
Array<{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }>,
|
||||
BigNumber[],
|
||||
boolean[]
|
||||
]
|
||||
> {
|
||||
BaseContract._assertCallParams(callData, defaultBlock);
|
||||
const rawCallResult = await self._performCallAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...callData },
|
||||
defaultBlock,
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
BaseContract._throwIfUnexpectedEmptyCallResult(rawCallResult, abiEncoder);
|
||||
return abiEncoder.strictDecodeReturnValue<
|
||||
[
|
||||
Array<{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }>,
|
||||
BigNumber[],
|
||||
boolean[]
|
||||
]
|
||||
>(rawCallResult);
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
return self._strictEncodeArguments(functionSignature, [orders, signatures]);
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Cancel a single limit order. The caller must be the maker.
|
||||
* Silently succeeds if the order has already been cancelled.
|
||||
@@ -4346,6 +4946,83 @@ export class IZeroExContract extends BaseContract {
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get order info, fillable amount, and signature validity for a limit order.
|
||||
* Fillable amount is determined using balances and allowances of the maker.
|
||||
* @param order The limit order.
|
||||
* @param signature The order signature.
|
||||
*/
|
||||
public getLimitOrderRelevantState(
|
||||
order: {
|
||||
makerToken: string;
|
||||
takerToken: string;
|
||||
makerAmount: BigNumber;
|
||||
takerAmount: BigNumber;
|
||||
takerTokenFeeAmount: BigNumber;
|
||||
maker: string;
|
||||
taker: string;
|
||||
sender: string;
|
||||
feeRecipient: string;
|
||||
pool: string;
|
||||
expiry: BigNumber;
|
||||
salt: BigNumber;
|
||||
},
|
||||
signature: { signatureType: number | BigNumber; v: number | BigNumber; r: string; s: string },
|
||||
): ContractTxFunctionObj<
|
||||
[{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }, BigNumber, boolean]
|
||||
> {
|
||||
const self = (this as any) as IZeroExContract;
|
||||
|
||||
const functionSignature =
|
||||
'getLimitOrderRelevantState((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))';
|
||||
|
||||
return {
|
||||
async sendTransactionAsync(
|
||||
txData?: Partial<TxData> | undefined,
|
||||
opts: SendTransactionOpts = { shouldValidate: true },
|
||||
): Promise<string> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...txData },
|
||||
this.estimateGasAsync.bind(this),
|
||||
);
|
||||
if (opts.shouldValidate !== false) {
|
||||
await this.callAsync(txDataWithDefaults);
|
||||
}
|
||||
return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
txData?: Partial<TxData>,
|
||||
opts: AwaitTransactionSuccessOpts = { shouldValidate: true },
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts);
|
||||
},
|
||||
async estimateGasAsync(txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({
|
||||
data: this.getABIEncodedTransactionData(),
|
||||
...txData,
|
||||
});
|
||||
return self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
},
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }, BigNumber, boolean]> {
|
||||
BaseContract._assertCallParams(callData, defaultBlock);
|
||||
const rawCallResult = await self._performCallAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...callData },
|
||||
defaultBlock,
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
BaseContract._throwIfUnexpectedEmptyCallResult(rawCallResult, abiEncoder);
|
||||
return abiEncoder.strictDecodeReturnValue<
|
||||
[{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }, BigNumber, boolean]
|
||||
>(rawCallResult);
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
return self._strictEncodeArguments(functionSignature, [order, signature]);
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get the block at which a meta-transaction has been executed.
|
||||
* @param mtx The meta-transaction.
|
||||
@@ -4755,6 +5432,81 @@ export class IZeroExContract extends BaseContract {
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get order info, fillable amount, and signature validity for an RFQ order.
|
||||
* Fillable amount is determined using balances and allowances of the maker.
|
||||
* @param order The RFQ order.
|
||||
* @param signature The order signature.
|
||||
*/
|
||||
public getRfqOrderRelevantState(
|
||||
order: {
|
||||
makerToken: string;
|
||||
takerToken: string;
|
||||
makerAmount: BigNumber;
|
||||
takerAmount: BigNumber;
|
||||
maker: string;
|
||||
taker: string;
|
||||
txOrigin: string;
|
||||
pool: string;
|
||||
expiry: BigNumber;
|
||||
salt: BigNumber;
|
||||
},
|
||||
signature: { signatureType: number | BigNumber; v: number | BigNumber; r: string; s: string },
|
||||
): ContractTxFunctionObj<
|
||||
[{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }, BigNumber, boolean]
|
||||
> {
|
||||
const self = (this as any) as IZeroExContract;
|
||||
|
||||
const functionSignature =
|
||||
'getRfqOrderRelevantState((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))';
|
||||
|
||||
return {
|
||||
async sendTransactionAsync(
|
||||
txData?: Partial<TxData> | undefined,
|
||||
opts: SendTransactionOpts = { shouldValidate: true },
|
||||
): Promise<string> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...txData },
|
||||
this.estimateGasAsync.bind(this),
|
||||
);
|
||||
if (opts.shouldValidate !== false) {
|
||||
await this.callAsync(txDataWithDefaults);
|
||||
}
|
||||
return self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
txData?: Partial<TxData>,
|
||||
opts: AwaitTransactionSuccessOpts = { shouldValidate: true },
|
||||
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
|
||||
return self._promiseWithTransactionHash(this.sendTransactionAsync(txData, opts), opts);
|
||||
},
|
||||
async estimateGasAsync(txData?: Partial<TxData> | undefined): Promise<number> {
|
||||
const txDataWithDefaults = await self._applyDefaultsToTxDataAsync({
|
||||
data: this.getABIEncodedTransactionData(),
|
||||
...txData,
|
||||
});
|
||||
return self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
},
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }, BigNumber, boolean]> {
|
||||
BaseContract._assertCallParams(callData, defaultBlock);
|
||||
const rawCallResult = await self._performCallAsync(
|
||||
{ data: this.getABIEncodedTransactionData(), ...callData },
|
||||
defaultBlock,
|
||||
);
|
||||
const abiEncoder = self._lookupAbiEncoder(functionSignature);
|
||||
BaseContract._throwIfUnexpectedEmptyCallResult(rawCallResult, abiEncoder);
|
||||
return abiEncoder.strictDecodeReturnValue<
|
||||
[{ orderHash: string; status: number; takerTokenFilledAmount: BigNumber }, BigNumber, boolean]
|
||||
>(rawCallResult);
|
||||
},
|
||||
getABIEncodedTransactionData(): string {
|
||||
return self._strictEncodeArguments(functionSignature, [order, signature]);
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Retrieve an entry in the rollback history for a function.
|
||||
* @param selector The function selector.
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "6.5.9",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "6.5.8",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.5.9 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v6.5.8 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/migrations",
|
||||
"version": "6.5.8",
|
||||
"version": "6.5.9",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -69,19 +69,19 @@
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.2.14",
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.2",
|
||||
"@0x/contracts-coordinator": "^3.1.21",
|
||||
"@0x/contracts-dev-utils": "^1.3.19",
|
||||
"@0x/contracts-erc1155": "^2.1.20",
|
||||
"@0x/contracts-erc20": "^3.2.14",
|
||||
"@0x/contracts-erc721": "^3.1.20",
|
||||
"@0x/contracts-exchange": "^3.2.21",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.21",
|
||||
"@0x/contracts-extensions": "^6.2.15",
|
||||
"@0x/contracts-multisig": "^4.1.21",
|
||||
"@0x/contracts-staking": "^2.0.28",
|
||||
"@0x/contracts-utils": "^4.6.5",
|
||||
"@0x/contracts-zero-ex": "^0.16.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.3",
|
||||
"@0x/contracts-coordinator": "^3.1.22",
|
||||
"@0x/contracts-dev-utils": "^1.3.20",
|
||||
"@0x/contracts-erc1155": "^2.1.21",
|
||||
"@0x/contracts-erc20": "^3.3.0",
|
||||
"@0x/contracts-erc721": "^3.1.21",
|
||||
"@0x/contracts-exchange": "^3.2.22",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.22",
|
||||
"@0x/contracts-extensions": "^6.2.16",
|
||||
"@0x/contracts-multisig": "^4.1.22",
|
||||
"@0x/contracts-staking": "^2.0.29",
|
||||
"@0x/contracts-utils": "^4.7.0",
|
||||
"@0x/contracts-zero-ex": "^0.17.0",
|
||||
"@0x/sol-compiler": "^4.4.1",
|
||||
"@0x/subproviders": "^6.2.3",
|
||||
"@0x/typescript-typings": "^5.1.6",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "10.4.13",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "10.4.12",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v10.4.13 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v10.4.12 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/order-utils",
|
||||
"version": "10.4.12",
|
||||
"version": "10.4.13",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -70,7 +70,7 @@
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.19",
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/contract-wrappers": "^13.11.2",
|
||||
"@0x/contract-wrappers": "^13.12.0",
|
||||
"@0x/json-schemas": "^5.3.4",
|
||||
"@0x/utils": "^6.1.1",
|
||||
"@0x/web3-wrapper": "^7.3.0",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1609802516,
|
||||
"version": "1.1.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1608692071,
|
||||
"version": "1.1.2",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.1.3 - _January 4, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.1.2 - _December 23, 2020_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/protocol-utils",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -63,7 +63,7 @@
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.19",
|
||||
"@0x/contract-addresses": "^5.8.0",
|
||||
"@0x/contract-wrappers": "^13.11.2",
|
||||
"@0x/contract-wrappers": "^13.12.0",
|
||||
"@0x/json-schemas": "^5.3.4",
|
||||
"@0x/subproviders": "^6.2.3",
|
||||
"@0x/utils": "^6.1.1",
|
||||
|
Reference in New Issue
Block a user