Compare commits
14 Commits
@0x/asset-
...
romain/sam
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f8a4101d5 | ||
|
|
15b7cf3986 | ||
|
|
5d4481f0f0 | ||
|
|
2a9871d706 | ||
|
|
254b850a8b | ||
|
|
e2242e5955 | ||
|
|
7a0255fee7 | ||
|
|
ec6522cfbf | ||
|
|
1bf96e91bb | ||
|
|
eb733cc58f | ||
|
|
d9fdcf813b | ||
|
|
88bd1c9cea | ||
|
|
9e759e82b4 | ||
|
|
da433854ac |
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "3.3.18",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629353596,
|
"timestamp": 1629353596,
|
||||||
"version": "3.3.17",
|
"version": "3.3.17",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v3.3.18 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v3.3.17 - _August 19, 2021_
|
## v3.3.17 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-erc20",
|
"name": "@0x/contracts-erc20",
|
||||||
"version": "3.3.17",
|
"version": "3.3.18",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.6.0",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-gen": "^2.0.38",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.4.9",
|
"@0x/contracts-test-utils": "^5.4.10",
|
||||||
"@0x/contracts-utils": "^4.7.17",
|
"@0x/contracts-utils": "^4.7.18",
|
||||||
"@0x/dev-utils": "^4.2.7",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/sol-compiler": "^4.7.3",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "5.4.10",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629353596,
|
"timestamp": 1629353596,
|
||||||
"version": "5.4.9",
|
"version": "5.4.9",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v5.4.10 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v5.4.9 - _August 19, 2021_
|
## v5.4.9 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-test-utils",
|
"name": "@0x/contracts-test-utils",
|
||||||
"version": "5.4.9",
|
"version": "5.4.10",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.27",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/base-contract": "^6.4.0",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contract-addresses": "^6.6.1",
|
"@0x/contract-addresses": "^6.7.0",
|
||||||
"@0x/dev-utils": "^4.2.7",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/json-schemas": "^6.1.3",
|
"@0x/json-schemas": "^6.1.3",
|
||||||
"@0x/order-utils": "^10.4.28",
|
"@0x/order-utils": "^10.4.28",
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "1.3.4",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629353596,
|
"timestamp": 1629353596,
|
||||||
"version": "1.3.3",
|
"version": "1.3.3",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.3.4 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.3.3 - _August 19, 2021_
|
## v1.3.3 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-treasury",
|
"name": "@0x/contracts-treasury",
|
||||||
"version": "1.3.3",
|
"version": "1.3.4",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -47,12 +47,12 @@
|
|||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.6.0",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contract-addresses": "^6.6.1",
|
"@0x/contract-addresses": "^6.7.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||||
"@0x/contracts-erc20": "^3.3.17",
|
"@0x/contracts-erc20": "^3.3.18",
|
||||||
"@0x/contracts-gen": "^2.0.38",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-staking": "^2.0.45",
|
"@0x/contracts-staking": "^2.0.45",
|
||||||
"@0x/contracts-test-utils": "^5.4.9",
|
"@0x/contracts-test-utils": "^5.4.10",
|
||||||
"@0x/sol-compiler": "^4.7.3",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
"@0x/tslint-config": "^4.1.4",
|
"@0x/tslint-config": "^4.1.4",
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.4.0",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/protocol-utils": "^1.8.3",
|
"@0x/protocol-utils": "^1.8.4",
|
||||||
"@0x/subproviders": "^6.5.3",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "4.7.18",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629353596,
|
"timestamp": 1629353596,
|
||||||
"version": "4.7.17",
|
"version": "4.7.17",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v4.7.18 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v4.7.17 - _August 19, 2021_
|
## v4.7.17 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-utils",
|
"name": "@0x/contracts-utils",
|
||||||
"version": "4.7.17",
|
"version": "4.7.18",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.6.0",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contracts-gen": "^2.0.38",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.4.9",
|
"@0x/contracts-test-utils": "^5.4.10",
|
||||||
"@0x/dev-utils": "^4.2.7",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.28",
|
"@0x/order-utils": "^10.4.28",
|
||||||
"@0x/sol-compiler": "^4.7.3",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "0.28.3",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.28.2",
|
"version": "0.28.2",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v0.28.3 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v0.28.2 - _August 19, 2021_
|
## v0.28.2 - _August 19, 2021_
|
||||||
|
|
||||||
* Add ethers as an explicit dependency (#310)
|
* Add ethers as an explicit dependency (#310)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contracts-zero-ex",
|
"name": "@0x/contracts-zero-ex",
|
||||||
"version": "0.28.2",
|
"version": "0.28.3",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -56,10 +56,10 @@
|
|||||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/abi-gen": "^5.6.0",
|
"@0x/abi-gen": "^5.6.0",
|
||||||
"@0x/contract-addresses": "^6.6.1",
|
"@0x/contract-addresses": "^6.7.0",
|
||||||
"@0x/contracts-erc20": "^3.3.17",
|
"@0x/contracts-erc20": "^3.3.18",
|
||||||
"@0x/contracts-gen": "^2.0.38",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.4.9",
|
"@0x/contracts-test-utils": "^5.4.10",
|
||||||
"@0x/dev-utils": "^4.2.7",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/order-utils": "^10.4.28",
|
"@0x/order-utils": "^10.4.28",
|
||||||
"@0x/sol-compiler": "^4.7.3",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.4.0",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/protocol-utils": "^1.8.3",
|
"@0x/protocol-utils": "^1.8.4",
|
||||||
"@0x/subproviders": "^6.5.3",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
"ignoreDependencyVersionsForPackage": "contract-wrappers"
|
"ignoreDependencyVersionsForPackage": "contract-wrappers"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@0x/monorepo-scripts": "^3.1.7",
|
"@0x/monorepo-scripts": "^3.2.0",
|
||||||
"@0x-lerna-fork/lerna": "3.16.10",
|
"@0x-lerna-fork/lerna": "3.16.10",
|
||||||
"@0xproject/npm-cli-login": "^0.0.11",
|
"@0xproject/npm-cli-login": "^0.0.11",
|
||||||
"async-child-process": "^1.1.1",
|
"async-child-process": "^1.1.1",
|
||||||
|
|||||||
@@ -1,4 +1,23 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "16.27.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Avalanche deployment",
|
||||||
|
"pr": 312
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1630459879
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "16.26.2",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "chore: Curve new pools (CVX-CRX, MIM, atricrypto3)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1630393585
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629414734,
|
"timestamp": 1629414734,
|
||||||
"version": "16.26.1",
|
"version": "16.26.1",
|
||||||
|
|||||||
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v16.27.0 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Avalanche deployment (#312)
|
||||||
|
|
||||||
|
## v16.26.2 - _August 31, 2021_
|
||||||
|
|
||||||
|
* chore: Curve new pools (CVX-CRX, MIM, atricrypto3)
|
||||||
|
|
||||||
## v16.26.1 - _August 19, 2021_
|
## v16.26.1 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/asset-swapper",
|
"name": "@0x/asset-swapper",
|
||||||
"version": "16.26.1",
|
"version": "16.27.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -60,13 +60,13 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.27",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/base-contract": "^6.4.0",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contract-addresses": "^6.6.1",
|
"@0x/contract-addresses": "^6.7.0",
|
||||||
"@0x/contract-wrappers": "^13.17.5",
|
"@0x/contract-wrappers": "^13.17.6",
|
||||||
"@0x/contracts-erc20": "^3.3.17",
|
"@0x/contracts-erc20": "^3.3.18",
|
||||||
"@0x/contracts-zero-ex": "^0.27.0",
|
"@0x/contracts-zero-ex": "^0.27.0",
|
||||||
"@0x/dev-utils": "^4.2.7",
|
"@0x/dev-utils": "^4.2.7",
|
||||||
"@0x/json-schemas": "^6.1.3",
|
"@0x/json-schemas": "^6.1.3",
|
||||||
"@0x/protocol-utils": "^1.8.3",
|
"@0x/protocol-utils": "^1.8.4",
|
||||||
"@0x/quote-server": "^6.0.2",
|
"@0x/quote-server": "^6.0.2",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
@@ -97,10 +97,10 @@
|
|||||||
"@0x/contracts-exchange": "^3.2.38",
|
"@0x/contracts-exchange": "^3.2.38",
|
||||||
"@0x/contracts-exchange-libs": "^4.3.37",
|
"@0x/contracts-exchange-libs": "^4.3.37",
|
||||||
"@0x/contracts-gen": "^2.0.38",
|
"@0x/contracts-gen": "^2.0.38",
|
||||||
"@0x/contracts-test-utils": "^5.4.9",
|
"@0x/contracts-test-utils": "^5.4.10",
|
||||||
"@0x/contracts-utils": "^4.7.17",
|
"@0x/contracts-utils": "^4.7.18",
|
||||||
"@0x/mesh-rpc-client": "^9.4.2",
|
"@0x/mesh-rpc-client": "^9.4.2",
|
||||||
"@0x/migrations": "^8.1.3",
|
"@0x/migrations": "^8.1.4",
|
||||||
"@0x/sol-compiler": "^4.7.3",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/subproviders": "^6.5.3",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/ts-doc-gen": "^0.0.28",
|
"@0x/ts-doc-gen": "^0.0.28",
|
||||||
|
|||||||
40
packages/asset-swapper/src/rpc_sampler_client.ts
Normal file
40
packages/asset-swapper/src/rpc_sampler_client.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { Client as RPCClient, JSONRPCVersionOneResponse } from 'jayson';
|
||||||
|
|
||||||
|
import {
|
||||||
|
LiquidityResponse,
|
||||||
|
RpcLiquidityRequest,
|
||||||
|
RPCSamplerCallback,
|
||||||
|
} from './utils/market_operation_utils/sampler_types';
|
||||||
|
|
||||||
|
const RPC_SAMPLER_SERVICE_URL = '';
|
||||||
|
const RPC_SAMPLER_SERVICE_PORT = 7002;
|
||||||
|
export class RpcSamplerClient {
|
||||||
|
private readonly _rpcUrl: string;
|
||||||
|
private readonly _rpcClient: RPCClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rpcUrl URL to the Sampler Service to which JSON RPC requests should be sent
|
||||||
|
*/
|
||||||
|
constructor() {
|
||||||
|
this._rpcUrl = RPC_SAMPLER_SERVICE_URL;
|
||||||
|
this._rpcClient = RPCClient.http({ port: RPC_SAMPLER_SERVICE_PORT });
|
||||||
|
}
|
||||||
|
|
||||||
|
public getSellLiquidity(reqs: RpcLiquidityRequest[], rpcSamplerCallback: RPCSamplerCallback): void {
|
||||||
|
try {
|
||||||
|
this._rpcClient.request(`get_sell_liquidity`, [reqs], (err: any, response: JSONRPCVersionOneResponse) => {
|
||||||
|
return rpcSamplerCallback(err, response.result);
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`error with sampler service: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getSellLiquidityWrapperAsync(reqs: RpcLiquidityRequest[]): Promise<LiquidityResponse[]> {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
this.getSellLiquidity(reqs, (err, liquidityResponses: LiquidityResponse[]) => {
|
||||||
|
return resolve(liquidityResponses);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
import { artifacts } from './artifacts';
|
import { artifacts } from './artifacts';
|
||||||
import { constants, INVALID_SIGNATURE, KEEP_ALIVE_TTL } from './constants';
|
import { constants, INVALID_SIGNATURE, KEEP_ALIVE_TTL } from './constants';
|
||||||
|
import { RpcSamplerClient } from './rpc_sampler_client';
|
||||||
import {
|
import {
|
||||||
AssetSwapperContractAddresses,
|
AssetSwapperContractAddresses,
|
||||||
MarketBuySwapQuote,
|
MarketBuySwapQuote,
|
||||||
@@ -143,6 +144,7 @@ export class SwapQuoter {
|
|||||||
this._marketOperationUtils = new MarketOperationUtils(
|
this._marketOperationUtils = new MarketOperationUtils(
|
||||||
new DexOrderSampler(
|
new DexOrderSampler(
|
||||||
this.chainId,
|
this.chainId,
|
||||||
|
new RpcSamplerClient(),
|
||||||
samplerContract,
|
samplerContract,
|
||||||
samplerOverrides,
|
samplerOverrides,
|
||||||
undefined, // pools caches for balancer and cream
|
undefined, // pools caches for balancer and cream
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import {
|
|||||||
NULL_ADDRESS,
|
NULL_ADDRESS,
|
||||||
PANCAKESWAP_ROUTER_BY_CHAIN_ID,
|
PANCAKESWAP_ROUTER_BY_CHAIN_ID,
|
||||||
PANCAKESWAPV2_ROUTER_BY_CHAIN_ID,
|
PANCAKESWAPV2_ROUTER_BY_CHAIN_ID,
|
||||||
|
PANGOLIN_ROUTER_BY_CHAIN_ID,
|
||||||
POLYDEX_ROUTER_BY_CHAIN_ID,
|
POLYDEX_ROUTER_BY_CHAIN_ID,
|
||||||
QUICKSWAP_ROUTER_BY_CHAIN_ID,
|
QUICKSWAP_ROUTER_BY_CHAIN_ID,
|
||||||
SADDLE_MAINNET_INFOS,
|
SADDLE_MAINNET_INFOS,
|
||||||
@@ -41,6 +42,7 @@ import {
|
|||||||
SNOWSWAP_MAINNET_INFOS,
|
SNOWSWAP_MAINNET_INFOS,
|
||||||
SUSHISWAP_ROUTER_BY_CHAIN_ID,
|
SUSHISWAP_ROUTER_BY_CHAIN_ID,
|
||||||
SWERVE_MAINNET_INFOS,
|
SWERVE_MAINNET_INFOS,
|
||||||
|
TRADER_JOE_ROUTER_BY_CHAIN_ID,
|
||||||
UNISWAPV2_ROUTER_BY_CHAIN_ID,
|
UNISWAPV2_ROUTER_BY_CHAIN_ID,
|
||||||
WAULTSWAP_ROUTER_BY_CHAIN_ID,
|
WAULTSWAP_ROUTER_BY_CHAIN_ID,
|
||||||
XSIGMA_MAINNET_INFOS,
|
XSIGMA_MAINNET_INFOS,
|
||||||
@@ -439,7 +441,9 @@ export function uniswapV2LikeRouterAddress(
|
|||||||
| ERC20BridgeSource.WaultSwap
|
| ERC20BridgeSource.WaultSwap
|
||||||
| ERC20BridgeSource.Polydex
|
| ERC20BridgeSource.Polydex
|
||||||
| ERC20BridgeSource.ShibaSwap
|
| ERC20BridgeSource.ShibaSwap
|
||||||
| ERC20BridgeSource.JetSwap,
|
| ERC20BridgeSource.JetSwap
|
||||||
|
| ERC20BridgeSource.TraderJoe
|
||||||
|
| ERC20BridgeSource.Pangolin,
|
||||||
): string {
|
): string {
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case ERC20BridgeSource.UniswapV2:
|
case ERC20BridgeSource.UniswapV2:
|
||||||
@@ -476,6 +480,10 @@ export function uniswapV2LikeRouterAddress(
|
|||||||
return SHIBASWAP_ROUTER_BY_CHAIN_ID[chainId];
|
return SHIBASWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
case ERC20BridgeSource.JetSwap:
|
case ERC20BridgeSource.JetSwap:
|
||||||
return JETSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
return JETSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.Pangolin:
|
||||||
|
return PANGOLIN_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
|
case ERC20BridgeSource.TraderJoe:
|
||||||
|
return TRADER_JOE_ROUTER_BY_CHAIN_ID[chainId];
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown UniswapV2 like source ${source}`);
|
throw new Error(`Unknown UniswapV2 like source ${source}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ function valueByChainId<T>(rest: Partial<{ [key in ChainId]: T }>, defaultValue:
|
|||||||
[ChainId.BSC]: defaultValue,
|
[ChainId.BSC]: defaultValue,
|
||||||
[ChainId.Polygon]: defaultValue,
|
[ChainId.Polygon]: defaultValue,
|
||||||
[ChainId.PolygonMumbai]: defaultValue,
|
[ChainId.PolygonMumbai]: defaultValue,
|
||||||
|
[ChainId.Avalanche]: defaultValue,
|
||||||
...(rest || {}),
|
...(rest || {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -157,6 +158,12 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
|||||||
ERC20BridgeSource.JetSwap,
|
ERC20BridgeSource.JetSwap,
|
||||||
ERC20BridgeSource.IronSwap,
|
ERC20BridgeSource.IronSwap,
|
||||||
]),
|
]),
|
||||||
|
[ChainId.Avalanche]: new SourceFilters([
|
||||||
|
ERC20BridgeSource.MultiHop,
|
||||||
|
ERC20BridgeSource.Pangolin,
|
||||||
|
ERC20BridgeSource.TraderJoe,
|
||||||
|
ERC20BridgeSource.SushiSwap,
|
||||||
|
]),
|
||||||
},
|
},
|
||||||
new SourceFilters([]),
|
new SourceFilters([]),
|
||||||
);
|
);
|
||||||
@@ -258,6 +265,12 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
|||||||
ERC20BridgeSource.JetSwap,
|
ERC20BridgeSource.JetSwap,
|
||||||
ERC20BridgeSource.IronSwap,
|
ERC20BridgeSource.IronSwap,
|
||||||
]),
|
]),
|
||||||
|
[ChainId.Avalanche]: new SourceFilters([
|
||||||
|
ERC20BridgeSource.MultiHop,
|
||||||
|
ERC20BridgeSource.Pangolin,
|
||||||
|
ERC20BridgeSource.TraderJoe,
|
||||||
|
ERC20BridgeSource.SushiSwap,
|
||||||
|
]),
|
||||||
},
|
},
|
||||||
new SourceFilters([]),
|
new SourceFilters([]),
|
||||||
);
|
);
|
||||||
@@ -276,6 +289,7 @@ export const FEE_QUOTE_SOURCES_BY_CHAIN_ID = valueByChainId<ERC20BridgeSource[]>
|
|||||||
[ChainId.BSC]: [ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.Mooniswap, ERC20BridgeSource.SushiSwap],
|
[ChainId.BSC]: [ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.Mooniswap, ERC20BridgeSource.SushiSwap],
|
||||||
[ChainId.Ropsten]: [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap],
|
[ChainId.Ropsten]: [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap],
|
||||||
[ChainId.Polygon]: [ERC20BridgeSource.QuickSwap, ERC20BridgeSource.SushiSwap],
|
[ChainId.Polygon]: [ERC20BridgeSource.QuickSwap, ERC20BridgeSource.SushiSwap],
|
||||||
|
[ChainId.Avalanche]: [ERC20BridgeSource.Pangolin, ERC20BridgeSource.TraderJoe, ERC20BridgeSource.SushiSwap],
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -379,6 +393,8 @@ export const MAINNET_TOKENS = {
|
|||||||
ESS: '0x24ae124c4cc33d6791f8e8b63520ed7107ac8b3e',
|
ESS: '0x24ae124c4cc33d6791f8e8b63520ed7107ac8b3e',
|
||||||
cvxCRV: '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7',
|
cvxCRV: '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7',
|
||||||
CRV: '0xd533a949740bb3306d119cc777fa900ba034cd52',
|
CRV: '0xd533a949740bb3306d119cc777fa900ba034cd52',
|
||||||
|
MIM: '0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3',
|
||||||
|
EURT: '0xc581b735a1688071a1746c968e0798d642ede491',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const BSC_TOKENS = {
|
export const BSC_TOKENS = {
|
||||||
@@ -414,6 +430,13 @@ export const POLYGON_TOKENS = {
|
|||||||
WEXPOLY: '0x4c4bf319237d98a30a929a96112effa8da3510eb',
|
WEXPOLY: '0x4c4bf319237d98a30a929a96112effa8da3510eb',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const AVALANCHE_TOKENS = {
|
||||||
|
WAVAX: '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
|
||||||
|
WETH: '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab',
|
||||||
|
USDT: '0xc7198437980c041c805a1edcba50c1ce5db95118',
|
||||||
|
DAI: '0xd586e7f844cea2f87f50152665bcbc2c279d8d70',
|
||||||
|
};
|
||||||
|
|
||||||
export const CURVE_POOLS = {
|
export const CURVE_POOLS = {
|
||||||
compound: '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56', // 0.Compound
|
compound: '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56', // 0.Compound
|
||||||
// 1.USDT is dead
|
// 1.USDT is dead
|
||||||
@@ -455,6 +478,9 @@ export const CURVE_POOLS = {
|
|||||||
LUSD: '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca',
|
LUSD: '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca',
|
||||||
BUSD: '0x4807862aa8b2bf68830e4c8dc86d0e9a998e085a',
|
BUSD: '0x4807862aa8b2bf68830e4c8dc86d0e9a998e085a',
|
||||||
DSU3CRV: '0x6ec80df362d7042c50d4469bcfbc174c9dd9109a',
|
DSU3CRV: '0x6ec80df362d7042c50d4469bcfbc174c9dd9109a',
|
||||||
|
cvxcrv: '0x9d0464996170c6b9e75eed71c68b99ddedf279e8',
|
||||||
|
mim: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b',
|
||||||
|
eurt: '0xfd5db7463a3ab53fd211b4af195c5bccc1a03890',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CURVE_V2_POOLS = {
|
export const CURVE_V2_POOLS = {
|
||||||
@@ -469,6 +495,7 @@ export const CURVE_POLYGON_POOLS = {
|
|||||||
|
|
||||||
export const CURVE_V2_POLYGON_POOLS = {
|
export const CURVE_V2_POLYGON_POOLS = {
|
||||||
atricrypto: '0x3fcd5de6a9fc8a99995c406c77dda3ed7e406f81',
|
atricrypto: '0x3fcd5de6a9fc8a99995c406c77dda3ed7e406f81',
|
||||||
|
atricrypto3: '0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SWERVE_POOLS = {
|
export const SWERVE_POOLS = {
|
||||||
@@ -563,6 +590,12 @@ export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId<string[]>(
|
|||||||
POLYGON_TOKENS.USDT,
|
POLYGON_TOKENS.USDT,
|
||||||
POLYGON_TOKENS.WBTC,
|
POLYGON_TOKENS.WBTC,
|
||||||
],
|
],
|
||||||
|
[ChainId.Avalanche]: [
|
||||||
|
AVALANCHE_TOKENS.WAVAX,
|
||||||
|
AVALANCHE_TOKENS.WETH,
|
||||||
|
AVALANCHE_TOKENS.DAI,
|
||||||
|
AVALANCHE_TOKENS.USDT,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -576,10 +609,7 @@ export const DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID = valueByChainId<TokenAdj
|
|||||||
})
|
})
|
||||||
.tap(builder => {
|
.tap(builder => {
|
||||||
// Mirror Protocol
|
// Mirror Protocol
|
||||||
builder
|
builder.add(MAINNET_TOKENS.MIR, MAINNET_TOKENS.UST);
|
||||||
.add(MAINNET_TOKENS.MIR, MAINNET_TOKENS.UST)
|
|
||||||
.add(MAINNET_TOKENS.UST, [MAINNET_TOKENS.MIR, ...Object.values(MIRROR_WRAPPED_TOKENS)]);
|
|
||||||
Object.values(MIRROR_WRAPPED_TOKENS).forEach(t => builder.add(t, MAINNET_TOKENS.UST));
|
|
||||||
// Convex and Curve
|
// Convex and Curve
|
||||||
builder.add(MAINNET_TOKENS.cvxCRV, MAINNET_TOKENS.CRV).add(MAINNET_TOKENS.CRV, MAINNET_TOKENS.cvxCRV);
|
builder.add(MAINNET_TOKENS.cvxCRV, MAINNET_TOKENS.CRV).add(MAINNET_TOKENS.CRV, MAINNET_TOKENS.cvxCRV);
|
||||||
})
|
})
|
||||||
@@ -591,6 +621,9 @@ export const DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID = valueByChainId<TokenAdj
|
|||||||
[ChainId.Polygon]: new TokenAdjacencyGraphBuilder({
|
[ChainId.Polygon]: new TokenAdjacencyGraphBuilder({
|
||||||
default: DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Polygon],
|
default: DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Polygon],
|
||||||
}).build(),
|
}).build(),
|
||||||
|
[ChainId.Avalanche]: new TokenAdjacencyGraphBuilder({
|
||||||
|
default: DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Avalanche],
|
||||||
|
}).build(),
|
||||||
},
|
},
|
||||||
new TokenAdjacencyGraphBuilder({ default: [] }).build(),
|
new TokenAdjacencyGraphBuilder({ default: [] }).build(),
|
||||||
);
|
);
|
||||||
@@ -604,6 +637,7 @@ export const NATIVE_FEE_TOKEN_BY_CHAIN_ID = valueByChainId<string>(
|
|||||||
[ChainId.Rinkeby]: getContractAddressesForChainOrThrow(ChainId.Rinkeby).etherToken,
|
[ChainId.Rinkeby]: getContractAddressesForChainOrThrow(ChainId.Rinkeby).etherToken,
|
||||||
[ChainId.Kovan]: getContractAddressesForChainOrThrow(ChainId.Kovan).etherToken,
|
[ChainId.Kovan]: getContractAddressesForChainOrThrow(ChainId.Kovan).etherToken,
|
||||||
[ChainId.Polygon]: getContractAddressesForChainOrThrow(ChainId.Polygon).etherToken,
|
[ChainId.Polygon]: getContractAddressesForChainOrThrow(ChainId.Polygon).etherToken,
|
||||||
|
[ChainId.Avalanche]: getContractAddressesForChainOrThrow(ChainId.Avalanche).etherToken,
|
||||||
},
|
},
|
||||||
NULL_ADDRESS,
|
NULL_ADDRESS,
|
||||||
);
|
);
|
||||||
@@ -775,6 +809,11 @@ export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
|||||||
pool: CURVE_POOLS.eurs,
|
pool: CURVE_POOLS.eurs,
|
||||||
gasSchedule: 320e3,
|
gasSchedule: 320e3,
|
||||||
}),
|
}),
|
||||||
|
[CURVE_POOLS.eurt]: createCurveExchangePool({
|
||||||
|
tokens: [MAINNET_TOKENS.EURT, MAINNET_TOKENS.sEUR],
|
||||||
|
pool: CURVE_POOLS.eurt,
|
||||||
|
gasSchedule: 320e3,
|
||||||
|
}),
|
||||||
[CURVE_POOLS.aave]: createCurveExchangeUnderlyingPool({
|
[CURVE_POOLS.aave]: createCurveExchangeUnderlyingPool({
|
||||||
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
|
tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
|
||||||
pool: CURVE_POOLS.aave,
|
pool: CURVE_POOLS.aave,
|
||||||
@@ -863,6 +902,16 @@ export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
|||||||
pool: CURVE_POOLS.DSU3CRV,
|
pool: CURVE_POOLS.DSU3CRV,
|
||||||
gasSchedule: 387e3,
|
gasSchedule: 387e3,
|
||||||
}),
|
}),
|
||||||
|
[CURVE_POOLS.mim]: createCurveMetaTriPool({
|
||||||
|
tokens: [MAINNET_TOKENS.MIM],
|
||||||
|
pool: CURVE_POOLS.mim,
|
||||||
|
gasSchedule: 300e3,
|
||||||
|
}),
|
||||||
|
[CURVE_POOLS.cvxcrv]: createCurveExchangePool({
|
||||||
|
tokens: [MAINNET_TOKENS.CRV, MAINNET_TOKENS.cvxCRV],
|
||||||
|
pool: CURVE_POOLS.cvxcrv,
|
||||||
|
gasSchedule: 105e3,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CURVE_V2_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
export const CURVE_V2_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||||
@@ -902,6 +951,11 @@ export const CURVE_V2_POLYGON_INFOS: { [name: string]: CurveInfo } = {
|
|||||||
pool: CURVE_V2_POLYGON_POOLS.atricrypto,
|
pool: CURVE_V2_POLYGON_POOLS.atricrypto,
|
||||||
gasSchedule: 300e3,
|
gasSchedule: 300e3,
|
||||||
}),
|
}),
|
||||||
|
[CURVE_V2_POLYGON_POOLS.atricrypto3]: createCurveV2MetaTriPool({
|
||||||
|
tokens: [POLYGON_TOKENS.WBTC, POLYGON_TOKENS.WETH],
|
||||||
|
pool: CURVE_V2_POLYGON_POOLS.atricrypto3,
|
||||||
|
gasSchedule: 300e3,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SWERVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
export const SWERVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||||
@@ -1196,6 +1250,7 @@ export const SUSHISWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
|||||||
[ChainId.BSC]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
[ChainId.BSC]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||||
[ChainId.Ropsten]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
[ChainId.Ropsten]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||||
[ChainId.Polygon]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
[ChainId.Polygon]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||||
|
[ChainId.Avalanche]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||||
},
|
},
|
||||||
NULL_ADDRESS,
|
NULL_ADDRESS,
|
||||||
);
|
);
|
||||||
@@ -1568,6 +1623,20 @@ export const JETSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
|||||||
NULL_ADDRESS,
|
NULL_ADDRESS,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const PANGOLIN_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||||
|
{
|
||||||
|
[ChainId.Avalanche]: '0xe54ca86531e17ef3616d22ca28b0d458b6c89106',
|
||||||
|
},
|
||||||
|
NULL_ADDRESS,
|
||||||
|
);
|
||||||
|
|
||||||
|
export const TRADER_JOE_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||||
|
{
|
||||||
|
[ChainId.Avalanche]: '0x60ae616a2155ee3d9a68541ba4544862310933d4',
|
||||||
|
},
|
||||||
|
NULL_ADDRESS,
|
||||||
|
);
|
||||||
|
|
||||||
const uniswapV2CloneGasSchedule = (fillData?: FillData) => {
|
const uniswapV2CloneGasSchedule = (fillData?: FillData) => {
|
||||||
// TODO: Different base cost if to/from ETH.
|
// TODO: Different base cost if to/from ETH.
|
||||||
let gas = 90e3;
|
let gas = 90e3;
|
||||||
@@ -1696,6 +1765,12 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
|
|||||||
[ERC20BridgeSource.Dfyn]: uniswapV2CloneGasSchedule,
|
[ERC20BridgeSource.Dfyn]: uniswapV2CloneGasSchedule,
|
||||||
[ERC20BridgeSource.Polydex]: uniswapV2CloneGasSchedule,
|
[ERC20BridgeSource.Polydex]: uniswapV2CloneGasSchedule,
|
||||||
[ERC20BridgeSource.JetSwap]: uniswapV2CloneGasSchedule,
|
[ERC20BridgeSource.JetSwap]: uniswapV2CloneGasSchedule,
|
||||||
|
|
||||||
|
//
|
||||||
|
// Avalanche
|
||||||
|
//
|
||||||
|
[ERC20BridgeSource.Pangolin]: uniswapV2CloneGasSchedule,
|
||||||
|
[ERC20BridgeSource.TraderJoe]: uniswapV2CloneGasSchedule,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DEFAULT_FEE_SCHEDULE: Required<FeeSchedule> = { ...DEFAULT_GAS_SCHEDULE };
|
export const DEFAULT_FEE_SCHEDULE: Required<FeeSchedule> = { ...DEFAULT_GAS_SCHEDULE };
|
||||||
|
|||||||
@@ -124,90 +124,90 @@ export class MarketOperationUtils {
|
|||||||
): Promise<MarketSideLiquidity> {
|
): Promise<MarketSideLiquidity> {
|
||||||
const _opts = { ...DEFAULT_GET_MARKET_ORDERS_OPTS, ...opts };
|
const _opts = { ...DEFAULT_GET_MARKET_ORDERS_OPTS, ...opts };
|
||||||
const { makerToken, takerToken } = nativeOrders[0].order;
|
const { makerToken, takerToken } = nativeOrders[0].order;
|
||||||
const sampleAmounts = getSampleAmounts(takerAmount, _opts.numSamples, _opts.sampleDistributionBase);
|
// const sampleAmounts = getSampleAmounts(takerAmount, _opts.numSamples, _opts.sampleDistributionBase);
|
||||||
|
|
||||||
const requestFilters = new SourceFilters().exclude(_opts.excludedSources).include(_opts.includedSources);
|
const requestFilters = new SourceFilters().exclude(_opts.excludedSources).include(_opts.includedSources);
|
||||||
const quoteSourceFilters = this._sellSources.merge(requestFilters);
|
const quoteSourceFilters = this._sellSources.merge(requestFilters);
|
||||||
const feeSourceFilters = this._feeSources.exclude(_opts.excludedFeeSources);
|
const feeSourceFilters = this._feeSources.exclude(_opts.excludedFeeSources);
|
||||||
|
|
||||||
// Used to determine whether the tx origin is an EOA or a contract
|
// Used to determine whether the tx origin is an EOA or a contract
|
||||||
const txOrigin = (_opts.rfqt && _opts.rfqt.txOrigin) || NULL_ADDRESS;
|
// const txOrigin = (_opts.rfqt && _opts.rfqt.txOrigin) || NULL_ADDRESS;
|
||||||
|
|
||||||
|
const sellQuotes = this._sampler.getCachedSellQuotesAsync(quoteSourceFilters.sources, makerToken, takerToken, takerAmount);
|
||||||
|
|
||||||
// Call the sampler contract.
|
// Call the sampler contract.
|
||||||
const samplerPromise = this._sampler.executeAsync(
|
// const samplerPromise = this._sampler.executeAsync(
|
||||||
this._sampler.getTokenDecimals([makerToken, takerToken]),
|
// // this._sampler.getTokenDecimals([makerToken, takerToken]),
|
||||||
// Get native order fillable amounts.
|
// // // Get native order fillable amounts.
|
||||||
this._sampler.getLimitOrderFillableTakerAmounts(nativeOrders, this.contractAddresses.exchangeProxy),
|
// // this._sampler.getLimitOrderFillableTakerAmounts(nativeOrders, this.contractAddresses.exchangeProxy),
|
||||||
// Get ETH -> maker token price.
|
// // // Get ETH -> maker token price.
|
||||||
this._sampler.getMedianSellRate(
|
// // this._sampler.getMedianSellRate(
|
||||||
feeSourceFilters.sources,
|
// // feeSourceFilters.sources,
|
||||||
makerToken,
|
// // makerToken,
|
||||||
this._nativeFeeToken,
|
// // this._nativeFeeToken,
|
||||||
this._nativeFeeTokenAmount,
|
// // this._nativeFeeTokenAmount,
|
||||||
),
|
// // ),
|
||||||
// Get ETH -> taker token price.
|
// // // Get ETH -> taker token price.
|
||||||
this._sampler.getMedianSellRate(
|
// // this._sampler.getMedianSellRate(
|
||||||
feeSourceFilters.sources,
|
// // feeSourceFilters.sources,
|
||||||
takerToken,
|
// // takerToken,
|
||||||
this._nativeFeeToken,
|
// // this._nativeFeeToken,
|
||||||
this._nativeFeeTokenAmount,
|
// // this._nativeFeeTokenAmount,
|
||||||
),
|
// // ),
|
||||||
// Get sell quotes for taker -> maker.
|
// // Get sell quotes for taker -> maker.
|
||||||
this._sampler.getSellQuotes(quoteSourceFilters.sources, makerToken, takerToken, sampleAmounts),
|
// this._sampler.getCachedSellQuotesAsync(quoteSourceFilters.sources, makerToken, takerToken, takerAmount),
|
||||||
this._sampler.getTwoHopSellQuotes(
|
// // this._sampler.getTwoHopSellQuotes(
|
||||||
quoteSourceFilters.isAllowed(ERC20BridgeSource.MultiHop) ? quoteSourceFilters.sources : [],
|
// // quoteSourceFilters.isAllowed(ERC20BridgeSource.MultiHop) ? quoteSourceFilters.sources : [],
|
||||||
makerToken,
|
// // makerToken,
|
||||||
takerToken,
|
// // takerToken,
|
||||||
takerAmount,
|
// // takerAmount,
|
||||||
),
|
// // ),
|
||||||
this._sampler.isAddressContract(txOrigin),
|
// // this._sampler.isAddressContract(txOrigin),
|
||||||
);
|
// );
|
||||||
|
|
||||||
// Refresh the cached pools asynchronously if required
|
// Refresh the cached pools asynchronously if required
|
||||||
void this._refreshPoolCacheIfRequiredAsync(takerToken, makerToken);
|
// void this._refreshPoolCacheIfRequiredAsync(takerToken, makerToken);
|
||||||
|
|
||||||
const [
|
const [
|
||||||
[
|
// tokenDecimals,
|
||||||
tokenDecimals,
|
// orderFillableTakerAmounts,
|
||||||
orderFillableTakerAmounts,
|
// outputAmountPerEth,
|
||||||
outputAmountPerEth,
|
// inputAmountPerEth,
|
||||||
inputAmountPerEth,
|
|
||||||
dexQuotes,
|
dexQuotes,
|
||||||
rawTwoHopQuotes,
|
// rawTwoHopQuotes,
|
||||||
isTxOriginContract,
|
// isTxOriginContract,
|
||||||
],
|
] = await Promise.all([sellQuotes]);
|
||||||
] = await Promise.all([samplerPromise]);
|
|
||||||
|
|
||||||
// Filter out any invalid two hop quotes where we couldn't find a route
|
// Filter out any invalid two hop quotes where we couldn't find a route
|
||||||
const twoHopQuotes = rawTwoHopQuotes.filter(
|
// const twoHopQuotes = rawTwoHopQuotes.filter(
|
||||||
q => q && q.fillData && q.fillData.firstHopSource && q.fillData.secondHopSource,
|
// q => q && q.fillData && q.fillData.firstHopSource && q.fillData.secondHopSource,
|
||||||
);
|
// );
|
||||||
|
|
||||||
const [makerTokenDecimals, takerTokenDecimals] = tokenDecimals;
|
// const [makerTokenDecimals, takerTokenDecimals] = tokenDecimals;
|
||||||
|
|
||||||
const isRfqSupported = !!(_opts.rfqt && !isTxOriginContract);
|
// const isRfqSupported = !!(_opts.rfqt && !isTxOriginContract);
|
||||||
const limitOrdersWithFillableAmounts = nativeOrders.map((order, i) => ({
|
// const limitOrdersWithFillableAmounts = nativeOrders.map((order, i) => ({
|
||||||
...order,
|
// ...order,
|
||||||
...getNativeAdjustedFillableAmountsFromTakerAmount(order, orderFillableTakerAmounts[i]),
|
// ...getNativeAdjustedFillableAmountsFromTakerAmount(order, orderFillableTakerAmounts[i]),
|
||||||
}));
|
// }));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
side: MarketOperation.Sell,
|
side: MarketOperation.Sell,
|
||||||
inputAmount: takerAmount,
|
inputAmount: takerAmount,
|
||||||
inputToken: takerToken,
|
inputToken: takerToken,
|
||||||
outputToken: makerToken,
|
outputToken: makerToken,
|
||||||
outputAmountPerEth,
|
outputAmountPerEth: new BigNumber(1),
|
||||||
inputAmountPerEth,
|
inputAmountPerEth: new BigNumber(1),
|
||||||
quoteSourceFilters,
|
quoteSourceFilters,
|
||||||
makerTokenDecimals: makerTokenDecimals.toNumber(),
|
makerTokenDecimals: 18,
|
||||||
takerTokenDecimals: takerTokenDecimals.toNumber(),
|
takerTokenDecimals: 18,
|
||||||
quotes: {
|
quotes: {
|
||||||
nativeOrders: limitOrdersWithFillableAmounts,
|
nativeOrders: [],
|
||||||
rfqtIndicativeQuotes: [],
|
rfqtIndicativeQuotes: [],
|
||||||
twoHopQuotes,
|
twoHopQuotes: [],
|
||||||
dexQuotes,
|
dexQuotes,
|
||||||
},
|
},
|
||||||
isRfqSupported,
|
isRfqSupported: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
|
|||||||
return encodeBridgeSourceId(BridgeProtocol.Curve, 'ACryptoS');
|
return encodeBridgeSourceId(BridgeProtocol.Curve, 'ACryptoS');
|
||||||
case ERC20BridgeSource.Clipper:
|
case ERC20BridgeSource.Clipper:
|
||||||
return encodeBridgeSourceId(BridgeProtocol.Clipper, 'Clipper');
|
return encodeBridgeSourceId(BridgeProtocol.Clipper, 'Clipper');
|
||||||
|
case ERC20BridgeSource.Pangolin:
|
||||||
|
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'Pangolin');
|
||||||
|
case ERC20BridgeSource.TraderJoe:
|
||||||
|
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'TraderJoe');
|
||||||
default:
|
default:
|
||||||
throw new Error(AggregationError.NoBridgeForSource);
|
throw new Error(AggregationError.NoBridgeForSource);
|
||||||
}
|
}
|
||||||
@@ -256,6 +260,8 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
|
|||||||
case ERC20BridgeSource.Polydex:
|
case ERC20BridgeSource.Polydex:
|
||||||
case ERC20BridgeSource.ShibaSwap:
|
case ERC20BridgeSource.ShibaSwap:
|
||||||
case ERC20BridgeSource.JetSwap:
|
case ERC20BridgeSource.JetSwap:
|
||||||
|
case ERC20BridgeSource.Pangolin:
|
||||||
|
case ERC20BridgeSource.TraderJoe:
|
||||||
const uniswapV2FillData = (order as OptimizedMarketBridgeOrder<UniswapV2FillData>).fillData;
|
const uniswapV2FillData = (order as OptimizedMarketBridgeOrder<UniswapV2FillData>).fillData;
|
||||||
bridgeData = encoder.encode([uniswapV2FillData.router, uniswapV2FillData.tokenAddressPath]);
|
bridgeData = encoder.encode([uniswapV2FillData.router, uniswapV2FillData.tokenAddressPath]);
|
||||||
break;
|
break;
|
||||||
@@ -448,6 +454,8 @@ export const BRIDGE_ENCODERS: {
|
|||||||
[ERC20BridgeSource.CryptoCom]: routerAddressPathEncoder,
|
[ERC20BridgeSource.CryptoCom]: routerAddressPathEncoder,
|
||||||
[ERC20BridgeSource.Linkswap]: routerAddressPathEncoder,
|
[ERC20BridgeSource.Linkswap]: routerAddressPathEncoder,
|
||||||
[ERC20BridgeSource.ShibaSwap]: routerAddressPathEncoder,
|
[ERC20BridgeSource.ShibaSwap]: routerAddressPathEncoder,
|
||||||
|
[ERC20BridgeSource.Pangolin]: routerAddressPathEncoder,
|
||||||
|
[ERC20BridgeSource.TraderJoe]: routerAddressPathEncoder,
|
||||||
// BSC
|
// BSC
|
||||||
[ERC20BridgeSource.PancakeSwap]: routerAddressPathEncoder,
|
[ERC20BridgeSource.PancakeSwap]: routerAddressPathEncoder,
|
||||||
[ERC20BridgeSource.PancakeSwapV2]: routerAddressPathEncoder,
|
[ERC20BridgeSource.PancakeSwapV2]: routerAddressPathEncoder,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { ChainId } from '@0x/contract-addresses';
|
import { ChainId } from '@0x/contract-addresses';
|
||||||
import { BigNumber, NULL_BYTES } from '@0x/utils';
|
import { BigNumber, NULL_BYTES } from '@0x/utils';
|
||||||
|
import { RpcSamplerClient } from '../../rpc_sampler_client';
|
||||||
|
|
||||||
import { SamplerOverrides } from '../../types';
|
import { SamplerOverrides } from '../../types';
|
||||||
import { ERC20BridgeSamplerContract } from '../../wrappers';
|
import { ERC20BridgeSamplerContract } from '../../wrappers';
|
||||||
@@ -34,6 +35,7 @@ type BatchedOperationResult<T> = T extends BatchedOperation<infer TResult> ? TRe
|
|||||||
export class DexOrderSampler extends SamplerOperations {
|
export class DexOrderSampler extends SamplerOperations {
|
||||||
constructor(
|
constructor(
|
||||||
public readonly chainId: ChainId,
|
public readonly chainId: ChainId,
|
||||||
|
rpcSamplerClient: RpcSamplerClient,
|
||||||
_samplerContract: ERC20BridgeSamplerContract,
|
_samplerContract: ERC20BridgeSamplerContract,
|
||||||
private readonly _samplerOverrides?: SamplerOverrides,
|
private readonly _samplerOverrides?: SamplerOverrides,
|
||||||
poolsCaches?: { [key in ERC20BridgeSource]: PoolsCache },
|
poolsCaches?: { [key in ERC20BridgeSource]: PoolsCache },
|
||||||
@@ -41,7 +43,7 @@ export class DexOrderSampler extends SamplerOperations {
|
|||||||
liquidityProviderRegistry?: LiquidityProviderRegistry,
|
liquidityProviderRegistry?: LiquidityProviderRegistry,
|
||||||
bancorServiceFn: () => Promise<BancorService | undefined> = async () => undefined,
|
bancorServiceFn: () => Promise<BancorService | undefined> = async () => undefined,
|
||||||
) {
|
) {
|
||||||
super(chainId, _samplerContract, poolsCaches, tokenAdjacencyGraph, liquidityProviderRegistry, bancorServiceFn);
|
super(chainId, rpcSamplerClient, _samplerContract, poolsCaches, tokenAdjacencyGraph, liquidityProviderRegistry, bancorServiceFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Type overloads for `executeAsync()`. Could skip this if we would upgrade TS. */
|
/* Type overloads for `executeAsync()`. Could skip this if we would upgrade TS. */
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { LimitOrderFields } from '@0x/protocol-utils';
|
|||||||
import { BigNumber, logUtils } from '@0x/utils';
|
import { BigNumber, logUtils } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { RpcSamplerClient } from '../../rpc_sampler_client';
|
||||||
import { SamplerCallResult, SignedNativeOrder } from '../../types';
|
import { SamplerCallResult, SignedNativeOrder } from '../../types';
|
||||||
import { ERC20BridgeSamplerContract } from '../../wrappers';
|
import { ERC20BridgeSamplerContract } from '../../wrappers';
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ import { getLiquidityProvidersForPair } from './liquidity_provider_utils';
|
|||||||
import { getIntermediateTokens } from './multihop_utils';
|
import { getIntermediateTokens } from './multihop_utils';
|
||||||
import { BalancerPoolsCache, BalancerV2PoolsCache, CreamPoolsCache, PoolsCache } from './pools_cache';
|
import { BalancerPoolsCache, BalancerV2PoolsCache, CreamPoolsCache, PoolsCache } from './pools_cache';
|
||||||
import { SamplerContractOperation } from './sampler_contract_operation';
|
import { SamplerContractOperation } from './sampler_contract_operation';
|
||||||
|
import { Address, LiquidityResponse, RpcLiquidityRequest } from './sampler_types';
|
||||||
import { SourceFilters } from './source_filters';
|
import { SourceFilters } from './source_filters';
|
||||||
import {
|
import {
|
||||||
BalancerFillData,
|
BalancerFillData,
|
||||||
@@ -56,6 +58,7 @@ import {
|
|||||||
DexSample,
|
DexSample,
|
||||||
DODOFillData,
|
DODOFillData,
|
||||||
ERC20BridgeSource,
|
ERC20BridgeSource,
|
||||||
|
FillData,
|
||||||
GenericRouterFillData,
|
GenericRouterFillData,
|
||||||
HopInfo,
|
HopInfo,
|
||||||
KyberDmmFillData,
|
KyberDmmFillData,
|
||||||
@@ -95,6 +98,8 @@ export const BATCH_SOURCE_FILTERS = SourceFilters.all().exclude([ERC20BridgeSour
|
|||||||
* Composable operations that can be batched in a single transaction,
|
* Composable operations that can be batched in a single transaction,
|
||||||
* for use with `DexOrderSampler.executeAsync()`.
|
* for use with `DexOrderSampler.executeAsync()`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export declare type JSONRPCQuoteCallback = (err: Error | null, dexQuotes: Array<Array<DexSample<FillData>>>) => void;
|
||||||
export class SamplerOperations {
|
export class SamplerOperations {
|
||||||
public readonly liquidityProviderRegistry: LiquidityProviderRegistry;
|
public readonly liquidityProviderRegistry: LiquidityProviderRegistry;
|
||||||
public readonly poolsCaches: { [key in SourcesWithPoolsCache]: PoolsCache };
|
public readonly poolsCaches: { [key in SourcesWithPoolsCache]: PoolsCache };
|
||||||
@@ -109,6 +114,7 @@ export class SamplerOperations {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public readonly chainId: ChainId,
|
public readonly chainId: ChainId,
|
||||||
|
protected readonly rpcSamplerClient: RpcSamplerClient,
|
||||||
protected readonly _samplerContract: ERC20BridgeSamplerContract,
|
protected readonly _samplerContract: ERC20BridgeSamplerContract,
|
||||||
poolsCaches?: { [key in SourcesWithPoolsCache]: PoolsCache },
|
poolsCaches?: { [key in SourcesWithPoolsCache]: PoolsCache },
|
||||||
protected readonly tokenAdjacencyGraph: TokenAdjacencyGraph = { default: [] },
|
protected readonly tokenAdjacencyGraph: TokenAdjacencyGraph = { default: [] },
|
||||||
@@ -130,8 +136,101 @@ export class SamplerOperations {
|
|||||||
bancorServiceFn()
|
bancorServiceFn()
|
||||||
.then(service => (this._bancorService = service))
|
.then(service => (this._bancorService = service))
|
||||||
.catch(/* do nothing */);
|
.catch(/* do nothing */);
|
||||||
|
this.rpcSamplerClient = new RpcSamplerClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getTokenDecimalsAsync(tokens: Address[]): Promise<number[]> {
|
||||||
|
return [];
|
||||||
|
// return (await this.rpcSamplerClient.getTokensAsync(tokens)).map(t => t.decimals);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getCachedSellQuotesAsync(
|
||||||
|
sources: ERC20BridgeSource[],
|
||||||
|
makerToken: string,
|
||||||
|
takerToken: string,
|
||||||
|
takerAmount: BigNumber,
|
||||||
|
// callback: JSONRPCQuoteCallback,
|
||||||
|
): Promise<Array<Array<DexSample<FillData>>>> {
|
||||||
|
// ): Promise<void> {
|
||||||
|
const rpcLiquidityRequests: RpcLiquidityRequest[] = sources.map(source => {
|
||||||
|
return {
|
||||||
|
tokenPath: [makerToken, takerToken],
|
||||||
|
inputAmount: takerAmount.toString(),
|
||||||
|
source,
|
||||||
|
demand: true,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const liquidityResponses: LiquidityResponse[] = await this.rpcSamplerClient.getSellLiquidityWrapperAsync(rpcLiquidityRequests);
|
||||||
|
const dexQuotes: Array<Array<DexSample<FillData>>> = liquidityResponses.map((liquidityResponse: LiquidityResponse) => {
|
||||||
|
const dexSample: Array<DexSample<FillData>> = liquidityResponse.liquidityCurves.map((point, j) => {
|
||||||
|
const fillData: DexSample = {
|
||||||
|
source: liquidityResponse.source,
|
||||||
|
fillData: point[j].encodedFillData,
|
||||||
|
input: new BigNumber(point[j].sellAmount.toString()), // TODO Romain: prob a better way
|
||||||
|
output: new BigNumber(point[j].buyAmount.toString()),
|
||||||
|
// gasCost: new BigNumber(point[j].gasCost.toString()),
|
||||||
|
};
|
||||||
|
return fillData;
|
||||||
|
});
|
||||||
|
return dexSample;
|
||||||
|
});
|
||||||
|
return dexQuotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getBuyQuotesAsync(
|
||||||
|
sources: ERC20BridgeSource[],
|
||||||
|
makerToken: string,
|
||||||
|
takerToken: string,
|
||||||
|
takerAmount: BigNumber,
|
||||||
|
): Promise<Array<Array<DexSample<FillData>>>> {
|
||||||
|
return [];
|
||||||
|
// const rpcLiquidityRequests: RpcLiquidityRequest[] = sources.map(source => {
|
||||||
|
// return {
|
||||||
|
// tokenPath: [makerToken, takerToken],
|
||||||
|
// inputAmount: takerAmount.toString(),
|
||||||
|
// source,
|
||||||
|
// demand: true,
|
||||||
|
// };
|
||||||
|
// });
|
||||||
|
// const rpcLiquidityResponse = await this.rpcSamplerClient.getBuyLiquidityAsync(rpcLiquidityRequests);
|
||||||
|
// const dexQuotes: Array<Array<DexSample<FillData>>> = rpcLiquidityResponse.map((response, i) => {
|
||||||
|
// const dexSample: Array<DexSample<FillData>> = response.liquidityCurve.map((point, j) => {
|
||||||
|
// const fillData: DexSample = {
|
||||||
|
// source: sources[i],
|
||||||
|
// fillData: point.encodedFillData,
|
||||||
|
// input: point.sellAmount,
|
||||||
|
// output: point.buyAmount,
|
||||||
|
// };
|
||||||
|
// return fillData;
|
||||||
|
// });
|
||||||
|
// return dexSample;
|
||||||
|
// });
|
||||||
|
// return dexQuotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getMedianSellRateAsync(
|
||||||
|
sources: ERC20BridgeSource[],
|
||||||
|
makerToken: string,
|
||||||
|
takerToken: string,
|
||||||
|
takerFillAmount: BigNumber,
|
||||||
|
): Promise<BigNumber> {
|
||||||
|
return new BigNumber(0);
|
||||||
|
// const samples = await this.getSellQuotesAsync(sources, makerToken, takerToken, takerFillAmount);
|
||||||
|
// if (samples.length === 0) {
|
||||||
|
// return ZERO_AMOUNT;
|
||||||
|
// }
|
||||||
|
// const flatSortedSamples = samples
|
||||||
|
// .reduce((acc, v) => acc.concat(...v))
|
||||||
|
// .filter(v => !v.output.isZero())
|
||||||
|
// .sort((a, b) => a.output.comparedTo(b.output));
|
||||||
|
// if (flatSortedSamples.length === 0) {
|
||||||
|
// return ZERO_AMOUNT;
|
||||||
|
// }
|
||||||
|
// const medianSample = flatSortedSamples[Math.floor(flatSortedSamples.length / 2)];
|
||||||
|
// return medianSample.output.div(takerFillAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legacy
|
||||||
public getTokenDecimals(tokens: string[]): BatchedOperation<BigNumber[]> {
|
public getTokenDecimals(tokens: string[]): BatchedOperation<BigNumber[]> {
|
||||||
return new SamplerContractOperation({
|
return new SamplerContractOperation({
|
||||||
source: ERC20BridgeSource.Native,
|
source: ERC20BridgeSource.Native,
|
||||||
@@ -1196,6 +1295,8 @@ export class SamplerOperations {
|
|||||||
case ERC20BridgeSource.Polydex:
|
case ERC20BridgeSource.Polydex:
|
||||||
case ERC20BridgeSource.ShibaSwap:
|
case ERC20BridgeSource.ShibaSwap:
|
||||||
case ERC20BridgeSource.JetSwap:
|
case ERC20BridgeSource.JetSwap:
|
||||||
|
case ERC20BridgeSource.Pangolin:
|
||||||
|
case ERC20BridgeSource.TraderJoe:
|
||||||
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
||||||
if (!isValidAddress(uniLikeRouter)) {
|
if (!isValidAddress(uniLikeRouter)) {
|
||||||
return [];
|
return [];
|
||||||
@@ -1489,6 +1590,8 @@ export class SamplerOperations {
|
|||||||
case ERC20BridgeSource.Polydex:
|
case ERC20BridgeSource.Polydex:
|
||||||
case ERC20BridgeSource.ShibaSwap:
|
case ERC20BridgeSource.ShibaSwap:
|
||||||
case ERC20BridgeSource.JetSwap:
|
case ERC20BridgeSource.JetSwap:
|
||||||
|
case ERC20BridgeSource.Pangolin:
|
||||||
|
case ERC20BridgeSource.TraderJoe:
|
||||||
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
||||||
if (!isValidAddress(uniLikeRouter)) {
|
if (!isValidAddress(uniLikeRouter)) {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { BigNumber } from '@0x/utils';
|
||||||
|
|
||||||
|
import { ERC20BridgeSource } from './types';
|
||||||
|
|
||||||
|
export type Bytes = string;
|
||||||
|
export type Address = Bytes;
|
||||||
|
|
||||||
|
export type LiquiditySource = ERC20BridgeSource;
|
||||||
|
|
||||||
|
export declare type RPCSamplerCallback = (err: Error | null, liquidityResponses: LiquidityResponse[]) => void;
|
||||||
|
|
||||||
|
export interface RpcLiquidityRequest {
|
||||||
|
tokenPath: Address[];
|
||||||
|
inputAmount: string;
|
||||||
|
source: LiquiditySource;
|
||||||
|
demand: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LiquidityCurvePoint {
|
||||||
|
sellAmount: bigint;
|
||||||
|
buyAmount: bigint;
|
||||||
|
encodedFillData: Bytes;
|
||||||
|
gasCost: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LiquidityResponse {
|
||||||
|
source: LiquiditySource;
|
||||||
|
liquidityCurves: LiquidityCurvePoint[][];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TokenResponse {
|
||||||
|
address: Address;
|
||||||
|
symbol: string;
|
||||||
|
decimals: number;
|
||||||
|
gasCost: number;
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import { QuoteRequestor } from '../../utils/quote_requestor';
|
|||||||
import { PriceComparisonsReport, QuoteReport } from '../quote_report_generator';
|
import { PriceComparisonsReport, QuoteReport } from '../quote_report_generator';
|
||||||
|
|
||||||
import { CollapsedPath } from './path';
|
import { CollapsedPath } from './path';
|
||||||
|
import { LiquiditySource } from './sampler_types';
|
||||||
import { SourceFilters } from './source_filters';
|
import { SourceFilters } from './source_filters';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,6 +92,9 @@ export enum ERC20BridgeSource {
|
|||||||
FirebirdOneSwap = 'FirebirdOneSwap',
|
FirebirdOneSwap = 'FirebirdOneSwap',
|
||||||
JetSwap = 'JetSwap',
|
JetSwap = 'JetSwap',
|
||||||
IronSwap = 'IronSwap',
|
IronSwap = 'IronSwap',
|
||||||
|
// Avalanche
|
||||||
|
Pangolin = 'Pangolin',
|
||||||
|
TraderJoe = 'TraderJoe',
|
||||||
}
|
}
|
||||||
export type SourcesWithPoolsCache = ERC20BridgeSource.Balancer | ERC20BridgeSource.BalancerV2 | ERC20BridgeSource.Cream;
|
export type SourcesWithPoolsCache = ERC20BridgeSource.Balancer | ERC20BridgeSource.BalancerV2 | ERC20BridgeSource.Cream;
|
||||||
|
|
||||||
@@ -172,6 +176,7 @@ export interface DexSample<TFillData extends FillData = FillData> {
|
|||||||
fillData: TFillData;
|
fillData: TFillData;
|
||||||
input: BigNumber;
|
input: BigNumber;
|
||||||
output: BigNumber;
|
output: BigNumber;
|
||||||
|
// gasCost: BigNumber;
|
||||||
}
|
}
|
||||||
export interface CurveFillData extends FillData {
|
export interface CurveFillData extends FillData {
|
||||||
fromTokenIdx: number;
|
fromTokenIdx: number;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
} from '../types';
|
} from '../types';
|
||||||
|
|
||||||
import { returnQuoteFromAltMMAsync } from './alt_mm_implementation_utils';
|
import { returnQuoteFromAltMMAsync } from './alt_mm_implementation_utils';
|
||||||
|
import { ONE_SECOND_MS } from './market_operation_utils/constants';
|
||||||
import { RfqMakerBlacklist } from './rfq_maker_blacklist';
|
import { RfqMakerBlacklist } from './rfq_maker_blacklist';
|
||||||
|
|
||||||
const MAKER_TIMEOUT_STREAK_LENGTH = 10;
|
const MAKER_TIMEOUT_STREAK_LENGTH = 10;
|
||||||
@@ -177,6 +178,12 @@ export class QuoteRequestor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static getDurationUntilExpirationMs(expirationTimeSeconds: BigNumber): BigNumber {
|
||||||
|
const expirationTimeMs = expirationTimeSeconds.times(constants.ONE_SECOND_MS);
|
||||||
|
const currentTimeMs = new BigNumber(Date.now());
|
||||||
|
return BigNumber.max(expirationTimeMs.minus(currentTimeMs), 0);
|
||||||
|
}
|
||||||
|
|
||||||
private static _makerSupportsPair(
|
private static _makerSupportsPair(
|
||||||
typedMakerUrl: TypedMakerUrl,
|
typedMakerUrl: TypedMakerUrl,
|
||||||
makerToken: string,
|
makerToken: string,
|
||||||
@@ -361,12 +368,6 @@ export class QuoteRequestor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _isExpirationTooSoon(expirationTimeSeconds: BigNumber): boolean {
|
|
||||||
const expirationTimeMs = expirationTimeSeconds.times(constants.ONE_SECOND_MS);
|
|
||||||
const currentTimeMs = new BigNumber(Date.now());
|
|
||||||
return expirationTimeMs.isLessThan(currentTimeMs.plus(this._expiryBufferMs));
|
|
||||||
}
|
|
||||||
|
|
||||||
private async _getQuotesAsync<ResponseT>(
|
private async _getQuotesAsync<ResponseT>(
|
||||||
makerToken: string,
|
makerToken: string,
|
||||||
takerToken: string,
|
takerToken: string,
|
||||||
@@ -587,12 +588,15 @@ export class QuoteRequestor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const isLastLook = Boolean(options.isLastLook);
|
const isLastLook = Boolean(options.isLastLook);
|
||||||
if (this._isExpirationTooSoon(new BigNumber(order.expiry))) {
|
const msRemainingUntilExpiration = QuoteRequestor.getDurationUntilExpirationMs(new BigNumber(order.expiry));
|
||||||
|
const isExpirationTooSoon = msRemainingUntilExpiration.lt(this._expiryBufferMs);
|
||||||
|
if (isExpirationTooSoon) {
|
||||||
this._warningLogger(order, 'Expiry too soon in RFQ-T firm quote, filtering out');
|
this._warningLogger(order, 'Expiry too soon in RFQ-T firm quote, filtering out');
|
||||||
this._metrics?.incrementExpirationToSoonCounter(isLastLook, order.maker);
|
this._metrics?.incrementExpirationToSoonCounter(isLastLook, order.maker);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this._metrics?.measureExpirationForValidOrder(isLastLook, order.maker, order.expiry);
|
const secondsRemaining = msRemainingUntilExpiration.div(ONE_SECOND_MS);
|
||||||
|
this._metrics?.measureExpirationForValidOrder(isLastLook, order.maker, secondsRemaining);
|
||||||
|
|
||||||
const takerAmount = new BigNumber(order.takerAmount);
|
const takerAmount = new BigNumber(order.takerAmount);
|
||||||
const fillRatio = takerAmount.div(assetFillAmount);
|
const fillRatio = takerAmount.div(assetFillAmount);
|
||||||
@@ -673,7 +677,9 @@ export class QuoteRequestor {
|
|||||||
this._warningLogger(order, 'Unexpected token or taker address in RFQ order, filtering out');
|
this._warningLogger(order, 'Unexpected token or taker address in RFQ order, filtering out');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this._isExpirationTooSoon(new BigNumber(order.expiry))) {
|
const msRemainingUntilExpiration = QuoteRequestor.getDurationUntilExpirationMs(new BigNumber(order.expiry));
|
||||||
|
const isExpirationTooSoon = msRemainingUntilExpiration.lt(this._expiryBufferMs);
|
||||||
|
if (isExpirationTooSoon) {
|
||||||
this._warningLogger(order, 'Expiry too soon in RFQ indicative quote, filtering out');
|
this._warningLogger(order, 'Expiry too soon in RFQ indicative quote, filtering out');
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,567 +0,0 @@
|
|||||||
import { ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
|
|
||||||
import {
|
|
||||||
constants,
|
|
||||||
expect,
|
|
||||||
getRandomFloat,
|
|
||||||
getRandomInteger,
|
|
||||||
randomAddress,
|
|
||||||
toBaseUnitAmount,
|
|
||||||
} from '@0x/contracts-test-utils';
|
|
||||||
import { FillQuoteTransformerOrderType, LimitOrderFields, SignatureType } from '@0x/protocol-utils';
|
|
||||||
import { BigNumber, hexUtils, NULL_ADDRESS } from '@0x/utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
import { SignedOrder } from '../src/types';
|
|
||||||
import { DexOrderSampler, getSampleAmounts } from '../src/utils/market_operation_utils/sampler';
|
|
||||||
import { ERC20BridgeSource, TokenAdjacencyGraph } from '../src/utils/market_operation_utils/types';
|
|
||||||
|
|
||||||
import { MockSamplerContract } from './utils/mock_sampler_contract';
|
|
||||||
import { generatePseudoRandomSalt } from './utils/utils';
|
|
||||||
|
|
||||||
const CHAIN_ID = 1;
|
|
||||||
const EMPTY_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
||||||
// tslint:disable: custom-no-magic-numbers
|
|
||||||
describe('DexSampler tests', () => {
|
|
||||||
const MAKER_TOKEN = randomAddress();
|
|
||||||
const TAKER_TOKEN = randomAddress();
|
|
||||||
const chainId = ChainId.Mainnet;
|
|
||||||
|
|
||||||
const wethAddress = getContractAddressesForChainOrThrow(CHAIN_ID).etherToken;
|
|
||||||
const exchangeProxyAddress = getContractAddressesForChainOrThrow(CHAIN_ID).exchangeProxy;
|
|
||||||
|
|
||||||
const tokenAdjacencyGraph: TokenAdjacencyGraph = { default: [wethAddress] };
|
|
||||||
|
|
||||||
describe('getSampleAmounts()', () => {
|
|
||||||
const FILL_AMOUNT = getRandomInteger(1, 1e18);
|
|
||||||
const NUM_SAMPLES = 16;
|
|
||||||
|
|
||||||
it('generates the correct number of amounts', () => {
|
|
||||||
const amounts = getSampleAmounts(FILL_AMOUNT, NUM_SAMPLES);
|
|
||||||
expect(amounts).to.be.length(NUM_SAMPLES);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('first amount is nonzero', () => {
|
|
||||||
const amounts = getSampleAmounts(FILL_AMOUNT, NUM_SAMPLES);
|
|
||||||
expect(amounts[0]).to.not.bignumber.eq(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('last amount is the fill amount', () => {
|
|
||||||
const amounts = getSampleAmounts(FILL_AMOUNT, NUM_SAMPLES);
|
|
||||||
expect(amounts[NUM_SAMPLES - 1]).to.bignumber.eq(FILL_AMOUNT);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can generate a single amount', () => {
|
|
||||||
const amounts = getSampleAmounts(FILL_AMOUNT, 1);
|
|
||||||
expect(amounts).to.be.length(1);
|
|
||||||
expect(amounts[0]).to.bignumber.eq(FILL_AMOUNT);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('generates ascending amounts', () => {
|
|
||||||
const amounts = getSampleAmounts(FILL_AMOUNT, NUM_SAMPLES);
|
|
||||||
for (const i of _.times(NUM_SAMPLES).slice(1)) {
|
|
||||||
const prev = amounts[i - 1];
|
|
||||||
const amount = amounts[i];
|
|
||||||
expect(prev).to.bignumber.lt(amount);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function createOrder(overrides?: Partial<LimitOrderFields>): SignedOrder<LimitOrderFields> {
|
|
||||||
const o: SignedOrder<LimitOrderFields> = {
|
|
||||||
order: {
|
|
||||||
salt: generatePseudoRandomSalt(),
|
|
||||||
expiry: getRandomInteger(0, 2 ** 64),
|
|
||||||
makerToken: MAKER_TOKEN,
|
|
||||||
takerToken: TAKER_TOKEN,
|
|
||||||
makerAmount: getRandomInteger(1, 1e18),
|
|
||||||
takerAmount: getRandomInteger(1, 1e18),
|
|
||||||
takerTokenFeeAmount: constants.ZERO_AMOUNT,
|
|
||||||
chainId: CHAIN_ID,
|
|
||||||
pool: EMPTY_BYTES32,
|
|
||||||
feeRecipient: NULL_ADDRESS,
|
|
||||||
sender: NULL_ADDRESS,
|
|
||||||
maker: NULL_ADDRESS,
|
|
||||||
taker: NULL_ADDRESS,
|
|
||||||
verifyingContract: exchangeProxyAddress,
|
|
||||||
...overrides,
|
|
||||||
},
|
|
||||||
signature: { v: 1, r: hexUtils.random(), s: hexUtils.random(), signatureType: SignatureType.EthSign },
|
|
||||||
type: FillQuoteTransformerOrderType.Limit,
|
|
||||||
};
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
const ORDERS = _.times(4, () => createOrder());
|
|
||||||
const SIMPLE_ORDERS = ORDERS.map(o => _.omit(o.order, ['chainId', 'verifyingContract']));
|
|
||||||
|
|
||||||
describe('operations', () => {
|
|
||||||
it('getLimitOrderFillableMakerAssetAmounts()', async () => {
|
|
||||||
const expectedFillableAmounts = ORDERS.map(() => getRandomInteger(0, 100e18));
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
getLimitOrderFillableMakerAssetAmounts: (orders, signatures) => {
|
|
||||||
expect(orders).to.deep.eq(SIMPLE_ORDERS);
|
|
||||||
expect(signatures).to.deep.eq(ORDERS.map(o => o.signature));
|
|
||||||
return expectedFillableAmounts;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [fillableAmounts] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getLimitOrderFillableMakerAmounts(ORDERS, exchangeProxyAddress),
|
|
||||||
);
|
|
||||||
expect(fillableAmounts).to.deep.eq(expectedFillableAmounts);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getLimitOrderFillableTakerAssetAmounts()', async () => {
|
|
||||||
const expectedFillableAmounts = ORDERS.map(() => getRandomInteger(0, 100e18));
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
getLimitOrderFillableTakerAssetAmounts: (orders, signatures) => {
|
|
||||||
expect(orders).to.deep.eq(SIMPLE_ORDERS);
|
|
||||||
expect(signatures).to.deep.eq(ORDERS.map(o => o.signature));
|
|
||||||
return expectedFillableAmounts;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [fillableAmounts] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getLimitOrderFillableTakerAmounts(ORDERS, exchangeProxyAddress),
|
|
||||||
);
|
|
||||||
expect(fillableAmounts).to.deep.eq(expectedFillableAmounts);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getKyberSellQuotes()', async () => {
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleSellsFromKyberNetwork: (_reserveOffset, takerToken, makerToken, fillAmounts) => {
|
|
||||||
expect(takerToken).to.eq(expectedTakerToken);
|
|
||||||
expect(makerToken).to.eq(expectedMakerToken);
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedTakerFillAmounts);
|
|
||||||
return ['0x', '0x', expectedMakerFillAmounts];
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [fillableAmounts] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getKyberSellQuotes(
|
|
||||||
{ hintHandler: randomAddress(), networkProxy: randomAddress(), weth: randomAddress() },
|
|
||||||
new BigNumber(0),
|
|
||||||
expectedMakerToken,
|
|
||||||
expectedTakerToken,
|
|
||||||
expectedTakerFillAmounts,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(fillableAmounts).to.deep.eq(expectedMakerFillAmounts);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getLiquidityProviderSellQuotes()', async () => {
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const poolAddress = randomAddress();
|
|
||||||
const gasCost = 123;
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleSellsFromLiquidityProvider: (providerAddress, takerToken, makerToken, _fillAmounts) => {
|
|
||||||
expect(providerAddress).to.eq(poolAddress);
|
|
||||||
expect(takerToken).to.eq(expectedTakerToken);
|
|
||||||
expect(makerToken).to.eq(expectedMakerToken);
|
|
||||||
return [toBaseUnitAmount(1001)];
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
{
|
|
||||||
[poolAddress]: { tokens: [expectedMakerToken, expectedTakerToken], gasCost },
|
|
||||||
},
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [result] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getSellQuotes(
|
|
||||||
[ERC20BridgeSource.LiquidityProvider],
|
|
||||||
expectedMakerToken,
|
|
||||||
expectedTakerToken,
|
|
||||||
[toBaseUnitAmount(1000)],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(result).to.deep.equal([
|
|
||||||
[
|
|
||||||
{
|
|
||||||
source: 'LiquidityProvider',
|
|
||||||
output: toBaseUnitAmount(1001),
|
|
||||||
input: toBaseUnitAmount(1000),
|
|
||||||
fillData: { poolAddress, gasCost },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getLiquidityProviderBuyQuotes()', async () => {
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const poolAddress = randomAddress();
|
|
||||||
const gasCost = 321;
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleBuysFromLiquidityProvider: (providerAddress, takerToken, makerToken, _fillAmounts) => {
|
|
||||||
expect(providerAddress).to.eq(poolAddress);
|
|
||||||
expect(takerToken).to.eq(expectedTakerToken);
|
|
||||||
expect(makerToken).to.eq(expectedMakerToken);
|
|
||||||
return [toBaseUnitAmount(999)];
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
{
|
|
||||||
[poolAddress]: { tokens: [expectedMakerToken, expectedTakerToken], gasCost },
|
|
||||||
},
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [result] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getBuyQuotes(
|
|
||||||
[ERC20BridgeSource.LiquidityProvider],
|
|
||||||
expectedMakerToken,
|
|
||||||
expectedTakerToken,
|
|
||||||
[toBaseUnitAmount(1000)],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(result).to.deep.equal([
|
|
||||||
[
|
|
||||||
{
|
|
||||||
source: 'LiquidityProvider',
|
|
||||||
output: toBaseUnitAmount(999),
|
|
||||||
input: toBaseUnitAmount(1000),
|
|
||||||
fillData: { poolAddress, gasCost },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getUniswapSellQuotes()', async () => {
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleSellsFromUniswap: (_router, takerToken, makerToken, fillAmounts) => {
|
|
||||||
expect(takerToken).to.eq(expectedTakerToken);
|
|
||||||
expect(makerToken).to.eq(expectedMakerToken);
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedTakerFillAmounts);
|
|
||||||
return expectedMakerFillAmounts;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [fillableAmounts] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getUniswapSellQuotes(
|
|
||||||
randomAddress(),
|
|
||||||
expectedMakerToken,
|
|
||||||
expectedTakerToken,
|
|
||||||
expectedTakerFillAmounts,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(fillableAmounts).to.deep.eq(expectedMakerFillAmounts);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getUniswapV2SellQuotes()', async () => {
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleSellsFromUniswapV2: (_router, path, fillAmounts) => {
|
|
||||||
expect(path).to.deep.eq([expectedMakerToken, expectedTakerToken]);
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedTakerFillAmounts);
|
|
||||||
return expectedMakerFillAmounts;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [fillableAmounts] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getUniswapV2SellQuotes(
|
|
||||||
NULL_ADDRESS,
|
|
||||||
[expectedMakerToken, expectedTakerToken],
|
|
||||||
expectedTakerFillAmounts,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(fillableAmounts).to.deep.eq(expectedMakerFillAmounts);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getUniswapBuyQuotes()', async () => {
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 10);
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleBuysFromUniswap: (_router, takerToken, makerToken, fillAmounts) => {
|
|
||||||
expect(takerToken).to.eq(expectedTakerToken);
|
|
||||||
expect(makerToken).to.eq(expectedMakerToken);
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedMakerFillAmounts);
|
|
||||||
return expectedTakerFillAmounts;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [fillableAmounts] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getUniswapBuyQuotes(
|
|
||||||
randomAddress(),
|
|
||||||
expectedMakerToken,
|
|
||||||
expectedTakerToken,
|
|
||||||
expectedMakerFillAmounts,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(fillableAmounts).to.deep.eq(expectedTakerFillAmounts);
|
|
||||||
});
|
|
||||||
|
|
||||||
interface RatesBySource {
|
|
||||||
[src: string]: BigNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
it('getSellQuotes()', async () => {
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const sources = [ERC20BridgeSource.Uniswap, ERC20BridgeSource.UniswapV2];
|
|
||||||
const ratesBySource: RatesBySource = {
|
|
||||||
[ERC20BridgeSource.Kyber]: getRandomFloat(0, 100),
|
|
||||||
[ERC20BridgeSource.Uniswap]: getRandomFloat(0, 100),
|
|
||||||
[ERC20BridgeSource.UniswapV2]: getRandomFloat(0, 100),
|
|
||||||
};
|
|
||||||
const expectedTakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 3);
|
|
||||||
let uniswapRouter: string;
|
|
||||||
let uniswapV2Router: string;
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleSellsFromUniswap: (router, takerToken, makerToken, fillAmounts) => {
|
|
||||||
uniswapRouter = router;
|
|
||||||
expect(takerToken).to.eq(expectedTakerToken);
|
|
||||||
expect(makerToken).to.eq(expectedMakerToken);
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedTakerFillAmounts);
|
|
||||||
return fillAmounts.map(a => a.times(ratesBySource[ERC20BridgeSource.Uniswap]).integerValue());
|
|
||||||
},
|
|
||||||
sampleSellsFromUniswapV2: (router, path, fillAmounts) => {
|
|
||||||
uniswapV2Router = router;
|
|
||||||
if (path.length === 2) {
|
|
||||||
expect(path).to.deep.eq([expectedTakerToken, expectedMakerToken]);
|
|
||||||
} else if (path.length === 3) {
|
|
||||||
expect(path).to.deep.eq([expectedTakerToken, wethAddress, expectedMakerToken]);
|
|
||||||
} else {
|
|
||||||
expect(path).to.have.lengthOf.within(2, 3);
|
|
||||||
}
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedTakerFillAmounts);
|
|
||||||
return fillAmounts.map(a => a.times(ratesBySource[ERC20BridgeSource.UniswapV2]).integerValue());
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
tokenAdjacencyGraph,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [quotes] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getSellQuotes(
|
|
||||||
sources,
|
|
||||||
expectedMakerToken,
|
|
||||||
expectedTakerToken,
|
|
||||||
expectedTakerFillAmounts,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
const expectedQuotes = sources.map(s =>
|
|
||||||
expectedTakerFillAmounts.map(a => ({
|
|
||||||
source: s,
|
|
||||||
input: a,
|
|
||||||
output: a.times(ratesBySource[s]).integerValue(),
|
|
||||||
fillData: (() => {
|
|
||||||
if (s === ERC20BridgeSource.UniswapV2) {
|
|
||||||
return {
|
|
||||||
router: uniswapV2Router,
|
|
||||||
tokenAddressPath: [expectedTakerToken, expectedMakerToken],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// TODO jacob pass through
|
|
||||||
if (s === ERC20BridgeSource.Uniswap) {
|
|
||||||
return { router: uniswapRouter };
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
})(),
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
const uniswapV2ETHQuotes = [
|
|
||||||
expectedTakerFillAmounts.map(a => ({
|
|
||||||
source: ERC20BridgeSource.UniswapV2,
|
|
||||||
input: a,
|
|
||||||
output: a.times(ratesBySource[ERC20BridgeSource.UniswapV2]).integerValue(),
|
|
||||||
fillData: {
|
|
||||||
router: uniswapV2Router,
|
|
||||||
tokenAddressPath: [expectedTakerToken, wethAddress, expectedMakerToken],
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
];
|
|
||||||
// extra quote for Uniswap V2, which provides a direct quote (tokenA -> tokenB) AND an ETH quote (tokenA -> ETH -> tokenB)
|
|
||||||
const additionalSourceCount = 1;
|
|
||||||
expect(quotes).to.have.lengthOf(sources.length + additionalSourceCount);
|
|
||||||
expect(quotes).to.deep.eq(expectedQuotes.concat(uniswapV2ETHQuotes));
|
|
||||||
});
|
|
||||||
it('getBuyQuotes()', async () => {
|
|
||||||
const expectedTakerToken = randomAddress();
|
|
||||||
const expectedMakerToken = randomAddress();
|
|
||||||
const sources = [ERC20BridgeSource.Uniswap, ERC20BridgeSource.UniswapV2];
|
|
||||||
const ratesBySource: RatesBySource = {
|
|
||||||
[ERC20BridgeSource.Uniswap]: getRandomFloat(0, 100),
|
|
||||||
[ERC20BridgeSource.UniswapV2]: getRandomFloat(0, 100),
|
|
||||||
};
|
|
||||||
const expectedMakerFillAmounts = getSampleAmounts(new BigNumber(100e18), 3);
|
|
||||||
let uniswapRouter: string;
|
|
||||||
let uniswapV2Router: string;
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
sampleBuysFromUniswap: (router, takerToken, makerToken, fillAmounts) => {
|
|
||||||
uniswapRouter = router;
|
|
||||||
expect(takerToken).to.eq(expectedTakerToken);
|
|
||||||
expect(makerToken).to.eq(expectedMakerToken);
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedMakerFillAmounts);
|
|
||||||
return fillAmounts.map(a => a.times(ratesBySource[ERC20BridgeSource.Uniswap]).integerValue());
|
|
||||||
},
|
|
||||||
sampleBuysFromUniswapV2: (router, path, fillAmounts) => {
|
|
||||||
uniswapV2Router = router;
|
|
||||||
if (path.length === 2) {
|
|
||||||
expect(path).to.deep.eq([expectedTakerToken, expectedMakerToken]);
|
|
||||||
} else if (path.length === 3) {
|
|
||||||
expect(path).to.deep.eq([expectedTakerToken, wethAddress, expectedMakerToken]);
|
|
||||||
} else {
|
|
||||||
expect(path).to.have.lengthOf.within(2, 3);
|
|
||||||
}
|
|
||||||
expect(fillAmounts).to.deep.eq(expectedMakerFillAmounts);
|
|
||||||
return fillAmounts.map(a => a.times(ratesBySource[ERC20BridgeSource.UniswapV2]).integerValue());
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
tokenAdjacencyGraph,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [quotes] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getBuyQuotes(sources, expectedMakerToken, expectedTakerToken, expectedMakerFillAmounts),
|
|
||||||
);
|
|
||||||
const expectedQuotes = sources.map(s =>
|
|
||||||
expectedMakerFillAmounts.map(a => ({
|
|
||||||
source: s,
|
|
||||||
input: a,
|
|
||||||
output: a.times(ratesBySource[s]).integerValue(),
|
|
||||||
fillData: (() => {
|
|
||||||
if (s === ERC20BridgeSource.UniswapV2) {
|
|
||||||
return {
|
|
||||||
router: uniswapV2Router,
|
|
||||||
tokenAddressPath: [expectedTakerToken, expectedMakerToken],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (s === ERC20BridgeSource.Uniswap) {
|
|
||||||
return { router: uniswapRouter };
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
})(),
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
const uniswapV2ETHQuotes = [
|
|
||||||
expectedMakerFillAmounts.map(a => ({
|
|
||||||
source: ERC20BridgeSource.UniswapV2,
|
|
||||||
input: a,
|
|
||||||
output: a.times(ratesBySource[ERC20BridgeSource.UniswapV2]).integerValue(),
|
|
||||||
fillData: {
|
|
||||||
router: uniswapV2Router,
|
|
||||||
tokenAddressPath: [expectedTakerToken, wethAddress, expectedMakerToken],
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
];
|
|
||||||
// extra quote for Uniswap V2, which provides a direct quote (tokenA -> tokenB) AND an ETH quote (tokenA -> ETH -> tokenB)
|
|
||||||
expect(quotes).to.have.lengthOf(sources.length + 1);
|
|
||||||
expect(quotes).to.deep.eq(expectedQuotes.concat(uniswapV2ETHQuotes));
|
|
||||||
});
|
|
||||||
describe('batched operations', () => {
|
|
||||||
it('getLimitOrderFillableMakerAssetAmounts(), getLimitOrderFillableTakerAssetAmounts()', async () => {
|
|
||||||
const expectedFillableTakerAmounts = ORDERS.map(() => getRandomInteger(0, 100e18));
|
|
||||||
const expectedFillableMakerAmounts = ORDERS.map(() => getRandomInteger(0, 100e18));
|
|
||||||
const sampler = new MockSamplerContract({
|
|
||||||
getLimitOrderFillableMakerAssetAmounts: (orders, signatures) => {
|
|
||||||
expect(orders).to.deep.eq(SIMPLE_ORDERS);
|
|
||||||
expect(signatures).to.deep.eq(ORDERS.map(o => o.signature));
|
|
||||||
return expectedFillableMakerAmounts;
|
|
||||||
},
|
|
||||||
getLimitOrderFillableTakerAssetAmounts: (orders, signatures) => {
|
|
||||||
expect(orders).to.deep.eq(SIMPLE_ORDERS);
|
|
||||||
expect(signatures).to.deep.eq(ORDERS.map(o => o.signature));
|
|
||||||
return expectedFillableTakerAmounts;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const dexOrderSampler = new DexOrderSampler(
|
|
||||||
chainId,
|
|
||||||
sampler,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
async () => undefined,
|
|
||||||
);
|
|
||||||
const [fillableMakerAmounts, fillableTakerAmounts] = await dexOrderSampler.executeAsync(
|
|
||||||
dexOrderSampler.getLimitOrderFillableMakerAmounts(ORDERS, exchangeProxyAddress),
|
|
||||||
dexOrderSampler.getLimitOrderFillableTakerAmounts(ORDERS, exchangeProxyAddress),
|
|
||||||
);
|
|
||||||
expect(fillableMakerAmounts).to.deep.eq(expectedFillableMakerAmounts);
|
|
||||||
expect(fillableTakerAmounts).to.deep.eq(expectedFillableTakerAmounts);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// tslint:disable-next-line: max-file-line-count
|
|
||||||
@@ -1,4 +1,14 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "6.7.0",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Avalanche deployment",
|
||||||
|
"pr": 312
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timestamp": 1630459879
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629353596,
|
"timestamp": 1629353596,
|
||||||
"version": "6.6.1",
|
"version": "6.6.1",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v6.7.0 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Avalanche deployment (#312)
|
||||||
|
|
||||||
## v6.6.1 - _August 19, 2021_
|
## v6.6.1 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -334,5 +334,47 @@
|
|||||||
"fillQuoteTransformer": "0x750cb81ee6d64e29e1e358ba155925000bf044d4",
|
"fillQuoteTransformer": "0x750cb81ee6d64e29e1e358ba155925000bf044d4",
|
||||||
"positiveSlippageFeeTransformer": "0x30aebc4c68effa70e21612b39b94299a8778d0cb"
|
"positiveSlippageFeeTransformer": "0x30aebc4c68effa70e21612b39b94299a8778d0cb"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"43114": {
|
||||||
|
"erc20Proxy": "0x0000000000000000000000000000000000000000",
|
||||||
|
"erc721Proxy": "0x0000000000000000000000000000000000000000",
|
||||||
|
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||||
|
"etherToken": "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",
|
||||||
|
"exchangeV2": "0x0000000000000000000000000000000000000000",
|
||||||
|
"exchange": "0x0000000000000000000000000000000000000000",
|
||||||
|
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
|
||||||
|
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
|
||||||
|
"forwarder": "0x0000000000000000000000000000000000000000",
|
||||||
|
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
|
||||||
|
"coordinator": "0x0000000000000000000000000000000000000000",
|
||||||
|
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
|
||||||
|
"staticCallProxy": "0x0000000000000000000000000000000000000000",
|
||||||
|
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
|
||||||
|
"devUtils": "0x0000000000000000000000000000000000000000",
|
||||||
|
"zrxVault": "0x0000000000000000000000000000000000000000",
|
||||||
|
"staking": "0x0000000000000000000000000000000000000000",
|
||||||
|
"stakingProxy": "0x0000000000000000000000000000000000000000",
|
||||||
|
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
|
||||||
|
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
|
||||||
|
"chaiBridge": "0x0000000000000000000000000000000000000000",
|
||||||
|
"dydxBridge": "0x0000000000000000000000000000000000000000",
|
||||||
|
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
|
||||||
|
"broker": "0x0000000000000000000000000000000000000000",
|
||||||
|
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
|
||||||
|
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
|
||||||
|
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
|
||||||
|
"exchangeProxyGovernor": "0xca7bab1b2d1ec7d81710b7f9e2ab4e6788930588",
|
||||||
|
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
|
||||||
|
"exchangeProxyTransformerDeployer": "0xa60b57833dce6260f4f2411c811755dd980bc0a7",
|
||||||
|
"exchangeProxyFlashWallet": "0xdb6f1920a889355780af7570773609bd8cb1f498",
|
||||||
|
"exchangeProxyLiquidityProviderSandbox": "0x8953c63d0858d286cc407cd6f8e26b9cbd02a511",
|
||||||
|
"zrxTreasury": "0x0000000000000000000000000000000000000000",
|
||||||
|
"transformers": {
|
||||||
|
"wethTransformer": "0x9b8b52391071d71cd4ad1e61d7f273268fa34c6c",
|
||||||
|
"payTakerTransformer": "0x898c6fde239d646c73f0a57e3570b6f86a3d62a3",
|
||||||
|
"affiliateFeeTransformer": "0x34617b855411e52fbc05899435f44cbd0503022c",
|
||||||
|
"fillQuoteTransformer": "0x8a5417dd7ffde61ec61e11b45797e16686e1d6b9",
|
||||||
|
"positiveSlippageFeeTransformer": "0x470ba89da18a6db6e8a0567b3c9214b960861857"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contract-addresses",
|
"name": "@0x/contract-addresses",
|
||||||
"version": "6.6.1",
|
"version": "6.7.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export enum ChainId {
|
|||||||
BSC = 56,
|
BSC = 56,
|
||||||
Polygon = 137,
|
Polygon = 137,
|
||||||
PolygonMumbai = 80001,
|
PolygonMumbai = 80001,
|
||||||
|
Avalanche = 43114,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "13.17.6",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629353596,
|
"timestamp": 1629353596,
|
||||||
"version": "13.17.5",
|
"version": "13.17.5",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v13.17.6 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v13.17.5 - _August 19, 2021_
|
## v13.17.5 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/contract-wrappers",
|
"name": "@0x/contract-wrappers",
|
||||||
"version": "13.17.5",
|
"version": "13.17.6",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.27",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/base-contract": "^6.4.0",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contract-addresses": "^6.6.1",
|
"@0x/contract-addresses": "^6.7.0",
|
||||||
"@0x/json-schemas": "^6.1.3",
|
"@0x/json-schemas": "^6.1.3",
|
||||||
"@0x/types": "^3.3.3",
|
"@0x/types": "^3.3.3",
|
||||||
"@0x/utils": "^6.4.3",
|
"@0x/utils": "^6.4.3",
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "8.1.4",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629414734,
|
"timestamp": 1629414734,
|
||||||
"version": "8.1.3",
|
"version": "8.1.3",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v8.1.4 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v8.1.3 - _August 19, 2021_
|
## v8.1.3 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/migrations",
|
"name": "@0x/migrations",
|
||||||
"version": "8.1.3",
|
"version": "8.1.4",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -68,20 +68,20 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^6.4.0",
|
"@0x/base-contract": "^6.4.0",
|
||||||
"@0x/contract-addresses": "^6.6.1",
|
"@0x/contract-addresses": "^6.7.0",
|
||||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||||
"@0x/contracts-coordinator": "^3.1.38",
|
"@0x/contracts-coordinator": "^3.1.38",
|
||||||
"@0x/contracts-dev-utils": "^1.3.36",
|
"@0x/contracts-dev-utils": "^1.3.36",
|
||||||
"@0x/contracts-erc1155": "^2.1.37",
|
"@0x/contracts-erc1155": "^2.1.37",
|
||||||
"@0x/contracts-erc20": "^3.3.17",
|
"@0x/contracts-erc20": "^3.3.18",
|
||||||
"@0x/contracts-erc721": "^3.1.37",
|
"@0x/contracts-erc721": "^3.1.37",
|
||||||
"@0x/contracts-exchange": "^3.2.38",
|
"@0x/contracts-exchange": "^3.2.38",
|
||||||
"@0x/contracts-exchange-forwarder": "^4.2.38",
|
"@0x/contracts-exchange-forwarder": "^4.2.38",
|
||||||
"@0x/contracts-extensions": "^6.2.32",
|
"@0x/contracts-extensions": "^6.2.32",
|
||||||
"@0x/contracts-multisig": "^4.1.38",
|
"@0x/contracts-multisig": "^4.1.38",
|
||||||
"@0x/contracts-staking": "^2.0.45",
|
"@0x/contracts-staking": "^2.0.45",
|
||||||
"@0x/contracts-utils": "^4.7.17",
|
"@0x/contracts-utils": "^4.7.18",
|
||||||
"@0x/contracts-zero-ex": "^0.28.2",
|
"@0x/contracts-zero-ex": "^0.28.3",
|
||||||
"@0x/sol-compiler": "^4.7.3",
|
"@0x/sol-compiler": "^4.7.3",
|
||||||
"@0x/subproviders": "^6.5.3",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/typescript-typings": "^5.2.0",
|
"@0x/typescript-typings": "^5.2.0",
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"timestamp": 1630459879,
|
||||||
|
"version": "1.8.4",
|
||||||
|
"changes": [
|
||||||
|
{
|
||||||
|
"note": "Dependencies updated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"timestamp": 1629353596,
|
"timestamp": 1629353596,
|
||||||
"version": "1.8.3",
|
"version": "1.8.3",
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
|||||||
|
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
|
|
||||||
|
## v1.8.4 - _September 1, 2021_
|
||||||
|
|
||||||
|
* Dependencies updated
|
||||||
|
|
||||||
## v1.8.3 - _August 19, 2021_
|
## v1.8.3 - _August 19, 2021_
|
||||||
|
|
||||||
* Dependencies updated
|
* Dependencies updated
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@0x/protocol-utils",
|
"name": "@0x/protocol-utils",
|
||||||
"version": "1.8.3",
|
"version": "1.8.4",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
},
|
},
|
||||||
@@ -63,8 +63,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/assert": "^3.0.27",
|
"@0x/assert": "^3.0.27",
|
||||||
"@0x/contract-addresses": "^6.6.1",
|
"@0x/contract-addresses": "^6.7.0",
|
||||||
"@0x/contract-wrappers": "^13.17.5",
|
"@0x/contract-wrappers": "^13.17.6",
|
||||||
"@0x/json-schemas": "^6.1.3",
|
"@0x/json-schemas": "^6.1.3",
|
||||||
"@0x/subproviders": "^6.5.3",
|
"@0x/subproviders": "^6.5.3",
|
||||||
"@0x/utils": "^6.4.3",
|
"@0x/utils": "^6.4.3",
|
||||||
|
|||||||
60
yarn.lock
60
yarn.lock
@@ -902,12 +902,13 @@
|
|||||||
web3-providers "^2.0.0-alpha.1"
|
web3-providers "^2.0.0-alpha.1"
|
||||||
websocket "^1.0.29"
|
websocket "^1.0.29"
|
||||||
|
|
||||||
"@0x/monorepo-scripts@^3.1.7":
|
"@0x/monorepo-scripts@^3.2.0":
|
||||||
version "3.1.7"
|
version "3.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-3.1.7.tgz#17e719b9e26875958562532ed705cd770d107a43"
|
resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-3.2.0.tgz#a4cacf2fd7f4d8f23cd042e4f6aa8fe360aa2c08"
|
||||||
|
integrity sha512-5z6LYHUIIyZOBGZALZL23LZ76NFfNF9B8IgZS4Oc+j6fFj2bFgTzyj8KqpYHOQXtYmFAom4lSfBelvP9li/oGQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@0x/types" "^3.3.3"
|
"@0x/types" "^3.3.4"
|
||||||
"@0x/utils" "^6.4.3"
|
"@0x/utils" "^6.4.4"
|
||||||
"@lerna/batch-packages" "^3.0.0-beta.18"
|
"@lerna/batch-packages" "^3.0.0-beta.18"
|
||||||
"@types/depcheck" "^0.6.0"
|
"@types/depcheck" "^0.6.0"
|
||||||
"@types/node" "12.12.54"
|
"@types/node" "12.12.54"
|
||||||
@@ -1140,6 +1141,15 @@
|
|||||||
bignumber.js "~9.0.0"
|
bignumber.js "~9.0.0"
|
||||||
ethereum-types "^3.5.0"
|
ethereum-types "^3.5.0"
|
||||||
|
|
||||||
|
"@0x/types@^3.3.4":
|
||||||
|
version "3.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@0x/types/-/types-3.3.4.tgz#184946b1674f7f5b4cfb73105952b499a67fc23e"
|
||||||
|
integrity sha512-lB6maU/D1TEBrJXQcbwzGilmugX9qrfhxbyPr8r89TinSHe2SS694tTKIyI+ijnTbhyVjWzEnA95iuWxhPmP5g==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "12.12.54"
|
||||||
|
bignumber.js "~9.0.0"
|
||||||
|
ethereum-types "^3.6.0"
|
||||||
|
|
||||||
"@0x/typescript-typings@^5.0.1", "@0x/typescript-typings@^5.1.5":
|
"@0x/typescript-typings@^5.0.1", "@0x/typescript-typings@^5.1.5":
|
||||||
version "5.1.5"
|
version "5.1.5"
|
||||||
resolved "https://registry.yarnpkg.com/@0x/typescript-typings/-/typescript-typings-5.1.5.tgz#dd0ad20ef42dad9d054886fd1da72839145b5863"
|
resolved "https://registry.yarnpkg.com/@0x/typescript-typings/-/typescript-typings-5.1.5.tgz#dd0ad20ef42dad9d054886fd1da72839145b5863"
|
||||||
@@ -1173,6 +1183,18 @@
|
|||||||
ethereum-types "^3.5.0"
|
ethereum-types "^3.5.0"
|
||||||
popper.js "1.14.3"
|
popper.js "1.14.3"
|
||||||
|
|
||||||
|
"@0x/typescript-typings@^5.2.1":
|
||||||
|
version "5.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@0x/typescript-typings/-/typescript-typings-5.2.1.tgz#bc82d0f39688b174142ebb5b2fd6a01c1d2f0163"
|
||||||
|
integrity sha512-2yswstFMy/cpF+MrJclEZc8BNceBAVovwzRYdz1CyGPfzMT1Kh8jVGeexx0KvVw58KrhxMgcRD4mzCSHNqzjPA==
|
||||||
|
dependencies:
|
||||||
|
"@types/bn.js" "^4.11.0"
|
||||||
|
"@types/node" "12.12.54"
|
||||||
|
"@types/react" "*"
|
||||||
|
bignumber.js "~9.0.0"
|
||||||
|
ethereum-types "^3.6.0"
|
||||||
|
popper.js "1.14.3"
|
||||||
|
|
||||||
"@0x/utils@^5.1.1", "@0x/utils@^5.4.0", "@0x/utils@^5.4.1":
|
"@0x/utils@^5.1.1", "@0x/utils@^5.4.0", "@0x/utils@^5.4.1":
|
||||||
version "5.6.4"
|
version "5.6.4"
|
||||||
resolved "https://registry.yarnpkg.com/@0x/utils/-/utils-5.6.4.tgz#0158ec3243bbee444d90afbd79981321d19ccdfd"
|
resolved "https://registry.yarnpkg.com/@0x/utils/-/utils-5.6.4.tgz#0158ec3243bbee444d90afbd79981321d19ccdfd"
|
||||||
@@ -1228,6 +1250,26 @@
|
|||||||
js-sha3 "^0.7.0"
|
js-sha3 "^0.7.0"
|
||||||
lodash "^4.17.11"
|
lodash "^4.17.11"
|
||||||
|
|
||||||
|
"@0x/utils@^6.4.4":
|
||||||
|
version "6.4.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/@0x/utils/-/utils-6.4.4.tgz#de9782a7ee2af77580a98a8c6db010dda7f56b94"
|
||||||
|
integrity sha512-gTfK14tdMNtsmHC6FCrWz221+MYJNdDBdhA1hhnT+Kvru22uvhdTpP2udy7296/4yHZaEkDt5ZkvgJMsJCEhbg==
|
||||||
|
dependencies:
|
||||||
|
"@0x/types" "^3.3.4"
|
||||||
|
"@0x/typescript-typings" "^5.2.1"
|
||||||
|
"@types/mocha" "^5.2.7"
|
||||||
|
"@types/node" "12.12.54"
|
||||||
|
abortcontroller-polyfill "^1.1.9"
|
||||||
|
bignumber.js "~9.0.0"
|
||||||
|
chalk "^2.3.0"
|
||||||
|
detect-node "2.0.3"
|
||||||
|
ethereum-types "^3.6.0"
|
||||||
|
ethereumjs-util "^7.1.0"
|
||||||
|
ethers "~4.0.4"
|
||||||
|
isomorphic-fetch "2.2.1"
|
||||||
|
js-sha3 "^0.7.0"
|
||||||
|
lodash "^4.17.11"
|
||||||
|
|
||||||
"@0x/web3-wrapper@^7.5.3":
|
"@0x/web3-wrapper@^7.5.3":
|
||||||
version "7.5.3"
|
version "7.5.3"
|
||||||
resolved "https://registry.yarnpkg.com/@0x/web3-wrapper/-/web3-wrapper-7.5.3.tgz#f36c3a2e5ffcbca2b3deef1a15e7485eb91dba7e"
|
resolved "https://registry.yarnpkg.com/@0x/web3-wrapper/-/web3-wrapper-7.5.3.tgz#f36c3a2e5ffcbca2b3deef1a15e7485eb91dba7e"
|
||||||
@@ -5805,6 +5847,14 @@ ethereum-types@^3.5.0:
|
|||||||
"@types/node" "12.12.54"
|
"@types/node" "12.12.54"
|
||||||
bignumber.js "~9.0.0"
|
bignumber.js "~9.0.0"
|
||||||
|
|
||||||
|
ethereum-types@^3.6.0:
|
||||||
|
version "3.6.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ethereum-types/-/ethereum-types-3.6.0.tgz#7cf0a7258537b1f8d113dd51d050189a742a9a6e"
|
||||||
|
integrity sha512-iJX96C9W1elWhCZKUiSQfWn9fC+EO+xU2TvAE/p7QhMwcGibihKsxcG27B/4WZAudd8jNoeIhY4PH2qQPLuUfw==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "12.12.54"
|
||||||
|
bignumber.js "~9.0.0"
|
||||||
|
|
||||||
ethereumjs-abi@0.6.5:
|
ethereumjs-abi@0.6.5:
|
||||||
version "0.6.5"
|
version "0.6.5"
|
||||||
resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.5.tgz#5a637ef16ab43473fa72a29ad90871405b3f5241"
|
resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.5.tgz#5a637ef16ab43473fa72a29ad90871405b3f5241"
|
||||||
|
|||||||
Reference in New Issue
Block a user