diff --git a/CODEOWNERS b/CODEOWNERS
index de256ab3fc..c97af726ef 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -6,8 +6,6 @@
# https://git-scm.com/docs/gitignore#_pattern_format
-packages/asset-swapper/ @dekz @dextracker @kyu-c
-
# Dev tools & setup
.circleci/ @dekz
diff --git a/packages/asset-swapper/.gitignore b/packages/asset-swapper/.gitignore
deleted file mode 100644
index 2bd6a3f7e3..0000000000
--- a/packages/asset-swapper/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-**/generated-artifacts
-**/generated-wrappers
diff --git a/packages/asset-swapper/.npmignore b/packages/asset-swapper/.npmignore
deleted file mode 100644
index 62439cf8d0..0000000000
--- a/packages/asset-swapper/.npmignore
+++ /dev/null
@@ -1,11 +0,0 @@
-# Blacklist all files
-.*
-*
-# Whitelist lib
-!lib/**/*
-# Whitelist Solidity contracts
-!contracts/src/**/*
-# Blacklist tests and publish scripts
-/lib/test/*
-/lib/monorepo_scripts/
-# Package specific ignore
diff --git a/packages/asset-swapper/.solhint.json b/packages/asset-swapper/.solhint.json
deleted file mode 100644
index 3090d981a1..0000000000
--- a/packages/asset-swapper/.solhint.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "extends": "default",
- "rules": {
- "avoid-low-level-calls": false,
- "avoid-tx-origin": "warn",
- "bracket-align": false,
- "code-complexity": false,
- "compiler-fixed": false,
- "const-name-snakecase": "error",
- "expression-indent": "error",
- "function-max-lines": false,
- "func-order": "error",
- "indent": ["error", 4],
- "max-line-length": ["warn", 160],
- "no-inline-assembly": false,
- "quotes": ["error", "double"],
- "separate-by-one-line-in-contract": "error",
- "space-after-comma": "error",
- "statement-indent": "error"
- }
-}
diff --git a/packages/asset-swapper/CHANGELOG.json b/packages/asset-swapper/CHANGELOG.json
deleted file mode 100644
index 97d50596e8..0000000000
--- a/packages/asset-swapper/CHANGELOG.json
+++ /dev/null
@@ -1,2448 +0,0 @@
-[
- {
- "version": "16.66.4",
- "changes": [
- {
- "note": "Offboard Cream",
- "pr": 546
- },
- {
- "note": "Change WooFi gas estimates",
- "pr": 551
- }
- ],
- "timestamp": 1661145612
- },
- {
- "timestamp": 1660093941,
- "version": "16.66.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "16.66.2",
- "changes": [
- {
- "note": "Upgrade dependency",
- "pr": 543
- }
- ],
- "timestamp": 1660073235
- },
- {
- "version": "16.66.1",
- "changes": [
- {
- "note": "Upgrade dependency",
- "pr": 538
- }
- ],
- "timestamp": 1659926840
- },
- {
- "version": "16.66.0",
- "changes": [
- {
- "note": "Add WOOFi support",
- "pr": 513
- }
- ],
- "timestamp": 1659750766
- },
- {
- "version": "16.65.0",
- "changes": [
- {
- "note": "Use 0x gas api instead of eth gas station api",
- "pr": 532
- }
- ],
- "timestamp": 1659391840
- },
- {
- "version": "16.64.0",
- "changes": [
- {
- "note": "Refactor `TokenAdjacency` and `TokenAdjacencyBuilder`",
- "pr": 517
- },
- {
- "note": "Add Synthetix support`",
- "pr": 518
- },
- {
- "note": "Replace Beethoven X subgraph URL",
- "pr": 519
- },
- {
- "note": "Remove Mooniswap on Ethereum mainnet",
- "pr": 529
- }
- ],
- "timestamp": 1658950329
- },
- {
- "version": "16.63.1",
- "changes": [
- {
- "note": "Better error handling for balancer cache",
- "pr": 515
- }
- ],
- "timestamp": 1657661207
- },
- {
- "version": "16.63.0",
- "changes": [
- {
- "note": "Remove JS router",
- "pr": 480
- },
- {
- "note": "Removed Median price in favour of best gas adjusted price",
- "pr": 480
- }
- ],
- "timestamp": 1656491792
- },
- {
- "version": "16.62.2",
- "changes": [
- {
- "note": "Offboard Smoothy and ComethSwap",
- "pr": 509
- }
- ]
- },
- {
- "version": "16.62.1",
- "changes": [
- {
- "note": "Remove nUSD from intermediate liquidity to save on sampler gas",
- "pr": 505
- }
- ],
- "timestamp": 1655253622
- },
- {
- "version": "16.62.0",
- "changes": [
- {
- "note": "Add MDEX on BSC",
- "pr": 496
- },
- {
- "note": "Add KnightSwap on BSC",
- "pr": 498
- },
- {
- "note": "Add Velodrome support on Optimism",
- "pr": 494
- },
- {
- "note": "Do not send empty entries on Quote Report",
- "pr": 501
- },
- {
- "note": "KnightSwap/Mdex cosmetic change",
- "pr": 502
- },
- {
- "note": "Offboard JetSwap, CafeSwap, JulSwap, and PolyDex",
- "pr": 503
- }
- ],
- "timestamp": 1655244958
- },
- {
- "version": "16.61.0",
- "changes": [
- {
- "note": "Add stETH wrap/unwrap support",
- "pr": 476
- },
- {
- "note": "Offboard/clean up Oasis, CoFix, and legacy Kyber",
- "pr": 482
- },
- {
- "note": "Add MeshSwap on Polygon",
- "pr": 491
- }
- ],
- "timestamp": 1654284040
- },
- {
- "version": "16.60.1",
- "changes": [
- {
- "note": "Alias Balancer sor to the old version",
- "pr": 481
- }
- ],
- "timestamp": 1652931596
- },
- {
- "version": "16.60.0",
- "changes": [
- {
- "note": "Add BiSwap on BSC",
- "pr": 467
- },
- {
- "note": "Add GMX and Platypus on Avalanche and Enable KyberDMM on bsc",
- "pr": 478
- },
- {
- "note": "Add Yoshi Exchange support in Fantom",
- "pr": 473
- },
- {
- "note": "Fix KyberDMM gas underestimation",
- "pr": 479
- }
- ],
- "timestamp": 1652919697
- },
- {
- "version": "16.59.0",
- "changes": [
- {
- "note": "Remove SnowSwap on mainnet",
- "pr": 468
- },
- {
- "note": "Offboard Swerve Finance and LinkSwap",
- "pr": 469
- },
- {
- "note": "Offboard Eth2Dai",
- "pr": 470
- },
- {
- "note": "Add an optional IRfqClient for SwapQuoter#getSwapQuoteAsync",
- "pr": 467
- }
- ],
- "timestamp": 1652400434
- },
- {
- "version": "16.58.0",
- "changes": [
- {
- "note": "Update Saddle pools on Mainnet",
- "pr": 450
- }
- ]
- },
- {
- "version": "16.57.3",
- "changes": [
- {
- "note": "Fix a runtime error related to BalancerV2SwapInfoCache",
- "pr": 472
- }
- ],
- "timestamp": 1652146864
- },
- {
- "version": "16.57.2",
- "changes": [
- {
- "note": "Fix missing AMM quotes on indicative Quote Reports",
- "pr": 466
- }
- ],
- "timestamp": 1651526551
- },
- {
- "version": "16.57.1",
- "changes": [
- {
- "note": "Added QUICK/ANY pair on Polygon",
- "pr": 464
- },
- {
- "note": "Added cvxFXS/FXS curve pool on mainnet",
- "pr": 465
- }
- ]
- },
- {
- "version": "16.57.0",
- "changes": [
- {
- "note": "Add BalancerV2 batch swap support",
- "pr": 462
- }
- ],
- "timestamp": 1650611093
- },
- {
- "version": "16.56.0",
- "changes": [
- {
- "note": "Add estimatedGas to ExtendedQuoteReport",
- "pr": 463
- }
- ],
- "timestamp": 1650575781
- },
- {
- "version": "16.55.0",
- "changes": [
- {
- "note": "Fix fillRfqOrder VIP being used for swaps that need transformERC20",
- "pr": 461
- }
- ],
- "timestamp": 1649347667
- },
- {
- "version": "16.54.0",
- "changes": [
- {
- "note": "Add true VIP support for eligible RFQt swaps",
- "pr": 458
- }
- ],
- "timestamp": 1649215576
- },
- {
- "version": "16.53.0",
- "changes": [
- {
- "note": "Adds support for STG/USDC pool on Curve Mainnet",
- "pr": 451
- },
- {
- "note": "Use neon-router in asset-swapper tests",
- "pr": 453
- },
- {
- "note": "Add sampler blocknumber to quote report data",
- "pr": 448
- }
- ],
- "timestamp": 1648739346
- },
- {
- "version": "16.52.0",
- "changes": [
- {
- "note": "Adds support for mobius money on celo",
- "pr": 423
- }
- ]
- },
- {
- "version": "16.51.0",
- "changes": [
- {
- "note": "Added `Curve` `YFI-ETH` pool",
- "pr": 444
- }
- ],
- "timestamp": 1646888282
- },
- {
- "version": "16.50.3",
- "changes": [
- {
- "note": "Routing glue optimization",
- "pr": 439
- },
- {
- "note": "Move VIP source routing into neon-router & disable fallback orders for native/plp",
- "pr": 440
- }
- ],
- "timestamp": 1646837959
- },
- {
- "version": "16.50.2",
- "changes": [
- {
- "note": "Update `Uniswap_V3` address on `Ropsten`",
- "pr": 441
- }
- ],
- "timestamp": 1646617024
- },
- {
- "version": "16.50.1",
- "changes": [
- {
- "note": "Add BTRFLY/WETH Curve pool on mainnet",
- "pr": 437
- },
- {
- "note": "Lower Uniswap V3 Sampler gas allowance",
- "pr": 438
- }
- ],
- "timestamp": 1646312638
- },
- {
- "version": "16.50.0",
- "changes": [
- {
- "note": "Adding support for Geist on `Fantom`",
- "pr": 398
- },
- {
- "note": "Improve Uniswap V3 gas schedule",
- "pr": 424
- }
- ],
- "timestamp": 1646225739
- },
- {
- "version": "16.49.9",
- "changes": [
- {
- "note": "Fix native order scaling & filter out 1 wei quotes",
- "pr": "430"
- }
- ],
- "timestamp": 1645696356
- },
- {
- "timestamp": 1645569128,
- "version": "16.49.8",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "16.49.7",
- "changes": [
- {
- "note": "Fix native order handling for very small quotes and bump `neon-router` dependency",
- "pr": 425
- }
- ],
- "timestamp": 1645534245
- },
- {
- "version": "16.49.6",
- "changes": [
- {
- "note": "Fixed btrfly routing to include the ohmV2/dai, ohmV2/btfly, and ohmV2/weth pools",
- "pr": 427
- }
- ],
- "timestamp": 1645113751
- },
- {
- "version": "16.49.5",
- "changes": [
- {
- "note": "Fix scaling 1 base unit to 0, round output to base units",
- "pr": 422
- }
- ],
- "timestamp": 1644844353
- },
- {
- "version": "16.49.4",
- "changes": [
- {
- "note": "Reverts 'Improve Uniswap V3 gas schedule' due to issue with buys",
- "pr": 419
- }
- ],
- "timestamp": 1644507275
- },
- {
- "version": "16.49.3",
- "changes": [
- {
- "note": "Fix `slippage` inconsistency when recalculated in exchange proxy quote consumer",
- "pr": 412
- },
- {
- "note": "Fix incorrect output scaling when input is less than desired amount, update fast-abi",
- "pr": 401
- },
- {
- "note": "Improve Uniswap V3 gas schedule",
- "pr": 397
- },
- {
- "note": "Fix add Native as VIP and use Path to compare all sources vs vip only",
- "pr": 413
- }
- ],
- "timestamp": 1644495123
- },
- {
- "version": "16.49.2",
- "changes": [
- {
- "note": "Fix ABI encoding error with two hop buys due to applying slippage to uint(-1) values",
- "pr": 410
- }
- ],
- "timestamp": 1643653482
- },
- {
- "version": "16.49.1",
- "changes": [
- {
- "note": "Fix WorstCaseQuoteInfo encoding bug",
- "pr": 402
- }
- ],
- "timestamp": 1643613597
- },
- {
- "version": "16.49.0",
- "changes": [
- {
- "note": "Add more curve pools",
- "pr": 409
- }
- ],
- "timestamp": 1643407900
- },
- {
- "version": "16.48.0",
- "changes": [
- {
- "note": "Use `MIM` as an intermediate asset on `Fantom`",
- "pr": 405
- }
- ],
- "timestamp": 1643148019
- },
- {
- "version": "16.47.0",
- "changes": [
- {
- "note": "Adding support for Synapse on all networks",
- "pr": 400
- }
- ],
- "timestamp": 1643136662
- },
- {
- "version": "16.46.0",
- "changes": [
- {
- "note": "Enable `Curve` ETH/CVX pool",
- "pr": 394
- }
- ],
- "timestamp": 1641863395
- },
- {
- "version": "16.45.2",
- "changes": [
- {
- "note": "Handle 0 output samples and negative adjusted rate native orders in routing",
- "pr": 387
- }
- ],
- "timestamp": 1641827361
- },
- {
- "version": "16.45.1",
- "changes": [
- {
- "note": "Update `Celo` intermediate tokens",
- "pr": 390
- }
- ],
- "timestamp": 1641359319
- },
- {
- "version": "16.45.0",
- "changes": [
- {
- "note": "Capture router timings",
- "pr": 388
- }
- ],
- "timestamp": 1641308410
- },
- {
- "version": "16.44.0",
- "changes": [
- {
- "note": "Update neon-router and use router estimated output amount",
- "pr": 354
- }
- ],
- "timestamp": 1640778328
- },
- {
- "version": "16.43.0",
- "changes": [
- {
- "note": "`UniswapV3` support for `Optimism`",
- "pr": 385
- }
- ],
- "timestamp": 1640364306
- },
- {
- "version": "16.42.0",
- "changes": [
- {
- "note": "`UniswapV3` support for `Polygon`",
- "pr": 382
- },
- {
- "note": "Update `Beethoven` Graphql url",
- "pr": 383
- }
- ],
- "timestamp": 1640124159
- },
- {
- "version": "16.41.0",
- "changes": [
- {
- "note": "Update mcusd contract address, and made celo native asset",
- "pr": 376
- }
- ],
- "timestamp": 1638827302
- },
- {
- "version": "16.40.0",
- "changes": [
- {
- "note": "Add `AaveV2` and `Compound` deposit/withdrawal liquidity source",
- "pr": 321
- }
- ],
- "timestamp": 1638390144
- },
- {
- "version": "16.39.0",
- "changes": [
- {
- "note": "Curve ETH/CRV pool",
- "pr": 378
- }
- ]
- },
- {
- "version": "16.38.0",
- "changes": [
- {
- "note": "Capture sampler metrics",
- "pr": 374
- }
- ],
- "timestamp": 1638228231
- },
- {
- "version": "16.37.0",
- "changes": [
- {
- "note": "Changed Sushiswap router address",
- "pr": 373
- }
- ],
- "timestamp": 1637349338
- },
- {
- "version": "16.36.0",
- "changes": [
- {
- "note": "Specify liquid routes for FEI/TRIBE FXS/FRAX and OHM/FRAX",
- "pr": 371
- }
- ],
- "timestamp": 1637290768
- },
- {
- "version": "16.35.0",
- "changes": [
- {
- "note": "Add Beethoven X, MorpheusSwap and JetSwap to Fantom",
- "pr": 370
- }
- ],
- "timestamp": 1637206290
- },
- {
- "version": "16.34.0",
- "changes": [
- {
- "note": "Add support Celo",
- "pr": 367
- }
- ],
- "timestamp": 1637102971
- },
- {
- "version": "16.33.0",
- "changes": [
- {
- "note": "Add support for Uniswap V3 1 bps pools",
- "pr": 366
- }
- ],
- "timestamp": 1637065617
- },
- {
- "version": "16.32.0",
- "changes": [
- {
- "note": "Extended Quote Report",
- "pr": 361
- }
- ],
- "timestamp": 1636480845
- },
- {
- "timestamp": 1635903615,
- "version": "16.31.0",
- "changes": [
- {
- "note": "Added `Curve`, `Curve_V2` and `KyberDmm` to Avalanche",
- "pr": 363
- }
- ]
- },
- {
- "timestamp": 1635903615,
- "version": "16.30.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "16.30.0",
- "changes": [
- {
- "note": "Fantom deployment",
- "pr": 347
- }
- ],
- "timestamp": 1634668033
- },
- {
- "version": "16.29.3",
- "changes": [
- {
- "note": "Update neon-router version and address breaking changes",
- "pr": 344
- }
- ],
- "timestamp": 1634553393
- },
- {
- "version": "16.29.2",
- "changes": [
- {
- "note": "Check MAX_IN_RATIO in sampleBuysFromBalancer",
- "pr": 338
- },
- {
- "note": "Go back to using transformERC20 (instead of transformERC20Staging)",
- "pr": 343
- }
- ],
- "timestamp": 1634147078
- },
- {
- "version": "16.29.1",
- "changes": [
- {
- "note": "Remove `Clipper` as a custom liquidity source",
- "pr": 335
- }
- ],
- "timestamp": 1633374058
- },
- {
- "version": "16.29.0",
- "changes": [
- {
- "note": "Initial integration of neon-router (behind feature flag)",
- "pr": 295
- }
- ],
- "timestamp": 1633350101
- },
- {
- "version": "16.28.0",
- "changes": [
- {
- "note": "Update ExchangeProxySwapQuoteConsumer for Multiplex V2 and friends",
- "pr": 282
- }
- ],
- "timestamp": 1632957537
- },
- {
- "version": "16.27.5",
- "changes": [
- {
- "note": "Remove protocol fees by setting `PROTOCOL_FEE_MULTIPLIER` to 0",
- "pr": 333
- }
- ]
- },
- {
- "timestamp": 1631710679,
- "version": "16.27.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1631646242,
- "version": "16.27.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1631639620,
- "version": "16.27.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "16.27.1",
- "changes": [
- {
- "note": "Fix ApproximateBuys sampler to terminate if the buy amount is not met",
- "pr": 319
- }
- ],
- "timestamp": 1631120757
- },
- {
- "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,
- "version": "16.26.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "16.26.0",
- "changes": [
- {
- "note": "feat: Enable partial Native fills to be consumed, previously for v3 they were dropped",
- "pr": 309
- },
- {
- "note": "feat: Modify Intermediate tokens to be a union",
- "pr": 309
- },
- {
- "note": "feat: Retire Eth2Dai/Oasis",
- "pr": 309
- }
- ],
- "timestamp": 1629353596
- },
- {
- "version": "16.25.0",
- "changes": [
- {
- "note": "Fix: fallback fills which have not been used, unique id by source-index"
- }
- ],
- "timestamp": 1629079369
- },
- {
- "timestamp": 1628665757,
- "version": "16.24.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "16.24.0",
- "changes": [
- {
- "note": "Add `Clipper` as a custom liquidity source",
- "pr": 299
- },
- {
- "note": "Added `Curve` `Tricrypto2` and `ESD` v2",
- "pr": 302
- }
- ],
- "timestamp": 1628225642
- },
- {
- "version": "16.23.1",
- "changes": [
- {
- "note": "Fix fill amount rounding error when covnerting fills to orders.",
- "pr": 296
- }
- ],
- "timestamp": 1627572227
- },
- {
- "version": "16.23.0",
- "changes": [
- {
- "note": "ACryptoS",
- "pr": 284
- }
- ],
- "timestamp": 1626473497
- },
- {
- "version": "16.22.0",
- "changes": [
- {
- "note": "IronSwap",
- "pr": 281
- }
- ],
- "timestamp": 1626214787
- },
- {
- "version": "16.21.0",
- "changes": [
- {
- "note": "JetSwap",
- "pr": 280
- }
- ],
- "timestamp": 1625904026
- },
- {
- "version": "16.20.0",
- "changes": [
- {
- "note": "ShibaSwap",
- "pr": 276
- }
- ],
- "timestamp": 1625607277
- },
- {
- "version": "16.19.1",
- "changes": [
- {
- "note": "Fix LiquidityProvider fallback",
- "pr": 272
- }
- ],
- "timestamp": 1625544188
- },
- {
- "version": "16.19.0",
- "changes": [
- {
- "note": "Add LiquidityProvider to Polygon sources",
- "pr": 270
- }
- ],
- "timestamp": 1625190486
- },
- {
- "version": "6.18.3",
- "changes": [
- {
- "note": "Polygon Balance V2"
- }
- ],
- "timestamp": 1624987208
- },
- {
- "timestamp": 1624562704,
- "version": "6.18.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "6.18.1",
- "changes": [
- {
- "note": "FirebirdOneSwap, ApeSwap. New hop tokens: DFYN, BANANA, WEXPOLY",
- "pr": 265
- }
- ],
- "timestamp": 1624405040
- },
- {
- "version": "6.18.0",
- "changes": [
- {
- "note": "Add Lido stETH deposit integration",
- "pr": 260
- }
- ],
- "timestamp": 1624356181
- },
- {
- "version": "6.17.3",
- "changes": [
- {
- "note": "QUICK, TITAN, IRON as intermediate tokens, integrating WaultSwap and Polydex for Polygon, Curve renBTC pool"
- }
- ],
- "timestamp": 1623807529
- },
- {
- "timestamp": 1623382456,
- "version": "6.17.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1622609597,
- "version": "6.17.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "6.17.0",
- "changes": [
- {
- "note": "Re-enable liquidity provider and update KNC address",
- "pr": 253
- }
- ],
- "timestamp": 1622154125
- },
- {
- "version": "6.16.0",
- "changes": [
- {
- "note": "Add support for the Polygon chain",
- "pr": 240
- }
- ],
- "timestamp": 1621944788
- },
- {
- "version": "6.15.0",
- "changes": [
- {
- "note": "Fix KyberDmm",
- "pr": 236
- },
- {
- "note": "Re-enable KyberDmm",
- "pr": 247
- },
- {
- "note": "Add Huobi Token to liquidity provider tokens",
- "pr": 246
- },
- {
- "note": "Temporarily disable specific LiquidityProvider"
- }
- ],
- "timestamp": 1621600614
- },
- {
- "version": "6.14.0",
- "changes": [
- {
- "note": "Add support for additional sources and intermediate tokens on Ropsten",
- "pr": 231
- },
- {
- "note": "Add UniswapV3 VIP support",
- "pr": 237
- }
- ],
- "timestamp": 1620810800
- },
- {
- "version": "6.13.0",
- "changes": [
- {
- "note": "Add LiquidityProvider to BSC sources",
- "pr": 234
- }
- ],
- "timestamp": 1620703098
- },
- {
- "version": "6.12.0",
- "changes": [
- {
- "note": "`TwoHopSampler` to use `call` over `staticcall` in order to support sources like `Uniswap_V3` and `Balancer_V2`",
- "pr": 233
- }
- ],
- "timestamp": 1620610602
- },
- {
- "version": "6.11.0",
- "changes": [
- {
- "note": "Add price comparisons data separate from the quote report",
- "pr": 219
- },
- {
- "note": "Add caching for top Balancer V2 pools on startup and during regular intervals",
- "pr": 228
- },
- {
- "note": "Tweak compiler settings for smaller sampler bytecode",
- "pr": 229
- },
- {
- "note": "Fix Multiplex multihop encoding for ETH buys/sells",
- "pr": 230
- },
- {
- "note": "Fix Sampler address override for Ganache",
- "pr": 232
- }
- ],
- "timestamp": 1620362129
- },
- {
- "version": "6.10.0",
- "changes": [
- {
- "note": "Reactivate PancakeSwapV2 and BakerySwap VIP on BSC",
- "pr": 222
- },
- {
- "note": "Add LUSD Curve pool",
- "pr": 218
- },
- {
- "note": "Fix exchangeProxyGasOverhead for fallback path",
- "pr": 215
- },
- {
- "note": "Enable ETH based Curve pools",
- "pr": 220
- },
- {
- "note": "Reactivate PancakeSwapV2 and BakerySwap VIP on BSC",
- "pr": 222
- },
- {
- "note": "Disable WETH based SnowSwap pools",
- "pr": 220
- },
- {
- "note": "PLP now includes a fallback due to observed collisions",
- "pr": 223
- },
- {
- "note": "Add Balancer V2 integration",
- "pr": 206
- },
- {
- "note": "Re-work the PoolCache for Balancer et al",
- "pr": 226
- }
- ],
- "timestamp": 1620214333
- },
- {
- "version": "6.9.1",
- "changes": [
- {
- "note": "Temporarily remove PancakeV2 and BakerySwap from VIP"
- }
- ],
- "timestamp": 1619830995
- },
- {
- "version": "6.9.0",
- "changes": [
- {
- "note": "Remove conflicting Kyber reserve",
- "pr": 216
- }
- ],
- "timestamp": 1619825976
- },
- {
- "version": "6.8.0",
- "changes": [
- {
- "note": "Prune paths which cannot improve the best path",
- "pr": 183
- },
- {
- "note": "Use FastABI for Sampler ABI encoding and decoding",
- "pr": 183
- }
- ],
- "timestamp": 1619596077
- },
- {
- "version": "6.7.0",
- "changes": [
- {
- "note": "Support PancakeSwap V2",
- "pr": 211
- }
- ],
- "timestamp": 1619481586
- },
- {
- "version": "6.6.1",
- "changes": [
- {
- "note": "Fixing Positive Slippage logic to not force the EP route",
- "pr": 209
- }
- ]
- },
- {
- "version": "6.6.0",
- "changes": [
- {
- "note": "Support `Ropsten` network",
- "pr": 203
- },
- {
- "note": "BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule",
- "pr": 208
- }
- ],
- "timestamp": 1618592834
- },
- {
- "version": "6.5.3",
- "changes": [
- {
- "note": "Apply slippage to bridge orders in consumer",
- "pr": 198
- }
- ],
- "timestamp": 1618433771
- },
- {
- "timestamp": 1618314654,
- "version": "6.5.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1618259868,
- "version": "6.5.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "6.5.0",
- "changes": [
- {
- "note": "Add Kyber DMM to Ethereum mainnet",
- "pr": 194
- },
- {
- "note": "Add default LiquidityProvider registry and allow LiquidityProvider gasCost to be a function of tokens",
- "pr": 196
- }
- ],
- "timestamp": 1617913615
- },
- {
- "version": "6.4.0",
- "changes": [
- {
- "note": "Added Component, Smoothy, Saddle, Curve open pools, tweeks gas schedule, adding SushiSwap as a fee quote source",
- "pr": 182
- },
- {
- "note": "Use SOURCE_FLAGS.rfqOrder in comparisonPrice",
- "pr": 177
- },
- {
- "note": "Add a cancel token to ensure timeouts are respected",
- "pr": 176
- },
- {
- "note": "Rename {Rfqt=>Rfq} for many types in Asset Swapper",
- "pr": 179
- },
- {
- "note": "improve logging for alt RFQ requests",
- "pr": 158
- },
- {
- "note": "Use new bridge source ID encoding.",
- "pr": 162
- },
- {
- "note": "Refactor to provide chain id specific addresses",
- "pr": 163
- },
- {
- "note": "Added PancakeSwap and BakerySwap on Chain 56",
- "pr": 163
- },
- {
- "note": "Added Nerve and Dodo (v1) to BSC",
- "pr": 181
- }
- ],
- "timestamp": 1617311315
- },
- {
- "version": "6.3.0",
- "changes": [
- {
- "note": "Add MooniswapLiquidityProvider \"direct\" route to EP consumer.",
- "pr": 143
- },
- {
- "note": "Enable the ability to send RFQT requests thru a proxy",
- "pr": 159
- },
- {
- "note": "Add support for MultiplexFeature",
- "pr": 168
- }
- ],
- "timestamp": 1616005394
- },
- {
- "version": "6.2.0",
- "changes": [
- {
- "note": "drop curve Y and BUSD pools",
- "pr": 161
- }
- ],
- "timestamp": 1614645844
- },
- {
- "version": "6.1.0",
- "changes": [
- {
- "note": "Filter MultiHop where second source is not present",
- "pr": 138
- },
- {
- "note": "Add CurveLiquidityProvider \"direct\" route to EP consumer.",
- "pr": 127
- },
- {
- "note": "Fix compiler error on `ILiquidityProvider` call",
- "pr": 127
- },
- {
- "note": "Add deployed `CurveLiquidityProvider` addresses",
- "pr": 144
- },
- {
- "note": "Support `Mirror Protocol` with hops to `UST`",
- "pr": 142
- },
- {
- "note": "Fix protocol fee in fee schedule for `RfqOrder`",
- "pr": 146
- },
- {
- "note": "Special case BNB in uni v1 sampler",
- "pr": 147
- },
- {
- "note": "Create `FakeTaker` contract to get result data and gas used",
- "pr": 151
- },
- {
- "note": "Added support for `Dodo` v2",
- "pr": 152
- },
- {
- "note": "Added support for `Linkswap`",
- "pr": 153
- },
- {
- "note": "Re-add WBTC in default intermediate hops",
- "pr": 154
- },
- {
- "note": "Add an alternative RFQ market making implementation",
- "pr": 139
- },
- {
- "note": "Added an opt-in `PositiveSlippageAffiliateFee`",
- "pr": 101
- }
- ],
- "timestamp": 1614141718
- },
- {
- "version": "6.0.0",
- "changes": [
- {
- "note": "Pull top 250 Balancer pairs on initialization",
- "pr": 113
- },
- {
- "note": "Support v4 `RFQ` and `Limit` orders",
- "pr": 113
- },
- {
- "note": "Refactor to consume latest `FillQuoteTransformer`",
- "pr": 113
- },
- {
- "note": "Enable `fillData` for all sources, no longer optional",
- "pr": 113
- },
- {
- "note": "Support `tx.origin` in RFQT quote requestor",
- "pr": 113
- }
- ],
- "timestamp": 1612950500
- },
- {
- "version": "5.8.2",
- "changes": [
- {
- "note": "Fix error when Multihop data is not present",
- "pr": 80
- }
- ],
- "timestamp": 1611869778
- },
- {
- "timestamp": 1611648096,
- "version": "5.8.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "5.8.0",
- "changes": [
- {
- "note": "Automatically Discover Kyber reserves for tokens using `getTradingReserves`",
- "pr": 111
- },
- {
- "note": "Return `CallResults` from the Sampler",
- "pr": 111
- }
- ],
- "timestamp": 1610510890
- },
- {
- "version": "5.7.0",
- "changes": [
- {
- "note": "Add SPDX license identifiers to solidity files",
- "pr": 105
- }
- ]
- },
- {
- "timestamp": 1609802516,
- "version": "5.6.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "5.6.1",
- "changes": [
- {
- "note": "Fix fillAmount `ExchangeProxySwapQuoteConsumer` encoding when quote is a BuyQuote"
- }
- ],
- "timestamp": 1609387311
- },
- {
- "version": "5.6.0",
- "changes": [
- {
- "note": "Added Mooniswap V2 factory address",
- "pr": 100
- }
- ],
- "timestamp": 1609113560
- },
- {
- "timestamp": 1608692071,
- "version": "5.5.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1608245516,
- "version": "5.5.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1608149382,
- "version": "5.5.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "5.5.0",
- "changes": [
- {
- "note": "Bancor now supported in all pairs",
- "pr": 88
- }
- ],
- "timestamp": 1608105788
- },
- {
- "timestamp": 1607485227,
- "version": "5.4.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1607381756,
- "version": "5.4.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "5.4.0",
- "changes": [
- {
- "note": "Add `takerAssetToEthRate` and `makerAssetToEthRate` to swap quote response",
- "pr": 49
- }
- ],
- "timestamp": 1607373752
- },
- {
- "timestamp": 1607036724,
- "version": "5.3.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "5.3.0",
- "changes": [
- {
- "note": "Added Crypto.com",
- "pr": 43
- },
- {
- "note": "Add `getQuoteInfoMinBuyAmount` to quote consumer utils",
- "pr": 62
- },
- {
- "note": "Add `unoptimizedQuoteInfo` and `unoptimizedOrders` to SwapQuoteBase",
- "pr": 62
- },
- {
- "note": "Add `unoptimizedPath` to OptimizerResult",
- "pr": 62
- },
- {
- "note": "Enable PLP VIP feature and add gasCost field to LiquidityProviderRegistry",
- "pr": 65
- }
- ],
- "timestamp": 1606961263
- },
- {
- "version": "5.2.0",
- "changes": [
- {
- "note": "Update Gas schedules",
- "pr": 34
- },
- {
- "note": "Return the maker/taker token decimals from the sampler as part of the `SwapQuote`",
- "pr": 34
- },
- {
- "note": "Disable off-chain sampling for Balancer and CREAM",
- "pr": 41
- }
- ],
- "timestamp": 1605763885
- },
- {
- "version": "5.1.1",
- "changes": [
- {
- "note": "Disable PLP VIP feature in EP swap quote consumer",
- "pr": 36
- }
- ],
- "timestamp": 1605320370
- },
- {
- "version": "5.1.0",
- "changes": [
- {
- "note": "Add support for LiquidityProvider feature in the swap quote consumer",
- "pr": 16
- },
- {
- "note": "Remove support for MultiBridge 😞",
- "pr": 16
- }
- ],
- "timestamp": 1605302002
- },
- {
- "timestamp": 1604620645,
- "version": "5.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1604385937,
- "version": "5.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- },
- {
- "note": "adding Curve pools: PAX, hBTC, metapools: gUSD, hUSD, USDn, mUSD, tBTC",
- "pr": 26
- }
- ]
- },
- {
- "timestamp": 1604376968,
- "version": "5.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "5.0.0",
- "changes": [
- {
- "note": "Support multiple `Shells` by supplying the `pool` address",
- "pr": 17
- },
- {
- "note": "Make use of Token Adjacency in more places. Moved as a parameter for the quote",
- "pr": 24
- }
- ],
- "timestamp": 1604355662
- },
- {
- "version": "4.8.1",
- "changes": [
- {
- "note": "Fix Gas schedule with `SnowSwap` and `Bancor`",
- "pr": 15
- }
- ],
- "timestamp": 1603851023
- },
- {
- "version": "4.8.0",
- "changes": [
- {
- "note": "Moved Bridge addresses into Asset-swapper",
- "pr": 4
- },
- {
- "note": "Updated Sampler to Solidity 0.6",
- "pr": 4
- }
- ],
- "timestamp": 1603833198
- },
- {
- "timestamp": 1603487270,
- "version": "4.7.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "4.7.0",
- "changes": [
- {
- "note": "Return quoteReport from SwapQuoter functions",
- "pr": 2627
- },
- {
- "note": "Allow an empty override for sampler overrides",
- "pr": 2637
- },
- {
- "note": "Potentially heavy CPU functions inside the optimizer now yield to the event loop. As such they are now async.",
- "pr": 2637
- },
- {
- "note": "Support more varied curves",
- "pr": 2633
- },
- {
- "note": "Make path optimization go faster",
- "pr": 2640
- },
- {
- "note": "Adds `getBidAskLiquidityForMakerTakerAssetPairAsync` to return more detailed sample information",
- "pr": 2641
- },
- {
- "note": "Fix regression where a split on the same source was collapsed into a single fill",
- "pr": 2654
- },
- {
- "note": "Add support for buy token affiliate fees",
- "pr": 2658
- },
- {
- "note": "Fix optimization of buy paths",
- "pr": 2655
- },
- {
- "note": "Fix depth buy scale",
- "pr": 2659
- },
- {
- "note": "Adjust fill by ethToInputRate when ethToOutputRate is 0",
- "pr": 2660
- },
- {
- "note": "Add Bancor as liquidity source",
- "pr": 2650
- },
- {
- "note": "Added `mStable`",
- "pr": 2662
- },
- {
- "note": "Merge `erc20-bridge-sampler` into this package",
- "pr": 2664
- },
- {
- "note": "Added `Mooniswap`",
- "pr": 2675
- },
- {
- "note": "Stop requiring takerAddress for RFQ-T indicative quotes",
- "pr": 2684
- },
- {
- "note": "Added two-hop support",
- "pr": 2647
- },
- {
- "note": "Move ERC20BridgeSampler interfaces into `interfaces` directory",
- "pr": 2647
- },
- {
- "note": "Use on-chain sampling (sometimes) for Balancer",
- "pr": 2647
- },
- {
- "note": "Re-worked `Kyber` quotes supporting multiple reserves",
- "pr": 2683
- },
- {
- "note": "Enable Quote Report to be generated with an option `shouldGenerateQuoteReport`. Default is `false`",
- "pr": 2687
- },
- {
- "note": "Add `refundReceiver` to `ExchangeProxySwapQuoteConsumer` options.",
- "pr": 2657
- },
- {
- "note": "Use `IZeroExContract` in EP swap quote consumer.",
- "pr": 2657
- },
- {
- "note": "Set `rfqtTakerAddress` to null in EP consumer",
- "pr": 2692
- },
- {
- "note": "Return Mooniswap pool in sampler and encode it in bridge data",
- "pr": 2692
- },
- {
- "note": "Added `Swerve`",
- "pr": 2698
- },
- {
- "note": "Added `SushiSwap`",
- "pr": 2698
- },
- {
- "note": "Add uniswap VIP support",
- "pr": 2703
- },
- {
- "note": "Add `includedSources` support",
- "pr": 2703
- },
- {
- "note": "Added `Curve` Tripool",
- "pr": 2708
- },
- {
- "note": "Pass back fillData from quote reporter",
- "pr": 2702
- },
- {
- "note": "Fix Balancer sampling",
- "pr": 2711
- },
- {
- "note": "Respect max slippage in EP consumer",
- "pr": 2712
- },
- {
- "note": "Introduced Path class, exchangeProxyOverhead parameter",
- "pr": 2691
- },
- {
- "note": "Added `Shell`",
- "pr": 2722
- },
- {
- "note": "Fix exchange proxy overhead gas being scaled by gas price",
- "pr": 2723
- },
- {
- "note": "Remove 0x-API swap/v0-specifc code from asset-swapper",
- "pr": 2725
- },
- {
- "note": "Added `DODO`",
- "pr": 2701
- },
- {
- "note": "Fix for some edge cases with `includedSources` and `MultiHop`",
- "pr": 2730
- },
- {
- "note": "Introduced `excludedFeeSources` to disable sources when determining the price of an asset in ETH",
- "pr": 2731
- },
- {
- "note": "Support `DODO` Trade Allowed parameter to automatically disable the pool",
- "pr": 2732
- },
- {
- "note": "Added `SwerveBridge` and `SnowSwapBridge` deployed addresses",
- "pr": 7
- }
- ],
- "timestamp": 1603265572
- },
- {
- "version": "4.6.0",
- "changes": [
- {
- "note": "Use internal Eth Gas Station proxy",
- "pr": 2614
- },
- {
- "note": "Renamed RFQT request parameters",
- "pr": 2582
- },
- {
- "note": "Fix worst case asset amount calculations.",
- "pr": 2615
- },
- {
- "note": "Specify EthGasStation url as an optional parameter",
- "pr": 2617
- },
- {
- "note": "Singleton Gas Price Oracle",
- "pr": 2619
- },
- {
- "note": "\"Fix\" forwarder buys of low decimal tokens.",
- "pr": 2618
- },
- {
- "note": "Add Balancer support",
- "pr": 2613
- },
- {
- "note": "Consolidate UniswapV2 sources, Curve sources in `ERC20BridgeSource` enum",
- "pr": 2613
- },
- {
- "note": "Change gas/fee schedule values from constants to functions returning numbers",
- "pr": 2613
- },
- {
- "note": "Specify overrides to the ERC20Sampler contract, by default the latest bytecode is the override",
- "pr": 2629
- }
- ],
- "timestamp": 1594788383
- },
- {
- "version": "4.5.0",
- "changes": [
- {
- "note": "Add support for private liquidity providers",
- "pr": 2505
- },
- {
- "note": "Big refactor of market operation utils",
- "pr": 2513
- },
- {
- "note": "Remove `dustFractionThreshold`, `noConflicts` options.",
- "pr": 2513
- },
- {
- "note": "Revamp fill optimization algorithm",
- "pr": 2513
- },
- {
- "note": "Add fallback orders to quotes via `allowFallback` option.",
- "pr": 2513
- },
- {
- "note": "Add `maxFallbackSlippage` option.",
- "pr": 2513
- },
- {
- "note": "Fix fee schedule not being scaled by gas price.",
- "pr": 2522
- },
- {
- "note": "Fix quote optimizer bug not properly accounting for fees.",
- "pr": 2526
- },
- {
- "note": "Fix `getBatchMarketBuyOrdersAsync` throwing NO_OPTIMAL_PATH",
- "pr": 2533
- },
- {
- "note": "Add DFB support + refactor swap quote calculator utils",
- "pr": 2536
- },
- {
- "note": "Add support for RFQ-T, querying maker-hosted endpoints for quotes to be submitted by the taker",
- "pr": 2541
- },
- {
- "note": "Add support for indicative (non-committal) quotes via RFQ-T",
- "pr": 2555
- },
- {
- "note": "Collapse `LiquidityProvider` into `DexForwarderBridge`",
- "pr": 2560
- },
- {
- "note": "Added Curve `sUSD`",
- "pr": 2563
- },
- {
- "note": "Fix sporadically failing quote simulation tests",
- "pr": 2564
- },
- {
- "note": "Apply Native order penalty inline with the target amount",
- "pr": 2565
- },
- {
- "note": "Remove Kyber exclusion when Uniswap/Eth2Dai is present",
- "pr": 2575
- },
- {
- "note": "Expose fills object in asset-swapper quote orders",
- "pr": 2583
- },
- {
- "note": "Increase timeout for tests",
- "pr": 2587
- },
- {
- "note": "Add support for Uniswap V2",
- "pr": 2599
- },
- {
- "note": "Add support for MultiBridge",
- "pr": 2593
- },
- {
- "note": "Fix Uniswap V2 path ordering",
- "pr": 2601
- },
- {
- "note": "Add exchange proxy support",
- "pr": 2591
- }
- ],
- "timestamp": 1592969527
- },
- {
- "version": "4.4.0",
- "changes": [
- {
- "note": "Add support for ERC721 assets",
- "pr": 2491
- },
- {
- "note": "Add destroy for gas heartbeat",
- "pr": 2492
- },
- {
- "note": "Added `BUSD` Curve",
- "pr": 2506
- },
- {
- "note": "Updated `Compound` Curve address",
- "pr": 2506
- }
- ],
- "timestamp": 1583220306
- },
- {
- "version": "4.3.2",
- "changes": [
- {
- "note": "Fix order native pruning by fill amount",
- "pr": 2500
- }
- ],
- "timestamp": 1582837861
- },
- {
- "timestamp": 1582677073,
- "version": "4.3.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "4.3.0",
- "changes": [
- {
- "note": "Add `fees` to `GetMarketOrdersOpts`",
- "pr": 2481
- },
- {
- "note": "Incorporate fees into fill optimization",
- "pr": 2481
- }
- ],
- "timestamp": 1582623685
- },
- {
- "version": "4.2.0",
- "changes": [
- {
- "note": "Use `batchCall()` version of the `ERC20BridgeSampler` contract",
- "pr": 2477
- },
- {
- "note": "Support for sampling Curve contracts",
- "pr": 2483
- }
- ],
- "timestamp": 1581748629
- },
- {
- "timestamp": 1581204851,
- "version": "4.1.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "4.1.1",
- "changes": [
- {
- "note": "Fix bug with liquidity source breakdown",
- "pr": 2472
- },
- {
- "note": "Prune orders before creating a dummy order for the Sampler",
- "pr": 2470
- },
- {
- "note": "Bump sampler gas limit to 60e6",
- "pr": 2471
- }
- ],
- "timestamp": 1580988106
- },
- {
- "version": "4.1.0",
- "changes": [
- {
- "note": "Allow contract addresses to be passed as optional constructor ags instead of hardcoding",
- "pr": 2461
- },
- {
- "note": "Add swap quote liquidity source breakdown",
- "pr": 2465
- }
- ],
- "timestamp": 1580811564
- },
- {
- "version": "4.0.1",
- "changes": [
- {
- "note": "Fix underestimated protocol fee in worst case quote.",
- "pr": 2452
- }
- ],
- "timestamp": 1579744659
- },
- {
- "version": "4.0.0",
- "changes": [
- {
- "note": "Upgrade to new `Forwarder` contract with flat affiliate fees.",
- "pr": 2432
- },
- {
- "note": "Remove `getSmartContractParamsOrThrow()` from `SwapQuoteConsumer`s.",
- "pr": 2432
- },
- {
- "note": "Added `getBatchMarketBuySwapQuoteForAssetDataAsync` on `SwapQuoter`",
- "pr": 2427
- },
- {
- "note": "Add exponential sampling distribution and `sampleDistributionBase` option to `SwapQuoter`",
- "pr": 2427
- },
- {
- "note": "Compute more accurate best quote price",
- "pr": 2427
- },
- {
- "note": "Change Exchange sell function from `marketSellOrdersNoThrow` to `marketSellOrdersFillOrKill`",
- "pr": 2450
- }
- ],
- "timestamp": 1579682890
- },
- {
- "version": "3.0.3",
- "changes": [
- {
- "note": "Ignore zero sample results from the sampler contract.",
- "pr": 2406
- },
- {
- "note": "Increase default `runLimit` from `1024` to `4096`.",
- "pr": 2406
- },
- {
- "note": "Increase default `numSamples` from `8` to `10`",
- "pr": 2406
- },
- {
- "note": "Fix ordering of optimized orders.",
- "pr": 2406
- },
- {
- "note": "Fix best and worst quotes being reversed sometimes.",
- "pr": 2406
- },
- {
- "note": "Fix rounding of quoted asset amounts.",
- "pr": 2406
- },
- {
- "note": "Undo bridge slippage in best case quote calculation.",
- "pr": 2406
- },
- {
- "note": "Compare equivalent asset data when validating quotes and checking fee asset data.",
- "pr": 2421
- }
- ],
- "timestamp": 1578272714
- },
- {
- "version": "3.0.2",
- "changes": [
- {
- "note": "Fix gasPrice from `ethgasstation` to be in WEI instead of GWEI",
- "pr": 2393
- },
- {
- "note": "Add aggregator utils",
- "pr": 2353
- }
- ],
- "timestamp": 1576540892
- },
- {
- "timestamp": 1575931811,
- "version": "3.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "3.0.0",
- "changes": [
- {
- "note": "Refactor of logic for marketBuy/marketSell order pruning and selecting, introduced protocol fees, and refactored types used by the package",
- "pr": 2272
- },
- {
- "note": "Incorporate paying protocol fees.",
- "pr": 2350
- },
- {
- "note": "Update BigNumber version to ~9.0.0",
- "pr": 2342
- },
- {
- "note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
- "pr": 2313
- }
- ],
- "timestamp": 1575296764
- },
- {
- "version": "2.1.0-beta.4",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1575290197
- },
- {
- "version": "2.1.0-beta.3",
- "changes": [
- {
- "note": "Refactor of logic for marketBuy/marketSell order pruning and selecting, introduced protocol fees, and refactored types used by the package",
- "pr": 2272
- },
- {
- "note": "Incorporate paying protocol fees.",
- "pr": 2350
- }
- ],
- "timestamp": 1574238768
- },
- {
- "version": "2.1.0-beta.2",
- "changes": [
- {
- "note": "Update BigNumber version to ~9.0.0",
- "pr": 2342
- }
- ],
- "timestamp": 1573159180
- },
- {
- "version": "2.1.0-beta.1",
- "changes": [
- {
- "note": "All references to network ID have been removed, and references to chain ID have been introduced instead",
- "pr": 2313
- }
- ],
- "timestamp": 1573159180
- },
- {
- "version": "2.1.0-beta.0",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1570135330
- },
- {
- "version": "2.0.0",
- "changes": [
- {
- "note": "AssetSwapper to use `@0x/orderbook` to fetch and subscribe to order updates",
- "pr": 2056
- }
- ],
- "timestamp": 1568744790
- },
- {
- "timestamp": 1567521715,
- "version": "1.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1566446343,
- "version": "1.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1565296576,
- "version": "1.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.0",
- "changes": [
- {
- "note": "Added optimization utils to consumer output",
- "pr": 1988
- },
- {
- "note": "Expanded test coverage",
- "pr": 1980
- }
- ],
- "timestamp": 1564604963
- },
- {
- "timestamp": 1563957393,
- "version": "0.0.5",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1563193019,
- "version": "0.0.4",
- "changes": [
- {
- "note": "Switched MarketOperation type to enum and expanded default constants configuration",
- "pr": 1959
- },
- {
- "note": "Added additional options to control asset-swapper behavior and optimized consumer output",
- "pr": 1966
- }
- ]
- },
- {
- "timestamp": 1563047529,
- "version": "0.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1563006338,
- "version": "0.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "0.0.1",
- "changes": [
- {
- "note": "Refactored asset-buyer into asset-swapper to support ERC<>ERC marketSell and marketBuy operations",
- "pr": 1845
- }
- ]
- }
-]
diff --git a/packages/asset-swapper/CHANGELOG.md b/packages/asset-swapper/CHANGELOG.md
deleted file mode 100644
index 344b37fd98..0000000000
--- a/packages/asset-swapper/CHANGELOG.md
+++ /dev/null
@@ -1,893 +0,0 @@
-
-
-CHANGELOG
-
-## v16.66.4 - _August 22, 2022_
-
- * Offboard Cream (#546)
- * Change WooFi gas estimates (#551)
-
-## v16.66.3 - _August 10, 2022_
-
- * Dependencies updated
-
-## v16.66.2 - _August 9, 2022_
-
- * Upgrade dependency (#543)
-
-## v16.66.1 - _August 8, 2022_
-
- * Upgrade dependency (#538)
-
-## v16.66.0 - _August 6, 2022_
-
- * Add WOOFi support (#513)
-
-## v16.65.0 - _August 1, 2022_
-
- * Use 0x gas api instead of eth gas station api (#532)
-
-## v16.64.0 - _July 27, 2022_
-
- * Refactor `TokenAdjacency` and `TokenAdjacencyBuilder` (#517)
- * Add Synthetix support` (#518)
- * Replace Beethoven X subgraph URL (#519)
- * Remove Mooniswap on Ethereum mainnet (#529)
-
-## v16.63.1 - _July 12, 2022_
-
- * Better error handling for balancer cache (#515)
-
-## v16.63.0 - _June 29, 2022_
-
- * Remove JS router (#480)
- * Removed Median price in favour of best gas adjusted price (#480)
-
-## v16.62.2 - _Invalid date_
-
- * Offboard Smoothy and ComethSwap (#509)
-
-## v16.62.1 - _June 15, 2022_
-
- * Remove nUSD from intermediate liquidity to save on sampler gas (#505)
-
-## v16.62.0 - _June 14, 2022_
-
- * Add MDEX on BSC (#496)
- * Add KnightSwap on BSC (#498)
- * Add Velodrome support on Optimism (#494)
- * Do not send empty entries on Quote Report (#501)
- * KnightSwap/Mdex cosmetic change (#502)
- * Offboard JetSwap, CafeSwap, JulSwap, and PolyDex (#503)
-
-## v16.61.0 - _June 3, 2022_
-
- * Add stETH wrap/unwrap support (#476)
- * Offboard/clean up Oasis, CoFix, and legacy Kyber (#482)
- * Add MeshSwap on Polygon (#491)
-
-## v16.60.1 - _May 19, 2022_
-
- * Alias Balancer sor to the old version (#481)
-
-## v16.60.0 - _May 19, 2022_
-
- * Add BiSwap on BSC (#467)
- * Add GMX and Platypus on Avalanche and Enable KyberDMM on bsc (#478)
- * Add Yoshi Exchange support in Fantom (#473)
- * Fix KyberDMM gas underestimation (#479)
-
-## v16.59.0 - _May 13, 2022_
-
- * Remove SnowSwap on mainnet (#468)
- * Offboard Swerve Finance and LinkSwap (#469)
- * Offboard Eth2Dai (#470)
- * Add an optional IRfqClient for SwapQuoter#getSwapQuoteAsync (#467)
-
-## v16.58.0 - _Invalid date_
-
- * Update Saddle pools on Mainnet (#450)
-
-## v16.57.3 - _May 10, 2022_
-
- * Fix a runtime error related to BalancerV2SwapInfoCache (#472)
-
-## v16.57.2 - _May 2, 2022_
-
- * Fix missing AMM quotes on indicative Quote Reports (#466)
-
-## v16.57.1 - _Invalid date_
-
- * Added QUICK/ANY pair on Polygon (#464)
- * Added cvxFXS/FXS curve pool on mainnet (#465)
-
-## v16.57.0 - _April 22, 2022_
-
- * Add BalancerV2 batch swap support (#462)
-
-## v16.56.0 - _April 21, 2022_
-
- * Add estimatedGas to ExtendedQuoteReport (#463)
-
-## v16.55.0 - _April 7, 2022_
-
- * Fix fillRfqOrder VIP being used for swaps that need transformERC20 (#461)
-
-## v16.54.0 - _April 6, 2022_
-
- * Add true VIP support for eligible RFQt swaps (#458)
-
-## v16.53.0 - _March 31, 2022_
-
- * Adds support for STG/USDC pool on Curve Mainnet (#451)
- * Use neon-router in asset-swapper tests (#453)
- * Add sampler blocknumber to quote report data (#448)
-
-## v16.52.0 - _Invalid date_
-
- * Adds support for mobius money on celo (#423)
-
-## v16.51.0 - _March 10, 2022_
-
- * Added `Curve` `YFI-ETH` pool (#444)
-
-## v16.50.3 - _March 9, 2022_
-
- * Routing glue optimization (#439)
- * Move VIP source routing into neon-router & disable fallback orders for native/plp (#440)
-
-## v16.50.2 - _March 7, 2022_
-
- * Update `Uniswap_V3` address on `Ropsten` (#441)
-
-## v16.50.1 - _March 3, 2022_
-
- * Add BTRFLY/WETH Curve pool on mainnet (#437)
- * Lower Uniswap V3 Sampler gas allowance (#438)
-
-## v16.50.0 - _March 2, 2022_
-
- * Adding support for Geist on `Fantom` (#398)
- * Improve Uniswap V3 gas schedule (#424)
-
-## v16.49.9 - _February 24, 2022_
-
- * Fix native order scaling & filter out 1 wei quotes (#430)
-
-## v16.49.8 - _February 22, 2022_
-
- * Dependencies updated
-
-## v16.49.7 - _February 22, 2022_
-
- * Fix native order handling for very small quotes and bump `neon-router` dependency (#425)
-
-## v16.49.6 - _February 17, 2022_
-
- * Fixed btrfly routing to include the ohmV2/dai, ohmV2/btfly, and ohmV2/weth pools (#427)
-
-## v16.49.5 - _February 14, 2022_
-
- * Fix scaling 1 base unit to 0, round output to base units (#422)
-
-## v16.49.4 - _February 10, 2022_
-
- * Reverts 'Improve Uniswap V3 gas schedule' due to issue with buys (#419)
-
-## v16.49.3 - _February 10, 2022_
-
- * Fix `slippage` inconsistency when recalculated in exchange proxy quote consumer (#412)
- * Fix incorrect output scaling when input is less than desired amount, update fast-abi (#401)
- * Improve Uniswap V3 gas schedule (#397)
- * Fix add Native as VIP and use Path to compare all sources vs vip only (#413)
-
-## v16.49.2 - _January 31, 2022_
-
- * Fix ABI encoding error with two hop buys due to applying slippage to uint(-1) values (#410)
-
-## v16.49.1 - _January 31, 2022_
-
- * Fix WorstCaseQuoteInfo encoding bug (#402)
-
-## v16.49.0 - _January 28, 2022_
-
- * Add more curve pools (#409)
-
-## v16.48.0 - _January 25, 2022_
-
- * Use `MIM` as an intermediate asset on `Fantom` (#405)
-
-## v16.47.0 - _January 25, 2022_
-
- * Adding support for Synapse on all networks (#400)
-
-## v16.46.0 - _January 11, 2022_
-
- * Enable `Curve` ETH/CVX pool (#394)
-
-## v16.45.2 - _January 10, 2022_
-
- * Handle 0 output samples and negative adjusted rate native orders in routing (#387)
-
-## v16.45.1 - _January 5, 2022_
-
- * Update `Celo` intermediate tokens (#390)
-
-## v16.45.0 - _January 4, 2022_
-
- * Capture router timings (#388)
-
-## v16.44.0 - _December 29, 2021_
-
- * Update neon-router and use router estimated output amount (#354)
-
-## v16.43.0 - _December 24, 2021_
-
- * `UniswapV3` support for `Optimism` (#385)
-
-## v16.42.0 - _December 21, 2021_
-
- * `UniswapV3` support for `Polygon` (#382)
- * Update `Beethoven` Graphql url (#383)
-
-## v16.41.0 - _December 6, 2021_
-
- * Update mcusd contract address, and made celo native asset (#376)
-
-## v16.40.0 - _December 1, 2021_
-
- * Add `AaveV2` and `Compound` deposit/withdrawal liquidity source (#321)
-
-## v16.39.0 - _Invalid date_
-
- * Curve ETH/CRV pool (#378)
-
-## v16.38.0 - _November 29, 2021_
-
- * Capture sampler metrics (#374)
-
-## v16.37.0 - _November 19, 2021_
-
- * Changed Sushiswap router address (#373)
-
-## v16.36.0 - _November 19, 2021_
-
- * Specify liquid routes for FEI/TRIBE FXS/FRAX and OHM/FRAX (#371)
-
-## v16.35.0 - _November 18, 2021_
-
- * Add Beethoven X, MorpheusSwap and JetSwap to Fantom (#370)
-
-## v16.34.0 - _November 16, 2021_
-
- * Add support Celo (#367)
-
-## v16.33.0 - _November 16, 2021_
-
- * Add support for Uniswap V3 1 bps pools (#366)
-
-## v16.32.0 - _November 9, 2021_
-
- * Extended Quote Report (#361)
-
-## v16.31.0 - _November 3, 2021_
-
- * Added `Curve`, `Curve_V2` and `KyberDmm` to Avalanche (#363)
-
-## v16.30.1 - _November 3, 2021_
-
- * Dependencies updated
-
-## v16.30.0 - _October 19, 2021_
-
- * Fantom deployment (#347)
-
-## v16.29.3 - _October 18, 2021_
-
- * Update neon-router version and address breaking changes (#344)
-
-## v16.29.2 - _October 13, 2021_
-
- * Check MAX_IN_RATIO in sampleBuysFromBalancer (#338)
- * Go back to using transformERC20 (instead of transformERC20Staging) (#343)
-
-## v16.29.1 - _October 4, 2021_
-
- * Remove `Clipper` as a custom liquidity source (#335)
-
-## v16.29.0 - _October 4, 2021_
-
- * Initial integration of neon-router (behind feature flag) (#295)
-
-## v16.28.0 - _September 29, 2021_
-
- * Update ExchangeProxySwapQuoteConsumer for Multiplex V2 and friends (#282)
-
-## v16.27.5 - _Invalid date_
-
- * Remove protocol fees by setting `PROTOCOL_FEE_MULTIPLIER` to 0 (#333)
-
-## v16.27.4 - _September 15, 2021_
-
- * Dependencies updated
-
-## v16.27.3 - _September 14, 2021_
-
- * Dependencies updated
-
-## v16.27.2 - _September 14, 2021_
-
- * Dependencies updated
-
-## v16.27.1 - _September 8, 2021_
-
- * Fix ApproximateBuys sampler to terminate if the buy amount is not met (#319)
-
-## 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_
-
- * Dependencies updated
-
-## v16.26.0 - _August 19, 2021_
-
- * feat: Enable partial Native fills to be consumed, previously for v3 they were dropped (#309)
- * feat: Modify Intermediate tokens to be a union (#309)
- * feat: Retire Eth2Dai/Oasis (#309)
-
-## v16.25.0 - _August 16, 2021_
-
- * Fix: fallback fills which have not been used, unique id by source-index
-
-## v16.24.1 - _August 11, 2021_
-
- * Dependencies updated
-
-## v16.24.0 - _August 6, 2021_
-
- * Add `Clipper` as a custom liquidity source (#299)
- * Added `Curve` `Tricrypto2` and `ESD` v2 (#302)
-
-## v16.23.1 - _July 29, 2021_
-
- * Fix fill amount rounding error when covnerting fills to orders. (#296)
-
-## v16.23.0 - _July 16, 2021_
-
- * ACryptoS (#284)
-
-## v16.22.0 - _July 13, 2021_
-
- * IronSwap (#281)
-
-## v16.21.0 - _July 10, 2021_
-
- * JetSwap (#280)
-
-## v16.20.0 - _July 6, 2021_
-
- * ShibaSwap (#276)
-
-## v16.19.1 - _July 6, 2021_
-
- * Fix LiquidityProvider fallback (#272)
-
-## v16.19.0 - _July 2, 2021_
-
- * Add LiquidityProvider to Polygon sources (#270)
-
-## v6.18.3 - _June 29, 2021_
-
- * Polygon Balance V2
-
-## v6.18.2 - _June 24, 2021_
-
- * Dependencies updated
-
-## v6.18.1 - _June 22, 2021_
-
- * FirebirdOneSwap, ApeSwap. New hop tokens: DFYN, BANANA, WEXPOLY (#265)
-
-## v6.18.0 - _June 22, 2021_
-
- * Add Lido stETH deposit integration (#260)
-
-## v6.17.3 - _June 16, 2021_
-
- * QUICK, TITAN, IRON as intermediate tokens, integrating WaultSwap and Polydex for Polygon, Curve renBTC pool
-
-## v6.17.2 - _June 11, 2021_
-
- * Dependencies updated
-
-## v6.17.1 - _June 2, 2021_
-
- * Dependencies updated
-
-## v6.17.0 - _May 27, 2021_
-
- * Re-enable liquidity provider and update KNC address (#253)
-
-## v6.16.0 - _May 25, 2021_
-
- * Add support for the Polygon chain (#240)
-
-## v6.15.0 - _May 21, 2021_
-
- * Fix KyberDmm (#236)
- * Re-enable KyberDmm (#247)
- * Add Huobi Token to liquidity provider tokens (#246)
- * Temporarily disable specific LiquidityProvider
-
-## v6.14.0 - _May 12, 2021_
-
- * Add support for additional sources and intermediate tokens on Ropsten (#231)
- * Add UniswapV3 VIP support (#237)
-
-## v6.13.0 - _May 11, 2021_
-
- * Add LiquidityProvider to BSC sources (#234)
-
-## v6.12.0 - _May 10, 2021_
-
- * `TwoHopSampler` to use `call` over `staticcall` in order to support sources like `Uniswap_V3` and `Balancer_V2` (#233)
-
-## v6.11.0 - _May 7, 2021_
-
- * Add price comparisons data separate from the quote report (#219)
- * Add caching for top Balancer V2 pools on startup and during regular intervals (#228)
- * Tweak compiler settings for smaller sampler bytecode (#229)
- * Fix Multiplex multihop encoding for ETH buys/sells (#230)
- * Fix Sampler address override for Ganache (#232)
-
-## v6.10.0 - _May 5, 2021_
-
- * Reactivate PancakeSwapV2 and BakerySwap VIP on BSC (#222)
- * Add LUSD Curve pool (#218)
- * Fix exchangeProxyGasOverhead for fallback path (#215)
- * Enable ETH based Curve pools (#220)
- * Reactivate PancakeSwapV2 and BakerySwap VIP on BSC (#222)
- * Disable WETH based SnowSwap pools (#220)
- * PLP now includes a fallback due to observed collisions (#223)
- * Add Balancer V2 integration (#206)
- * Re-work the PoolCache for Balancer et al (#226)
-
-## v6.9.1 - _May 1, 2021_
-
- * Temporarily remove PancakeV2 and BakerySwap from VIP
-
-## v6.9.0 - _April 30, 2021_
-
- * Remove conflicting Kyber reserve (#216)
-
-## v6.8.0 - _April 28, 2021_
-
- * Prune paths which cannot improve the best path (#183)
- * Use FastABI for Sampler ABI encoding and decoding (#183)
-
-## v6.7.0 - _April 26, 2021_
-
- * Support PancakeSwap V2 (#211)
-
-## v6.6.1 - _Invalid date_
-
- * Fixing Positive Slippage logic to not force the EP route (#209)
-
-## v6.6.0 - _April 16, 2021_
-
- * Support `Ropsten` network (#203)
- * BSC Uniswap clones (ApeSwap, CafeSwap, CheeseSwap, JulSwap), Saddle BTC pool, Curve gas schedule (#208)
-
-## v6.5.3 - _April 14, 2021_
-
- * Apply slippage to bridge orders in consumer (#198)
-
-## v6.5.2 - _April 13, 2021_
-
- * Dependencies updated
-
-## v6.5.1 - _April 12, 2021_
-
- * Dependencies updated
-
-## v6.5.0 - _April 8, 2021_
-
- * Add Kyber DMM to Ethereum mainnet (#194)
- * Add default LiquidityProvider registry and allow LiquidityProvider gasCost to be a function of tokens (#196)
-
-## v6.4.0 - _April 1, 2021_
-
- * Added Component, Smoothy, Saddle, Curve open pools, tweeks gas schedule, adding SushiSwap as a fee quote source (#182)
- * Use SOURCE_FLAGS.rfqOrder in comparisonPrice (#177)
- * Add a cancel token to ensure timeouts are respected (#176)
- * Rename {Rfqt=>Rfq} for many types in Asset Swapper (#179)
- * improve logging for alt RFQ requests (#158)
- * Use new bridge source ID encoding. (#162)
- * Refactor to provide chain id specific addresses (#163)
- * Added PancakeSwap and BakerySwap on Chain 56 (#163)
- * Added Nerve and Dodo (v1) to BSC (#181)
-
-## v6.3.0 - _March 17, 2021_
-
- * Add MooniswapLiquidityProvider "direct" route to EP consumer. (#143)
- * Enable the ability to send RFQT requests thru a proxy (#159)
- * Add support for MultiplexFeature (#168)
-
-## v6.2.0 - _March 2, 2021_
-
- * drop curve Y and BUSD pools (#161)
-
-## v6.1.0 - _February 24, 2021_
-
- * Filter MultiHop where second source is not present (#138)
- * Add CurveLiquidityProvider "direct" route to EP consumer. (#127)
- * Fix compiler error on `ILiquidityProvider` call (#127)
- * Add deployed `CurveLiquidityProvider` addresses (#144)
- * Support `Mirror Protocol` with hops to `UST` (#142)
- * Fix protocol fee in fee schedule for `RfqOrder` (#146)
- * Special case BNB in uni v1 sampler (#147)
- * Create `FakeTaker` contract to get result data and gas used (#151)
- * Added support for `Dodo` v2 (#152)
- * Added support for `Linkswap` (#153)
- * Re-add WBTC in default intermediate hops (#154)
- * Add an alternative RFQ market making implementation (#139)
- * Added an opt-in `PositiveSlippageAffiliateFee` (#101)
-
-## v6.0.0 - _February 10, 2021_
-
- * Pull top 250 Balancer pairs on initialization (#113)
- * Support v4 `RFQ` and `Limit` orders (#113)
- * Refactor to consume latest `FillQuoteTransformer` (#113)
- * Enable `fillData` for all sources, no longer optional (#113)
- * Support `tx.origin` in RFQT quote requestor (#113)
-
-## v5.8.2 - _January 28, 2021_
-
- * Fix error when Multihop data is not present (#80)
-
-## v5.8.1 - _January 26, 2021_
-
- * Dependencies updated
-
-## v5.8.0 - _January 13, 2021_
-
- * Automatically Discover Kyber reserves for tokens using `getTradingReserves` (#111)
- * Return `CallResults` from the Sampler (#111)
-
-## v5.7.0 - _Invalid date_
-
- * Add SPDX license identifiers to solidity files (#105)
-
-## v5.6.2 - _January 4, 2021_
-
- * Dependencies updated
-
-## v5.6.1 - _December 31, 2020_
-
- * Fix fillAmount `ExchangeProxySwapQuoteConsumer` encoding when quote is a BuyQuote
-
-## v5.6.0 - _December 27, 2020_
-
- * Added Mooniswap V2 factory address (#100)
-
-## v5.5.3 - _December 23, 2020_
-
- * Dependencies updated
-
-## v5.5.2 - _December 17, 2020_
-
- * Dependencies updated
-
-## v5.5.1 - _December 16, 2020_
-
- * Dependencies updated
-
-## v5.5.0 - _December 16, 2020_
-
- * Bancor now supported in all pairs (#88)
-
-## v5.4.2 - _December 9, 2020_
-
- * Dependencies updated
-
-## v5.4.1 - _December 7, 2020_
-
- * Dependencies updated
-
-## v5.4.0 - _December 7, 2020_
-
- * Add `takerAssetToEthRate` and `makerAssetToEthRate` to swap quote response (#49)
-
-## v5.3.1 - _December 3, 2020_
-
- * Dependencies updated
-
-## v5.3.0 - _December 3, 2020_
-
- * Added Crypto.com (#43)
- * Add `getQuoteInfoMinBuyAmount` to quote consumer utils (#62)
- * Add `unoptimizedQuoteInfo` and `unoptimizedOrders` to SwapQuoteBase (#62)
- * Add `unoptimizedPath` to OptimizerResult (#62)
- * Enable PLP VIP feature and add gasCost field to LiquidityProviderRegistry (#65)
-
-## v5.2.0 - _November 19, 2020_
-
- * Update Gas schedules (#34)
- * Return the maker/taker token decimals from the sampler as part of the `SwapQuote` (#34)
- * Disable off-chain sampling for Balancer and CREAM (#41)
-
-## v5.1.1 - _November 14, 2020_
-
- * Disable PLP VIP feature in EP swap quote consumer (#36)
-
-## v5.1.0 - _November 13, 2020_
-
- * Add support for LiquidityProvider feature in the swap quote consumer (#16)
- * Remove support for MultiBridge 😞 (#16)
-
-## v5.0.3 - _November 5, 2020_
-
- * Dependencies updated
-
-## v5.0.2 - _November 3, 2020_
-
- * Dependencies updated
- * adding Curve pools: PAX, hBTC, metapools: gUSD, hUSD, USDn, mUSD, tBTC (#26)
-
-## v5.0.1 - _November 3, 2020_
-
- * Dependencies updated
-
-## v5.0.0 - _November 2, 2020_
-
- * Support multiple `Shells` by supplying the `pool` address (#17)
- * Make use of Token Adjacency in more places. Moved as a parameter for the quote (#24)
-
-## v4.8.1 - _October 28, 2020_
-
- * Fix Gas schedule with `SnowSwap` and `Bancor` (#15)
-
-## v4.8.0 - _October 27, 2020_
-
- * Moved Bridge addresses into Asset-swapper (#4)
- * Updated Sampler to Solidity 0.6 (#4)
-
-## v4.7.1 - _October 23, 2020_
-
- * Dependencies updated
-
-## v4.7.0 - _October 21, 2020_
-
- * Return quoteReport from SwapQuoter functions (#2627)
- * Allow an empty override for sampler overrides (#2637)
- * Potentially heavy CPU functions inside the optimizer now yield to the event loop. As such they are now async. (#2637)
- * Support more varied curves (#2633)
- * Make path optimization go faster (#2640)
- * Adds `getBidAskLiquidityForMakerTakerAssetPairAsync` to return more detailed sample information (#2641)
- * Fix regression where a split on the same source was collapsed into a single fill (#2654)
- * Add support for buy token affiliate fees (#2658)
- * Fix optimization of buy paths (#2655)
- * Fix depth buy scale (#2659)
- * Adjust fill by ethToInputRate when ethToOutputRate is 0 (#2660)
- * Add Bancor as liquidity source (#2650)
- * Added `mStable` (#2662)
- * Merge `erc20-bridge-sampler` into this package (#2664)
- * Added `Mooniswap` (#2675)
- * Stop requiring takerAddress for RFQ-T indicative quotes (#2684)
- * Added two-hop support (#2647)
- * Move ERC20BridgeSampler interfaces into `interfaces` directory (#2647)
- * Use on-chain sampling (sometimes) for Balancer (#2647)
- * Re-worked `Kyber` quotes supporting multiple reserves (#2683)
- * Enable Quote Report to be generated with an option `shouldGenerateQuoteReport`. Default is `false` (#2687)
- * Add `refundReceiver` to `ExchangeProxySwapQuoteConsumer` options. (#2657)
- * Use `IZeroExContract` in EP swap quote consumer. (#2657)
- * Set `rfqtTakerAddress` to null in EP consumer (#2692)
- * Return Mooniswap pool in sampler and encode it in bridge data (#2692)
- * Added `Swerve` (#2698)
- * Added `SushiSwap` (#2698)
- * Add uniswap VIP support (#2703)
- * Add `includedSources` support (#2703)
- * Added `Curve` Tripool (#2708)
- * Pass back fillData from quote reporter (#2702)
- * Fix Balancer sampling (#2711)
- * Respect max slippage in EP consumer (#2712)
- * Introduced Path class, exchangeProxyOverhead parameter (#2691)
- * Added `Shell` (#2722)
- * Fix exchange proxy overhead gas being scaled by gas price (#2723)
- * Remove 0x-API swap/v0-specifc code from asset-swapper (#2725)
- * Added `DODO` (#2701)
- * Fix for some edge cases with `includedSources` and `MultiHop` (#2730)
- * Introduced `excludedFeeSources` to disable sources when determining the price of an asset in ETH (#2731)
- * Support `DODO` Trade Allowed parameter to automatically disable the pool (#2732)
- * Added `SwerveBridge` and `SnowSwapBridge` deployed addresses (#7)
-
-## v4.6.0 - _July 15, 2020_
-
- * Use internal Eth Gas Station proxy (#2614)
- * Renamed RFQT request parameters (#2582)
- * Fix worst case asset amount calculations. (#2615)
- * Specify EthGasStation url as an optional parameter (#2617)
- * Singleton Gas Price Oracle (#2619)
- * "Fix" forwarder buys of low decimal tokens. (#2618)
- * Add Balancer support (#2613)
- * Consolidate UniswapV2 sources, Curve sources in `ERC20BridgeSource` enum (#2613)
- * Change gas/fee schedule values from constants to functions returning numbers (#2613)
- * Specify overrides to the ERC20Sampler contract, by default the latest bytecode is the override (#2629)
-
-## v4.5.0 - _June 24, 2020_
-
- * Add support for private liquidity providers (#2505)
- * Big refactor of market operation utils (#2513)
- * Remove `dustFractionThreshold`, `noConflicts` options. (#2513)
- * Revamp fill optimization algorithm (#2513)
- * Add fallback orders to quotes via `allowFallback` option. (#2513)
- * Add `maxFallbackSlippage` option. (#2513)
- * Fix fee schedule not being scaled by gas price. (#2522)
- * Fix quote optimizer bug not properly accounting for fees. (#2526)
- * Fix `getBatchMarketBuyOrdersAsync` throwing NO_OPTIMAL_PATH (#2533)
- * Add DFB support + refactor swap quote calculator utils (#2536)
- * Add support for RFQ-T, querying maker-hosted endpoints for quotes to be submitted by the taker (#2541)
- * Add support for indicative (non-committal) quotes via RFQ-T (#2555)
- * Collapse `LiquidityProvider` into `DexForwarderBridge` (#2560)
- * Added Curve `sUSD` (#2563)
- * Fix sporadically failing quote simulation tests (#2564)
- * Apply Native order penalty inline with the target amount (#2565)
- * Remove Kyber exclusion when Uniswap/Eth2Dai is present (#2575)
- * Expose fills object in asset-swapper quote orders (#2583)
- * Increase timeout for tests (#2587)
- * Add support for Uniswap V2 (#2599)
- * Add support for MultiBridge (#2593)
- * Fix Uniswap V2 path ordering (#2601)
- * Add exchange proxy support (#2591)
-
-## v4.4.0 - _March 3, 2020_
-
- * Add support for ERC721 assets (#2491)
- * Add destroy for gas heartbeat (#2492)
- * Added `BUSD` Curve (#2506)
- * Updated `Compound` Curve address (#2506)
-
-## v4.3.2 - _February 27, 2020_
-
- * Fix order native pruning by fill amount (#2500)
-
-## v4.3.1 - _February 26, 2020_
-
- * Dependencies updated
-
-## v4.3.0 - _February 25, 2020_
-
- * Add `fees` to `GetMarketOrdersOpts` (#2481)
- * Incorporate fees into fill optimization (#2481)
-
-## v4.2.0 - _February 15, 2020_
-
- * Use `batchCall()` version of the `ERC20BridgeSampler` contract (#2477)
- * Support for sampling Curve contracts (#2483)
-
-## v4.1.2 - _February 8, 2020_
-
- * Dependencies updated
-
-## v4.1.1 - _February 6, 2020_
-
- * Fix bug with liquidity source breakdown (#2472)
- * Prune orders before creating a dummy order for the Sampler (#2470)
- * Bump sampler gas limit to 60e6 (#2471)
-
-## v4.1.0 - _February 4, 2020_
-
- * Allow contract addresses to be passed as optional constructor ags instead of hardcoding (#2461)
- * Add swap quote liquidity source breakdown (#2465)
-
-## v4.0.1 - _January 23, 2020_
-
- * Fix underestimated protocol fee in worst case quote. (#2452)
-
-## v4.0.0 - _January 22, 2020_
-
- * Upgrade to new `Forwarder` contract with flat affiliate fees. (#2432)
- * Remove `getSmartContractParamsOrThrow()` from `SwapQuoteConsumer`s. (#2432)
- * Added `getBatchMarketBuySwapQuoteForAssetDataAsync` on `SwapQuoter` (#2427)
- * Add exponential sampling distribution and `sampleDistributionBase` option to `SwapQuoter` (#2427)
- * Compute more accurate best quote price (#2427)
- * Change Exchange sell function from `marketSellOrdersNoThrow` to `marketSellOrdersFillOrKill` (#2450)
-
-## v3.0.3 - _January 6, 2020_
-
- * Ignore zero sample results from the sampler contract. (#2406)
- * Increase default `runLimit` from `1024` to `4096`. (#2406)
- * Increase default `numSamples` from `8` to `10` (#2406)
- * Fix ordering of optimized orders. (#2406)
- * Fix best and worst quotes being reversed sometimes. (#2406)
- * Fix rounding of quoted asset amounts. (#2406)
- * Undo bridge slippage in best case quote calculation. (#2406)
- * Compare equivalent asset data when validating quotes and checking fee asset data. (#2421)
-
-## v3.0.2 - _December 17, 2019_
-
- * Fix gasPrice from `ethgasstation` to be in WEI instead of GWEI (#2393)
- * Add aggregator utils (#2353)
-
-## v3.0.1 - _December 9, 2019_
-
- * Dependencies updated
-
-## v3.0.0 - _December 2, 2019_
-
- * Refactor of logic for marketBuy/marketSell order pruning and selecting, introduced protocol fees, and refactored types used by the package (#2272)
- * Incorporate paying protocol fees. (#2350)
- * Update BigNumber version to ~9.0.0 (#2342)
- * All references to network ID have been removed, and references to chain ID have been introduced instead (#2313)
-
-## v2.1.0-beta.4 - _December 2, 2019_
-
- * Dependencies updated
-
-## v2.1.0-beta.3 - _November 20, 2019_
-
- * Refactor of logic for marketBuy/marketSell order pruning and selecting, introduced protocol fees, and refactored types used by the package (#2272)
- * Incorporate paying protocol fees. (#2350)
-
-## v2.1.0-beta.2 - _November 7, 2019_
-
- * Update BigNumber version to ~9.0.0 (#2342)
-
-## v2.1.0-beta.1 - _November 7, 2019_
-
- * All references to network ID have been removed, and references to chain ID have been introduced instead (#2313)
-
-## v2.1.0-beta.0 - _October 3, 2019_
-
- * Dependencies updated
-
-## v2.0.0 - _September 17, 2019_
-
- * AssetSwapper to use `@0x/orderbook` to fetch and subscribe to order updates (#2056)
-
-## v1.0.3 - _September 3, 2019_
-
- * Dependencies updated
-
-## v1.0.2 - _August 22, 2019_
-
- * Dependencies updated
-
-## v1.0.1 - _August 8, 2019_
-
- * Dependencies updated
-
-## v1.0.0 - _July 31, 2019_
-
- * Added optimization utils to consumer output (#1988)
- * Expanded test coverage (#1980)
-
-## v0.0.5 - _July 24, 2019_
-
- * Dependencies updated
-
-## v0.0.4 - _July 15, 2019_
-
- * Switched MarketOperation type to enum and expanded default constants configuration (#1959)
- * Added additional options to control asset-swapper behavior and optimized consumer output (#1966)
-
-## v0.0.3 - _July 13, 2019_
-
- * Dependencies updated
-
-## v0.0.2 - _July 13, 2019_
-
- * Dependencies updated
-
-## v0.0.1 - _Invalid date_
-
- * Refactored asset-buyer into asset-swapper to support ERC<>ERC marketSell and marketBuy operations (#1845)
diff --git a/packages/asset-swapper/README.md b/packages/asset-swapper/README.md
deleted file mode 100644
index c3db13b284..0000000000
--- a/packages/asset-swapper/README.md
+++ /dev/null
@@ -1,86 +0,0 @@
-> :warning: **@0x/asset-swapper has been deprecated!** The `asset-swapper` code has been moved to [0x-api](https://github.com/0xProject/0x-api). Please do not open a PR with `asset-swapper` changes.
-
-## @0x/asset-swapper
-
-Convenience package for swapping assets represented on the Ethereum blockchain using 0x. The package helps to perform all the off-chain computations to execute a marketBuy or marketSell function execution with 0x exchange contracts, or 0x extension contracts. Given some liquidity (0x signed orders), it helps estimate the cost of buying or selling a certain asset (giving a range) and then provide varying consumable outputs to execute the buy or sell.
-
-Asset-swapper integrates with the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)(in the future Mesh as well) and takes care of sourcing liquidity, order-pruning, and order-validation. The final result is a library that tells you what assets are available, provides a quote based on specified assets, and provide varying consumable metadata that can be used both on-chain in smart contracts or off-chain through web3 to swap a desired amount of ERC20 for another ERC20 asset.
-
-## Installation
-
-```bash
-yarn add @0x/asset-swapper
-```
-
-**Import**
-
-```typescript
-import { SwapQuoter } from '@0x/asset-swapper';
-```
-
-or
-
-```javascript
-var SwapQuoter = require('@0x/asset-swapper').SwapQuoter;
-var SwapQuoteConsumer = require('@0x/asset-swapper').SwapQuoteConsumer;
-```
-
-If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
-
-```json
-"compilerOptions": {
- "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
-}
-```
-
-## Contributing
-
-We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
-
-Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
-
-### Install dependencies
-
-If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
-
-```bash
-yarn config set workspaces-experimental true
-```
-
-Then install dependencies
-
-```bash
-yarn install
-```
-
-### Build
-
-To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
-
-```bash
-PKG=@0x/asset-swapper yarn build
-```
-
-Or continuously rebuild on change:
-
-```bash
-PKG=@0x/asset-swapper yarn watch
-```
-
-### Clean
-
-```bash
-yarn clean
-```
-
-### Lint
-
-```bash
-yarn lint
-```
-
-### Run Tests
-
-```bash
-yarn test
-```
diff --git a/packages/asset-swapper/compiler.json b/packages/asset-swapper/compiler.json
deleted file mode 100644
index 8cc3f1c58b..0000000000
--- a/packages/asset-swapper/compiler.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "artifactsDir": "./test/generated-artifacts",
- "contractsDir": "./contracts",
- "useDockerisedSolc": false,
- "isOfflineMode": false,
- "shouldSaveStandardInput": true,
- "compilerSettings": {
- "evmVersion": "istanbul",
- "optimizer": { "enabled": true, "runs": 200, "details": { "yul": false, "deduplicate": true } },
- "outputSelection": {
- "*": {
- "*": [
- "abi",
- "devdoc",
- "evm.bytecode.object",
- "evm.bytecode.sourceMap",
- "evm.deployedBytecode.object",
- "evm.deployedBytecode.sourceMap"
- ]
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/ApproximateBuys.sol b/packages/asset-swapper/contracts/src/ApproximateBuys.sol
deleted file mode 100644
index 7f8d9ddff4..0000000000
--- a/packages/asset-swapper/contracts/src/ApproximateBuys.sol
+++ /dev/null
@@ -1,148 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "@0x/contracts-utils/contracts/src/v06/LibMathV06.sol";
-
-
-contract ApproximateBuys {
-
- /// @dev Information computing buy quotes for sources that do not have native
- /// buy quote support.
- struct ApproximateBuyQuoteOpts {
- // Arbitrary maker token data to pass to `getSellQuoteCallback`.
- bytes makerTokenData;
- // Arbitrary taker token data to pass to `getSellQuoteCallback`.
- bytes takerTokenData;
- // Callback to retrieve a sell quote.
- function (bytes memory, bytes memory, uint256)
- internal
- view
- returns (uint256) getSellQuoteCallback;
- }
-
- uint256 private constant ONE_HUNDED_PERCENT_BPS = 1e4;
- /// @dev Maximum approximate (positive) error rate when approximating a buy quote.
- uint256 private constant APPROXIMATE_BUY_TARGET_EPSILON_BPS = 0.0005e4;
- /// @dev Maximum iterations to perform when approximating a buy quote.
- uint256 private constant APPROXIMATE_BUY_MAX_ITERATIONS = 5;
-
- function _sampleApproximateBuys(
- ApproximateBuyQuoteOpts memory opts,
- uint256[] memory makerTokenAmounts
- )
- internal
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- takerTokenAmounts = new uint256[](makerTokenAmounts.length);
- if (makerTokenAmounts.length == 0) {
- return takerTokenAmounts;
- }
-
- uint256 sellAmount = opts.getSellQuoteCallback(
- opts.makerTokenData,
- opts.takerTokenData,
- makerTokenAmounts[0]
- );
- if (sellAmount == 0) {
- return takerTokenAmounts;
- }
-
- uint256 buyAmount = opts.getSellQuoteCallback(
- opts.takerTokenData,
- opts.makerTokenData,
- sellAmount
- );
- if (buyAmount == 0) {
- return takerTokenAmounts;
- }
-
- for (uint256 i = 0; i < makerTokenAmounts.length; i++) {
- uint256 eps = 0;
- for (uint256 iter = 0; iter < APPROXIMATE_BUY_MAX_ITERATIONS; iter++) {
- // adjustedSellAmount = previousSellAmount * (target/actual) * JUMP_MULTIPLIER
- sellAmount = _safeGetPartialAmountCeil(
- makerTokenAmounts[i],
- buyAmount,
- sellAmount
- );
- if (sellAmount == 0) {
- break;
- }
- sellAmount = _safeGetPartialAmountCeil(
- (ONE_HUNDED_PERCENT_BPS + APPROXIMATE_BUY_TARGET_EPSILON_BPS),
- ONE_HUNDED_PERCENT_BPS,
- sellAmount
- );
- if (sellAmount == 0) {
- break;
- }
- uint256 _buyAmount = opts.getSellQuoteCallback(
- opts.takerTokenData,
- opts.makerTokenData,
- sellAmount
- );
- if (_buyAmount == 0) {
- break;
- }
- // We re-use buyAmount next iteration, only assign if it is
- // non zero
- buyAmount = _buyAmount;
- // If we've reached our goal, exit early
- if (buyAmount >= makerTokenAmounts[i]) {
- eps =
- (buyAmount - makerTokenAmounts[i]) * ONE_HUNDED_PERCENT_BPS /
- makerTokenAmounts[i];
- if (eps <= APPROXIMATE_BUY_TARGET_EPSILON_BPS) {
- break;
- }
- }
- }
- if (eps == 0 || eps > APPROXIMATE_BUY_TARGET_EPSILON_BPS) {
- break;
- }
- // We do our best to close in on the requested amount, but we can either over buy or under buy and exit
- // if we hit a max iteration limit
- // We scale the sell amount to get the approximate target
- takerTokenAmounts[i] = _safeGetPartialAmountCeil(
- makerTokenAmounts[i],
- buyAmount,
- sellAmount
- );
- }
- }
-
- function _safeGetPartialAmountCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- internal
- view
- returns (uint256 partialAmount)
- {
- if (numerator == 0 || target == 0 || denominator == 0) return 0;
- uint256 c = numerator * target;
- if (c / numerator != target) return 0;
- return (c + (denominator - 1)) / denominator;
- }
-}
diff --git a/packages/asset-swapper/contracts/src/BalanceChecker.sol b/packages/asset-swapper/contracts/src/BalanceChecker.sol
deleted file mode 100644
index bfbc970e66..0000000000
--- a/packages/asset-swapper/contracts/src/BalanceChecker.sol
+++ /dev/null
@@ -1,123 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-// ERC20 contract interface
-abstract contract IToken {
- /// @dev Query the balance of owner
- /// @param _owner The address from which the balance will be retrieved
- /// @return Balance of owner
- function balanceOf(address _owner) public virtual view returns (uint256);
-
- /// @param _owner The address of the account owning tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @return Amount of remaining tokens allowed to spent
- function allowance(address _owner, address _spender) public virtual view returns (uint256);
-}
-
-contract BalanceChecker {
- /*
- Check the token balances of wallet-token pairs.
- Pass 0xeee... as a "token" address to get ETH balance.
- Possible error throws:
- - extremely large arrays for user and or tokens (gas cost too high)
-
- Returns a one-dimensional that's user.length long.
- */
- function balances(address[] calldata users, address[] calldata tokens) external view returns (uint256[] memory) {
- // make sure the users array and tokens array are of equal length
- require(users.length == tokens.length, "users array is a different length than the tokens array");
-
- uint256[] memory addrBalances = new uint256[](users.length);
-
- for(uint i = 0; i < users.length; i++) {
- if (tokens[i] != address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
- addrBalances[i] = IToken(tokens[i]).balanceOf(users[i]);
- } else {
- addrBalances[i] = users[i].balance; // ETH balance
- }
- }
-
- return addrBalances;
- }
-
- /*
- Check the token balances of wallet-token pairs with a spender contract for an allowance check.
- Pass 0xeee... as a "token" address to get ETH balance.
- Possible error throws:
- - extremely large arrays for user and or tokens (gas cost too high)
-
- Returns a one-dimensional that's user.length long. It is the lesser of balance and allowance
- */
- function getMinOfBalancesOrAllowances(address[] calldata users, address[] calldata tokens, address spender) external view returns (uint256[] memory) {
- // make sure the users array and tokens array are of equal length
- require(users.length == tokens.length, "users array is a different length than the tokens array");
-
- uint256[] memory addrBalances = new uint256[](users.length);
-
- for(uint i = 0; i < users.length; i++) {
- if (tokens[i] != address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
- uint256 balance;
- uint256 allowance;
- balance = IToken(tokens[i]).balanceOf(users[i]);
- allowance = IToken(tokens[i]).allowance(users[i], spender);
- if (allowance < balance) {
- addrBalances[i] = allowance;
- } else {
- addrBalances[i] = balance;
- }
- } else {
- addrBalances[i] = users[i].balance; // ETH balance
- }
- }
-
- return addrBalances;
- }
-
- /*
- Check the allowances of an array of owner-spender-tokens
-
- Returns 0 for 0xeee... (ETH)
- Possible error throws:
- - extremely large arrays for user and or tokens (gas cost too high)
-
- Returns a one-dimensional array that's owners.length long.
- */
- function allowances(address[] calldata owners, address[] calldata spenders, address[] calldata tokens) external view returns (uint256[] memory) {
- // make sure the arrays are all of equal length
- require(owners.length == spenders.length, "all arrays must be of equal length");
- require(owners.length == tokens.length, "all arrays must be of equal length");
-
- uint256[] memory addrAllowances = new uint256[](owners.length);
-
- for(uint i = 0; i < owners.length; i++) {
- if (tokens[i] != address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)) {
- addrAllowances[i] = IToken(tokens[i]).allowance(owners[i], spenders[i]);
- } else {
- // ETH
- addrAllowances[i] = 0;
- }
- }
-
- return addrAllowances;
- }
-
-
-}
diff --git a/packages/asset-swapper/contracts/src/BalancerSampler.sol b/packages/asset-swapper/contracts/src/BalancerSampler.sol
deleted file mode 100644
index acd9e7acb1..0000000000
--- a/packages/asset-swapper/contracts/src/BalancerSampler.sol
+++ /dev/null
@@ -1,197 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IBalancer.sol";
-
-
-contract BalancerSampler {
-
- /// @dev Base gas limit for Balancer calls.
- uint256 constant private BALANCER_CALL_GAS = 300e3; // 300k
-
- // Balancer math constants
- // https://github.com/balancer-labs/balancer-core/blob/master/contracts/BConst.sol
- uint256 constant private BONE = 10 ** 18;
- uint256 constant private MAX_IN_RATIO = BONE / 2;
- uint256 constant private MAX_OUT_RATIO = (BONE / 3) + 1 wei;
-
- struct BalancerState {
- uint256 takerTokenBalance;
- uint256 makerTokenBalance;
- uint256 takerTokenWeight;
- uint256 makerTokenWeight;
- uint256 swapFee;
- }
-
- /// @dev Sample sell quotes from Balancer.
- /// @param poolAddress Address of the Balancer pool to query.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromBalancer(
- address poolAddress,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- IBalancer pool = IBalancer(poolAddress);
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- if (!pool.isBound(takerToken) || !pool.isBound(makerToken)) {
- return makerTokenAmounts;
- }
-
- BalancerState memory poolState;
- poolState.takerTokenBalance = pool.getBalance(takerToken);
- poolState.makerTokenBalance = pool.getBalance(makerToken);
- poolState.takerTokenWeight = pool.getDenormalizedWeight(takerToken);
- poolState.makerTokenWeight = pool.getDenormalizedWeight(makerToken);
- poolState.swapFee = pool.getSwapFee();
-
- for (uint256 i = 0; i < numSamples; i++) {
- // Handles this revert scenario:
- // https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol#L443
- if (takerTokenAmounts[i] > _bmul(poolState.takerTokenBalance, MAX_IN_RATIO)) {
- break;
- }
- try
- pool.calcOutGivenIn
- {gas: BALANCER_CALL_GAS}
- (
- poolState.takerTokenBalance,
- poolState.takerTokenWeight,
- poolState.makerTokenBalance,
- poolState.makerTokenWeight,
- takerTokenAmounts[i],
- poolState.swapFee
- )
- returns (uint256 amount)
- {
- makerTokenAmounts[i] = amount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from Balancer.
- /// @param poolAddress Address of the Balancer pool to query.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromBalancer(
- address poolAddress,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- IBalancer pool = IBalancer(poolAddress);
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- if (!pool.isBound(takerToken) || !pool.isBound(makerToken)) {
- return takerTokenAmounts;
- }
-
- BalancerState memory poolState;
- poolState.takerTokenBalance = pool.getBalance(takerToken);
- poolState.makerTokenBalance = pool.getBalance(makerToken);
- poolState.takerTokenWeight = pool.getDenormalizedWeight(takerToken);
- poolState.makerTokenWeight = pool.getDenormalizedWeight(makerToken);
- poolState.swapFee = pool.getSwapFee();
-
- for (uint256 i = 0; i < numSamples; i++) {
- // Handles this revert scenario:
- // https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol#L505
- if (makerTokenAmounts[i] > _bmul(poolState.makerTokenBalance, MAX_OUT_RATIO)) {
- break;
- }
- try
- pool.calcInGivenOut
- {gas: BALANCER_CALL_GAS}
- (
- poolState.takerTokenBalance,
- poolState.takerTokenWeight,
- poolState.makerTokenBalance,
- poolState.makerTokenWeight,
- makerTokenAmounts[i],
- poolState.swapFee
- )
- returns (uint256 amount)
- {
- // Handles this revert scenario:
- // https://github.com/balancer-labs/balancer-core/blob/master/contracts/BPool.sol#L443
- if (amount > _bmul(poolState.takerTokenBalance, MAX_IN_RATIO)) {
- break;
- }
-
- takerTokenAmounts[i] = amount;
- // Break early if there are 0 amounts
- if (takerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Hacked version of Balancer's `bmul` function, returning 0 instead
- /// of reverting.
- /// https://github.com/balancer-labs/balancer-core/blob/master/contracts/BNum.sol#L63-L73
- /// @param a The first operand.
- /// @param b The second operand.
- /// @param c The result of the multiplication, or 0 if `bmul` would've reverted.
- function _bmul(uint256 a, uint256 b)
- private
- pure
- returns (uint256 c)
- {
- uint c0 = a * b;
- if (a != 0 && c0 / a != b) {
- return 0;
- }
- uint c1 = c0 + (BONE / 2);
- if (c1 < c0) {
- return 0;
- }
- uint c2 = c1 / BONE;
- return c2;
- }
-}
diff --git a/packages/asset-swapper/contracts/src/BalancerV2BatchSampler.sol b/packages/asset-swapper/contracts/src/BalancerV2BatchSampler.sol
deleted file mode 100644
index f99284861d..0000000000
--- a/packages/asset-swapper/contracts/src/BalancerV2BatchSampler.sol
+++ /dev/null
@@ -1,105 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IBalancerV2Vault.sol";
-import "./BalancerV2Common.sol";
-
-contract BalancerV2BatchSampler is BalancerV2Common {
-
- // Replaces amount for first step with each takerTokenAmount and calls queryBatchSwap using supplied steps
- /// @dev Sample sell quotes from Balancer V2 supporting multihops.
- /// @param swapSteps Array of swap steps (can be >= 1).
- /// @param swapAssets Array of token address for swaps.
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- function sampleMultihopSellsFromBalancerV2(
- IBalancerV2Vault vault,
- IBalancerV2Vault.BatchSwapStep[] memory swapSteps,
- address[] memory swapAssets,
- uint256[] memory takerTokenAmounts
- )
- public
- returns (uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- IBalancerV2Vault.FundManagement memory swapFunds =
- _createSwapFunds();
-
- for (uint256 i = 0; i < numSamples; i++) {
- swapSteps[0].amount = takerTokenAmounts[i];
- try
- // For sells we specify the takerToken which is what the vault will receive from the trade
- vault.queryBatchSwap(IBalancerV2Vault.SwapKind.GIVEN_IN, swapSteps, swapAssets, swapFunds)
- // amounts represent pool balance deltas from the swap (incoming balance, outgoing balance)
- returns (int256[] memory amounts) {
- // Outgoing balance is negative so we need to flip the sign
- // Note - queryBatchSwap will return a delta for each token in the assets array and last asset should be tokenOut
- int256 amountOutFromPool = amounts[amounts.length - 1] * -1;
- if (amountOutFromPool <= 0) {
- break;
- }
- makerTokenAmounts[i] = uint256(amountOutFromPool);
- } catch {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- // Replaces amount for first step with each makerTokenAmount and calls queryBatchSwap using supplied steps
- /// @dev Sample buy quotes from Balancer V2 supporting multihops.
- /// @param swapSteps Array of swap steps (can be >= 1).
- /// @param swapAssets Array of token address for swaps.
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- function sampleMultihopBuysFromBalancerV2(
- IBalancerV2Vault vault,
- IBalancerV2Vault.BatchSwapStep[] memory swapSteps,
- address[] memory swapAssets,
- uint256[] memory makerTokenAmounts
- )
- public
- returns (uint256[] memory takerTokenAmounts)
- {
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- IBalancerV2Vault.FundManagement memory swapFunds =
- _createSwapFunds();
-
- for (uint256 i = 0; i < numSamples; i++) {
- swapSteps[0].amount = makerTokenAmounts[i];
- try
- // Uses GIVEN_OUT type for Buy
- vault.queryBatchSwap(IBalancerV2Vault.SwapKind.GIVEN_OUT, swapSteps, swapAssets, swapFunds)
- // amounts represent pool balance deltas from the swap (incoming balance, outgoing balance)
- returns (int256[] memory amounts) {
- int256 amountIntoPool = amounts[0];
- if (amountIntoPool <= 0) {
- break;
- }
- takerTokenAmounts[i] = uint256(amountIntoPool);
- } catch {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/BalancerV2Common.sol b/packages/asset-swapper/contracts/src/BalancerV2Common.sol
deleted file mode 100644
index d01a1b2195..0000000000
--- a/packages/asset-swapper/contracts/src/BalancerV2Common.sol
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IBalancerV2Vault.sol";
-
-
-contract BalancerV2Common {
-
- function _createSwapFunds()
- internal
- view
- returns (IBalancerV2Vault.FundManagement memory)
- {
- return
- IBalancerV2Vault.FundManagement({
- sender: address(this),
- fromInternalBalance: false,
- recipient: payable(address(this)),
- toInternalBalance: false
- });
- }
-}
diff --git a/packages/asset-swapper/contracts/src/BalancerV2Sampler.sol b/packages/asset-swapper/contracts/src/BalancerV2Sampler.sol
deleted file mode 100644
index a6cfdaaa3b..0000000000
--- a/packages/asset-swapper/contracts/src/BalancerV2Sampler.sol
+++ /dev/null
@@ -1,142 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./SamplerUtils.sol";
-import "./interfaces/IBalancerV2Vault.sol";
-import "./BalancerV2Common.sol";
-
-
-contract BalancerV2Sampler is SamplerUtils, BalancerV2Common {
-
- /// @dev Sample sell quotes from Balancer V2.
- /// @param poolInfo Struct with pool related data
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromBalancerV2(
- IBalancerV2Vault.BalancerV2PoolInfo memory poolInfo,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- returns (uint256[] memory makerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- IBalancerV2Vault vault = IBalancerV2Vault(poolInfo.vault);
- address[] memory swapAssets = new address[](2);
- swapAssets[0] = takerToken;
- swapAssets[1] = makerToken;
-
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- IBalancerV2Vault.FundManagement memory swapFunds =
- _createSwapFunds();
-
- for (uint256 i = 0; i < numSamples; i++) {
- IBalancerV2Vault.BatchSwapStep[] memory swapSteps =
- _createSwapSteps(poolInfo, takerTokenAmounts[i]);
-
- try
- // For sells we specify the takerToken which is what the vault will receive from the trade
- vault.queryBatchSwap(IBalancerV2Vault.SwapKind.GIVEN_IN, swapSteps, swapAssets, swapFunds)
- // amounts represent pool balance deltas from the swap (incoming balance, outgoing balance)
- returns (int256[] memory amounts) {
- // Outgoing balance is negative so we need to flip the sign
- int256 amountOutFromPool = amounts[amounts.length - 1] * -1;
- if (amountOutFromPool <= 0) {
- break;
- }
- makerTokenAmounts[i] = uint256(amountOutFromPool);
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from Balancer V2.
- /// @param poolInfo Struct with pool related data
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromBalancerV2(
- IBalancerV2Vault.BalancerV2PoolInfo memory poolInfo,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- returns (uint256[] memory takerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- IBalancerV2Vault vault = IBalancerV2Vault(poolInfo.vault);
- address[] memory swapAssets = new address[](2);
- swapAssets[0] = takerToken;
- swapAssets[1] = makerToken;
-
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- IBalancerV2Vault.FundManagement memory swapFunds =
- _createSwapFunds();
-
- for (uint256 i = 0; i < numSamples; i++) {
- IBalancerV2Vault.BatchSwapStep[] memory swapSteps =
- _createSwapSteps(poolInfo, makerTokenAmounts[i]);
-
- try
- // For buys we specify the makerToken which is what taker will receive from the trade
- vault.queryBatchSwap(IBalancerV2Vault.SwapKind.GIVEN_OUT, swapSteps, swapAssets, swapFunds)
- returns (int256[] memory amounts) {
- int256 amountIntoPool = amounts[0];
- if (amountIntoPool <= 0) {
- break;
- }
- takerTokenAmounts[i] = uint256(amountIntoPool);
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- function _createSwapSteps(
- IBalancerV2Vault.BalancerV2PoolInfo memory poolInfo,
- uint256 amount
- ) private pure returns (IBalancerV2Vault.BatchSwapStep[] memory) {
- IBalancerV2Vault.BatchSwapStep[] memory swapSteps =
- new IBalancerV2Vault.BatchSwapStep[](1);
- swapSteps[0] = IBalancerV2Vault.BatchSwapStep({
- poolId: poolInfo.poolId,
- assetInIndex: 0,
- assetOutIndex: 1,
- amount: amount,
- userData: ""
- });
-
- return swapSteps;
- }
-}
diff --git a/packages/asset-swapper/contracts/src/BancorSampler.sol b/packages/asset-swapper/contracts/src/BancorSampler.sol
deleted file mode 100644
index 349c1c7631..0000000000
--- a/packages/asset-swapper/contracts/src/BancorSampler.sol
+++ /dev/null
@@ -1,141 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IBancor.sol";
-
-
-contract BancorSampler {
-
- /// @dev Base gas limit for Bancor calls.
- uint256 constant private BANCOR_CALL_GAS = 300e3; // 300k
-
- struct BancorSamplerOpts {
- IBancorRegistry registry;
- address[][] paths;
- }
-
- /// @dev Sample sell quotes from Bancor.
- /// @param opts BancorSamplerOpts The Bancor registry contract address and paths
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return bancorNetwork the Bancor Network address
- /// @return path the selected conversion path from bancor
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromBancor(
- BancorSamplerOpts memory opts,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (address bancorNetwork, address[] memory path, uint256[] memory makerTokenAmounts)
- {
- if (opts.paths.length == 0) {
- return (bancorNetwork, path, makerTokenAmounts);
- }
- (bancorNetwork, path) = _findBestPath(opts, takerToken, makerToken, takerTokenAmounts);
- makerTokenAmounts = new uint256[](takerTokenAmounts.length);
-
- for (uint256 i = 0; i < makerTokenAmounts.length; i++) {
- try
- IBancorNetwork(bancorNetwork)
- .rateByPath
- {gas: BANCOR_CALL_GAS}
- (path, takerTokenAmounts[i])
- returns (uint256 amount)
- {
- makerTokenAmounts[i] = amount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- return (bancorNetwork, path, makerTokenAmounts);
- }
-
- /// @dev Sample buy quotes from Bancor. Unimplemented
- /// @param opts BancorSamplerOpts The Bancor registry contract address and paths
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return bancorNetwork the Bancor Network address
- /// @return path the selected conversion path from bancor
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromBancor(
- BancorSamplerOpts memory opts,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (address bancorNetwork, address[] memory path, uint256[] memory takerTokenAmounts)
- {
- }
-
- function _findBestPath(
- BancorSamplerOpts memory opts,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- internal
- view
- returns (address bancorNetwork, address[] memory path)
- {
- bancorNetwork = opts.registry.getAddress(opts.registry.BANCOR_NETWORK());
- if (opts.paths.length == 0) {
- return (bancorNetwork, path);
- }
- uint256 maxBoughtAmount = 0;
- // Find the best path by selling the largest taker amount
- for (uint256 i = 0; i < opts.paths.length; i++) {
- if (opts.paths[i].length < 2) {
- continue;
- }
-
- try
- IBancorNetwork(bancorNetwork)
- .rateByPath
- {gas: BANCOR_CALL_GAS}
- (opts.paths[i], takerTokenAmounts[takerTokenAmounts.length-1])
- returns (uint256 amount)
- {
- if (amount > maxBoughtAmount) {
- maxBoughtAmount = amount;
- path = opts.paths[i];
- }
- } catch {
- // Swallow failures, leaving all results as zero.
- continue;
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/BancorV3Sampler.sol b/packages/asset-swapper/contracts/src/BancorV3Sampler.sol
deleted file mode 100644
index 3a54179d9c..0000000000
--- a/packages/asset-swapper/contracts/src/BancorV3Sampler.sol
+++ /dev/null
@@ -1,120 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2022 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IBancorV3.sol";
-
-
-contract BancorV3Sampler
-{
- /// @dev Gas limit for BancorV3 calls.
- uint256 constant private BancorV3_CALL_GAS = 150e3; // 150k
-
- address constant public ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
-
- /// @dev Sample sell quotes from BancorV3.
- /// @param weth The WETH contract address
- /// @param router Router to look up tokens and amounts
- /// @param path Token route. Should be takerToken -> makerToken
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromBancorV3(
- address weth,
- address router,
- address[] memory path,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- if(path[0] == weth){
- path[0] = ETH;
- }
- if(path[1] == weth){
- path[1] = ETH;
- }
-
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IBancorV3(router).tradeOutputBySourceAmount(path[0], path[1], takerTokenAmounts[i])
- returns (uint256 amount)
- {
- makerTokenAmounts[i] = amount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from BancorV3.
- /// @param weth The WETH contract address
- /// @param router Router to look up tokens and amounts
- /// @param path Token route. Should be takerToken -> makerToken.
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromBancorV3(
- address weth,
- address router,
- address[] memory path,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
-
- if(path[0] == weth){
- path[0] = ETH;
- }
- if(path[1] == weth){
- path[1] = ETH;
- }
-
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IBancorV3(router).tradeInputByTargetAmount(path[0], path[1], makerTokenAmounts[i])
- returns (uint256 amount)
- {
- takerTokenAmounts[i] = amount;
- // Break early if there are 0 amounts
- if (takerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/packages/asset-swapper/contracts/src/CompoundSampler.sol b/packages/asset-swapper/contracts/src/CompoundSampler.sol
deleted file mode 100644
index 2f68f59c7d..0000000000
--- a/packages/asset-swapper/contracts/src/CompoundSampler.sol
+++ /dev/null
@@ -1,96 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./SamplerUtils.sol";
-import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
-
-// Minimal CToken interface
-interface ICToken {
- function mint(uint mintAmount) external returns (uint);
- function redeem(uint redeemTokens) external returns (uint);
- function redeemUnderlying(uint redeemAmount) external returns (uint);
- function exchangeRateStored() external view returns (uint);
- function decimals() external view returns (uint8);
-}
-
-contract CompoundSampler is SamplerUtils {
- uint256 constant private EXCHANGE_RATE_SCALE = 1e10;
-
- function sampleSellsFromCompound(
- ICToken cToken,
- IERC20TokenV06 takerToken,
- IERC20TokenV06 makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- // Exchange rate is scaled by 1 * 10^(18 - 8 + Underlying Token Decimals
- uint256 exchangeRate = cToken.exchangeRateStored();
- uint256 cTokenDecimals = uint256(cToken.decimals());
-
- if (address(makerToken) == address(cToken)) {
- // mint
- for (uint256 i = 0; i < numSamples; i++) {
- makerTokenAmounts[i] = (takerTokenAmounts[i] * EXCHANGE_RATE_SCALE * 10 ** cTokenDecimals) / exchangeRate;
- }
-
- } else if (address(takerToken) == address(cToken)) {
- // redeem
- for (uint256 i = 0; i < numSamples; i++) {
- makerTokenAmounts[i] = (takerTokenAmounts[i] * exchangeRate) / (EXCHANGE_RATE_SCALE * 10 ** cTokenDecimals);
- }
- }
- }
-
- function sampleBuysFromCompound(
- ICToken cToken,
- IERC20TokenV06 takerToken,
- IERC20TokenV06 makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- // Exchange rate is scaled by 1 * 10^(18 - 8 + Underlying Token Decimals
- uint256 exchangeRate = cToken.exchangeRateStored();
- uint256 cTokenDecimals = uint256(cToken.decimals());
-
- if (address(makerToken) == address(cToken)) {
- // mint
- for (uint256 i = 0; i < numSamples; i++) {
- takerTokenAmounts[i] = makerTokenAmounts[i] * exchangeRate / (EXCHANGE_RATE_SCALE * 10 ** cTokenDecimals);
- }
- } else if (address(takerToken) == address(cToken)) {
- // redeem
- for (uint256 i = 0; i < numSamples; i++) {
- takerTokenAmounts[i] = (makerTokenAmounts[i] * EXCHANGE_RATE_SCALE * 10 ** cTokenDecimals)/exchangeRate;
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/CurveSampler.sol b/packages/asset-swapper/contracts/src/CurveSampler.sol
deleted file mode 100644
index ce2e5ae7c6..0000000000
--- a/packages/asset-swapper/contracts/src/CurveSampler.sol
+++ /dev/null
@@ -1,161 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/ICurve.sol";
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-
-contract CurveSampler is
- SamplerUtils,
- ApproximateBuys
-{
- /// @dev Information for sampling from curve sources.
- struct CurveInfo {
- address poolAddress;
- bytes4 sellQuoteFunctionSelector;
- bytes4 buyQuoteFunctionSelector;
- }
-
- /// @dev Base gas limit for Curve calls. Some Curves have multiple tokens
- /// So a reasonable ceil is 150k per token. Biggest Curve has 4 tokens.
- uint256 constant private CURVE_CALL_GAS = 2000e3; // Was 600k for Curve but SnowSwap is using 1500k+
-
- /// @dev Sample sell quotes from Curve.
- /// @param curveInfo Curve information specific to this token pair.
- /// @param fromTokenIdx Index of the taker token (what to sell).
- /// @param toTokenIdx Index of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromCurve(
- CurveInfo memory curveInfo,
- int128 fromTokenIdx,
- int128 toTokenIdx,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- for (uint256 i = 0; i < numSamples; i++) {
- (bool didSucceed, bytes memory resultData) =
- curveInfo.poolAddress.staticcall.gas(CURVE_CALL_GAS)(
- abi.encodeWithSelector(
- curveInfo.sellQuoteFunctionSelector,
- fromTokenIdx,
- toTokenIdx,
- takerTokenAmounts[i]
- ));
- uint256 buyAmount = 0;
- if (didSucceed) {
- buyAmount = abi.decode(resultData, (uint256));
- }
- makerTokenAmounts[i] = buyAmount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from Curve.
- /// @param curveInfo Curve information specific to this token pair.
- /// @param fromTokenIdx Index of the taker token (what to sell).
- /// @param toTokenIdx Index of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromCurve(
- CurveInfo memory curveInfo,
- int128 fromTokenIdx,
- int128 toTokenIdx,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- if (curveInfo.buyQuoteFunctionSelector == bytes4(0)) {
- // Buys not supported on this curve, so approximate it.
- return _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(toTokenIdx, curveInfo),
- takerTokenData: abi.encode(fromTokenIdx, curveInfo),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromCurve
- }),
- makerTokenAmounts
- );
- }
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- for (uint256 i = 0; i < numSamples; i++) {
- (bool didSucceed, bytes memory resultData) =
- curveInfo.poolAddress.staticcall.gas(CURVE_CALL_GAS)(
- abi.encodeWithSelector(
- curveInfo.buyQuoteFunctionSelector,
- fromTokenIdx,
- toTokenIdx,
- makerTokenAmounts[i]
- ));
- uint256 sellAmount = 0;
- if (didSucceed) {
- sellAmount = abi.decode(resultData, (uint256));
- }
- takerTokenAmounts[i] = sellAmount;
- // Break early if there are 0 amounts
- if (takerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- function _sampleSellForApproximateBuyFromCurve(
- bytes memory takerTokenData,
- bytes memory makerTokenData,
- uint256 sellAmount
- )
- private
- view
- returns (uint256 buyAmount)
- {
- (int128 takerTokenIdx, CurveInfo memory curveInfo) =
- abi.decode(takerTokenData, (int128, CurveInfo));
- (int128 makerTokenIdx) =
- abi.decode(makerTokenData, (int128));
- (bool success, bytes memory resultData) =
- address(this).staticcall(abi.encodeWithSelector(
- this.sampleSellsFromCurve.selector,
- curveInfo,
- takerTokenIdx,
- makerTokenIdx,
- _toSingleValueArray(sellAmount)
- ));
- if (!success) {
- return 0;
- }
-
- return abi.decode(resultData, (uint256[]))[0];
- }
-}
diff --git a/packages/asset-swapper/contracts/src/DODOSampler.sol b/packages/asset-swapper/contracts/src/DODOSampler.sol
deleted file mode 100644
index 49e8ecf66b..0000000000
--- a/packages/asset-swapper/contracts/src/DODOSampler.sol
+++ /dev/null
@@ -1,211 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-
-interface IDODOZoo {
- function getDODO(address baseToken, address quoteToken) external view returns (address);
-}
-
-interface IDODOHelper {
- function querySellQuoteToken(address dodo, uint256 amount) external view returns (uint256);
-}
-
-interface IDODO {
- function querySellBaseToken(uint256 amount) external view returns (uint256);
- function _TRADE_ALLOWED_() external view returns (bool);
-}
-
-contract DODOSampler is
- SamplerUtils,
- ApproximateBuys
-{
-
- /// @dev Gas limit for DODO calls.
- uint256 constant private DODO_CALL_GAS = 300e3; // 300k
- struct DODOSamplerOpts {
- address registry;
- address helper;
- }
-
- /// @dev Sample sell quotes from DODO.
- /// @param opts DODOSamplerOpts DODO Registry and helper addresses
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return sellBase whether the bridge needs to sell the base token
- /// @return pool the DODO pool address
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromDODO(
- DODOSamplerOpts memory opts,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (bool sellBase, address pool, uint256[] memory makerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- pool = IDODOZoo(opts.registry).getDODO(takerToken, makerToken);
- address baseToken;
- // If pool exists we have the correct order of Base/Quote
- if (pool != address(0)) {
- baseToken = takerToken;
- sellBase = true;
- } else {
- pool = IDODOZoo(opts.registry).getDODO(makerToken, takerToken);
- // No pool either direction
- if (address(pool) == address(0)) {
- return (sellBase, pool, makerTokenAmounts);
- }
- baseToken = makerToken;
- sellBase = false;
- }
-
- // DODO Pool has been disabled
- if (!IDODO(pool)._TRADE_ALLOWED_()) {
- return (sellBase, pool, makerTokenAmounts);
- }
-
- for (uint256 i = 0; i < numSamples; i++) {
- uint256 buyAmount = _sampleSellForApproximateBuyFromDODO(
- abi.encode(takerToken, pool, baseToken, opts.helper), // taker token data
- abi.encode(makerToken, pool, baseToken, opts.helper), // maker token data
- takerTokenAmounts[i]
- );
- makerTokenAmounts[i] = buyAmount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from DODO.
- /// @param opts DODOSamplerOpts DODO Registry and helper addresses
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token sell amount for each sample.
- /// @return sellBase whether the bridge needs to sell the base token
- /// @return pool the DODO pool address
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromDODO(
- DODOSamplerOpts memory opts,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (bool sellBase, address pool, uint256[] memory takerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
-
- // Pool is BASE/QUOTE
- // Look up the pool from the taker/maker combination
- pool = IDODOZoo(opts.registry).getDODO(takerToken, makerToken);
- address baseToken;
- // If pool exists we have the correct order of Base/Quote
- if (pool != address(0)) {
- baseToken = takerToken;
- sellBase = true;
- } else {
- // Look up the pool from the maker/taker combination
- pool = IDODOZoo(opts.registry).getDODO(makerToken, takerToken);
- // No pool either direction
- if (address(pool) == address(0)) {
- return (sellBase, pool, takerTokenAmounts);
- }
- baseToken = makerToken;
- sellBase = false;
- }
-
- // DODO Pool has been disabled
- if (!IDODO(pool)._TRADE_ALLOWED_()) {
- return (sellBase, pool, takerTokenAmounts);
- }
-
- takerTokenAmounts = _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(makerToken, pool, baseToken, opts.helper),
- takerTokenData: abi.encode(takerToken, pool, baseToken, opts.helper),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromDODO
- }),
- makerTokenAmounts
- );
- }
-
- function _sampleSellForApproximateBuyFromDODO(
- bytes memory takerTokenData,
- bytes memory /* makerTokenData */,
- uint256 sellAmount
- )
- private
- view
- returns (uint256)
- {
- (address takerToken, address pool, address baseToken, address helper) = abi.decode(
- takerTokenData,
- (address, address, address, address)
- );
-
- // We will get called to sell both the taker token and also to sell the maker token
- if (takerToken == baseToken) {
- // If base token then use the original query on the pool
- try
- IDODO(pool).querySellBaseToken
- {gas: DODO_CALL_GAS}
- (sellAmount)
- returns (uint256 amount)
- {
- return amount;
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- return 0;
- }
- } else {
- // If quote token then use helper, this is less accurate
- try
- IDODOHelper(helper).querySellQuoteToken
- {gas: DODO_CALL_GAS}
- (pool, sellAmount)
- returns (uint256 amount)
- {
- return amount;
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- return 0;
- }
- }
- }
-
-}
diff --git a/packages/asset-swapper/contracts/src/DODOV2Sampler.sol b/packages/asset-swapper/contracts/src/DODOV2Sampler.sol
deleted file mode 100644
index 6b99135cc9..0000000000
--- a/packages/asset-swapper/contracts/src/DODOV2Sampler.sol
+++ /dev/null
@@ -1,204 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-interface IDODOV2Registry {
- function getDODOPool(address baseToken, address quoteToken)
- external
- view
- returns (address[] memory machines);
-}
-
-interface IDODOV2Pool {
- function querySellBase(address trader, uint256 payBaseAmount)
- external
- view
- returns (uint256 receiveQuoteAmount, uint256 mtFee);
-
- function querySellQuote(address trader, uint256 payQuoteAmount)
- external
- view
- returns (uint256 receiveBaseAmount, uint256 mtFee);
-}
-
-contract DODOV2Sampler is
- SamplerUtils,
- ApproximateBuys
-{
-
- /// @dev Gas limit for DODO V2 calls.
- uint256 constant private DODO_V2_CALL_GAS = 300e3; // 300k
-
- /// @dev Sample sell quotes from DODO V2.
- /// @param registry Address of the registry to look up.
- /// @param offset offset index for the pool in the registry.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return sellBase whether the bridge needs to sell the base token
- /// @return pool the DODO pool address
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromDODOV2(
- address registry,
- uint256 offset,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (bool sellBase, address pool, uint256[] memory makerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
-
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- (pool, sellBase) = _getNextDODOV2Pool(registry, offset, takerToken, makerToken);
- if (pool == address(0)) {
- return (sellBase, pool, makerTokenAmounts);
- }
-
- for (uint256 i = 0; i < numSamples; i++) {
- uint256 buyAmount = _sampleSellForApproximateBuyFromDODOV2(
- abi.encode(takerToken, pool, sellBase), // taker token data
- abi.encode(makerToken, pool, sellBase), // maker token data
- takerTokenAmounts[i]
- );
- makerTokenAmounts[i] = buyAmount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from DODO.
- /// @param registry Address of the registry to look up.
- /// @param offset offset index for the pool in the registry.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token sell amount for each sample.
- /// @return sellBase whether the bridge needs to sell the base token
- /// @return pool the DODO pool address
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromDODOV2(
- address registry,
- uint256 offset,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (bool sellBase, address pool, uint256[] memory takerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- (pool, sellBase) = _getNextDODOV2Pool(registry, offset, takerToken, makerToken);
- if (pool == address(0)) {
- return (sellBase, pool, takerTokenAmounts);
- }
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
-
- takerTokenAmounts = _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(makerToken, pool, !sellBase),
- takerTokenData: abi.encode(takerToken, pool, sellBase),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromDODOV2
- }),
- makerTokenAmounts
- );
- }
-
- function _sampleSellForApproximateBuyFromDODOV2(
- bytes memory takerTokenData,
- bytes memory /* makerTokenData */,
- uint256 sellAmount
- )
- private
- view
- returns (uint256)
- {
- (address takerToken, address pool, bool sellBase) = abi.decode(
- takerTokenData,
- (address, address, bool)
- );
-
- // We will get called to sell both the taker token and also to sell the maker token
- // since we use approximate buy for sell and buy functions
- if (sellBase) {
- try
- IDODOV2Pool(pool).querySellBase
- { gas: DODO_V2_CALL_GAS }
- (address(0), sellAmount)
- returns (uint256 amount, uint256)
- {
- return amount;
- } catch {
- return 0;
- }
- } else {
- try
- IDODOV2Pool(pool).querySellQuote
- { gas: DODO_V2_CALL_GAS }
- (address(0), sellAmount)
- returns (uint256 amount, uint256)
- {
- return amount;
- } catch {
- return 0;
- }
- }
- }
-
- function _getNextDODOV2Pool(
- address registry,
- uint256 offset,
- address takerToken,
- address makerToken
- )
- internal
- view
- returns (address machine, bool sellBase)
- {
- // Query in base -> quote direction, if a pool is found then we are selling the base
- address[] memory machines = IDODOV2Registry(registry).getDODOPool(takerToken, makerToken);
- sellBase = true;
- if (machines.length == 0) {
- // Query in quote -> base direction, if a pool is found then we are selling the quote
- machines = IDODOV2Registry(registry).getDODOPool(makerToken, takerToken);
- sellBase = false;
- }
-
- if (offset >= machines.length) {
- return (address(0), false);
- }
-
- machine = machines[offset];
- }
-
-}
diff --git a/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol b/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol
deleted file mode 100644
index 01195bfbe1..0000000000
--- a/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol
+++ /dev/null
@@ -1,105 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./BalancerSampler.sol";
-import "./BalancerV2Sampler.sol";
-import "./BalancerV2BatchSampler.sol";
-import "./BancorSampler.sol";
-import "./BancorV3Sampler.sol";
-import "./CompoundSampler.sol";
-import "./CurveSampler.sol";
-import "./DODOSampler.sol";
-import "./DODOV2Sampler.sol";
-import "./GMXSampler.sol";
-import "./KyberDmmSampler.sol";
-import "./LidoSampler.sol";
-import "./LiquidityProviderSampler.sol";
-import "./MakerPSMSampler.sol";
-import "./MStableSampler.sol";
-import "./MooniswapSampler.sol";
-import "./NativeOrderSampler.sol";
-import "./PlatypusSampler.sol";
-import "./ShellSampler.sol";
-import "./SynthetixSampler.sol";
-import "./TwoHopSampler.sol";
-import "./UniswapSampler.sol";
-import "./UniswapV2Sampler.sol";
-import "./UniswapV3Sampler.sol";
-import "./VelodromeSampler.sol";
-import "./WooPPSampler.sol";
-import "./UtilitySampler.sol";
-
-
-contract ERC20BridgeSampler is
- BalancerSampler,
- BalancerV2Sampler,
- BalancerV2BatchSampler,
- BancorSampler,
- BancorV3Sampler,
- CompoundSampler,
- CurveSampler,
- DODOSampler,
- DODOV2Sampler,
- GMXSampler,
- KyberDmmSampler,
- LidoSampler,
- LiquidityProviderSampler,
- MakerPSMSampler,
- MStableSampler,
- MooniswapSampler,
- NativeOrderSampler,
- PlatypusSampler,
- ShellSampler,
- SynthetixSampler,
- TwoHopSampler,
- UniswapSampler,
- UniswapV2Sampler,
- UniswapV3Sampler,
- VelodromeSampler,
- WooPPSampler,
- UtilitySampler
-{
-
- struct CallResults {
- bytes data;
- bool success;
- }
-
- /// @dev Call multiple public functions on this contract in a single transaction.
- /// @param callDatas ABI-encoded call data for each function call.
- /// @return callResults ABI-encoded results data for each call.
- function batchCall(bytes[] calldata callDatas)
- external
- returns (CallResults[] memory callResults)
- {
- callResults = new CallResults[](callDatas.length);
- for (uint256 i = 0; i != callDatas.length; ++i) {
- callResults[i].success = true;
- if (callDatas[i].length == 0) {
- continue;
- }
- (callResults[i].success, callResults[i].data) = address(this).call(callDatas[i]);
- }
- }
-
- receive() external payable {}
-}
diff --git a/packages/asset-swapper/contracts/src/FakeTaker.sol b/packages/asset-swapper/contracts/src/FakeTaker.sol
deleted file mode 100644
index 086c5a1590..0000000000
--- a/packages/asset-swapper/contracts/src/FakeTaker.sol
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-contract FakeTaker {
-
- struct Result {
- bool success;
- bytes resultData;
- uint256 gasUsed;
- }
-
- receive() payable external {}
-
- function execute(address payable to, bytes calldata data)
- public
- payable
- returns (Result memory result)
- {
- uint256 gasBefore = gasleft();
- (
- result.success,
- result.resultData
- ) = to.call{ value: msg.value }(data);
- result.gasUsed = gasBefore - gasleft();
- }
-}
diff --git a/packages/asset-swapper/contracts/src/GMXSampler.sol b/packages/asset-swapper/contracts/src/GMXSampler.sol
deleted file mode 100644
index 89a6180211..0000000000
--- a/packages/asset-swapper/contracts/src/GMXSampler.sol
+++ /dev/null
@@ -1,96 +0,0 @@
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IGMX.sol";
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-contract GMXSampler is
- SamplerUtils,
- ApproximateBuys
-{
- struct GMXInfo {
- address reader;
- address vault;
- address[] path;
- }
-
- function sampleSellsFromGMX(
- address reader,
- address vault,
- address[] memory path,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IGMX(reader).getAmountOut(IVault(vault), path[0], path[1], takerTokenAmounts[i])
- returns (uint256 amountAfterFees, uint256 feeAmount)
- {
- makerTokenAmounts[i] = amountAfterFees;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- function sampleBuysFromGMX(
- address reader,
- address vault,
- address[] memory path,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- address[] memory invertBuyPath = new address[](2);
- invertBuyPath[0] = path[1];
- invertBuyPath[1] = path[0];
- return _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(reader, vault, invertBuyPath),
- takerTokenData: abi.encode(reader, vault, path),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromGMX
- }),
- makerTokenAmounts
- );
- }
-
-
- function _sampleSellForApproximateBuyFromGMX(
- bytes memory takerTokenData,
- bytes memory makerTokenData,
- uint256 sellAmount
- )
- private
- view
- returns (uint256 buyAmount)
- {
- (address _reader, address _vault, address[] memory _path ) = abi.decode(takerTokenData, (address, address, address[]));
-
- (bool success, bytes memory resultData) = address(this).staticcall(abi.encodeWithSelector(
- this.sampleSellsFromGMX.selector,
- _reader,
- _vault,
- _path,
- _toSingleValueArray(sellAmount)
- ));
- if(!success) {
- return 0;
- }
-
- return abi.decode(resultData, (uint256[]))[0];
- }
-
-}
diff --git a/packages/asset-swapper/contracts/src/KyberDmmSampler.sol b/packages/asset-swapper/contracts/src/KyberDmmSampler.sol
deleted file mode 100644
index 29ea8c01b3..0000000000
--- a/packages/asset-swapper/contracts/src/KyberDmmSampler.sol
+++ /dev/null
@@ -1,179 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-interface IKyberDmmPool {
-
- function totalSupply()
- external
- view
- returns (uint256);
-}
-
-interface IKyberDmmFactory {
-
- function getPools(address token0, address token1)
- external
- view
- returns (address[] memory _tokenPools);
-}
-
-interface IKyberDmmRouter {
-
- function factory() external view returns (address);
-
- function getAmountsOut(uint256 amountIn, address[] calldata pools, address[] calldata path)
- external
- view
- returns (uint256[] memory amounts);
-
- function getAmountsIn(uint256 amountOut, address[] calldata pools, address[] calldata path)
- external
- view
- returns (uint256[] memory amounts);
-}
-
-
-
-contract KyberDmmSampler
-{
- /// @dev Gas limit for KyberDmm calls.
- uint256 constant private KYBER_DMM_CALL_GAS = 150e3; // 150k
-
- /// @dev Sample sell quotes from KyberDmm.
- /// @param router Router to look up tokens and amounts
- /// @param path Token route. Should be takerToken -> makerToken
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return pools The pool addresses involved in the multi path trade
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromKyberDmm(
- address router,
- address[] memory path,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (address[] memory pools, uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- pools = _getKyberDmmPools(router, path);
- if (pools.length == 0) {
- return (pools, makerTokenAmounts);
- }
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IKyberDmmRouter(router).getAmountsOut
- {gas: KYBER_DMM_CALL_GAS}
- (takerTokenAmounts[i], pools, path)
- returns (uint256[] memory amounts)
- {
- makerTokenAmounts[i] = amounts[path.length - 1];
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from KyberDmm.
- /// @param router Router to look up tokens and amounts
- /// @param path Token route. Should be takerToken -> makerToken.
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return pools The pool addresses involved in the multi path trade
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromKyberDmm(
- address router,
- address[] memory path,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (address[] memory pools, uint256[] memory takerTokenAmounts)
- {
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- pools = _getKyberDmmPools(router, path);
- if (pools.length == 0) {
- return (pools, takerTokenAmounts);
- }
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IKyberDmmRouter(router).getAmountsIn
- {gas: KYBER_DMM_CALL_GAS}
- (makerTokenAmounts[i], pools, path)
- returns (uint256[] memory amounts)
- {
- takerTokenAmounts[i] = amounts[0];
- // Break early if there are 0 amounts
- if (takerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- function _getKyberDmmPools(
- address router,
- address[] memory path
- )
- private
- view
- returns (address[] memory pools)
- {
- IKyberDmmFactory factory = IKyberDmmFactory(IKyberDmmRouter(router).factory());
- pools = new address[](path.length - 1);
- for (uint256 i = 0; i < pools.length; i++) {
- // find the best pool
- address[] memory allPools;
- try
- factory.getPools
- {gas: KYBER_DMM_CALL_GAS}
- (path[i], path[i + 1])
- returns (address[] memory allPools)
- {
- if (allPools.length == 0) {
- return new address[](0);
- }
-
- uint256 maxSupply = 0;
- for (uint256 j = 0; j < allPools.length; j++) {
- uint256 totalSupply = IKyberDmmPool(allPools[j]).totalSupply();
- if (totalSupply > maxSupply) {
- maxSupply = totalSupply;
- pools[i] = allPools[j];
- }
- }
- } catch (bytes memory) {
- return new address[](0);
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/LidoSampler.sol b/packages/asset-swapper/contracts/src/LidoSampler.sol
deleted file mode 100644
index 27e23f703a..0000000000
--- a/packages/asset-swapper/contracts/src/LidoSampler.sol
+++ /dev/null
@@ -1,119 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./SamplerUtils.sol";
-
-
-interface IWstETH {
- function getWstETHByStETH(uint256 _stETHAmount) external view returns (uint256);
- function getStETHByWstETH(uint256 _wstETHAmount) external view returns (uint256);
-}
-
-
-contract LidoSampler is SamplerUtils {
- struct LidoInfo {
- address stEthToken;
- address wethToken;
- address wstEthToken;
- }
-
- /// @dev Sample sell quotes from Lido
- /// @param lidoInfo Info regarding a specific Lido deployment
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromLido(
- LidoInfo memory lidoInfo,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory)
- {
- _assertValidPair(makerToken, takerToken);
-
- if (takerToken == lidoInfo.wethToken && makerToken == address(lidoInfo.stEthToken)) {
- // Minting stETH is always 1:1 therefore we can just return the same amounts back.
- return takerTokenAmounts;
- }
-
- return _sampleSellsForWrapped(lidoInfo, takerToken, makerToken, takerTokenAmounts);
- }
-
- /// @dev Sample buy quotes from Lido.
- /// @param lidoInfo Info regarding a specific Lido deployment
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromLido(
- LidoInfo memory lidoInfo,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory)
- {
- if (takerToken == lidoInfo.wethToken && makerToken == address(lidoInfo.stEthToken)) {
- // Minting stETH is always 1:1 therefore we can just return the same amounts back.
- return makerTokenAmounts;
- }
-
- // Swap out `makerToken` and `takerToken` and re-use `_sampleSellsForWrapped`.
- return _sampleSellsForWrapped(lidoInfo, makerToken, takerToken, makerTokenAmounts);
- }
-
- function _sampleSellsForWrapped(
- LidoInfo memory lidoInfo,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- ) private view returns (uint256[] memory) {
- IWstETH wstETH = IWstETH(lidoInfo.wstEthToken);
- uint256 numSamples = takerTokenAmounts.length;
- uint256[] memory makerTokenAmounts = new uint256[](numSamples);
-
- if (takerToken == lidoInfo.stEthToken && makerToken == lidoInfo.wstEthToken) {
- for (uint256 i = 0; i < numSamples; i++) {
- makerTokenAmounts[i] = wstETH.getWstETHByStETH(takerTokenAmounts[i]);
- }
- return makerTokenAmounts;
- }
-
- if (takerToken == lidoInfo.wstEthToken && makerToken == lidoInfo.stEthToken) {
- for (uint256 i = 0; i < numSamples; i++) {
- makerTokenAmounts[i] = wstETH.getStETHByWstETH(takerTokenAmounts[i]);
- }
- return makerTokenAmounts;
- }
-
- // Returns 0 values.
- return makerTokenAmounts;
- }
-}
diff --git a/packages/asset-swapper/contracts/src/LiquidityProviderSampler.sol b/packages/asset-swapper/contracts/src/LiquidityProviderSampler.sol
deleted file mode 100644
index a5c871c6e9..0000000000
--- a/packages/asset-swapper/contracts/src/LiquidityProviderSampler.sol
+++ /dev/null
@@ -1,132 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
-import "@0x/contracts-zero-ex/contracts/src/vendor/ILiquidityProvider.sol";
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-
-contract LiquidityProviderSampler is
- SamplerUtils,
- ApproximateBuys
-{
- /// @dev Default gas limit for liquidity provider calls.
- uint256 constant private DEFAULT_CALL_GAS = 400e3; // 400k
-
- /// @dev Sample sell quotes from an arbitrary on-chain liquidity provider.
- /// @param providerAddress Address of the liquidity provider.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromLiquidityProvider(
- address providerAddress,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- // Initialize array of maker token amounts.
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- for (uint256 i = 0; i < numSamples; i++) {
- try
- ILiquidityProvider(providerAddress).getSellQuote
- {gas: DEFAULT_CALL_GAS}
- (
- IERC20TokenV06(takerToken),
- IERC20TokenV06(makerToken),
- takerTokenAmounts[i]
- )
- returns (uint256 amount)
- {
- makerTokenAmounts[i] = amount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from an arbitrary on-chain liquidity provider.
- /// @param providerAddress Address of the liquidity provider.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromLiquidityProvider(
- address providerAddress,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- takerTokenAmounts = _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(makerToken, providerAddress),
- takerTokenData: abi.encode(takerToken, providerAddress),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromLiquidityProvider
- }),
- makerTokenAmounts
- );
- }
-
- function _sampleSellForApproximateBuyFromLiquidityProvider(
- bytes memory takerTokenData,
- bytes memory makerTokenData,
- uint256 sellAmount
- )
- private
- view
- returns (uint256 buyAmount)
- {
- (address takerToken, address providerAddress) =
- abi.decode(takerTokenData, (address, address));
- (address makerToken) =
- abi.decode(makerTokenData, (address));
- try
- this.sampleSellsFromLiquidityProvider
- {gas: DEFAULT_CALL_GAS}
- (providerAddress, takerToken, makerToken, _toSingleValueArray(sellAmount))
- returns (uint256[] memory amounts)
- {
- return amounts[0];
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- return 0;
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/MStableSampler.sol b/packages/asset-swapper/contracts/src/MStableSampler.sol
deleted file mode 100644
index 0947bc3767..0000000000
--- a/packages/asset-swapper/contracts/src/MStableSampler.sol
+++ /dev/null
@@ -1,127 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IMStable.sol";
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-
-contract MStableSampler is
- SamplerUtils,
- ApproximateBuys
-{
- /// @dev Default gas limit for mStable calls.
- uint256 constant private DEFAULT_CALL_GAS = 800e3; // 800k
-
- /// @dev Sample sell quotes from the mStable contract
- /// @param router Address of the mStable contract
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromMStable(
- address router,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- // Initialize array of maker token amounts.
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IMStable(router).getSwapOutput
- {gas: DEFAULT_CALL_GAS}
- (takerToken, makerToken, takerTokenAmounts[i])
- returns (uint256 amount)
- {
- makerTokenAmounts[i] = amount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from MStable contract
- /// @param router Address of the mStable contract
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromMStable(
- address router,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- return _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(makerToken, router),
- takerTokenData: abi.encode(takerToken, router),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromMStable
- }),
- makerTokenAmounts
- );
- }
-
- function _sampleSellForApproximateBuyFromMStable(
- bytes memory takerTokenData,
- bytes memory makerTokenData,
- uint256 sellAmount
- )
- private
- view
- returns (uint256 buyAmount)
- {
- (address takerToken, address router) =
- abi.decode(takerTokenData, (address, address));
- (address makerToken) =
- abi.decode(makerTokenData, (address));
- try
- this.sampleSellsFromMStable
- (router, takerToken, makerToken, _toSingleValueArray(sellAmount))
- returns (uint256[] memory amounts)
- {
- return amounts[0];
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- return 0;
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/MakerPSMSampler.sol b/packages/asset-swapper/contracts/src/MakerPSMSampler.sol
deleted file mode 100644
index 5adcf28716..0000000000
--- a/packages/asset-swapper/contracts/src/MakerPSMSampler.sol
+++ /dev/null
@@ -1,267 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./SamplerUtils.sol";
-import "@0x/contracts-utils/contracts/src/v06/LibMathV06.sol";
-
-interface IPSM {
- // @dev Get the fee for selling USDC to DAI in PSM
- // @return tin toll in [wad]
- function tin() external view returns (uint256);
- // @dev Get the fee for selling DAI to USDC in PSM
- // @return tout toll out [wad]
- function tout() external view returns (uint256);
-
- // @dev Get the address of the PSM state Vat
- // @return address of the Vat
- function vat() external view returns (address);
-
- // @dev Get the address of the underlying vault powering PSM
- // @return address of gemJoin contract
- function gemJoin() external view returns (address);
-
- // @dev Get the address of DAI
- // @return address of DAI contract
- function dai() external view returns (address);
-
- // @dev Sell USDC for DAI
- // @param usr The address of the account trading USDC for DAI.
- // @param gemAmt The amount of USDC to sell in USDC base units
- function sellGem(
- address usr,
- uint256 gemAmt
- ) external;
- // @dev Buy USDC for DAI
- // @param usr The address of the account trading DAI for USDC
- // @param gemAmt The amount of USDC to buy in USDC base units
- function buyGem(
- address usr,
- uint256 gemAmt
- ) external;
-}
-
-interface IVAT {
- // @dev Get a collateral type by identifier
- // @param ilkIdentifier bytes32 identifier. Example: ethers.utils.formatBytes32String("PSM-USDC-A")
- // @return ilk
- // @return ilk.Art Total Normalised Debt in wad
- // @return ilk.rate Accumulated Rates in ray
- // @return ilk.spot Price with Safety Margin in ray
- // @return ilk.line Debt Ceiling in rad
- // @return ilk.dust Urn Debt Floor in rad
- function ilks(
- bytes32 ilkIdentifier
- ) external view returns (
- uint256 Art,
- uint256 rate,
- uint256 spot,
- uint256 line,
- uint256 dust
- );
-}
-
-contract MakerPSMSampler is
- SamplerUtils
-{
- using LibSafeMathV06 for uint256;
-
- /// @dev Information about which PSM module to use
- struct MakerPsmInfo {
- address psmAddress;
- bytes32 ilkIdentifier;
- address gemTokenAddress;
- }
-
- /// @dev Gas limit for MakerPsm calls.
- uint256 constant private MAKER_PSM_CALL_GAS = 300e3; // 300k
-
-
- // Maker units
- // wad: fixed point decimal with 18 decimals (for basic quantities, e.g. balances)
- uint256 constant private WAD = 10 ** 18;
- // ray: fixed point decimal with 27 decimals (for precise quantites, e.g. ratios)
- uint256 constant private RAY = 10 ** 27;
- // rad: fixed point decimal with 45 decimals (result of integer multiplication with a wad and a ray)
- uint256 constant private RAD = 10 ** 45;
- // See https://github.com/makerdao/dss/blob/master/DEVELOPING.m
-
- /// @dev Sample sell quotes from Maker PSM
- function sampleSellsFromMakerPsm(
- MakerPsmInfo memory psmInfo,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- IPSM psm = IPSM(psmInfo.psmAddress);
- IVAT vat = IVAT(psm.vat());
-
-
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- if (makerToken != psm.dai() && takerToken != psm.dai()) {
- return makerTokenAmounts;
- }
-
- for (uint256 i = 0; i < numSamples; i++) {
- uint256 buyAmount = _samplePSMSell(psmInfo, makerToken, takerToken, takerTokenAmounts[i], psm, vat);
-
- if (buyAmount == 0) {
- break;
- }
- makerTokenAmounts[i] = buyAmount;
- }
- }
-
- function sampleBuysFromMakerPsm(
- MakerPsmInfo memory psmInfo,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- IPSM psm = IPSM(psmInfo.psmAddress);
- IVAT vat = IVAT(psm.vat());
-
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- if (makerToken != psm.dai() && takerToken != psm.dai()) {
- return takerTokenAmounts;
- }
-
- for (uint256 i = 0; i < numSamples; i++) {
- uint256 sellAmount = _samplePSMBuy(psmInfo, makerToken, takerToken, makerTokenAmounts[i], psm, vat);
-
- if (sellAmount == 0) {
- break;
- }
-
- takerTokenAmounts[i] = sellAmount;
- }
-
- }
-
- function _samplePSMSell(MakerPsmInfo memory psmInfo, address makerToken, address takerToken, uint256 takerTokenAmount, IPSM psm, IVAT vat)
- private
- view
- returns (uint256)
- {
- (uint256 totalDebtInWad,,, uint256 debtCeilingInRad, uint256 debtFloorInRad) = vat.ilks(psmInfo.ilkIdentifier);
- uint256 gemTokenBaseUnit = uint256(1e6);
-
- if (takerToken == psmInfo.gemTokenAddress) {
- // Simulate sellGem
- // Selling USDC to the PSM, increasing the total debt
- // Convert USDC 6 decimals to 18 decimals [wad]
- uint256 takerTokenAmountInWad = takerTokenAmount.safeMul(1e12);
-
- uint256 newTotalDebtInRad = totalDebtInWad.safeAdd(takerTokenAmountInWad).safeMul(RAY);
-
- // PSM is too full to fit
- if (newTotalDebtInRad >= debtCeilingInRad) {
- return 0;
- }
-
- uint256 feeInWad = takerTokenAmountInWad.safeMul(psm.tin()).safeDiv(WAD);
- uint256 makerTokenAmountInWad = takerTokenAmountInWad.safeSub(feeInWad);
-
- return makerTokenAmountInWad;
- } else if (makerToken == psmInfo.gemTokenAddress) {
- // Simulate buyGem
- // Buying USDC from the PSM, decreasing the total debt
- // Selling DAI for USDC, already in 18 decimals [wad]
- uint256 takerTokenAmountInWad = takerTokenAmount;
- if (takerTokenAmountInWad > totalDebtInWad) {
- return 0;
- }
- uint256 newTotalDebtInRad = totalDebtInWad.safeSub(takerTokenAmountInWad).safeMul(RAY);
-
- // PSM is empty, not enough USDC to buy from it
- if (newTotalDebtInRad <= debtFloorInRad) {
- return 0;
- }
-
- uint256 feeDivisorInWad = WAD.safeAdd(psm.tout()); // eg. 1.001 * 10 ** 18 with 0.1% tout;
- uint256 makerTokenAmountInGemTokenBaseUnits = takerTokenAmountInWad.safeMul(gemTokenBaseUnit).safeDiv(feeDivisorInWad);
-
- return makerTokenAmountInGemTokenBaseUnits;
- }
-
- return 0;
- }
-
- function _samplePSMBuy(MakerPsmInfo memory psmInfo, address makerToken, address takerToken, uint256 makerTokenAmount, IPSM psm, IVAT vat)
- private
- view
- returns (uint256)
- {
- (uint256 totalDebtInWad,,, uint256 debtCeilingInRad, uint256 debtFloorInRad) = vat.ilks(psmInfo.ilkIdentifier);
-
- if (takerToken == psmInfo.gemTokenAddress) {
- // Simulate sellGem
- // Selling USDC to the PSM, increasing the total debt
- uint256 makerTokenAmountInWad = makerTokenAmount;
- uint256 feeDivisorInWad = WAD.safeSub(psm.tin()); // eg. 0.999 * 10 ** 18 with 0.1% tin;
- uint256 takerTokenAmountInWad = makerTokenAmountInWad.safeMul(WAD).safeDiv(feeDivisorInWad);
- uint256 newTotalDebtInRad = totalDebtInWad.safeAdd(takerTokenAmountInWad).safeMul(RAY);
-
- // PSM is too full to fit
- if (newTotalDebtInRad >= debtCeilingInRad) {
- return 0;
- }
-
- uint256 takerTokenAmountInGemInGemBaseUnits = (takerTokenAmountInWad.safeDiv(1e12)).safeAdd(1); // Add 1 to deal with cut off decimals converting to lower decimals
-
- return takerTokenAmountInGemInGemBaseUnits;
- } else if (makerToken == psmInfo.gemTokenAddress) {
- // Simulate buyGem
- // Buying USDC from the PSM, decreasing the total debt
- uint256 makerTokenAmountInWad = makerTokenAmount.safeMul(1e12);
- uint256 feeMultiplierInWad = WAD.safeAdd(psm.tout()); // eg. 1.001 * 10 ** 18 with 0.1% tout;
- uint256 takerTokenAmountInWad = makerTokenAmountInWad.safeMul(feeMultiplierInWad).safeDiv(WAD);
- if (takerTokenAmountInWad > totalDebtInWad) {
- return 0;
- }
- uint256 newTotalDebtInRad = totalDebtInWad.safeSub(takerTokenAmountInWad).safeMul(RAY);
-
- // PSM is empty, not enough USDC to buy
- if (newTotalDebtInRad <= debtFloorInRad) {
- return 0;
- }
-
-
- return takerTokenAmountInWad;
- }
-
- return 0;
- }
-
-}
diff --git a/packages/asset-swapper/contracts/src/MooniswapSampler.sol b/packages/asset-swapper/contracts/src/MooniswapSampler.sol
deleted file mode 100644
index 32ee080450..0000000000
--- a/packages/asset-swapper/contracts/src/MooniswapSampler.sol
+++ /dev/null
@@ -1,169 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IMooniswap.sol";
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-
-contract MooniswapSampler is
- SamplerUtils,
- ApproximateBuys
-{
- /// @dev Gas limit for Mooniswap calls.
- uint256 constant private MOONISWAP_CALL_GAS = 150e3; // 150k
-
- /// @dev Sample sell quotes from Mooniswap.
- /// @param registry Address of the Mooniswap Registry.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return pool The contract address for the pool
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromMooniswap(
- address registry,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (IMooniswap pool, uint256[] memory makerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- for (uint256 i = 0; i < numSamples; i++) {
- uint256 buyAmount = sampleSingleSellFromMooniswapPool(
- registry,
- takerToken,
- makerToken,
- takerTokenAmounts[i]
- );
- makerTokenAmounts[i] = buyAmount;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- }
-
- pool = IMooniswap(
- IMooniswapRegistry(registry).pools(takerToken, makerToken)
- );
- }
-
- function sampleSingleSellFromMooniswapPool(
- address registry,
- address mooniswapTakerToken,
- address mooniswapMakerToken,
- uint256 takerTokenAmount
- )
- public
- view
- returns (uint256)
- {
- // Find the pool for the pair.
- IMooniswap pool = IMooniswap(
- IMooniswapRegistry(registry).pools(mooniswapTakerToken, mooniswapMakerToken)
- );
- // If there is no pool then return early
- if (address(pool) == address(0)) {
- return 0;
- }
- uint256 poolBalance = mooniswapTakerToken == address(0)
- ? address(pool).balance
- : IERC20TokenV06(mooniswapTakerToken).balanceOf(address(pool));
- // If the pool balance is smaller than the sell amount
- // don't sample to avoid multiplication overflow in buys
- if (poolBalance < takerTokenAmount) {
- return 0;
- }
- try
- pool.getReturn
- {gas: MOONISWAP_CALL_GAS}
- (mooniswapTakerToken, mooniswapMakerToken, takerTokenAmount)
- returns (uint256 amount)
- {
- return amount;
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- return 0;
- }
- }
-
- /// @dev Sample buy quotes from Mooniswap.
- /// @param registry Address of the Mooniswap Registry.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token sell amount for each sample.
- /// @return pool The contract address for the pool
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromMooniswap(
- address registry,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (IMooniswap pool, uint256[] memory takerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
-
- takerTokenAmounts = _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(registry, makerToken),
- takerTokenData: abi.encode(registry, takerToken),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromMooniswap
- }),
- makerTokenAmounts
- );
-
- pool = IMooniswap(
- IMooniswapRegistry(registry).pools(takerToken, makerToken)
- );
- }
-
- function _sampleSellForApproximateBuyFromMooniswap(
- bytes memory takerTokenData,
- bytes memory makerTokenData,
- uint256 sellAmount
- )
- private
- view
- returns (uint256 buyAmount)
- {
- (address registry, address mooniswapTakerToken) = abi.decode(takerTokenData, (address, address));
- (address _registry, address mooniswapMakerToken) = abi.decode(makerTokenData, (address, address));
- return sampleSingleSellFromMooniswapPool(
- registry,
- mooniswapTakerToken,
- mooniswapMakerToken,
- sellAmount
- );
- }
-}
diff --git a/packages/asset-swapper/contracts/src/NativeOrderSampler.sol b/packages/asset-swapper/contracts/src/NativeOrderSampler.sol
deleted file mode 100644
index 43c84272fe..0000000000
--- a/packages/asset-swapper/contracts/src/NativeOrderSampler.sol
+++ /dev/null
@@ -1,239 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
-import "@0x/contracts-utils/contracts/src/v06/LibMathV06.sol";
-import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
-import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
-
-
-interface IExchange {
-
- enum OrderStatus {
- INVALID,
- FILLABLE,
- FILLED,
- CANCELLED,
- EXPIRED
- }
-
- /// @dev A standard OTC or OO limit order.
- struct LimitOrder {
- IERC20TokenV06 makerToken;
- IERC20TokenV06 takerToken;
- uint128 makerAmount;
- uint128 takerAmount;
- uint128 takerTokenFeeAmount;
- address maker;
- address taker;
- address sender;
- address feeRecipient;
- bytes32 pool;
- uint64 expiry;
- uint256 salt;
- }
-
- /// @dev An RFQ limit order.
- struct RfqOrder {
- IERC20TokenV06 makerToken;
- IERC20TokenV06 takerToken;
- uint128 makerAmount;
- uint128 takerAmount;
- address maker;
- address taker;
- address txOrigin;
- bytes32 pool;
- uint64 expiry;
- uint256 salt;
- }
-
- /// @dev Info on a limit or RFQ order.
- struct OrderInfo {
- bytes32 orderHash;
- OrderStatus status;
- uint128 takerTokenFilledAmount;
- }
-
- /// @dev Allowed signature types.
- enum SignatureType {
- ILLEGAL,
- INVALID,
- EIP712,
- ETHSIGN
- }
-
- /// @dev Encoded EC signature.
- struct Signature {
- // How to validate the signature.
- SignatureType signatureType;
- // EC Signature data.
- uint8 v;
- // EC Signature data.
- bytes32 r;
- // EC Signature data.
- bytes32 s;
- }
-
- /// @dev Get the order info for a limit order.
- /// @param order The limit order.
- /// @return orderInfo Info about the order.
- function getLimitOrderInfo(LimitOrder memory order)
- external
- view
- returns (OrderInfo memory orderInfo);
-
- /// @dev Get order info, fillable amount, and signature validity for a limit order.
- /// Fillable amount is determined using balances and allowances of the maker.
- /// @param order The limit order.
- /// @param signature The order signature.
- /// @return orderInfo Info about the order.
- /// @return actualFillableTakerTokenAmount How much of the order is fillable
- /// based on maker funds, in taker tokens.
- /// @return isSignatureValid Whether the signature is valid.
- function getLimitOrderRelevantState(
- LimitOrder memory order,
- Signature calldata signature
- )
- external
- view
- returns (
- OrderInfo memory orderInfo,
- uint128 actualFillableTakerTokenAmount,
- bool isSignatureValid
- );
-}
-
-contract NativeOrderSampler {
- using LibSafeMathV06 for uint256;
- using LibBytesV06 for bytes;
-
- /// @dev Gas limit for calls to `getOrderFillableTakerAmount()`.
- uint256 constant internal DEFAULT_CALL_GAS = 200e3; // 200k
-
- /// @dev Queries the fillable taker asset amounts of native orders.
- /// Effectively ignores orders that have empty signatures or
- /// maker/taker asset amounts (returning 0).
- /// @param orders Native limit orders to query.
- /// @param orderSignatures Signatures for each respective order in `orders`.
- /// @param exchange The V4 exchange.
- /// @return orderFillableTakerAssetAmounts How much taker asset can be filled
- /// by each order in `orders`.
- function getLimitOrderFillableTakerAssetAmounts(
- IExchange.LimitOrder[] memory orders,
- IExchange.Signature[] memory orderSignatures,
- IExchange exchange
- )
- public
- view
- returns (uint256[] memory orderFillableTakerAssetAmounts)
- {
- orderFillableTakerAssetAmounts = new uint256[](orders.length);
- for (uint256 i = 0; i != orders.length; i++) {
- try
- this.getLimitOrderFillableTakerAmount
- {gas: DEFAULT_CALL_GAS}
- (
- orders[i],
- orderSignatures[i],
- exchange
- )
- returns (uint256 amount)
- {
- orderFillableTakerAssetAmounts[i] = amount;
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- orderFillableTakerAssetAmounts[i] = 0;
- }
- }
- }
-
- /// @dev Queries the fillable taker asset amounts of native orders.
- /// Effectively ignores orders that have empty signatures or
- /// @param orders Native orders to query.
- /// @param orderSignatures Signatures for each respective order in `orders`.
- /// @param exchange The V4 exchange.
- /// @return orderFillableMakerAssetAmounts How much maker asset can be filled
- /// by each order in `orders`.
- function getLimitOrderFillableMakerAssetAmounts(
- IExchange.LimitOrder[] memory orders,
- IExchange.Signature[] memory orderSignatures,
- IExchange exchange
- )
- public
- view
- returns (uint256[] memory orderFillableMakerAssetAmounts)
- {
- orderFillableMakerAssetAmounts = getLimitOrderFillableTakerAssetAmounts(
- orders,
- orderSignatures,
- exchange
- );
- // `orderFillableMakerAssetAmounts` now holds taker asset amounts, so
- // convert them to maker asset amounts.
- for (uint256 i = 0; i < orders.length; ++i) {
- if (orderFillableMakerAssetAmounts[i] != 0) {
- orderFillableMakerAssetAmounts[i] = LibMathV06.getPartialAmountCeil(
- orderFillableMakerAssetAmounts[i],
- orders[i].takerAmount,
- orders[i].makerAmount
- );
- }
- }
- }
-
- /// @dev Get the fillable taker amount of an order, taking into account
- /// order state, maker fees, and maker balances.
- function getLimitOrderFillableTakerAmount(
- IExchange.LimitOrder memory order,
- IExchange.Signature memory signature,
- IExchange exchange
- )
- virtual
- public
- view
- returns (uint256 fillableTakerAmount)
- {
- if (signature.signatureType == IExchange.SignatureType.ILLEGAL ||
- signature.signatureType == IExchange.SignatureType.INVALID ||
- order.makerAmount == 0 ||
- order.takerAmount == 0)
- {
- return 0;
- }
-
- (
- IExchange.OrderInfo memory orderInfo,
- uint128 remainingFillableTakerAmount,
- bool isSignatureValid
- ) = exchange.getLimitOrderRelevantState(order, signature);
-
- if (
- orderInfo.status != IExchange.OrderStatus.FILLABLE ||
- !isSignatureValid ||
- order.makerToken == IERC20TokenV06(0)
- ) {
- return 0;
- }
-
- fillableTakerAmount = uint256(remainingFillableTakerAmount);
- }
-}
diff --git a/packages/asset-swapper/contracts/src/PlatypusSampler.sol b/packages/asset-swapper/contracts/src/PlatypusSampler.sol
deleted file mode 100644
index d286a9e2e0..0000000000
--- a/packages/asset-swapper/contracts/src/PlatypusSampler.sol
+++ /dev/null
@@ -1,89 +0,0 @@
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IPlatypus.sol";
-import "./ApproximateBuys.sol";
-import "./SamplerUtils.sol";
-
-
-contract PlatypusSampler is
- SamplerUtils,
- ApproximateBuys
-{
-
- function sampleSellsFromPlatypus(
- address pool,
- address[] memory path,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
-
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IPlatypus(pool).quotePotentialSwap(path[0], path[1], takerTokenAmounts[i])
- returns (uint256 amountAfterFees, uint256 feeAmount)
- {
- makerTokenAmounts[i] = amountAfterFees;
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory result) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- function sampleBuysFromPlatypus(
- address pool,
- address[] memory path,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- address[] memory invertBuyPath = new address[](2);
- invertBuyPath[0] = path[1];
- invertBuyPath[1] = path[0];
- return _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(pool, invertBuyPath),
- takerTokenData: abi.encode(pool, path),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromPlatypus
- }),
- makerTokenAmounts
- );
- }
-
-
- function _sampleSellForApproximateBuyFromPlatypus(
- bytes memory makerTokenData,
- bytes memory takerTokenData,
- uint256 sellAmount
- )
- private
- view
- returns (uint256 buyAmount)
- {
- (address _pool, address[] memory _path ) = abi.decode(makerTokenData, (address, address[]));
-
- (bool success, bytes memory resultData) = address(this).staticcall(abi.encodeWithSelector(
- this.sampleSellsFromPlatypus.selector,
- _pool,
- _path,
- _toSingleValueArray(sellAmount)
- ));
- if(!success) {
- return 0;
- }
-
- return abi.decode(resultData, (uint256[]))[0];
- }
-}
diff --git a/packages/asset-swapper/contracts/src/SamplerUtils.sol b/packages/asset-swapper/contracts/src/SamplerUtils.sol
deleted file mode 100644
index b505512b6b..0000000000
--- a/packages/asset-swapper/contracts/src/SamplerUtils.sol
+++ /dev/null
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
-
-
-contract SamplerUtils {
-
- /// @dev Overridable way to get token decimals.
- /// @param tokenAddress Address of the token.
- /// @return decimals The decimal places for the token.
- function _getTokenDecimals(address tokenAddress)
- virtual
- internal
- view
- returns (uint8 decimals)
- {
- return LibERC20TokenV06.compatDecimals(IERC20TokenV06(tokenAddress));
- }
-
- function _toSingleValueArray(uint256 v)
- internal
- pure
- returns (uint256[] memory arr)
- {
- arr = new uint256[](1);
- arr[0] = v;
- }
-
- /// @dev Assert that the tokens in a trade pair are valid.
- /// @param makerToken Address of the maker token.
- /// @param takerToken Address of the taker token.
- function _assertValidPair(address makerToken, address takerToken)
- internal
- pure
- {
- require(makerToken != takerToken, "ERC20BridgeSampler/INVALID_TOKEN_PAIR");
- }
-}
diff --git a/packages/asset-swapper/contracts/src/ShellSampler.sol b/packages/asset-swapper/contracts/src/ShellSampler.sol
deleted file mode 100644
index f580e12cc2..0000000000
--- a/packages/asset-swapper/contracts/src/ShellSampler.sol
+++ /dev/null
@@ -1,126 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./ApproximateBuys.sol";
-import "./interfaces/IShell.sol";
-import "./SamplerUtils.sol";
-
-
-contract ShellSampler is
- SamplerUtils,
- ApproximateBuys
-{
-
- struct ShellInfo {
- address poolAddress;
- }
-
- /// @dev Default gas limit for Shell calls.
- uint256 constant private DEFAULT_CALL_GAS = 300e3; // 300k
-
- /// @dev Sample sell quotes from the Shell pool contract
- /// @param pool Address of the Shell pool contract
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromShell(
- address pool,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- // Initialize array of maker token amounts.
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IShell(pool).viewOriginSwap
- {gas: DEFAULT_CALL_GAS}
- (takerToken, makerToken, takerTokenAmounts[i])
- returns (uint256 amount)
- {
- makerTokenAmounts[i] = amount;
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from Shell pool contract
- /// @param pool Address of the Shell pool contract
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromShell(
- address pool,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- return _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- makerTokenData: abi.encode(makerToken, pool),
- takerTokenData: abi.encode(takerToken, pool),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromShell
- }),
- makerTokenAmounts
- );
- }
-
- function _sampleSellForApproximateBuyFromShell(
- bytes memory takerTokenData,
- bytes memory makerTokenData,
- uint256 sellAmount
- )
- private
- view
- returns (uint256 buyAmount)
- {
- (address takerToken, address pool) = abi.decode(takerTokenData, (address, address));
- (address makerToken) = abi.decode(makerTokenData, (address));
-
- try
- this.sampleSellsFromShell
- (pool, takerToken, makerToken, _toSingleValueArray(sellAmount))
- returns (uint256[] memory amounts)
- {
- return amounts[0];
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- return 0;
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/SynthetixSampler.sol b/packages/asset-swapper/contracts/src/SynthetixSampler.sol
deleted file mode 100644
index 38e45ebc6b..0000000000
--- a/packages/asset-swapper/contracts/src/SynthetixSampler.sol
+++ /dev/null
@@ -1,173 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2022 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-interface IReadProxyAddressResolver {
- function target() external view returns (address);
-}
-
-interface IAddressResolver {
- function getAddress(bytes32 name) external view returns (address);
-}
-
-interface IExchanger {
- // Ethereum Mainnet
- function getAmountsForAtomicExchange(
- uint256 sourceAmount,
- bytes32 sourceCurrencyKey,
- bytes32 destinationCurrencyKey
- )
- external
- view
- returns (
- uint256 amountReceived,
- uint256 fee,
- uint256 exchangeFeeRate
- );
-
- // Optimism
- function getAmountsForExchange(
- uint256 sourceAmount,
- bytes32 sourceCurrencyKey,
- bytes32 destinationCurrencyKey
- )
- external
- view
- returns (
- uint256 amountReceived,
- uint256 fee,
- uint256 exchangeFeeRate
- );
-}
-
-contract SynthetixSampler {
-
- /// @dev Sample sell quotes from Synthetix Atomic Swap.
- /// @param takerTokenSymbol Symbol (currency key) of the taker token (what to sell).
- /// @param makerTokenSymbol Symbol (currency key) of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample (sorted in ascending order).
- /// @return synthetix Synthetix address.
- /// @return makerTokenAmounts Maker amounts bought at each taker token amount.
- function sampleSellsFromSynthetix(
- IReadProxyAddressResolver readProxy,
- bytes32 takerTokenSymbol,
- bytes32 makerTokenSymbol,
- uint256[] memory takerTokenAmounts
- ) public view returns (address synthetix, uint256[] memory makerTokenAmounts) {
- synthetix = getSynthetixAddress(readProxy);
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- if (numSamples == 0) {
- return (synthetix, makerTokenAmounts);
- }
-
- makerTokenAmounts[0] = exchange(
- readProxy,
- takerTokenAmounts[0],
- takerTokenSymbol,
- makerTokenSymbol
- );
-
- // Synthetix atomic swap has a fixed rate. Calculate the rest based on the first value (and save gas).
- for (uint256 i = 1; i < numSamples; i++) {
- makerTokenAmounts[i] =
- (makerTokenAmounts[0] * takerTokenAmounts[i]) /
- takerTokenAmounts[0];
- }
- }
-
- /// @dev Sample buy quotes from Synthetix Atomic Swap.
- /// @param takerTokenSymbol Symbol (currency key) of the taker token (what to sell).
- /// @param makerTokenSymbol Symbol (currency key) of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample (sorted in ascending order).
- /// @return synthetix Synthetix address.
- /// @return takerTokenAmounts Taker amounts sold at each maker token amount.
- function sampleBuysFromSynthetix(
- IReadProxyAddressResolver readProxy,
- bytes32 takerTokenSymbol,
- bytes32 makerTokenSymbol,
- uint256[] memory makerTokenAmounts
- ) public view returns (address synthetix, uint256[] memory takerTokenAmounts) {
- synthetix = getSynthetixAddress(readProxy);
- // Since Synthetix atomic have a fixed rate, we can pick any reasonablely size takerTokenAmount (fixed to 1 ether here) and calculate the rest.
- uint256 amountReceivedForEther = exchange(
- readProxy,
- 1 ether,
- takerTokenSymbol,
- makerTokenSymbol
- );
-
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
-
- for (uint256 i = 0; i < numSamples; i++) {
- takerTokenAmounts[i] =
- (1 ether * makerTokenAmounts[i]) /
- amountReceivedForEther;
- }
- }
-
- function exchange(
- IReadProxyAddressResolver readProxy,
- uint256 sourceAmount,
- bytes32 sourceCurrencyKey,
- bytes32 destinationCurrencyKey
- ) private view returns (uint256 amountReceived) {
- IExchanger exchanger = getExchanger(readProxy);
- uint256 chainId;
- assembly {
- chainId := chainid()
- }
-
- if (chainId == 1) {
- (amountReceived, , ) = exchanger.getAmountsForAtomicExchange(
- sourceAmount,
- sourceCurrencyKey,
- destinationCurrencyKey
- );
- } else {
- (amountReceived, , ) = exchanger.getAmountsForExchange(
- sourceAmount,
- sourceCurrencyKey,
- destinationCurrencyKey
- );
- }
- }
-
- function getSynthetixAddress(IReadProxyAddressResolver readProxy)
- private
- view
- returns (address)
- {
- return IAddressResolver(readProxy.target()).getAddress("Synthetix");
- }
-
- function getExchanger(IReadProxyAddressResolver readProxy)
- private
- view
- returns (IExchanger)
- {
- return
- IExchanger(
- IAddressResolver(readProxy.target()).getAddress("Exchanger")
- );
- }
-}
diff --git a/packages/asset-swapper/contracts/src/TwoHopSampler.sol b/packages/asset-swapper/contracts/src/TwoHopSampler.sol
deleted file mode 100644
index a98fbc352c..0000000000
--- a/packages/asset-swapper/contracts/src/TwoHopSampler.sol
+++ /dev/null
@@ -1,124 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
-
-
-contract TwoHopSampler {
- using LibBytesV06 for bytes;
-
- struct HopInfo {
- uint256 sourceIndex;
- bytes returnData;
- }
-
- function sampleTwoHopSell(
- bytes[] memory firstHopCalls,
- bytes[] memory secondHopCalls,
- uint256 sellAmount
- )
- public
- returns (
- HopInfo memory firstHop,
- HopInfo memory secondHop,
- uint256 buyAmount
- )
- {
- uint256 intermediateAssetAmount = 0;
- for (uint256 i = 0; i != firstHopCalls.length; ++i) {
- firstHopCalls[i].writeUint256(firstHopCalls[i].length - 32, sellAmount);
- (bool didSucceed, bytes memory returnData) = address(this).call(firstHopCalls[i]);
- if (didSucceed) {
- uint256 amount = returnData.readUint256(returnData.length - 32);
- if (amount > intermediateAssetAmount) {
- intermediateAssetAmount = amount;
- firstHop.sourceIndex = i;
- firstHop.returnData = returnData;
- }
- }
- }
- if (intermediateAssetAmount == 0) {
- return (firstHop, secondHop, buyAmount);
- }
- for (uint256 j = 0; j != secondHopCalls.length; ++j) {
- secondHopCalls[j].writeUint256(secondHopCalls[j].length - 32, intermediateAssetAmount);
- (bool didSucceed, bytes memory returnData) = address(this).call(secondHopCalls[j]);
- if (didSucceed) {
- uint256 amount = returnData.readUint256(returnData.length - 32);
- if (amount > buyAmount) {
- buyAmount = amount;
- secondHop.sourceIndex = j;
- secondHop.returnData = returnData;
- }
- }
- }
- }
-
- function sampleTwoHopBuy(
- bytes[] memory firstHopCalls,
- bytes[] memory secondHopCalls,
- uint256 buyAmount
- )
- public
- returns (
- HopInfo memory firstHop,
- HopInfo memory secondHop,
- uint256 sellAmount
- )
- {
- sellAmount = uint256(-1);
- uint256 intermediateAssetAmount = uint256(-1);
- for (uint256 j = 0; j != secondHopCalls.length; ++j) {
- secondHopCalls[j].writeUint256(secondHopCalls[j].length - 32, buyAmount);
- (bool didSucceed, bytes memory returnData) = address(this).call(secondHopCalls[j]);
- if (didSucceed) {
- uint256 amount = returnData.readUint256(returnData.length - 32);
- if (
- amount > 0 &&
- amount < intermediateAssetAmount
- ) {
- intermediateAssetAmount = amount;
- secondHop.sourceIndex = j;
- secondHop.returnData = returnData;
- }
- }
- }
- if (intermediateAssetAmount == uint256(-1)) {
- return (firstHop, secondHop, sellAmount);
- }
- for (uint256 i = 0; i != firstHopCalls.length; ++i) {
- firstHopCalls[i].writeUint256(firstHopCalls[i].length - 32, intermediateAssetAmount);
- (bool didSucceed, bytes memory returnData) = address(this).call(firstHopCalls[i]);
- if (didSucceed) {
- uint256 amount = returnData.readUint256(returnData.length - 32);
- if (
- amount > 0 &&
- amount < sellAmount
- ) {
- sellAmount = amount;
- firstHop.sourceIndex = i;
- firstHop.returnData = returnData;
- }
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/UniswapSampler.sol b/packages/asset-swapper/contracts/src/UniswapSampler.sol
deleted file mode 100644
index 329461cef9..0000000000
--- a/packages/asset-swapper/contracts/src/UniswapSampler.sol
+++ /dev/null
@@ -1,214 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IUniswapExchangeQuotes.sol";
-import "./SamplerUtils.sol";
-
-
-interface IUniswapExchangeFactory {
-
- /// @dev Get the exchange for a token.
- /// @param tokenAddress The address of the token contract.
- function getExchange(address tokenAddress)
- external
- view
- returns (address);
-}
-
-
-contract UniswapSampler is
- SamplerUtils
-{
- /// @dev Gas limit for Uniswap calls.
- uint256 constant private UNISWAP_CALL_GAS = 150e3; // 150k
-
- /// @dev Sample sell quotes from Uniswap.
- /// @param router Address of the Uniswap Router
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromUniswap(
- address router,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- IUniswapExchangeQuotes takerTokenExchange = takerToken == address(0) ?
- IUniswapExchangeQuotes(0) : _getUniswapExchange(router, takerToken);
- IUniswapExchangeQuotes makerTokenExchange = makerToken == address(0) ?
- IUniswapExchangeQuotes(0) : _getUniswapExchange(router, makerToken);
- for (uint256 i = 0; i < numSamples; i++) {
- bool didSucceed = true;
- if (makerToken == address(0)) {
- (makerTokenAmounts[i], didSucceed) = _callUniswapExchangePriceFunction(
- address(takerTokenExchange),
- takerTokenExchange.getTokenToEthInputPrice.selector,
- takerTokenAmounts[i]
- );
- } else if (takerToken == address(0)) {
- (makerTokenAmounts[i], didSucceed) = _callUniswapExchangePriceFunction(
- address(makerTokenExchange),
- makerTokenExchange.getEthToTokenInputPrice.selector,
- takerTokenAmounts[i]
- );
- } else {
- uint256 ethBought;
- (ethBought, didSucceed) = _callUniswapExchangePriceFunction(
- address(takerTokenExchange),
- takerTokenExchange.getTokenToEthInputPrice.selector,
- takerTokenAmounts[i]
- );
- if (ethBought != 0) {
- (makerTokenAmounts[i], didSucceed) = _callUniswapExchangePriceFunction(
- address(makerTokenExchange),
- makerTokenExchange.getEthToTokenInputPrice.selector,
- ethBought
- );
- } else {
- makerTokenAmounts[i] = 0;
- }
- }
- // Break early if amounts are 0
- if (!didSucceed || makerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from Uniswap.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token sell amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromUniswap(
- address router,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- _assertValidPair(makerToken, takerToken);
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
-
- IUniswapExchangeQuotes takerTokenExchange = takerToken == address(0) ?
- IUniswapExchangeQuotes(0) : _getUniswapExchange(router, takerToken);
- IUniswapExchangeQuotes makerTokenExchange = makerToken == address(0) ?
- IUniswapExchangeQuotes(0) : _getUniswapExchange(router, makerToken);
- for (uint256 i = 0; i < numSamples; i++) {
- bool didSucceed = true;
- if (makerToken == address(0)) {
- (takerTokenAmounts[i], didSucceed) = _callUniswapExchangePriceFunction(
- address(takerTokenExchange),
- takerTokenExchange.getTokenToEthOutputPrice.selector,
- makerTokenAmounts[i]
- );
- } else if (takerToken == address(0)) {
- (takerTokenAmounts[i], didSucceed) = _callUniswapExchangePriceFunction(
- address(makerTokenExchange),
- makerTokenExchange.getEthToTokenOutputPrice.selector,
- makerTokenAmounts[i]
- );
- } else {
- uint256 ethSold;
- (ethSold, didSucceed) = _callUniswapExchangePriceFunction(
- address(makerTokenExchange),
- makerTokenExchange.getEthToTokenOutputPrice.selector,
- makerTokenAmounts[i]
- );
- if (ethSold != 0) {
- (takerTokenAmounts[i], didSucceed) = _callUniswapExchangePriceFunction(
- address(takerTokenExchange),
- takerTokenExchange.getTokenToEthOutputPrice.selector,
- ethSold
- );
- } else {
- takerTokenAmounts[i] = 0;
- }
- }
- // Break early if amounts are 0
- if (!didSucceed || takerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- /// @dev Gracefully calls a Uniswap pricing function.
- /// @param uniswapExchangeAddress Address of an `IUniswapExchangeQuotes` exchange.
- /// @param functionSelector Selector of the target function.
- /// @param inputAmount Quantity parameter particular to the pricing function.
- /// @return outputAmount The returned amount from the function call. Will be
- /// zero if the call fails or if `uniswapExchangeAddress` is zero.
- function _callUniswapExchangePriceFunction(
- address uniswapExchangeAddress,
- bytes4 functionSelector,
- uint256 inputAmount
- )
- private
- view
- returns (uint256 outputAmount, bool didSucceed)
- {
- if (uniswapExchangeAddress == address(0)) {
- return (outputAmount, didSucceed);
- }
- bytes memory resultData;
- (didSucceed, resultData) =
- uniswapExchangeAddress.staticcall.gas(UNISWAP_CALL_GAS)(
- abi.encodeWithSelector(
- functionSelector,
- inputAmount
- ));
- if (didSucceed) {
- outputAmount = abi.decode(resultData, (uint256));
- }
- }
-
- /// @dev Retrive an existing Uniswap exchange contract.
- /// Throws if the exchange does not exist.
- /// @param router Address of the Uniswap router.
- /// @param tokenAddress Address of the token contract.
- /// @return exchange `IUniswapExchangeQuotes` for the token.
- function _getUniswapExchange(address router, address tokenAddress)
- private
- view
- returns (IUniswapExchangeQuotes exchange)
- {
- exchange = IUniswapExchangeQuotes(
- address(IUniswapExchangeFactory(router)
- .getExchange(tokenAddress))
- );
- }
-}
diff --git a/packages/asset-swapper/contracts/src/UniswapV2Sampler.sol b/packages/asset-swapper/contracts/src/UniswapV2Sampler.sol
deleted file mode 100644
index de2f2ee29b..0000000000
--- a/packages/asset-swapper/contracts/src/UniswapV2Sampler.sol
+++ /dev/null
@@ -1,102 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "./interfaces/IUniswapV2Router01.sol";
-
-
-contract UniswapV2Sampler
-{
- /// @dev Gas limit for UniswapV2 calls.
- uint256 constant private UNISWAPV2_CALL_GAS = 150e3; // 150k
-
- /// @dev Sample sell quotes from UniswapV2.
- /// @param router Router to look up tokens and amounts
- /// @param path Token route. Should be takerToken -> makerToken
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromUniswapV2(
- address router,
- address[] memory path,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IUniswapV2Router01(router).getAmountsOut
- {gas: UNISWAPV2_CALL_GAS}
- (takerTokenAmounts[i], path)
- returns (uint256[] memory amounts)
- {
- makerTokenAmounts[i] = amounts[path.length - 1];
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from UniswapV2.
- /// @param router Router to look up tokens and amounts
- /// @param path Token route. Should be takerToken -> makerToken.
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromUniswapV2(
- address router,
- address[] memory path,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = new uint256[](numSamples);
- for (uint256 i = 0; i < numSamples; i++) {
- try
- IUniswapV2Router01(router).getAmountsIn
- {gas: UNISWAPV2_CALL_GAS}
- (makerTokenAmounts[i], path)
- returns (uint256[] memory amounts)
- {
- takerTokenAmounts[i] = amounts[0];
- // Break early if there are 0 amounts
- if (takerTokenAmounts[i] == 0) {
- break;
- }
- } catch (bytes memory) {
- // Swallow failures, leaving all results as zero.
- break;
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/UniswapV3Sampler.sol b/packages/asset-swapper/contracts/src/UniswapV3Sampler.sol
deleted file mode 100644
index 7eee3cedf6..0000000000
--- a/packages/asset-swapper/contracts/src/UniswapV3Sampler.sol
+++ /dev/null
@@ -1,363 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
-
-interface IUniswapV3QuoterV2 {
- function factory()
- external
- view
- returns (IUniswapV3Factory factory);
-
- // @notice Returns the amount out received for a given exact input swap without executing the swap
- // @param path The path of the swap, i.e. each token pair and the pool fee
- // @param amountIn The amount of the first token to swap
- // @return amountOut The amount of the last token that would be received
- // @return sqrtPriceX96AfterList List of the sqrt price after the swap for each pool in the path
- // @return initializedTicksCrossedList List of the initialized ticks that the swap crossed for each pool in the path
- // @return gasEstimate The estimate of the gas that the swap consumes
- function quoteExactInput(bytes memory path, uint256 amountIn)
- external
- returns (
- uint256 amountOut,
- uint160[] memory sqrtPriceX96AfterList,
- uint32[] memory initializedTicksCrossedList,
- uint256 gasEstimate
- );
-
- // @notice Returns the amount in required for a given exact output swap without executing the swap
- // @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order
- // @param amountOut The amount of the last token to receive
- // @return amountIn The amount of first token required to be paid
- // @return sqrtPriceX96AfterList List of the sqrt price after the swap for each pool in the path
- // @return initializedTicksCrossedList List of the initialized ticks that the swap crossed for each pool in the path
- // @return gasEstimate The estimate of the gas that the swap consumes
- function quoteExactOutput(bytes memory path, uint256 amountOut)
- external
- returns (
- uint256 amountIn,
- uint160[] memory sqrtPriceX96AfterList,
- uint32[] memory initializedTicksCrossedList,
- uint256 gasEstimate
- );
-}
-
-interface IUniswapV3Factory {
- function getPool(IERC20TokenV06 a, IERC20TokenV06 b, uint24 fee)
- external
- view
- returns (IUniswapV3Pool pool);
-}
-
-interface IUniswapV3Pool {
- function token0() external view returns (IERC20TokenV06);
- function token1() external view returns (IERC20TokenV06);
- function fee() external view returns (uint24);
-}
-
-contract UniswapV3Sampler
-{
- /// @dev Gas limit for UniswapV3 calls. This is 100% a guess.
- uint256 constant private QUOTE_GAS = 700e3;
-
- /// @dev Sample sell quotes from UniswapV3.
- /// @param quoter UniswapV3 Quoter contract.
- /// @param path Token route. Should be takerToken -> makerToken
- /// @param takerTokenAmounts Taker token sell amount for each sample.
- /// @return uniswapPaths The encoded uniswap path for each sample.
- /// @return uniswapGasUsed Estimated amount of gas used
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromUniswapV3(
- IUniswapV3QuoterV2 quoter,
- IERC20TokenV06[] memory path,
- uint256[] memory takerTokenAmounts
- )
- public
- returns (
- bytes[] memory uniswapPaths,
- uint256[] memory uniswapGasUsed,
- uint256[] memory makerTokenAmounts
- )
- {
- IUniswapV3Pool[][] memory poolPaths =
- _getValidPoolPaths(quoter.factory(), path, 0);
-
- makerTokenAmounts = new uint256[](takerTokenAmounts.length);
- uniswapPaths = new bytes[](takerTokenAmounts.length);
- uniswapGasUsed = new uint256[](takerTokenAmounts.length);
-
- for (uint256 i = 0; i < takerTokenAmounts.length; ++i) {
- // Pick the best result from all the paths.
- uint256 topBuyAmount = 0;
- for (uint256 j = 0; j < poolPaths.length; ++j) {
- bytes memory uniswapPath = _toUniswapPath(path, poolPaths[j]);
- try quoter.quoteExactInput
- { gas: QUOTE_GAS }
- (uniswapPath, takerTokenAmounts[i])
- returns (
- uint256 buyAmount,
- uint160[] memory, /* sqrtPriceX96AfterList */
- uint32[] memory, /* initializedTicksCrossedList */
- uint256 gasUsed
- )
- {
- if (topBuyAmount <= buyAmount) {
- topBuyAmount = buyAmount;
- uniswapPaths[i] = uniswapPath;
- uniswapGasUsed[i] = gasUsed;
- }
- } catch {}
- }
- // Break early if we can't complete the sells.
- if (topBuyAmount == 0) {
- // HACK(kimpers): To avoid too many local variables, paths and gas used is set directly in the loop
- // then reset if no valid valid quote was found
- uniswapPaths[i] = "";
- uniswapGasUsed[i] = 0;
- break;
- }
- makerTokenAmounts[i] = topBuyAmount;
- }
- }
-
- /// @dev Sample buy quotes from UniswapV3.
- /// @param quoter UniswapV3 Quoter contract.
- /// @param path Token route. Should be takerToken -> makerToken.
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return uniswapPaths The encoded uniswap path for each sample.
- /// @return uniswapGasUsed Estimated amount of gas used
- /// @return takerTokenAmounts Taker amounts sold at each maker token
- /// amount.
- function sampleBuysFromUniswapV3(
- IUniswapV3QuoterV2 quoter,
- IERC20TokenV06[] memory path,
- uint256[] memory makerTokenAmounts
- )
- public
- returns (
- bytes[] memory uniswapPaths,
- uint256[] memory uniswapGasUsed,
- uint256[] memory takerTokenAmounts
- )
- {
- IUniswapV3Pool[][] memory poolPaths =
- _getValidPoolPaths(quoter.factory(), path, 0);
- IERC20TokenV06[] memory reversedPath = _reverseTokenPath(path);
-
- takerTokenAmounts = new uint256[](makerTokenAmounts.length);
- uniswapPaths = new bytes[](makerTokenAmounts.length);
- uniswapGasUsed = new uint256[](makerTokenAmounts.length);
-
- for (uint256 i = 0; i < makerTokenAmounts.length; ++i) {
- // Pick the best result from all the paths.
- uint256 topSellAmount = 0;
- for (uint256 j = 0; j < poolPaths.length; ++j) {
- // quoter requires path to be reversed for buys.
- bytes memory uniswapPath = _toUniswapPath(
- reversedPath,
- _reversePoolPath(poolPaths[j])
- );
- try
- quoter.quoteExactOutput
- { gas: QUOTE_GAS }
- (uniswapPath, makerTokenAmounts[i])
- returns (
- uint256 sellAmount,
- uint160[] memory, /* sqrtPriceX96AfterList */
- uint32[] memory, /* initializedTicksCrossedList */
- uint256 gasUsed
- )
- {
- if (topSellAmount == 0 || topSellAmount >= sellAmount) {
- topSellAmount = sellAmount;
- // But the output path should still be encoded for sells.
- uniswapPaths[i] = _toUniswapPath(path, poolPaths[j]);
- uniswapGasUsed[i] = gasUsed;
- }
- } catch {}
- }
- // Break early if we can't complete the buys.
- if (topSellAmount == 0) {
- // HACK(kimpers): To avoid too many local variables, paths and gas used is set directly in the loop
- // then reset if no valid valid quote was found
- uniswapPaths[i] = "";
- uniswapGasUsed[i] = 0;
- break;
- }
- takerTokenAmounts[i] = topSellAmount;
- }
- }
-
- function _getValidPoolPaths(
- IUniswapV3Factory factory,
- IERC20TokenV06[] memory tokenPath,
- uint256 startIndex
- )
- private
- view
- returns (IUniswapV3Pool[][] memory poolPaths)
- {
- require(
- tokenPath.length - startIndex >= 2,
- "UniswapV3Sampler/tokenPath too short"
- );
- uint24[4] memory validPoolFees = [
- // The launch pool fees. Could get hairier if they add more.
- uint24(0.0001e6),
- uint24(0.0005e6),
- uint24(0.003e6),
- uint24(0.01e6)
- ];
- IUniswapV3Pool[] memory validPools =
- new IUniswapV3Pool[](validPoolFees.length);
- uint256 numValidPools = 0;
- {
- IERC20TokenV06 inputToken = tokenPath[startIndex];
- IERC20TokenV06 outputToken = tokenPath[startIndex + 1];
- for (uint256 i = 0; i < validPoolFees.length; ++i) {
- IUniswapV3Pool pool =
- factory.getPool(inputToken, outputToken, validPoolFees[i]);
- if (_isValidPool(pool)) {
- validPools[numValidPools++] = pool;
- }
- }
- }
- if (numValidPools == 0) {
- // No valid pools for this hop.
- return poolPaths;
- }
- if (startIndex + 2 == tokenPath.length) {
- // End of path.
- poolPaths = new IUniswapV3Pool[][](numValidPools);
- for (uint256 i = 0; i < numValidPools; ++i) {
- poolPaths[i] = new IUniswapV3Pool[](1);
- poolPaths[i][0] = validPools[i];
- }
- return poolPaths;
- }
- // Get paths for subsequent hops.
- IUniswapV3Pool[][] memory subsequentPoolPaths =
- _getValidPoolPaths(factory, tokenPath, startIndex + 1);
- if (subsequentPoolPaths.length == 0) {
- // Could not complete the path.
- return poolPaths;
- }
- // Combine our pools with the next hop paths.
- poolPaths = new IUniswapV3Pool[][](
- numValidPools * subsequentPoolPaths.length
- );
- for (uint256 i = 0; i < numValidPools; ++i) {
- for (uint256 j = 0; j < subsequentPoolPaths.length; ++j) {
- uint256 o = i * subsequentPoolPaths.length + j;
- // Prepend pool to the subsequent path.
- poolPaths[o] =
- new IUniswapV3Pool[](1 + subsequentPoolPaths[j].length);
- poolPaths[o][0] = validPools[i];
- for (uint256 k = 0; k < subsequentPoolPaths[j].length; ++k) {
- poolPaths[o][1 + k] = subsequentPoolPaths[j][k];
- }
- }
- }
- return poolPaths;
- }
-
- function _reverseTokenPath(IERC20TokenV06[] memory tokenPath)
- private
- pure
- returns (IERC20TokenV06[] memory reversed)
- {
- reversed = new IERC20TokenV06[](tokenPath.length);
- for (uint256 i = 0; i < tokenPath.length; ++i) {
- reversed[i] = tokenPath[tokenPath.length - i - 1];
- }
- }
-
- function _reversePoolPath(IUniswapV3Pool[] memory poolPath)
- private
- pure
- returns (IUniswapV3Pool[] memory reversed)
- {
- reversed = new IUniswapV3Pool[](poolPath.length);
- for (uint256 i = 0; i < poolPath.length; ++i) {
- reversed[i] = poolPath[poolPath.length - i - 1];
- }
- }
-
- function _isValidPool(IUniswapV3Pool pool)
- private
- view
- returns (bool isValid)
- {
- // Check if it has been deployed.
- {
- uint256 codeSize;
- assembly {
- codeSize := extcodesize(pool)
- }
- if (codeSize == 0) {
- return false;
- }
- }
- // Must have a balance of both tokens.
- if (pool.token0().balanceOf(address(pool)) == 0) {
- return false;
- }
- if (pool.token1().balanceOf(address(pool)) == 0) {
- return false;
- }
- return true;
- }
-
- function _toUniswapPath(
- IERC20TokenV06[] memory tokenPath,
- IUniswapV3Pool[] memory poolPath
- )
- private
- view
- returns (bytes memory uniswapPath)
- {
- require(
- tokenPath.length >= 2 && tokenPath.length == poolPath.length + 1,
- "UniswapV3Sampler/invalid path lengths"
- );
- // Uniswap paths are tightly packed as:
- // [token0, token0token1PairFee, token1, token1Token2PairFee, token2, ...]
- uniswapPath = new bytes(tokenPath.length * 20 + poolPath.length * 3);
- uint256 o;
- assembly { o := add(uniswapPath, 32) }
- for (uint256 i = 0; i < tokenPath.length; ++i) {
- if (i > 0) {
- uint24 poolFee = poolPath[i - 1].fee();
- assembly {
- mstore(o, shl(232, poolFee))
- o := add(o, 3)
- }
- }
- IERC20TokenV06 token = tokenPath[i];
- assembly {
- mstore(o, shl(96, token))
- o := add(o, 20)
- }
- }
- }
-}
diff --git a/packages/asset-swapper/contracts/src/UtilitySampler.sol b/packages/asset-swapper/contracts/src/UtilitySampler.sol
deleted file mode 100644
index bbc3c5a1ad..0000000000
--- a/packages/asset-swapper/contracts/src/UtilitySampler.sol
+++ /dev/null
@@ -1,95 +0,0 @@
-
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2021 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
-
-contract UtilitySampler {
-
- using LibERC20TokenV06 for IERC20TokenV06;
-
- IERC20TokenV06 private immutable UTILITY_ETH_ADDRESS = IERC20TokenV06(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
-
- function getTokenDecimals(IERC20TokenV06[] memory tokens)
- public
- view
- returns (uint256[] memory decimals)
- {
- decimals = new uint256[](tokens.length);
- for (uint256 i = 0; i != tokens.length; i++) {
- decimals[i] = tokens[i] == UTILITY_ETH_ADDRESS
- ? 18
- : tokens[i].compatDecimals();
- }
- }
-
- function getBalanceOf(IERC20TokenV06[] memory tokens, address account)
- public
- view
- returns (uint256[] memory balances)
- {
- balances = new uint256[](tokens.length);
- for (uint256 i = 0; i != tokens.length; i++) {
- balances[i] = tokens[i] == UTILITY_ETH_ADDRESS
- ? account.balance
- : tokens[i].compatBalanceOf(account);
- }
- }
-
- function getAllowanceOf(IERC20TokenV06[] memory tokens, address account, address spender)
- public
- view
- returns (uint256[] memory allowances)
- {
- allowances = new uint256[](tokens.length);
- for (uint256 i = 0; i != tokens.length; i++) {
- allowances[i] = tokens[i] == UTILITY_ETH_ADDRESS
- ? 0
- : tokens[i].compatAllowance(account, spender);
- }
- }
-
- function isContract(address account)
- public
- view
- returns (bool)
- {
- uint256 size;
- assembly { size := extcodesize(account) }
- return size > 0;
- }
-
- function getGasLeft()
- public
- returns (uint256)
- {
- return gasleft();
- }
-
- function getBlockNumber()
- public
- view
- returns (uint256)
- {
- return block.number;
- }
-}
\ No newline at end of file
diff --git a/packages/asset-swapper/contracts/src/VelodromeSampler.sol b/packages/asset-swapper/contracts/src/VelodromeSampler.sol
deleted file mode 100644
index 8640f9e1c7..0000000000
--- a/packages/asset-swapper/contracts/src/VelodromeSampler.sol
+++ /dev/null
@@ -1,134 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2022 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import './ApproximateBuys.sol';
-import './SamplerUtils.sol';
-
-struct VeloRoute {
- address from;
- address to;
- bool stable;
-}
-
-interface IVelodromeRouter {
- function getAmountOut(
- uint256 amountIn,
- address tokenIn,
- address tokenOut
- ) external view returns (uint256 amount, bool stable);
-
- function getAmountsOut(uint256 amountIn, VeloRoute[] calldata routes)
- external
- view
- returns (uint256[] memory amounts);
-}
-
-contract VelodromeSampler is SamplerUtils, ApproximateBuys {
- /// @dev Sample sell quotes from Velodrome
- /// @param router Address of Velodrome router.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample (sorted in ascending order).
- /// @return stable Whether the pool is a stable pool (vs volatile).
- /// @return makerTokenAmounts Maker amounts bought at each taker token amount.
- function sampleSellsFromVelodrome(
- IVelodromeRouter router,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- ) public view returns (bool stable, uint256[] memory makerTokenAmounts) {
- _assertValidPair(makerToken, takerToken);
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
-
- // Sampling should not mix stable and volatile pools.
- // Find the most liquid pool based on max(takerTokenAmounts) and stick with it.
- stable = _isMostLiquidPoolStablePool(router, takerToken, makerToken, takerTokenAmounts);
- VeloRoute[] memory routes = new VeloRoute[](1);
- routes[0] = VeloRoute({ from: takerToken, to: makerToken, stable: stable });
-
- for (uint256 i = 0; i < numSamples; i++) {
- makerTokenAmounts[i] = router.getAmountsOut(takerTokenAmounts[i], routes)[1];
- // Break early if there are 0 amounts
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from Velodrome.
- /// @param router Address of Velodrome router.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token buy amount for each sample.
- /// @return stable Whether the pool is a stable pool (vs volatile).
- /// @return takerTokenAmounts Taker amounts sold at each maker token amount.
- function sampleBuysFromVelodrome(
- IVelodromeRouter router,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- ) public view returns (bool stable, uint256[] memory takerTokenAmounts) {
- _assertValidPair(makerToken, takerToken);
-
- // Sampling should not mix stable and volatile pools.
- // Find the most liquid pool based on the reverse swap (maker -> taker) and stick with it.
- stable = _isMostLiquidPoolStablePool(router, makerToken, takerToken, makerTokenAmounts);
-
- takerTokenAmounts = _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- takerTokenData: abi.encode(router, VeloRoute({ from: takerToken, to: makerToken, stable: stable })),
- makerTokenData: abi.encode(router, VeloRoute({ from: makerToken, to: takerToken, stable: stable })),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromVelodrome
- }),
- makerTokenAmounts
- );
- }
-
- function _sampleSellForApproximateBuyFromVelodrome(
- bytes memory takerTokenData,
- bytes memory, /* makerTokenData */
- uint256 sellAmount
- ) internal view returns (uint256) {
- (IVelodromeRouter router, VeloRoute memory route) = abi.decode(takerTokenData, (IVelodromeRouter, VeloRoute));
-
- VeloRoute[] memory routes = new VeloRoute[](1);
- routes[0] = route;
- return router.getAmountsOut(sellAmount, routes)[1];
- }
-
- /// @dev Returns whether the most liquid pool is a stable pool.
- /// @param router Address of Velodrome router.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token buy amount for each sample (sorted in ascending order)
- /// @return stable Whether the pool is a stable pool (vs volatile).
- function _isMostLiquidPoolStablePool(
- IVelodromeRouter router,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- ) internal view returns (bool stable) {
- uint256 numSamples = takerTokenAmounts.length;
- (, stable) = router.getAmountOut(takerTokenAmounts[numSamples - 1], takerToken, makerToken);
- }
-}
diff --git a/packages/asset-swapper/contracts/src/WooPPSampler.sol b/packages/asset-swapper/contracts/src/WooPPSampler.sol
deleted file mode 100644
index 4d40c6dde7..0000000000
--- a/packages/asset-swapper/contracts/src/WooPPSampler.sol
+++ /dev/null
@@ -1,121 +0,0 @@
-// SPDX-License-Identifier: UNLICENSED
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-import "./SamplerUtils.sol";
-import "./ApproximateBuys.sol";
-
-interface IWooPP {
- /// @dev get the quote token address (immutable)
- /// @return address of quote token
- function quoteToken() external view returns (address);
-
- /// @dev Query the amount for selling the base token amount.
- /// @param baseToken the base token to sell
- /// @param baseAmount the amount to sell
- /// @return quoteAmount the swapped quote amount
- function querySellBase(address baseToken, uint256 baseAmount) external view returns (uint256 quoteAmount);
-
- /// @dev Query the amount for selling the quote token.
- /// @param baseToken the base token to receive (buy)
- /// @param quoteAmount the amount to sell
- /// @return baseAmount the swapped base token amount
- function querySellQuote(address baseToken, uint256 quoteAmount) external view returns (uint256 baseAmount);
-}
-
-contract WooPPSampler is SamplerUtils, ApproximateBuys{
-
- function query(
- uint amountIn,
- address tokenIn,
- address tokenOut,
- address pool
- ) internal view returns (uint256 amountOut) {
- if (amountIn == 0) {
- return 0;
- }
- address quoteToken = IWooPP(pool).quoteToken();
- if (tokenIn == quoteToken) {
- amountOut = IWooPP(pool).querySellQuote(tokenOut, amountIn);
- } else if (tokenOut == quoteToken) {
- amountOut = IWooPP(pool).querySellBase(tokenIn, amountIn);
- } else {
- uint quoteAmount = IWooPP(pool).querySellBase(tokenIn, amountIn);
- amountOut = IWooPP(pool).querySellQuote(tokenOut, quoteAmount);
- }
- }
-
- /// @dev Sample sell quotes from WooFI.
- /// @param pool Address of the pool we are sampling from
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param takerTokenAmounts Taker token sell amount for each sample (sorted in ascending order).
- /// @return makerTokenAmounts Maker amounts bought at each taker token
- /// amount.
- function sampleSellsFromWooPP(
- address pool,
- address takerToken,
- address makerToken,
- uint256[] memory takerTokenAmounts
- )
- public
- view
- returns (uint256[] memory makerTokenAmounts)
- {
- uint256 numSamples = takerTokenAmounts.length;
- makerTokenAmounts = new uint256[](numSamples);
- for (uint256 i = 0; i < numSamples; i++) {
- makerTokenAmounts[i] = query(takerTokenAmounts[i], takerToken, makerToken, pool);
-
- if (makerTokenAmounts[i] == 0) {
- break;
- }
- }
- }
-
- /// @dev Sample buy quotes from WooFI.
- /// @param pool Address of the pool we are sampling from
- /// @param takerToken Address of the taker token (what to sell).
- /// @param makerToken Address of the maker token (what to buy).
- /// @param makerTokenAmounts Maker token sell amount for each sample (sorted in ascending order).
- /// @return takerTokenAmounts Taker amounts bought at each taker token
- /// amount.
- function sampleBuysFromWooPP(
- address pool,
- address takerToken,
- address makerToken,
- uint256[] memory makerTokenAmounts
- )
- public
- view
- returns (uint256[] memory takerTokenAmounts)
- {
- uint256 numSamples = makerTokenAmounts.length;
- takerTokenAmounts = _sampleApproximateBuys(
- ApproximateBuyQuoteOpts({
- takerTokenData: abi.encode(pool,takerToken, makerToken),
- makerTokenData: abi.encode(pool, makerToken, takerToken),
- getSellQuoteCallback: _sampleSellForApproximateBuyFromWoofi
- }),
- makerTokenAmounts
- );
- }
-
- function _sampleSellForApproximateBuyFromWoofi(
- bytes memory takerTokenData,
- bytes memory makerTokenData,
- uint256 sellAmount
- ) internal view returns (uint256) {
- (address _pool, address _takerToken, address _makerToken) = abi.decode(takerTokenData, (address, address, address));
- (bool success, bytes memory resultData) = address(this).staticcall(abi.encodeWithSelector(
- this.sampleSellsFromWooPP.selector,
- _pool,
- _takerToken,
- _makerToken,
- _toSingleValueArray(sellAmount)
- ));
- if(!success) {
- return 0;
- }
- return abi.decode(resultData, (uint256[]))[0];
- }
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IBalancer.sol b/packages/asset-swapper/contracts/src/interfaces/IBalancer.sol
deleted file mode 100644
index 31a90776c5..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IBalancer.sol
+++ /dev/null
@@ -1,44 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IBalancer {
- function isBound(address t) external view returns (bool);
- function getDenormalizedWeight(address token) external view returns (uint256);
- function getBalance(address token) external view returns (uint256);
- function getSwapFee() external view returns (uint256);
- function calcOutGivenIn(
- uint256 tokenBalanceIn,
- uint256 tokenWeightIn,
- uint256 tokenBalanceOut,
- uint256 tokenWeightOut,
- uint256 tokenAmountIn,
- uint256 swapFee
- ) external pure returns (uint256 tokenAmountOut);
- function calcInGivenOut(
- uint256 tokenBalanceIn,
- uint256 tokenWeightIn,
- uint256 tokenBalanceOut,
- uint256 tokenWeightOut,
- uint256 tokenAmountOut,
- uint256 swapFee
- ) external pure returns (uint256 tokenAmountIn);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IBalancerV2Vault.sol b/packages/asset-swapper/contracts/src/interfaces/IBalancerV2Vault.sol
deleted file mode 100644
index 14f45f19b8..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IBalancerV2Vault.sol
+++ /dev/null
@@ -1,54 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-/// @dev Minimal Balancer V2 Vault interface
-/// for documentation refer to https://github.com/balancer-labs/balancer-core-v2/blob/master/contracts/vault/interfaces/IVault.sol
-interface IBalancerV2Vault {
- enum SwapKind { GIVEN_IN, GIVEN_OUT }
-
- struct BatchSwapStep {
- bytes32 poolId;
- uint256 assetInIndex;
- uint256 assetOutIndex;
- uint256 amount;
- bytes userData;
- }
-
- struct FundManagement {
- address sender;
- bool fromInternalBalance;
- address payable recipient;
- bool toInternalBalance;
- }
-
- struct BalancerV2PoolInfo {
- bytes32 poolId;
- address vault;
- }
-
- function queryBatchSwap(
- SwapKind kind,
- BatchSwapStep[] calldata swaps,
- address[] calldata assets,
- FundManagement calldata funds
- ) external returns (int256[] memory assetDeltas);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IBancor.sol b/packages/asset-swapper/contracts/src/interfaces/IBancor.sol
deleted file mode 100644
index df64503d80..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IBancor.sol
+++ /dev/null
@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IBancor {}
-
-interface IBancorNetwork {
- function conversionPath(address _sourceToken, address _targetToken) external view returns (address[] memory);
- function rateByPath(address[] memory _path, uint256 _amount) external view returns (uint256);
-}
-
-interface IBancorRegistry {
- function getAddress(bytes32 _contractName) external view returns (address);
- function BANCOR_NETWORK() external view returns (bytes32);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IBancorV3.sol b/packages/asset-swapper/contracts/src/interfaces/IBancorV3.sol
deleted file mode 100644
index 0b5bed9f8f..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IBancorV3.sol
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2022 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-interface IBancorV3 {
-
- /**
- * @dev returns the output amount when trading by providing the source amount
- */
- function tradeOutputBySourceAmount(
- address sourceToken,
- address targetToken,
- uint256 sourceAmount
- ) external view returns (uint256);
-
- /**
- * @dev returns the input amount when trading by providing the target amount
- */
- function tradeInputByTargetAmount(
- address sourceToken,
- address targetToken,
- uint256 targetAmount
- ) external view returns (uint256);
-
-}
\ No newline at end of file
diff --git a/packages/asset-swapper/contracts/src/interfaces/ICurve.sol b/packages/asset-swapper/contracts/src/interfaces/ICurve.sol
deleted file mode 100644
index 3720ddcfdc..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/ICurve.sol
+++ /dev/null
@@ -1,70 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-interface ICurve {
-
- /// @dev Sell `sellAmount` of `fromToken` token and receive `toToken` token.
- /// This function exists on later versions of Curve (USDC/DAI/USDT)
- /// @param i The token index being sold.
- /// @param j The token index being bought.
- /// @param sellAmount The amount of token being bought.
- /// @param minBuyAmount The minimum buy amount of the token being bought.
- function exchange_underlying(
- int128 i,
- int128 j,
- uint256 sellAmount,
- uint256 minBuyAmount
- )
- external;
-
- /// @dev Get the amount of `toToken` by selling `sellAmount` of `fromToken`
- /// @param i The token index being sold.
- /// @param j The token index being bought.
- /// @param sellAmount The amount of token being bought.
- function get_dy_underlying(
- int128 i,
- int128 j,
- uint256 sellAmount
- )
- external
- returns (uint256 dy);
-
- /// @dev Get the amount of `fromToken` by buying `buyAmount` of `toToken`
- /// This function exists on later versions of Curve (USDC/DAI/USDT)
- /// @param i The token index being sold.
- /// @param j The token index being bought.
- /// @param buyAmount The amount of token being bought.
- function get_dx_underlying(
- int128 i,
- int128 j,
- uint256 buyAmount
- )
- external
- returns (uint256 dx);
-
- /// @dev Get the underlying token address from the token index
- /// @param i The token index.
- function underlying_coins(
- int128 i
- )
- external
- returns (address tokenAddress);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IGMX.sol b/packages/asset-swapper/contracts/src/interfaces/IGMX.sol
deleted file mode 100644
index 12b1c3d87c..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IGMX.sol
+++ /dev/null
@@ -1,23 +0,0 @@
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-interface IGMX {
- function getMaxAmountIn(IVault _vault, address _tokenIn, address _tokenOut)
- external
- view
- returns (uint256);
-
- function getAmountOut(IVault _vault, address _tokenIn, address _tokenOut, uint256 _amountIn)
- external
- view
- returns (uint256, uint256);
-}
-
-interface IVault {
- function getFeeBasisPoints(address _token, uint256 _usdgDelta, uint256 _feeBasisPoints, uint256 _taxBasisPoints, bool _increment) external view returns (uint256);
- function stableSwapFeeBasisPoints() external view returns (uint256);
- function stableTokens(address _token) external view returns (bool);
- function tokenDecimals(address _token) external view returns (uint256);
- function getMaxPrice(address _token) external view returns (uint256);
- function getMinPrice(address _token) external view returns (uint256);
-}
\ No newline at end of file
diff --git a/packages/asset-swapper/contracts/src/interfaces/IMStable.sol b/packages/asset-swapper/contracts/src/interfaces/IMStable.sol
deleted file mode 100644
index cae1bbb99b..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IMStable.sol
+++ /dev/null
@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IMStable {
-
- function getSwapOutput(
- address _input,
- address _output,
- uint256 _quantity
- )
- external
- view
- returns (uint256 swapOutput);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IMooniswap.sol b/packages/asset-swapper/contracts/src/interfaces/IMooniswap.sol
deleted file mode 100644
index 93a8fff596..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IMooniswap.sol
+++ /dev/null
@@ -1,38 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IMooniswapRegistry {
-
- function pools(address token1, address token2) external view returns(address);
-}
-
-interface IMooniswap {
-
- function getReturn(
- address fromToken,
- address destToken,
- uint256 amount
- )
- external
- view
- returns(uint256 returnAmount);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IMultiBridge.sol b/packages/asset-swapper/contracts/src/interfaces/IMultiBridge.sol
deleted file mode 100644
index 1bad277f59..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IMultiBridge.sol
+++ /dev/null
@@ -1,59 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IMultiBridge {
-
- /// @dev Transfers `amount` of the ERC20 `tokenAddress` from `from` to `to`.
- /// @param tokenAddress The address of the ERC20 token to transfer.
- /// @param from Address to transfer asset from.
- /// @param to Address to transfer asset to.
- /// @param amount Amount of asset to transfer.
- /// @param bridgeData Arbitrary asset data needed by the bridge contract.
- /// @return success The magic bytes `0xdc1600f3` if successful.
- function bridgeTransferFrom(
- address tokenAddress,
- address from,
- address to,
- uint256 amount,
- bytes calldata bridgeData
- )
- external
- returns (bytes4 success);
-
- /// @dev Quotes the amount of `makerToken` that would be obtained by
- /// selling `sellAmount` of `takerToken`.
- /// @param takerToken Address of the taker token (what to sell).
- /// @param intermediateToken The address of the intermediate token to
- /// use in an indirect route.
- /// @param makerToken Address of the maker token (what to buy).
- /// @param sellAmount Amount of `takerToken` to sell.
- /// @return makerTokenAmount Amount of `makerToken` that would be obtained.
- function getSellQuote(
- address takerToken,
- address intermediateToken,
- address makerToken,
- uint256 sellAmount
- )
- external
- view
- returns (uint256 makerTokenAmount);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IPlatypus.sol b/packages/asset-swapper/contracts/src/interfaces/IPlatypus.sol
deleted file mode 100644
index d764de70f4..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IPlatypus.sol
+++ /dev/null
@@ -1,11 +0,0 @@
-pragma solidity ^0.6;
-
-interface IPlatypus {
- function quotePotentialSwap(
- address fromToken,
- address toToken,
- uint256 fromAmount
- ) external view returns (uint256 potentialOutcome, uint256 haircut);
-
- function assetOf(address token) external view returns (address);
-}
\ No newline at end of file
diff --git a/packages/asset-swapper/contracts/src/interfaces/IShell.sol b/packages/asset-swapper/contracts/src/interfaces/IShell.sol
deleted file mode 100644
index 103b2778af..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IShell.sol
+++ /dev/null
@@ -1,43 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IShell {
-
- function viewOriginSwap (
- address from,
- address to,
- uint256 fromAmount
- )
- external
- view
- returns (uint256 toAmount);
-
- function viewTargetSwap (
- address from,
- address to,
- uint256 toAmount
- )
- external
- view
- returns (uint256 fromAmount);
-}
-
diff --git a/packages/asset-swapper/contracts/src/interfaces/IUniswapExchangeQuotes.sol b/packages/asset-swapper/contracts/src/interfaces/IUniswapExchangeQuotes.sol
deleted file mode 100644
index 5143824643..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IUniswapExchangeQuotes.sol
+++ /dev/null
@@ -1,52 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IUniswapExchangeQuotes {
-
- function getEthToTokenInputPrice(
- uint256 ethSold
- )
- external
- view
- returns (uint256 tokensBought);
-
- function getEthToTokenOutputPrice(
- uint256 tokensBought
- )
- external
- view
- returns (uint256 ethSold);
-
- function getTokenToEthInputPrice(
- uint256 tokensSold
- )
- external
- view
- returns (uint256 ethBought);
-
- function getTokenToEthOutputPrice(
- uint256 ethBought
- )
- external
- view
- returns (uint256 tokensSold);
-}
diff --git a/packages/asset-swapper/contracts/src/interfaces/IUniswapV2Router01.sol b/packages/asset-swapper/contracts/src/interfaces/IUniswapV2Router01.sol
deleted file mode 100644
index ab63971992..0000000000
--- a/packages/asset-swapper/contracts/src/interfaces/IUniswapV2Router01.sol
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2020 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.6;
-
-
-interface IUniswapV2Router01 {
-
- function getAmountsOut(uint256 amountIn, address[] calldata path)
- external
- view
- returns (uint256[] memory amounts);
-
- function getAmountsIn(uint256 amountOut, address[] calldata path)
- external
- view
- returns (uint256[] memory amounts);
-}
diff --git a/packages/asset-swapper/contracts/test/TestNativeOrderSampler.sol b/packages/asset-swapper/contracts/test/TestNativeOrderSampler.sol
deleted file mode 100644
index 39cb0b2af0..0000000000
--- a/packages/asset-swapper/contracts/test/TestNativeOrderSampler.sol
+++ /dev/null
@@ -1,135 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-/*
-
- Copyright 2019 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-pragma solidity ^0.6;
-pragma experimental ABIEncoderV2;
-
-import "../src/NativeOrderSampler.sol";
-import "../src/UtilitySampler.sol";
-
-
-contract TestNativeOrderSamplerToken {
- mapping (address => uint256) public balanceOf;
- mapping (address => mapping(address => uint256)) public allowance;
-
- function setBalanceAndAllowance(
- address owner,
- address spender,
- uint256 balance,
- uint256 allowance_
- )
- external
- {
- balanceOf[owner] = balance;
- allowance[owner][spender] = allowance_;
- }
-}
-
-contract TestNativeOrderSampler is
- NativeOrderSampler,
- UtilitySampler
-{
- uint8 private constant MAX_ORDER_STATUS = uint8(IExchange.OrderStatus.CANCELLED) + 1;
- bytes32 private constant VALID_SIGNATURE_HASH = bytes32(hex"01");
-
- function createTokens(uint256 count)
- external
- returns (TestNativeOrderSamplerToken[] memory tokens)
- {
- tokens = new TestNativeOrderSamplerToken[](count);
- for (uint256 i = 0; i < count; ++i) {
- tokens[i] = new TestNativeOrderSamplerToken();
- }
- }
-
- function setTokenBalanceAndAllowance(
- TestNativeOrderSamplerToken token,
- address owner,
- address spender,
- uint256 balance,
- uint256 allowance
- )
- external
- {
- token.setBalanceAndAllowance(owner, spender, balance, allowance);
- }
-
- // IExchange.getLimitOrderRelevantState()
- function getLimitOrderRelevantState(
- IExchange.LimitOrder memory order,
- IExchange.Signature calldata signature
- )
- external
- view
- returns (
- IExchange.OrderInfo memory orderInfo,
- uint128 actualFillableTakerTokenAmount,
- bool isSignatureValid
- )
- {
- // The order salt determines everything.
- orderInfo.orderHash = keccak256(abi.encode(order.salt));
- if (uint8(order.salt) == 0xFF) {
- orderInfo.status = IExchange.OrderStatus.FILLED;
- } else {
- orderInfo.status = IExchange.OrderStatus.FILLABLE;
- }
-
- isSignatureValid = signature.r == VALID_SIGNATURE_HASH;
-
- // The expiration time is the filled taker asset amount.
- orderInfo.takerTokenFilledAmount = uint128(order.expiry);
-
- // Calculate how much is fillable in maker terms given the filled taker amount
- uint256 fillableMakerTokenAmount = LibMathV06.getPartialAmountFloor(
- uint256(
- order.takerAmount
- - orderInfo.takerTokenFilledAmount
- ),
- uint256(order.takerAmount),
- uint256(order.makerAmount)
- );
-
- // Take the min of the balance/allowance and the fillable maker amount
- fillableMakerTokenAmount = LibSafeMathV06.min256(
- fillableMakerTokenAmount,
- _getSpendableERC20BalanceOf(order.makerToken, order.maker)
- );
-
- // Convert to taker terms
- actualFillableTakerTokenAmount = LibMathV06.getPartialAmountCeil(
- fillableMakerTokenAmount,
- uint256(order.makerAmount),
- uint256(order.takerAmount)
- ).safeDowncastToUint128();
- }
-
- function _getSpendableERC20BalanceOf(
- IERC20TokenV06 token,
- address owner
- )
- internal
- view
- returns (uint256)
- {
- return LibSafeMathV06.min256(
- token.allowance(owner, address(this)),
- token.balanceOf(owner)
- );
- }
-}
diff --git a/packages/asset-swapper/coverage/.gitkeep b/packages/asset-swapper/coverage/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/asset-swapper/docs/reference.mdx b/packages/asset-swapper/docs/reference.mdx
deleted file mode 100644
index 52b4cb9576..0000000000
--- a/packages/asset-swapper/docs/reference.mdx
+++ /dev/null
@@ -1,3368 +0,0 @@
-# Interface: Web3JsV1Provider
-
-Web3.js version 1 provider interface
-This provider interface was implemented in the pre-1.0Beta releases for Web3.js.
-This interface allowed sending synchonous requests, support for which was later dropped.
-
-
-## Methods
-
-### send
-
-▸ **send**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md)): *[JSONRPCResponsePayload](#class-jsonrpcresponsepayload)*
-
-*Defined in [ethereum-types/src/index.ts:45](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L45)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
-
-**Returns:** *[JSONRPCResponsePayload](#class-jsonrpcresponsepayload)*
-
-___
-
-### sendAsync
-
-▸ **sendAsync**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
-
-*Defined in [ethereum-types/src/index.ts:44](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L44)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
-`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
-
-**Returns:** *void*
-
-
-
-# Class: SwapQuoteConsumer
-
-
-## Implements
-
-* [SwapQuoteConsumerBase](#interface-swapquoteconsumerbase)‹*[SmartContractParams](#smartcontractparams)*›
-
-
-## Constructors
-
-
-
-\+ **new SwapQuoteConsumer**(`supportedProvider`: [SupportedProvider](#supportedprovider), `options`: `Partial`): *[SwapQuoteConsumer](#class-swapquoteconsumer)*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:39](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L39)*
-
-**Parameters:**
-
-Name | Type | Default |
------- | ------ | ------ |
-`supportedProvider` | [SupportedProvider](#supportedprovider) | - |
-`options` | `Partial` | {} |
-
-**Returns:** *[SwapQuoteConsumer](#class-swapquoteconsumer)*
-
-## Properties
-
-### chainId
-
-• **chainId**: *number*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:28](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L28)*
-
-___
-
-### provider
-
-• **provider**: *`ZeroExProvider`*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:27](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L27)*
-
-## Methods
-
-### executeSwapQuoteOrThrowAsync
-
-▸ **executeSwapQuoteOrThrowAsync**(`quote`: [SwapQuote](#swapquote), `opts`: `Partial`): *`Promise`*
-
-*Implementation of [SwapQuoteConsumerBase](#interface-swapquoteconsumerbase)*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:89](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L89)*
-
-Given a SwapQuote and desired rate (in takerAsset), attempt to execute the swap with 0x extension or exchange contract.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`quote` | [SwapQuote](#swapquote) | - | An object that conforms to SwapQuote. See type definition for more information. |
-`opts` | `Partial` | {} | Options for getting CalldataInfo. See type definition for more information. |
-
-**Returns:** *`Promise`*
-
-___
-
-### getCalldataOrThrowAsync
-
-▸ **getCalldataOrThrowAsync**(`quote`: [SwapQuote](#swapquote), `opts`: `Partial`): *`Promise`*
-
-*Implementation of [SwapQuoteConsumerBase](#interface-swapquoteconsumerbase)*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:61](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L61)*
-
-Given a SwapQuote, returns 'CalldataInfo' for a 0x extesion or exchange call. See type definition of CalldataInfo for more information.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`quote` | [SwapQuote](#swapquote) | - | An object that conforms to SwapQuote. See type definition for more information. |
-`opts` | `Partial` | {} | Options for getting SmartContractParams. See type definition for more information. |
-
-**Returns:** *`Promise`*
-
-___
-
-### getOptimalExtensionContractTypeAsync
-
-▸ **getOptimalExtensionContractTypeAsync**(`quote`: [SwapQuote](#swapquote), `opts`: `Partial`): *`Promise`*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:103](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L103)*
-
-Given a SwapQuote, returns optimal 0x protocol interface (extension or no extension) to perform the swap.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`quote` | [SwapQuote](#swapquote) | - | An object that conforms to SwapQuote. See type definition for more information. |
-`opts` | `Partial` | {} | Options for getting optimal exteion contract to fill quote. See type definition for more information. |
-
-**Returns:** *`Promise`*
-
-___
-
-### getSmartContractParamsOrThrowAsync
-
-▸ **getSmartContractParamsOrThrowAsync**(`quote`: [SwapQuote](#swapquote), `opts`: `Partial`): *`Promise>`*
-
-*Implementation of [SwapQuoteConsumerBase](#interface-swapquoteconsumerbase)*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:75](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L75)*
-
-Given a SwapQuote, returns 'SmartContractParamsInfo' for a 0x extension or exchange call. See type definition of SmartContractParamsInfo for more information.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`quote` | [SwapQuote](#swapquote) | - | An object that conforms to SwapQuote. See type definition for more information. |
-`opts` | `Partial` | {} | Options for getting SmartContractParams. See type definition for more information. |
-
-**Returns:** *`Promise>`*
-
-___
-
-### `Static` getSwapQuoteConsumer
-
-▸ **getSwapQuoteConsumer**(`supportedProvider`: [SupportedProvider](#supportedprovider), `options`: `Partial`): *[SwapQuoteConsumer](#class-swapquoteconsumer)*
-
-*Defined in [asset-swapper/src/quote_consumers/swap_quote_consumer.ts:34](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts#L34)*
-
-**Parameters:**
-
-Name | Type | Default |
------- | ------ | ------ |
-`supportedProvider` | [SupportedProvider](#supportedprovider) | - |
-`options` | `Partial` | {} |
-
-**Returns:** *[SwapQuoteConsumer](#class-swapquoteconsumer)*
-
-
-
-# Class: SwapQuoter
-
-
-## Constructors
-
-
-
-\+ **new SwapQuoter**(`supportedProvider`: [SupportedProvider](#supportedprovider), `orderbook`: `Orderbook`, `options`: `Partial`): *[SwapQuoter](#class-swapquoter)*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:129](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L129)*
-
-Instantiates a new SwapQuoter instance
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`supportedProvider` | [SupportedProvider](#supportedprovider) | - | The Provider instance you would like to use for interacting with the Ethereum network. |
-`orderbook` | `Orderbook` | - | An object that conforms to Orderbook, see type for definition. |
-`options` | `Partial` | {} | Initialization options for the SwapQuoter. See type definition for details. |
-
-**Returns:** *[SwapQuoter](#class-swapquoter)*
-
-An instance of SwapQuoter
-
-## Properties
-
-### expiryBufferMs
-
-• **expiryBufferMs**: *number*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:32](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L32)*
-
-___
-
-### orderbook
-
-• **orderbook**: *`Orderbook`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:31](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L31)*
-
-___
-
-### permittedOrderFeeTypes
-
-• **permittedOrderFeeTypes**: *`Set`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:33](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L33)*
-
-___
-
-### provider
-
-• **provider**: *`ZeroExProvider`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:30](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L30)*
-
-## Methods
-
-### destroyAsync
-
-▸ **destroyAsync**(): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:393](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L393)*
-
-Destroys any subscriptions or connections.
-
-**Returns:** *`Promise`*
-
-___
-
-### getAvailableMakerAssetDatasAsync
-
-▸ **getAvailableMakerAssetDatasAsync**(`takerAssetData`: string): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:321](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L321)*
-
-Get the asset data of all assets that are purchaseable with takerAssetData in the order provider passed in at init.
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`takerAssetData` | string |
-
-**Returns:** *`Promise`*
-
-An array of asset data strings that are purchaseable with takerAssetData.
-
-___
-
-### getAvailableTakerAssetDatasAsync
-
-▸ **getAvailableTakerAssetDatasAsync**(`makerAssetData`: string): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:306](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L306)*
-
-Get the asset data of all assets that can be used to purchase makerAssetData in the order provider passed in at init.
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`makerAssetData` | string |
-
-**Returns:** *`Promise`*
-
-An array of asset data strings that can purchase makerAssetData.
-
-___
-
-### getEtherTokenAssetDataOrThrowAsync
-
-▸ **getEtherTokenAssetDataOrThrowAsync**(): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:400](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L400)*
-
-Utility function to get assetData for Ether token.
-
-**Returns:** *`Promise`*
-
-___
-
-### getLiquidityForMakerTakerAssetDataPairAsync
-
-▸ **getLiquidityForMakerTakerAssetDataPairAsync**(`makerAssetData`: string, `takerAssetData`: string): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:281](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L281)*
-
-Returns information about available liquidity for an asset
-Does not factor in slippage or fees
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`makerAssetData` | string | The makerAssetData of the desired asset to swap for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-`takerAssetData` | string | The takerAssetData of the asset to swap makerAssetData for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-
-**Returns:** *`Promise`*
-
-An object that conforms to LiquidityForTakerMakerAssetDataPair that satisfies the request. See type definition for more information.
-
-___
-
-### getMarketBuySwapQuoteAsync
-
-▸ **getMarketBuySwapQuoteAsync**(`makerTokenAddress`: string, `takerTokenAddress`: string, `makerAssetBuyAmount`: `BigNumber`, `options`: `Partial`): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:223](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L223)*
-
-Get a `SwapQuote` containing all information relevant to fulfilling a swap between a desired ERC20 token address and ERC20 owned by a provided address.
-You can then pass the `SwapQuote` to a `SwapQuoteConsumer` to execute a buy, or process SwapQuote for on-chain consumption.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`makerTokenAddress` | string | - | The address of the maker asset |
-`takerTokenAddress` | string | - | The address of the taker asset |
-`makerAssetBuyAmount` | `BigNumber` | - | The amount of maker asset to swap for. |
-`options` | `Partial` | {} | Options for the request. See type definition for more information. |
-
-**Returns:** *`Promise`*
-
-An object that conforms to SwapQuote that satisfies the request. See type definition for more information.
-
-___
-
-### getMarketBuySwapQuoteForAssetDataAsync
-
-▸ **getMarketBuySwapQuoteForAssetDataAsync**(`makerAssetData`: string, `takerAssetData`: string, `makerAssetBuyAmount`: `BigNumber`, `options`: `Partial`): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:198](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L198)*
-
-Get a `SwapQuote` containing all information relevant to fulfilling a swap between a desired ERC20 token address and ERC20 owned by a provided address.
-You can then pass the `SwapQuote` to a `SwapQuoteConsumer` to execute a buy, or process SwapQuote for on-chain consumption.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`makerAssetData` | string | - | The makerAssetData of the desired asset to swap for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-`takerAssetData` | string | - | The takerAssetData of the asset to swap makerAssetData for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-`makerAssetBuyAmount` | `BigNumber` | - | The amount of maker asset to swap for. |
-`options` | `Partial` | {} | Options for the request. See type definition for more information. |
-
-**Returns:** *`Promise`*
-
-An object that conforms to SwapQuote that satisfies the request. See type definition for more information.
-
-___
-
-### getMarketSellSwapQuoteAsync
-
-▸ **getMarketSellSwapQuoteAsync**(`makerTokenAddress`: string, `takerTokenAddress`: string, `takerAssetSellAmount`: `BigNumber`, `options`: `Partial`): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:253](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L253)*
-
-Get a `SwapQuote` containing all information relevant to fulfilling a swap between a desired ERC20 token address and ERC20 owned by a provided address.
-You can then pass the `SwapQuote` to a `SwapQuoteConsumer` to execute a buy, or process SwapQuote for on-chain consumption.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`makerTokenAddress` | string | - | The address of the maker asset |
-`takerTokenAddress` | string | - | The address of the taker asset |
-`takerAssetSellAmount` | `BigNumber` | - | The amount of taker asset to sell. |
-`options` | `Partial` | {} | Options for the request. See type definition for more information. |
-
-**Returns:** *`Promise`*
-
-An object that conforms to SwapQuote that satisfies the request. See type definition for more information.
-
-___
-
-### getMarketSellSwapQuoteForAssetDataAsync
-
-▸ **getMarketSellSwapQuoteForAssetDataAsync**(`makerAssetData`: string, `takerAssetData`: string, `takerAssetSellAmount`: `BigNumber`, `options`: `Partial`): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:172](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L172)*
-
-Get a `SwapQuote` containing all information relevant to fulfilling a swap between a desired ERC20 token address and ERC20 owned by a provided address.
-You can then pass the `SwapQuote` to a `SwapQuoteConsumer` to execute a buy, or process SwapQuote for on-chain consumption.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`makerAssetData` | string | - | The makerAssetData of the desired asset to swap for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-`takerAssetData` | string | - | The takerAssetData of the asset to swap makerAssetData for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-`takerAssetSellAmount` | `BigNumber` | - | The amount of taker asset to swap for. |
-`options` | `Partial` | {} | Options for the request. See type definition for more information. |
-
-**Returns:** *`Promise`*
-
-An object that conforms to SwapQuote that satisfies the request. See type definition for more information.
-
-___
-
-### getPrunedSignedOrdersAsync
-
-▸ **getPrunedSignedOrdersAsync**(`makerAssetData`: string, `takerAssetData`: string): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:355](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L355)*
-
-Grab orders from the order provider, prunes for valid orders with provided OrderPruner options
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`makerAssetData` | string | The makerAssetData of the desired asset to swap for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-`takerAssetData` | string | The takerAssetData of the asset to swap makerAssetData for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-
-**Returns:** *`Promise`*
-
-___
-
-### isSwapQuoteFillableByTakerAddressAsync
-
-▸ **isSwapQuoteFillableByTakerAddressAsync**(`swapQuote`: [SwapQuote](#swapquote), `takerAddress`: string): *`Promise<[boolean, boolean]>`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:376](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L376)*
-
-Util function to check if takerAddress's allowance is enough for 0x exchange contracts to conduct the swap specified by the swapQuote.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`swapQuote` | [SwapQuote](#swapquote) | The swapQuote in question to check enough allowance enabled for 0x exchange contracts to conduct the swap. |
-`takerAddress` | string | The address of the taker of the provided swapQuote |
-
-**Returns:** *`Promise<[boolean, boolean]>`*
-
-___
-
-### isTakerMakerAssetDataPairAvailableAsync
-
-▸ **isTakerMakerAssetDataPairAvailableAsync**(`makerAssetData`: string, `takerAssetData`: string): *`Promise`*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:338](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L338)*
-
-Validates the taker + maker asset pair is available from the order provider provided to `SwapQuote`.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`makerAssetData` | string | The makerAssetData of the desired asset to swap for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-`takerAssetData` | string | The takerAssetData of the asset to swap makerAssetData for (for more info: https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md). |
-
-**Returns:** *`Promise`*
-
-A boolean on if the taker, maker pair exists
-
-___
-
-### `Static` getSwapQuoterForMeshEndpoint
-
-▸ **getSwapQuoterForMeshEndpoint**(`supportedProvider`: [SupportedProvider](#supportedprovider), `meshEndpoint`: string, `options`: `Partial`): *[SwapQuoter](#class-swapquoter)*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:116](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L116)*
-
-Instantiates a new SwapQuoter instance given a 0x Mesh endpoint. This pulls all available liquidity stored in Mesh
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`supportedProvider` | [SupportedProvider](#supportedprovider) | - | The Provider instance you would like to use for interacting with the Ethereum network. |
-`meshEndpoint` | string | - | The standard relayer API base HTTP url you would like to source orders from. |
-`options` | `Partial` | {} | Initialization options for the SwapQuoter. See type definition for details. |
-
-**Returns:** *[SwapQuoter](#class-swapquoter)*
-
-An instance of SwapQuoter
-
-___
-
-### `Static` getSwapQuoterForProvidedOrders
-
-▸ **getSwapQuoterForProvidedOrders**(`supportedProvider`: [SupportedProvider](#supportedprovider), `orders`: `SignedOrder`[], `options`: `Partial`): *[SwapQuoter](#class-swapquoter)*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:44](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L44)*
-
-Instantiates a new SwapQuoter instance given existing liquidity in the form of orders and feeOrders.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`supportedProvider` | [SupportedProvider](#supportedprovider) | - | The Provider instance you would like to use for interacting with the Ethereum network. |
-`orders` | `SignedOrder`[] | - | A non-empty array of objects that conform to SignedOrder. All orders must have the same makerAssetData and takerAssetData. |
-`options` | `Partial` | {} | Initialization options for the SwapQuoter. See type definition for details. |
-
-**Returns:** *[SwapQuoter](#class-swapquoter)*
-
-An instance of SwapQuoter
-
-___
-
-### `Static` getSwapQuoterForStandardRelayerAPIUrl
-
-▸ **getSwapQuoterForStandardRelayerAPIUrl**(`supportedProvider`: [SupportedProvider](#supportedprovider), `sraApiUrl`: string, `options`: `Partial`): *[SwapQuoter](#class-swapquoter)*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:64](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L64)*
-
-Instantiates a new SwapQuoter instance given a [Standard Relayer API](https://github.com/0xProject/standard-relayer-api) endpoint
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`supportedProvider` | [SupportedProvider](#supportedprovider) | - | The Provider instance you would like to use for interacting with the Ethereum network. |
-`sraApiUrl` | string | - | The standard relayer API base HTTP url you would like to source orders from. |
-`options` | `Partial` | {} | Initialization options for the SwapQuoter. See type definition for details. |
-
-**Returns:** *[SwapQuoter](#class-swapquoter)*
-
-An instance of SwapQuoter
-
-___
-
-### `Static` getSwapQuoterForStandardRelayerAPIWebsocket
-
-▸ **getSwapQuoterForStandardRelayerAPIWebsocket**(`supportedProvider`: [SupportedProvider](#supportedprovider), `sraApiUrl`: string, `sraWebsocketAPIUrl`: string, `options`: `Partial`): *[SwapQuoter](#class-swapquoter)*
-
-*Defined in [asset-swapper/src/swap_quoter.ts:91](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/swap_quoter.ts#L91)*
-
-Instantiates a new SwapQuoter instance given a [Standard Relayer API](https://github.com/0xProject/standard-relayer-api) endpoint
-and a websocket endpoint. This is more effecient than `getSwapQuoterForStandardRelayerAPIUrl` when requesting multiple quotes.
-
-**Parameters:**
-
-Name | Type | Default | Description |
------- | ------ | ------ | ------ |
-`supportedProvider` | [SupportedProvider](#supportedprovider) | - | The Provider instance you would like to use for interacting with the Ethereum network. |
-`sraApiUrl` | string | - | The standard relayer API base HTTP url you would like to source orders from. |
-`sraWebsocketAPIUrl` | string | - | - |
-`options` | `Partial` | {} | Initialization options for the SwapQuoter. See type definition for details. |
-
-**Returns:** *[SwapQuoter](#class-swapquoter)*
-
-An instance of SwapQuoter
-
-
-
-# Class: BaseOrderProvider
-
-
-## Constructors
-
-
-
-\+ **new BaseOrderProvider**(`orderStore`: [OrderStore](_orderbook_src_order_store_.orderstore.md)): *[BaseOrderProvider](#class-baseorderprovider)*
-
-*Defined in [orderbook/src/order_provider/base_order_provider.ts:12](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_provider/base_order_provider.ts#L12)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`orderStore` | [OrderStore](#class-orderstore) |
-
-**Returns:** *[BaseOrderProvider](#class-baseorderprovider)*
-
-## Properties
-
-### _orderStore
-
-• **_orderStore**: *[OrderStore](#class-orderstore)*
-
-*Defined in [orderbook/src/order_provider/base_order_provider.ts:12](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_provider/base_order_provider.ts#L12)*
-
-## Methods
-
-### `Abstract` addOrdersAsync
-
-▸ **addOrdersAsync**(`orders`: `SignedOrder`[]): *`Promise`*
-
-*Defined in [orderbook/src/order_provider/base_order_provider.ts:27](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_provider/base_order_provider.ts#L27)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`orders` | `SignedOrder`[] |
-
-**Returns:** *`Promise`*
-
-___
-
-### `Abstract` createSubscriptionForAssetPairAsync
-
-▸ **createSubscriptionForAssetPairAsync**(`makerAssetData`: string, `takerAssetData`: string): *`Promise`*
-
-*Defined in [orderbook/src/order_provider/base_order_provider.ts:18](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_provider/base_order_provider.ts#L18)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`makerAssetData` | string |
-`takerAssetData` | string |
-
-**Returns:** *`Promise`*
-
-___
-
-### `Abstract` destroyAsync
-
-▸ **destroyAsync**(): *`Promise`*
-
-*Defined in [orderbook/src/order_provider/base_order_provider.ts:25](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_provider/base_order_provider.ts#L25)*
-
-**Returns:** *`Promise`*
-
-___
-
-### `Abstract` getAvailableAssetDatasAsync
-
-▸ **getAvailableAssetDatasAsync**(): *`Promise`*
-
-*Defined in [orderbook/src/order_provider/base_order_provider.ts:23](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_provider/base_order_provider.ts#L23)*
-
-**Returns:** *`Promise`*
-
-
-
-# Class: OrderSet
-
-
-## Constructors
-
-
-
-\+ **new OrderSet**(`orders`: `APIOrder`[]): *[OrderSet](#class-orderset)*
-
-*Defined in [orderbook/src/order_set.ts:6](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L6)*
-
-**Parameters:**
-
-Name | Type | Default |
------- | ------ | ------ |
-`orders` | `APIOrder`[] | [] |
-
-**Returns:** *[OrderSet](#class-orderset)*
-
-## Methods
-
-### add
-
-▸ **add**(`item`: `APIOrder`): *void*
-
-*Defined in [orderbook/src/order_set.ts:19](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L19)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`item` | `APIOrder` |
-
-**Returns:** *void*
-
-___
-
-### addMany
-
-▸ **addMany**(`items`: `APIOrder`[]): *void*
-
-*Defined in [orderbook/src/order_set.ts:25](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L25)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`items` | `APIOrder`[] |
-
-**Returns:** *void*
-
-___
-
-### delete
-
-▸ **delete**(`item`: `APIOrder`): *boolean*
-
-*Defined in [orderbook/src/order_set.ts:57](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L57)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`item` | `APIOrder` |
-
-**Returns:** *boolean*
-
-___
-
-### deleteMany
-
-▸ **deleteMany**(`items`: `APIOrder`[]): *void*
-
-*Defined in [orderbook/src/order_set.ts:61](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L61)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`items` | `APIOrder`[] |
-
-**Returns:** *void*
-
-___
-
-### diff
-
-▸ **diff**(`other`: [OrderSet](#class-orderset)): *object*
-
-*Defined in [orderbook/src/order_set.ts:35](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L35)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`other` | [OrderSet](#class-orderset) |
-
-**Returns:** *object*
-
-___
-
-### has
-
-▸ **has**(`order`: `APIOrder`): *boolean*
-
-*Defined in [orderbook/src/order_set.ts:31](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L31)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`order` | `APIOrder` |
-
-**Returns:** *boolean*
-
-___
-
-### size
-
-▸ **size**(): *number*
-
-*Defined in [orderbook/src/order_set.ts:15](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L15)*
-
-**Returns:** *number*
-
-___
-
-### values
-
-▸ **values**(): *`IterableIterator`*
-
-*Defined in [orderbook/src/order_set.ts:53](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_set.ts#L53)*
-
-**Returns:** *`IterableIterator`*
-
-
-
-# Class: OrderStore
-
-
-## Methods
-
-### getOrderSetForAssetPair
-
-▸ **getOrderSetForAssetPair**(`assetPairKey`: string): *[OrderSet](#class-orderset)*
-
-*Defined in [orderbook/src/order_store.ts:19](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L19)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`assetPairKey` | string |
-
-**Returns:** *[OrderSet](#class-orderset)*
-
-___
-
-### getOrderSetForAssets
-
-▸ **getOrderSetForAssets**(`makerAssetData`: string, `takerAssetData`: string): *[OrderSet](#class-orderset)*
-
-*Defined in [orderbook/src/order_store.ts:15](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L15)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`makerAssetData` | string |
-`takerAssetData` | string |
-
-**Returns:** *[OrderSet](#class-orderset)*
-
-___
-
-### has
-
-▸ **has**(`assetPairKey`: string): *boolean*
-
-*Defined in [orderbook/src/order_store.ts:34](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L34)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`assetPairKey` | string |
-
-**Returns:** *boolean*
-
-___
-
-### keys
-
-▸ **keys**(): *`IterableIterator`*
-
-*Defined in [orderbook/src/order_store.ts:40](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L40)*
-
-**Returns:** *`IterableIterator`*
-
-___
-
-### update
-
-▸ **update**(`addedRemoved`: [AddedRemovedOrders](#interface-addedremovedorders)): *void*
-
-*Defined in [orderbook/src/order_store.ts:28](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L28)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`addedRemoved` | [AddedRemovedOrders](#interface-addedremovedorders) |
-
-**Returns:** *void*
-
-___
-
-### values
-
-▸ **values**(`assetPairKey`: string): *`APIOrder`[]*
-
-*Defined in [orderbook/src/order_store.ts:37](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L37)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`assetPairKey` | string |
-
-**Returns:** *`APIOrder`[]*
-
-___
-
-### `Static` assetPairKeyToAssets
-
-▸ **assetPairKeyToAssets**(`assetPairKey`: string): *string[]*
-
-*Defined in [orderbook/src/order_store.ts:12](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L12)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`assetPairKey` | string |
-
-**Returns:** *string[]*
-
-___
-
-### `Static` getKeyForAssetPair
-
-▸ **getKeyForAssetPair**(`makerAssetData`: string, `takerAssetData`: string): *string*
-
-*Defined in [orderbook/src/order_store.ts:9](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_store.ts#L9)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`makerAssetData` | string |
-`takerAssetData` | string |
-
-**Returns:** *string*
-
-
-
-# Class: Orderbook
-
-
-## Constructors
-
-
-
-\+ **new Orderbook**(`orderProvider`: [BaseOrderProvider](_orderbook_src_order_provider_base_order_provider_.baseorderprovider.md), `orderStore`: [OrderStore](_orderbook_src_order_store_.orderstore.md)): *[Orderbook](#class-orderbook)*
-
-*Defined in [orderbook/src/orderbook.ts:55](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L55)*
-
-Creates an Orderbook with the order provider. All order updates are stored
-in the `OrderStore`.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`orderProvider` | [BaseOrderProvider](#class-baseorderprovider) | the order provider, e.g SRAWebbsocketOrderProvider |
-`orderStore` | [OrderStore](#class-orderstore) | the order store where orders are added and deleted |
-
-**Returns:** *[Orderbook](#class-orderbook)*
-
-## Methods
-
-### addOrdersAsync
-
-▸ **addOrdersAsync**(`orders`: `SignedOrder`[]): *`Promise`*
-
-*Defined in [orderbook/src/orderbook.ts:98](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L98)*
-
-Adds the orders to the Order Provider. All accepted orders will be returned
-and rejected orders will be returned with an message indicating a reason for its rejection
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`orders` | `SignedOrder`[] | The set of Orders to add to the Order Provider |
-
-**Returns:** *`Promise`*
-
-___
-
-### destroyAsync
-
-▸ **destroyAsync**(): *`Promise`*
-
-*Defined in [orderbook/src/orderbook.ts:104](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L104)*
-
-Destroys any subscriptions or connections.
-
-**Returns:** *`Promise`*
-
-___
-
-### getAvailableAssetDatasAsync
-
-▸ **getAvailableAssetDatasAsync**(): *`Promise`*
-
-*Defined in [orderbook/src/orderbook.ts:90](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L90)*
-
-Returns all of the Available Asset Pairs for the provided Order Provider.
-
-**Returns:** *`Promise`*
-
-___
-
-### getOrdersAsync
-
-▸ **getOrdersAsync**(`makerAssetData`: string, `takerAssetData`: string): *`Promise`*
-
-*Defined in [orderbook/src/orderbook.ts:75](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L75)*
-
-Returns all orders where the order.makerAssetData == makerAssetData and
-order.takerAssetData == takerAssetData. This pair is then subscribed to
-and all future updates will be stored. The first request
-to `getOrdersAsync` might fetch the orders from the Order Provider and create a subscription.
-Subsequent requests will be quick and up to date and synced with the Order Provider state.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`makerAssetData` | string | the maker asset data |
-`takerAssetData` | string | the taker asset data |
-
-**Returns:** *`Promise`*
-
-___
-
-### `Static` getOrderbookForMeshProvider
-
-▸ **getOrderbookForMeshProvider**(`opts`: [MeshOrderProviderOpts](#interface-meshorderprovideropts)): *[Orderbook](#class-orderbook)*
-
-*Defined in [orderbook/src/orderbook.ts:52](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L52)*
-
-Creates an Orderbook with a Mesh Order Provider. This Provider fetches ALL orders
-and subscribes to updates on ALL orders.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`opts` | [MeshOrderProviderOpts](#interface-meshorderprovideropts) | the `MeshOrderProviderOpts` |
-
-**Returns:** *[Orderbook](#class-orderbook)*
-
-___
-
-### `Static` getOrderbookForPollingProvider
-
-▸ **getOrderbookForPollingProvider**(`opts`: [SRAPollingOrderProviderOpts](#interface-srapollingorderprovideropts)): *[Orderbook](#class-orderbook)*
-
-*Defined in [orderbook/src/orderbook.ts:43](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L43)*
-
-Creates an Orderbook with SRA Polling Provider. This Provider simply polls every interval.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`opts` | [SRAPollingOrderProviderOpts](#interface-srapollingorderprovideropts) | the `SRAPollingOrderProviderOpts` |
-
-**Returns:** *[Orderbook](#class-orderbook)*
-
-___
-
-### `Static` getOrderbookForProvidedOrders
-
-▸ **getOrderbookForProvidedOrders**(`orders`: `SignedOrder`[]): *[Orderbook](#class-orderbook)*
-
-*Defined in [orderbook/src/orderbook.ts:26](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L26)*
-
-Creates an Orderbook with the provided orders. This provider simply stores the
-orders and allows querying. No validation or subscriptions occur.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`orders` | `SignedOrder`[] | the set of SignedOrders |
-
-**Returns:** *[Orderbook](#class-orderbook)*
-
-___
-
-### `Static` getOrderbookForWebsocketProvider
-
-▸ **getOrderbookForWebsocketProvider**(`opts`: [SRAWebsocketOrderProviderOpts](#interface-srawebsocketorderprovideropts)): *[Orderbook](#class-orderbook)*
-
-*Defined in [orderbook/src/orderbook.ts:35](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/orderbook.ts#L35)*
-
-Creates an Orderbook with the SRA Websocket Provider. This Provider fetches orders via
-the SRA http endpoint and then subscribes to the asset pair for future updates.
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`opts` | [SRAWebsocketOrderProviderOpts](#interface-srawebsocketorderprovideropts) | the `SRAWebsocketOrderProviderOpts` |
-
-**Returns:** *[Orderbook](#class-orderbook)*
-
-
-
-# Enumeration: ExtensionContractType
-
-Represents the varying smart contracts that can consume a valid swap quote
-
-
-## Enumeration members
-
-### Forwarder
-
-• **Forwarder**: = "FORWARDER"
-
-*Defined in [asset-swapper/src/types.ts:106](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L106)*
-
-___
-
-### None
-
-• **None**: = "NONE"
-
-*Defined in [asset-swapper/src/types.ts:107](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L107)*
-
-
-
-
-
-
-
-
-
-# Enumeration: SwapQuoterError
-
-Possible error messages thrown by an SwapQuoter instance or associated static methods.
-
-
-## Enumeration members
-
-### AssetUnavailable
-
-• **AssetUnavailable**: = "ASSET_UNAVAILABLE"
-
-*Defined in [asset-swapper/src/types.ts:298](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L298)*
-
-___
-
-### InsufficientAssetLiquidity
-
-• **InsufficientAssetLiquidity**: = "INSUFFICIENT_ASSET_LIQUIDITY"
-
-*Defined in [asset-swapper/src/types.ts:297](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L297)*
-
-___
-
-### NoEtherTokenContractFound
-
-• **NoEtherTokenContractFound**: = "NO_ETHER_TOKEN_CONTRACT_FOUND"
-
-*Defined in [asset-swapper/src/types.ts:295](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L295)*
-
-___
-
-### NoGasPriceProvidedOrEstimated
-
-• **NoGasPriceProvidedOrEstimated**: = "NO_GAS_PRICE_PROVIDED_OR_ESTIMATED"
-
-*Defined in [asset-swapper/src/types.ts:299](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L299)*
-
-___
-
-### StandardRelayerApiError
-
-• **StandardRelayerApiError**: = "STANDARD_RELAYER_API_ERROR"
-
-*Defined in [asset-swapper/src/types.ts:296](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L296)*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Interface: CalldataInfo
-
-Represents the metadata to call a smart contract with calldata.
-calldataHexString: The hexstring of the calldata.
-methodAbi: The ABI of the smart contract method to call.
-toAddress: The contract address to call.
-ethAmount: The eth amount in wei to send with the smart contract call.
-
-
-## Properties
-
-### calldataHexString
-
-• **calldataHexString**: *string*
-
-*Defined in [asset-swapper/src/types.ts:55](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L55)*
-
-___
-
-### ethAmount
-
-• **ethAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:58](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L58)*
-
-___
-
-### methodAbi
-
-• **methodAbi**: *`MethodAbi`*
-
-*Defined in [asset-swapper/src/types.ts:56](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L56)*
-
-___
-
-### toAddress
-
-• **toAddress**: *string*
-
-*Defined in [asset-swapper/src/types.ts:57](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L57)*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Interface: GetExtensionContractTypeOpts
-
-
-## Properties
-
-### `Optional` ethAmount
-
-• **ethAmount**? : *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:209](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L209)*
-
-___
-
-### `Optional` takerAddress
-
-• **takerAddress**? : *undefined | string*
-
-*Defined in [asset-swapper/src/types.ts:208](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L208)*
-
-
-
-# Interface: LiquidityForTakerMakerAssetDataPair
-
-Represents available liquidity for a given assetData.
-
-
-## Properties
-
-### makerAssetAvailableInBaseUnits
-
-• **makerAssetAvailableInBaseUnits**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:306](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L306)*
-
-___
-
-### takerAssetAvailableInBaseUnits
-
-• **takerAssetAvailableInBaseUnits**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:307](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L307)*
-
-
-
-# Interface: MarketBuySwapQuote
-
-makerAssetFillAmount: The amount of makerAsset bought with takerAsset.
-type: Specified MarketOperation the SwapQuote is provided for
-
-
-## Properties
-
-### bestCaseQuoteInfo
-
-• **bestCaseQuoteInfo**: *[SwapQuoteInfo](#class-swapquoteinfo)*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[bestCaseQuoteInfo](#bestcasequoteinfo)*
-
-*Defined in [asset-swapper/src/types.ts:223](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L223)*
-
-___
-
-### makerAssetData
-
-• **makerAssetData**: *string*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[makerAssetData](#makerassetdata)*
-
-*Defined in [asset-swapper/src/types.ts:221](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L221)*
-
-___
-
-### makerAssetFillAmount
-
-• **makerAssetFillAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:241](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L241)*
-
-___
-
-### orders
-
-• **orders**: *`SignedOrder`[]*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[orders](#orders)*
-
-*Defined in [asset-swapper/src/types.ts:222](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L222)*
-
-___
-
-### takerAssetData
-
-• **takerAssetData**: *string*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[takerAssetData](#takerassetdata)*
-
-*Defined in [asset-swapper/src/types.ts:220](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L220)*
-
-___
-
-### type
-
-• **type**: *[Buy](#buy)*
-
-*Defined in [asset-swapper/src/types.ts:242](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L242)*
-
-___
-
-### worstCaseQuoteInfo
-
-• **worstCaseQuoteInfo**: *[SwapQuoteInfo](#class-swapquoteinfo)*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[worstCaseQuoteInfo](#worstcasequoteinfo)*
-
-*Defined in [asset-swapper/src/types.ts:224](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L224)*
-
-
-
-# Interface: MarketSellSwapQuote
-
-takerAssetFillAmount: The amount of takerAsset sold for makerAsset.
-type: Specified MarketOperation the SwapQuote is provided for
-
-
-## Properties
-
-### bestCaseQuoteInfo
-
-• **bestCaseQuoteInfo**: *[SwapQuoteInfo](#class-swapquoteinfo)*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[bestCaseQuoteInfo](#bestcasequoteinfo)*
-
-*Defined in [asset-swapper/src/types.ts:223](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L223)*
-
-___
-
-### makerAssetData
-
-• **makerAssetData**: *string*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[makerAssetData](#makerassetdata)*
-
-*Defined in [asset-swapper/src/types.ts:221](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L221)*
-
-___
-
-### orders
-
-• **orders**: *`SignedOrder`[]*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[orders](#orders)*
-
-*Defined in [asset-swapper/src/types.ts:222](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L222)*
-
-___
-
-### takerAssetData
-
-• **takerAssetData**: *string*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[takerAssetData](#takerassetdata)*
-
-*Defined in [asset-swapper/src/types.ts:220](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L220)*
-
-___
-
-### takerAssetFillAmount
-
-• **takerAssetFillAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:232](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L232)*
-
-___
-
-### type
-
-• **type**: *[Sell](#sell)*
-
-*Defined in [asset-swapper/src/types.ts:233](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L233)*
-
-___
-
-### worstCaseQuoteInfo
-
-• **worstCaseQuoteInfo**: *[SwapQuoteInfo](#class-swapquoteinfo)*
-
-*Inherited from [SwapQuoteBase](#interface-swapquotebase).[worstCaseQuoteInfo](#worstcasequoteinfo)*
-
-*Defined in [asset-swapper/src/types.ts:224](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L224)*
-
-
-
-
-
-
-
-
-
-# Interface: PrunedSignedOrder
-
-fillableMakerAssetAmount: Amount of makerAsset that is fillable
-fillableTakerAssetAmount: Amount of takerAsset that is fillable
-fillableTakerFeeAmount: Amount of takerFee paid to fill fillableTakerAssetAmount
-
-
-## Properties
-
-### chainId
-
-• **chainId**: *number*
-
-
-
-Defined in types/lib/index.d.ts:4
-
-___
-
-### exchangeAddress
-
-• **exchangeAddress**: *string*
-
-
-
-Defined in types/lib/index.d.ts:5
-
-___
-
-### expirationTimeSeconds
-
-• **expirationTimeSeconds**: *`BigNumber`*
-
-
-
-Defined in types/lib/index.d.ts:14
-
-___
-
-### feeRecipientAddress
-
-• **feeRecipientAddress**: *string*
-
-
-
-Defined in types/lib/index.d.ts:8
-
-___
-
-### fillableMakerAssetAmount
-
-• **fillableMakerAssetAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:42](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L42)*
-
-___
-
-### fillableTakerAssetAmount
-
-• **fillableTakerAssetAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:43](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L43)*
-
-___
-
-### fillableTakerFeeAmount
-
-• **fillableTakerFeeAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:44](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L44)*
-
-___
-
-### makerAddress
-
-• **makerAddress**: *string*
-
-
-
-Defined in types/lib/index.d.ts:6
-
-___
-
-### makerAssetAmount
-
-• **makerAssetAmount**: *`BigNumber`*
-
-
-
-Defined in types/lib/index.d.ts:10
-
-___
-
-### makerAssetData
-
-• **makerAssetData**: *string*
-
-
-
-Defined in types/lib/index.d.ts:16
-
-___
-
-### makerFee
-
-• **makerFee**: *`BigNumber`*
-
-
-
-Defined in types/lib/index.d.ts:12
-
-___
-
-### makerFeeAssetData
-
-• **makerFeeAssetData**: *string*
-
-
-
-Defined in types/lib/index.d.ts:18
-
-___
-
-### salt
-
-• **salt**: *`BigNumber`*
-
-
-
-Defined in types/lib/index.d.ts:15
-
-___
-
-### senderAddress
-
-• **senderAddress**: *string*
-
-
-
-Defined in types/lib/index.d.ts:9
-
-___
-
-### signature
-
-• **signature**: *string*
-
-
-
-Defined in types/lib/index.d.ts:22
-
-___
-
-### takerAddress
-
-• **takerAddress**: *string*
-
-
-
-Defined in types/lib/index.d.ts:7
-
-___
-
-### takerAssetAmount
-
-• **takerAssetAmount**: *`BigNumber`*
-
-
-
-Defined in types/lib/index.d.ts:11
-
-___
-
-### takerAssetData
-
-• **takerAssetData**: *string*
-
-
-
-Defined in types/lib/index.d.ts:17
-
-___
-
-### takerFee
-
-• **takerFee**: *`BigNumber`*
-
-
-
-Defined in types/lib/index.d.ts:13
-
-___
-
-### takerFeeAssetData
-
-• **takerFeeAssetData**: *string*
-
-
-
-Defined in types/lib/index.d.ts:19
-
-
-
-
-
-# Interface: SmartContractParamsInfo <**T**>
-
-Represents the metadata to call a smart contract with parameters.
-params: The metadata object containing all the input parameters of a smart contract call.
-toAddress: The contract address to call.
-ethAmount: If provided, the eth amount in wei to send with the smart contract call.
-methodAbi: The ABI of the smart contract method to call with params.
-
-## Type parameters
-
-▪ **T**
-
-
-## Properties
-
-### ethAmount
-
-• **ethAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:71](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L71)*
-
-___
-
-### methodAbi
-
-• **methodAbi**: *`MethodAbi`*
-
-*Defined in [asset-swapper/src/types.ts:72](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L72)*
-
-___
-
-### params
-
-• **params**: *`T`*
-
-*Defined in [asset-swapper/src/types.ts:69](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L69)*
-
-___
-
-### toAddress
-
-• **toAddress**: *string*
-
-*Defined in [asset-swapper/src/types.ts:70](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L70)*
-
-
-
-
-
-# Interface: SwapQuoteConsumerBase <**T**>
-
-Interface that varying SwapQuoteConsumers adhere to (exchange consumer, router consumer, forwarder consumer, coordinator consumer)
-getCalldataOrThrow: Get CalldataInfo to swap for tokens with provided SwapQuote. Throws if invalid SwapQuote is provided.
-getSmartContractParamsOrThrow: Get SmartContractParamsInfo to swap for tokens with provided SwapQuote. Throws if invalid SwapQuote is provided.
-executeSwapQuoteOrThrowAsync: Executes a web3 transaction to swap for tokens with provided SwapQuote. Throws if invalid SwapQuote is provided.
-
-## Type parameters
-
-▪ **T**
-
-
-## Implemented by
-
-* [SwapQuoteConsumer](#class-swapquoteconsumer)
-
-
-## Methods
-
-### executeSwapQuoteOrThrowAsync
-
-▸ **executeSwapQuoteOrThrowAsync**(`quote`: [SwapQuote](#swapquote), `opts`: `Partial`): *`Promise`*
-
-*Defined in [asset-swapper/src/types.ts:159](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L159)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`quote` | [SwapQuote](#swapquote) |
-`opts` | `Partial` |
-
-**Returns:** *`Promise`*
-
-___
-
-### getCalldataOrThrowAsync
-
-▸ **getCalldataOrThrowAsync**(`quote`: [SwapQuote](#swapquote), `opts`: `Partial`): *`Promise`*
-
-*Defined in [asset-swapper/src/types.ts:154](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L154)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`quote` | [SwapQuote](#swapquote) |
-`opts` | `Partial` |
-
-**Returns:** *`Promise`*
-
-___
-
-### getSmartContractParamsOrThrowAsync
-
-▸ **getSmartContractParamsOrThrowAsync**(`quote`: [SwapQuote](#swapquote), `opts`: `Partial`): *`Promise>`*
-
-*Defined in [asset-swapper/src/types.ts:155](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L155)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`quote` | [SwapQuote](#swapquote) |
-`opts` | `Partial` |
-
-**Returns:** *`Promise>`*
-
-
-
-# Interface: SwapQuoteConsumerOpts
-
-chainId: The chainId that the desired orders should be for.
-
-
-## Properties
-
-### chainId
-
-• **chainId**: *number*
-
-*Defined in [asset-swapper/src/types.ts:166](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L166)*
-
-
-
-# Interface: SwapQuoteConsumingOpts
-
-
-## Properties
-
-### useExtensionContract
-
-• **useExtensionContract**: *[ExtensionContractType](#enumeration-extensioncontracttype)*
-
-*Defined in [asset-swapper/src/types.ts:202](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L202)*
-
-
-
-# Interface: SwapQuoteExecutionOpts
-
-takerAddress: The address to perform the buy. Defaults to the first available address from the provider.
-gasLimit: The amount of gas to send with a transaction (in Gwei). Defaults to an eth_estimateGas rpc call.
-gasPrice: Gas price in Wei to use for a transaction
-ethAmount: The amount of eth sent with the execution of a swap
-
-
-## Properties
-
-### `Optional` ethAmount
-
-• **ethAmount**? : *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:184](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L184)*
-
-___
-
-### `Optional` gasLimit
-
-• **gasLimit**? : *undefined | number*
-
-*Defined in [asset-swapper/src/types.ts:182](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L182)*
-
-___
-
-### `Optional` gasPrice
-
-• **gasPrice**? : *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:183](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L183)*
-
-___
-
-### `Optional` takerAddress
-
-• **takerAddress**? : *undefined | string*
-
-*Defined in [asset-swapper/src/types.ts:181](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L181)*
-
-
-
-# Interface: SwapQuoteGetOutputOpts
-
-Represents the options provided to a generic SwapQuoteConsumer
-
-
-## Hierarchy
-
-* **SwapQuoteInfo**
-
-
-## Properties
-
-### feeTakerAssetAmount
-
-• **feeTakerAssetAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:253](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L253)*
-
-___
-
-### makerAssetAmount
-
-• **makerAssetAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:256](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L256)*
-
-___
-
-### protocolFeeInEthAmount
-
-• **protocolFeeInEthAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:257](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L257)*
-
-___
-
-### takerAssetAmount
-
-• **takerAssetAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:254](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L254)*
-
-___
-
-### totalTakerAssetAmount
-
-• **totalTakerAssetAmount**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:255](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L255)*
-
-
-
-# Interface: SwapQuoteRequestOpts
-
-slippagePercentage: The percentage buffer to add to account for slippage. Affects max ETH price estimates. Defaults to 0.01 (1%).
-gasPrice: gas price to determine protocolFee amount, default to ethGasStation fast amount
-
-
-## Properties
-
-### `Optional` gasPrice
-
-• **gasPrice**? : *`BigNumber`*
-
-*Defined in [asset-swapper/src/types.ts:266](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L266)*
-
-___
-
-### slippagePercentage
-
-• **slippagePercentage**: *number*
-
-*Defined in [asset-swapper/src/types.ts:265](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L265)*
-
-
-
-# Interface: SwapQuoterOpts
-
-chainId: The ethereum chain id. Defaults to 1 (mainnet).
-orderRefreshIntervalMs: The interval in ms that getBuyQuoteAsync should trigger an refresh of orders and order states. Defaults to 10000ms (10s).
-expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
-
-
-## Properties
-
-### chainId
-
-• **chainId**: *number*
-
-*Defined in [asset-swapper/src/types.ts:275](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L275)*
-
-___
-
-### expiryBufferMs
-
-• **expiryBufferMs**: *number*
-
-*Overrides [OrderPrunerOpts](_asset_swapper_src_types_.orderpruneropts.md).[expiryBufferMs](#expirybufferms)*
-
-*Defined in [asset-swapper/src/types.ts:277](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L277)*
-
-___
-
-### orderRefreshIntervalMs
-
-• **orderRefreshIntervalMs**: *number*
-
-*Defined in [asset-swapper/src/types.ts:276](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L276)*
-
-___
-
-### permittedOrderFeeTypes
-
-• **permittedOrderFeeTypes**: *`Set`*
-
-*Inherited from [OrderPrunerOpts](#interface-orderpruneropts).[permittedOrderFeeTypes](#permittedorderfeetypes)*
-
-*Defined in [asset-swapper/src/types.ts:11](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L11)*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Interface: DataItem
-
-
-## Properties
-
-### `Optional` components
-
-• **components**? : *[DataItem](#class-dataitem)[]*
-
-*Defined in [ethereum-types/src/index.ts:137](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L137)*
-
-___
-
-### name
-
-• **name**: *string*
-
-*Defined in [ethereum-types/src/index.ts:135](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L135)*
-
-___
-
-### type
-
-• **type**: *string*
-
-*Defined in [ethereum-types/src/index.ts:136](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L136)*
-
-
-
-
-
-
-
-
-
-# Interface: EIP1193Provider
-
-
-## Properties
-
-### isEIP1193
-
-• **isEIP1193**: *boolean*
-
-*Defined in [ethereum-types/src/index.ts:73](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L73)*
-
-## Methods
-
-### on
-
-▸ **on**(`event`: [EIP1193Event](#eip1193event), `listener`: function): *this*
-
-*Defined in [ethereum-types/src/index.ts:75](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L75)*
-
-**Parameters:**
-
-▪ **event**: *[EIP1193Event](#eip1193event)*
-
-▪ **listener**: *function*
-
-▸ (`result`: any): *void*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`result` | any |
-
-**Returns:** *this*
-
-___
-
-### send
-
-▸ **send**(`method`: string, `params?`: any[]): *`Promise`*
-
-*Defined in [ethereum-types/src/index.ts:74](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L74)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`method` | string |
-`params?` | any[] |
-
-**Returns:** *`Promise`*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Interface: GanacheProvider
-
-
-## Methods
-
-### sendAsync
-
-▸ **sendAsync**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
-
-*Defined in [ethereum-types/src/index.ts:14](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L14)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
-`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
-
-**Returns:** *void*
-
-
-
-
-
-# Interface: JSONRPCRequestPayload
-
-
-## Properties
-
-### id
-
-• **id**: *number*
-
-*Defined in [ethereum-types/src/index.ts:330](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L330)*
-
-___
-
-### jsonrpc
-
-• **jsonrpc**: *string*
-
-*Defined in [ethereum-types/src/index.ts:331](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L331)*
-
-___
-
-### method
-
-• **method**: *string*
-
-*Defined in [ethereum-types/src/index.ts:329](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L329)*
-
-___
-
-### params
-
-• **params**: *any[]*
-
-*Defined in [ethereum-types/src/index.ts:328](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L328)*
-
-
-
-# Interface: JSONRPCResponseError
-
-
-## Properties
-
-### code
-
-• **code**: *number*
-
-*Defined in [ethereum-types/src/index.ts:336](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L336)*
-
-___
-
-### message
-
-• **message**: *string*
-
-*Defined in [ethereum-types/src/index.ts:335](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L335)*
-
-
-
-# Interface: JSONRPCResponsePayload
-
-
-## Properties
-
-### `Optional` error
-
-• **error**? : *[JSONRPCResponseError](#class-jsonrpcresponseerror)*
-
-*Defined in [ethereum-types/src/index.ts:343](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L343)*
-
-___
-
-### id
-
-• **id**: *number*
-
-*Defined in [ethereum-types/src/index.ts:341](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L341)*
-
-___
-
-### jsonrpc
-
-• **jsonrpc**: *string*
-
-*Defined in [ethereum-types/src/index.ts:342](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L342)*
-
-___
-
-### result
-
-• **result**: *any*
-
-*Defined in [ethereum-types/src/index.ts:340](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L340)*
-
-
-
-
-
-
-
-
-
-# Interface: MethodAbi
-
-
-## Properties
-
-### constant
-
-• **constant**: *boolean*
-
-*Defined in [ethereum-types/src/index.ts:94](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L94)*
-
-___
-
-### inputs
-
-• **inputs**: *[DataItem](#class-dataitem)[]*
-
-*Defined in [ethereum-types/src/index.ts:92](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L92)*
-
-___
-
-### name
-
-• **name**: *string*
-
-*Defined in [ethereum-types/src/index.ts:91](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L91)*
-
-___
-
-### outputs
-
-• **outputs**: *[DataItem](#class-dataitem)[]*
-
-*Defined in [ethereum-types/src/index.ts:93](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L93)*
-
-___
-
-### payable
-
-• **payable**: *boolean*
-
-*Defined in [ethereum-types/src/index.ts:96](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L96)*
-
-___
-
-### stateMutability
-
-• **stateMutability**: *[StateMutability](#statemutability)*
-
-*Defined in [ethereum-types/src/index.ts:95](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L95)*
-
-___
-
-### type
-
-• **type**: *string*
-
-*Defined in [ethereum-types/src/index.ts:90](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L90)*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Interface: TupleDataItem
-
-
-## Properties
-
-### components
-
-• **components**: *[DataItem](#class-dataitem)[]*
-
-*Overrides [DataItem](_ethereum_types_src_index_.dataitem.md).[components](#optional-components)*
-
-*Defined in [ethereum-types/src/index.ts:141](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L141)*
-
-___
-
-### name
-
-• **name**: *string*
-
-*Inherited from [DataItem](#interface-dataitem).[name](#name)*
-
-*Defined in [ethereum-types/src/index.ts:135](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L135)*
-
-___
-
-### type
-
-• **type**: *string*
-
-*Inherited from [DataItem](#interface-dataitem).[type](#type)*
-
-*Defined in [ethereum-types/src/index.ts:136](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L136)*
-
-
-
-
-
-
-
-# Class: InsufficientAssetLiquidityError
-
-Error class representing insufficient asset liquidity
-
-
-## Constructors
-
-
-
-\+ **new InsufficientAssetLiquidityError**(`amountAvailableToFill`: `BigNumber`): *[InsufficientAssetLiquidityError](#class-insufficientassetliquidityerror)*
-
-*Defined in [asset-swapper/src/errors.ts:12](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/errors.ts#L12)*
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`amountAvailableToFill` | `BigNumber` | The amount availabe to fill (in base units) factoring in slippage |
-
-**Returns:** *[InsufficientAssetLiquidityError](#class-insufficientassetliquidityerror)*
-
-## Properties
-
-### amountAvailableToFill
-
-• **amountAvailableToFill**: *`BigNumber`*
-
-*Defined in [asset-swapper/src/errors.ts:12](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/errors.ts#L12)*
-
-The amount availabe to fill (in base units) factoring in slippage.
-
-___
-
-### message
-
-• **message**: *string*
-
-
-
-
-
-___
-
-### name
-
-• **name**: *string*
-
-
-
-
-
-___
-
-### `Optional` stack
-
-• **stack**? : *undefined | string*
-
-
-
-*Overrides void*
-
-
-
-___
-
-### `Static` Error
-
-▪ **Error**: *`ErrorConstructor`*
-
-
-
-
-
-# Interface: Web3JsV2Provider
-
-Web3.js version 2 provider interface
-This provider interface was used in a couple of Web3.js 1.0 beta releases
-before the first attempts to conform to EIP1193
-
-
-## Methods
-
-### send
-
-▸ **send**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
-
-*Defined in [ethereum-types/src/index.ts:54](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L54)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
-`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
-
-**Returns:** *void*
-
-
-
-# Interface: Web3JsV3Provider
-
-Web3.js version 3 provider interface
-This provider interface was implemented with the hopes for conforming to the EIP1193 spec,
-however it does not conform entirely.
-
-
-## Methods
-
-### send
-
-▸ **send**(`method`: string, `params?`: any[]): *`Promise`*
-
-*Defined in [ethereum-types/src/index.ts:63](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L63)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`method` | string |
-`params?` | any[] |
-
-**Returns:** *`Promise`*
-
-
-
-# Interface: ZeroExProvider
-
-The interface for the provider used internally by 0x libraries
-Any property we use from any SupportedProvider should we explicitly
-add here
-
-
-## Properties
-
-### `Optional` isMetaMask
-
-• **isMetaMask**? : *undefined | false | true*
-
-*Defined in [ethereum-types/src/index.ts:31](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L31)*
-
-___
-
-### `Optional` isParity
-
-• **isParity**? : *undefined | false | true*
-
-*Defined in [ethereum-types/src/index.ts:32](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L32)*
-
-___
-
-### `Optional` isZeroExProvider
-
-• **isZeroExProvider**? : *undefined | false | true*
-
-*Defined in [ethereum-types/src/index.ts:30](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L30)*
-
-## Methods
-
-### `Optional` enable
-
-▸ **enable**(): *`Promise`*
-
-*Defined in [ethereum-types/src/index.ts:34](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L34)*
-
-**Returns:** *`Promise`*
-
-___
-
-### sendAsync
-
-▸ **sendAsync**(`payload`: [JSONRPCRequestPayload](_ethereum_types_src_index_.jsonrpcrequestpayload.md), `callback`: [JSONRPCErrorCallback](#jsonrpcerrorcallback)): *void*
-
-*Defined in [ethereum-types/src/index.ts:35](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L35)*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`payload` | [JSONRPCRequestPayload](#class-jsonrpcrequestpayload) |
-`callback` | [JSONRPCErrorCallback](#jsonrpcerrorcallback) |
-
-**Returns:** *void*
-
-___
-
-### `Optional` stop
-
-▸ **stop**(): *void*
-
-*Defined in [ethereum-types/src/index.ts:33](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L33)*
-
-**Returns:** *void*
-
-
-
-# Interface: AcceptedRejectedOrders
-
-
-## Properties
-
-### accepted
-
-• **accepted**: *`SignedOrder`[]*
-
-*Defined in [orderbook/src/types.ts:15](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L15)*
-
-___
-
-### rejected
-
-• **rejected**: *[RejectedOrder](#class-rejectedorder)[]*
-
-*Defined in [orderbook/src/types.ts:16](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L16)*
-
-
-
-# Interface: AddedRemovedOrders
-
-
-## Properties
-
-### added
-
-• **added**: *`APIOrder`[]*
-
-*Defined in [orderbook/src/types.ts:6](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L6)*
-
-___
-
-### assetPairKey
-
-• **assetPairKey**: *string*
-
-*Defined in [orderbook/src/types.ts:5](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L5)*
-
-___
-
-### removed
-
-• **removed**: *`APIOrder`[]*
-
-*Defined in [orderbook/src/types.ts:7](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L7)*
-
-
-
-# Interface: MeshOrderProviderOpts
-
-Constructor options for a Mesh Order Provider
-
-
-## Properties
-
-### websocketEndpoint
-
-• **websocketEndpoint**: *string*
-
-*Defined in [orderbook/src/types.ts:52](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L52)*
-
-___
-
-### `Optional` wsOpts
-
-• **wsOpts**? : *`WSOpts`*
-
-*Defined in [orderbook/src/types.ts:54](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L54)*
-
-
-
-# Interface: RejectedOrder
-
-
-## Properties
-
-### message
-
-• **message**: *string*
-
-*Defined in [orderbook/src/types.ts:11](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L11)*
-
-___
-
-### order
-
-• **order**: *`SignedOrder`*
-
-*Defined in [orderbook/src/types.ts:12](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L12)*
-
-
-
-# Interface: SRAPollingOrderProviderOpts
-
-Constructor options for a SRA Polling Order Provider
-
-
-## Properties
-
-### `Optional` chainId
-
-• **chainId**? : *undefined | number*
-
-*Defined in [orderbook/src/types.ts:44](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L44)*
-
-___
-
-### httpEndpoint
-
-• **httpEndpoint**: *string*
-
-*Defined in [orderbook/src/types.ts:38](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L38)*
-
-___
-
-### `Optional` perPage
-
-• **perPage**? : *undefined | number*
-
-*Defined in [orderbook/src/types.ts:42](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L42)*
-
-___
-
-### pollingIntervalMs
-
-• **pollingIntervalMs**: *number*
-
-*Defined in [orderbook/src/types.ts:40](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L40)*
-
-
-
-# Interface: SRAWebsocketOrderProviderOpts
-
-Constructor options for a SRA Websocket Order Provider
-
-
-## Properties
-
-### `Optional` chainId
-
-• **chainId**? : *undefined | number*
-
-*Defined in [orderbook/src/types.ts:30](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L30)*
-
-___
-
-### httpEndpoint
-
-• **httpEndpoint**: *string*
-
-*Defined in [orderbook/src/types.ts:26](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L26)*
-
-___
-
-### websocketEndpoint
-
-• **websocketEndpoint**: *string*
-
-*Defined in [orderbook/src/types.ts:28](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/types.ts#L28)*
-
-
-
-# Interface: APIOrder
-
-
-## Properties
-
-### metaData
-
-• **metaData**: *object*
-
-*Defined in [types/src/index.ts:403](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L403)*
-
-___
-
-### order
-
-• **order**: *[SignedOrder](#class-signedorder)*
-
-*Defined in [types/src/index.ts:402](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L402)*
-
-
-
-
-
-# Interface: Asset
-
-
-## Properties
-
-### assetData
-
-• **assetData**: *string*
-
-*Defined in [types/src/index.ts:419](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L419)*
-
-___
-
-### maxAmount
-
-• **maxAmount**: *`BigNumber`*
-
-*Defined in [types/src/index.ts:421](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L421)*
-
-___
-
-### minAmount
-
-• **minAmount**: *`BigNumber`*
-
-*Defined in [types/src/index.ts:420](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L420)*
-
-___
-
-### precision
-
-• **precision**: *number*
-
-*Defined in [types/src/index.ts:422](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L422)*
-
-
-
-# Interface: AssetPairsItem
-
-
-## Properties
-
-### assetDataA
-
-• **assetDataA**: *[Asset](#class-asset)*
-
-*Defined in [types/src/index.ts:414](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L414)*
-
-___
-
-### assetDataB
-
-• **assetDataB**: *[Asset](#class-asset)*
-
-*Defined in [types/src/index.ts:415](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L415)*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Interface: SignedOrder
-
-
-## Properties
-
-### chainId
-
-• **chainId**: *number*
-
-*Inherited from [Order](#interface-order).[chainId](#chainid)*
-
-*Defined in [types/src/index.ts:14](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L14)*
-
-___
-
-### exchangeAddress
-
-• **exchangeAddress**: *string*
-
-*Inherited from [Order](#interface-order).[exchangeAddress](#exchangeaddress)*
-
-*Defined in [types/src/index.ts:15](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L15)*
-
-___
-
-### expirationTimeSeconds
-
-• **expirationTimeSeconds**: *`BigNumber`*
-
-*Inherited from [Order](#interface-order).[expirationTimeSeconds](#expirationtimeseconds)*
-
-*Defined in [types/src/index.ts:24](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L24)*
-
-___
-
-### feeRecipientAddress
-
-• **feeRecipientAddress**: *string*
-
-*Inherited from [Order](#interface-order).[feeRecipientAddress](#feerecipientaddress)*
-
-*Defined in [types/src/index.ts:18](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L18)*
-
-___
-
-### makerAddress
-
-• **makerAddress**: *string*
-
-*Inherited from [Order](#interface-order).[makerAddress](#makeraddress)*
-
-*Defined in [types/src/index.ts:16](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L16)*
-
-___
-
-### makerAssetAmount
-
-• **makerAssetAmount**: *`BigNumber`*
-
-*Inherited from [Order](#interface-order).[makerAssetAmount](#makerassetamount)*
-
-*Defined in [types/src/index.ts:20](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L20)*
-
-___
-
-### makerAssetData
-
-• **makerAssetData**: *string*
-
-*Inherited from [Order](#interface-order).[makerAssetData](#makerassetdata)*
-
-*Defined in [types/src/index.ts:26](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L26)*
-
-___
-
-### makerFee
-
-• **makerFee**: *`BigNumber`*
-
-*Inherited from [Order](#interface-order).[makerFee](#makerfee)*
-
-*Defined in [types/src/index.ts:22](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L22)*
-
-___
-
-### makerFeeAssetData
-
-• **makerFeeAssetData**: *string*
-
-*Inherited from [Order](#interface-order).[makerFeeAssetData](#makerfeeassetdata)*
-
-*Defined in [types/src/index.ts:28](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L28)*
-
-___
-
-### salt
-
-• **salt**: *`BigNumber`*
-
-*Inherited from [Order](#interface-order).[salt](#salt)*
-
-*Defined in [types/src/index.ts:25](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L25)*
-
-___
-
-### senderAddress
-
-• **senderAddress**: *string*
-
-*Inherited from [Order](#interface-order).[senderAddress](#senderaddress)*
-
-*Defined in [types/src/index.ts:19](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L19)*
-
-___
-
-### signature
-
-• **signature**: *string*
-
-*Defined in [types/src/index.ts:33](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L33)*
-
-___
-
-### takerAddress
-
-• **takerAddress**: *string*
-
-*Inherited from [Order](#interface-order).[takerAddress](#takeraddress)*
-
-*Defined in [types/src/index.ts:17](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L17)*
-
-___
-
-### takerAssetAmount
-
-• **takerAssetAmount**: *`BigNumber`*
-
-*Inherited from [Order](#interface-order).[takerAssetAmount](#takerassetamount)*
-
-*Defined in [types/src/index.ts:21](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L21)*
-
-___
-
-### takerAssetData
-
-• **takerAssetData**: *string*
-
-*Inherited from [Order](#interface-order).[takerAssetData](#takerassetdata)*
-
-*Defined in [types/src/index.ts:27](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L27)*
-
-___
-
-### takerFee
-
-• **takerFee**: *`BigNumber`*
-
-*Inherited from [Order](#interface-order).[takerFee](#takerfee)*
-
-*Defined in [types/src/index.ts:23](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L23)*
-
-___
-
-### takerFeeAssetData
-
-• **takerFeeAssetData**: *string*
-
-*Inherited from [Order](#interface-order).[takerFeeAssetData](#takerfeeassetdata)*
-
-*Defined in [types/src/index.ts:29](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/types/src/index.ts#L29)*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Type aliases
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Type aliases
-
-
-
-
-
-
-
-### SwapQuote
-
-Ƭ **SwapQuote**: *[MarketBuySwapQuote](#interface-marketbuyswapquote) | [MarketSellSwapQuote](#interface-marketsellswapquote)*
-
-*Defined in [asset-swapper/src/types.ts:205](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/types.ts#L205)*
-
-
-
-
-
-
-## Object literals
-
-### `Const` affiliateFeeUtils
-
-#### ▪ **affiliateFeeUtils**: *object*
-
-*Defined in [asset-swapper/src/utils/affiliate_fee_utils.ts:7](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/utils/affiliate_fee_utils.ts#L7)*
-
-#### getTotalEthAmountWithAffiliateFee
-
-▸ **getTotalEthAmountWithAffiliateFee**(`swapQuoteInfo`: [SwapQuoteInfo](#interface-swapquoteinfo), `feePercentage`: number): *`BigNumber`*
-
-*Defined in [asset-swapper/src/utils/affiliate_fee_utils.ts:13](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/utils/affiliate_fee_utils.ts#L13)*
-
-Get the amount of eth to send for a forwarder contract call (includes takerAssetAmount, protocol fees, and specified affiliate fee amount)
-
-**Parameters:**
-
-Name | Type | Description |
------- | ------ | ------ |
-`swapQuoteInfo` | [SwapQuoteInfo](#interface-swapquoteinfo) | SwapQuoteInfo to generate total eth amount from |
-`feePercentage` | number | Percentage of additive fees to apply to totalTakerAssetAmount + protocol fee. (max 5%) |
-
-**Returns:** *`BigNumber`*
-
-
-
-
-
-
-## Object literals
-
-#### `Const` protocolFeeUtils
-
-#### ▪ **protocolFeeUtils**: *object*
-
-*Defined in [asset-swapper/src/utils/protocol_fee_utils.ts:9](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/utils/protocol_fee_utils.ts#L9)*
-
-#### calculateWorstCaseProtocolFee
-
-▸ **calculateWorstCaseProtocolFee**<**T**>(`orders`: `T`[], `gasPrice`: `BigNumber`): *`BigNumber`*
-
-*Defined in [asset-swapper/src/utils/protocol_fee_utils.ts:27](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/utils/protocol_fee_utils.ts#L27)*
-
-Calculates protocol fee with protofol fee multiplier for each fill.
-
-**Type parameters:**
-
-▪ **T**: *`Order`*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`orders` | `T`[] |
-`gasPrice` | `BigNumber` |
-
-**Returns:** *`BigNumber`*
-
-#### getGasPriceEstimationOrThrowAsync
-
-▸ **getGasPriceEstimationOrThrowAsync**(): *`Promise`*
-
-*Defined in [asset-swapper/src/utils/protocol_fee_utils.ts:13](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/asset-swapper/src/utils/protocol_fee_utils.ts#L13)*
-
-Gets 'fast' gas price from Eth Gas Station.
-
-**Returns:** *`Promise`*
-
-
-
-
-
-
-## Type aliases
-
-
-
-
-
-### ConstructorStateMutability
-
-Ƭ **ConstructorStateMutability**: *"nonpayable" | "payable"*
-
-*Defined in [ethereum-types/src/index.ts:84](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L84)*
-
-___
-
-
-
-
-
-
-
-### EIP1193Event
-
-Ƭ **EIP1193Event**: *"accountsChanged" | "networkChanged" | "close" | "connect" | "notification"*
-
-*Defined in [ethereum-types/src/index.ts:70](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L70)*
-
-Interface for providers that conform to EIP 1193
-Source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md
-
-___
-
-
-
-
-
-
-
-### JSONRPCErrorCallback
-
-Ƭ **JSONRPCErrorCallback**: *function*
-
-*Defined in [ethereum-types/src/index.ts:3](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L3)*
-
-#### Type declaration:
-
-▸ (`err`: `Error` | null, `result?`: [JSONRPCResponsePayload](#interface-jsonrpcresponsepayload)): *void*
-
-**Parameters:**
-
-Name | Type |
------- | ------ |
-`err` | `Error` \| null |
-`result?` | [JSONRPCResponsePayload](#interface-jsonrpcresponsepayload) |
-
-___
-
-
-
-
-
-
-
-
-
-### StateMutability
-
-Ƭ **StateMutability**: *"pure" | "view" | [ConstructorStateMutability](#constructorstatemutability)*
-
-*Defined in [ethereum-types/src/index.ts:85](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L85)*
-
-___
-
-### SupportedProvider
-
-Ƭ **SupportedProvider**: *[Web3JsProvider](_ethereum_types_src_index_.md#web3jsprovider) | [GanacheProvider](#interface-ganacheprovider) | [EIP1193Provider](#interface-eip1193provider) | [ZeroExProvider](#interface-zeroexprovider)*
-
-*Defined in [ethereum-types/src/index.ts:9](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L9)*
-
-Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library
-Read more about Providers in the guides section of the 0x docs.
-
-___
-
-
-
-
-
-### Web3JsProvider
-
-Ƭ **Web3JsProvider**: *[Web3JsV1Provider](#interface-web3jsv1provider) | [Web3JsV2Provider](#interface-web3jsv2provider) | [Web3JsV3Provider](#interface-web3jsv3provider)*
-
-*Defined in [ethereum-types/src/index.ts:11](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/ethereum-types/src/index.ts#L11)*
-
-
-
-
-
-
-## Variables
-
-### `Const` DEFAULT_TOKEN_PRECISION
-
-• **DEFAULT_TOKEN_PRECISION**: *`18`* = 18
-
-*Defined in [orderbook/src/order_provider/base_order_provider.ts:9](https://github.com/0xProject/0x-monorepo/blob/36d7afd2a/packages/orderbook/src/order_provider/base_order_provider.ts#L9)*
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Type aliases
-
-
diff --git a/packages/asset-swapper/package-lock.json b/packages/asset-swapper/package-lock.json
deleted file mode 100644
index 5bfd95859e..0000000000
--- a/packages/asset-swapper/package-lock.json
+++ /dev/null
@@ -1,1839 +0,0 @@
-{
- "name": "@0x/asset-swapper",
- "version": "2.1.0-beta.0",
- "lockfileVersion": 1,
- "requires": true,
- "dependencies": {
- "ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
- "dev": true
- },
- "ansi-styles": {
- "version": "3.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
- "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
- "dev": true,
- "requires": {
- "color-convert": "^1.9.0"
- }
- },
- "arr-diff": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
- "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=",
- "dev": true
- },
- "arr-flatten": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz",
- "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==",
- "dev": true
- },
- "arr-union": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz",
- "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=",
- "dev": true
- },
- "array-unique": {
- "version": "0.3.2",
- "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz",
- "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
- "dev": true
- },
- "assign-symbols": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
- "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
- "dev": true
- },
- "atob": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
- "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
- "dev": true
- },
- "base": {
- "version": "0.11.2",
- "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz",
- "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==",
- "dev": true,
- "requires": {
- "cache-base": "^1.0.1",
- "class-utils": "^0.3.5",
- "component-emitter": "^1.2.1",
- "define-property": "^1.0.0",
- "isobject": "^3.0.1",
- "mixin-deep": "^1.2.0",
- "pascalcase": "^0.1.1"
- },
- "dependencies": {
- "define-property": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
- "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^1.0.0"
- }
- },
- "is-accessor-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
- "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-data-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
- "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-descriptor": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
- "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
- "dev": true,
- "requires": {
- "is-accessor-descriptor": "^1.0.0",
- "is-data-descriptor": "^1.0.0",
- "kind-of": "^6.0.2"
- }
- }
- }
- },
- "big.js": {
- "version": "5.2.2",
- "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
- "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
- "dev": true
- },
- "braces": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz",
- "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==",
- "dev": true,
- "requires": {
- "arr-flatten": "^1.1.0",
- "array-unique": "^0.3.2",
- "extend-shallow": "^2.0.1",
- "fill-range": "^4.0.0",
- "isobject": "^3.0.1",
- "repeat-element": "^1.1.2",
- "snapdragon": "^0.8.1",
- "snapdragon-node": "^2.0.1",
- "split-string": "^3.0.2",
- "to-regex": "^3.0.1"
- },
- "dependencies": {
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- }
- }
- },
- "cache-base": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz",
- "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==",
- "dev": true,
- "requires": {
- "collection-visit": "^1.0.0",
- "component-emitter": "^1.2.1",
- "get-value": "^2.0.6",
- "has-value": "^1.0.0",
- "isobject": "^3.0.1",
- "set-value": "^2.0.0",
- "to-object-path": "^0.3.0",
- "union-value": "^1.0.0",
- "unset-value": "^1.0.0"
- }
- },
- "camelcase": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
- "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
- "dev": true
- },
- "chalk": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
- "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
- "dev": true,
- "requires": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
- },
- "dependencies": {
- "supports-color": {
- "version": "5.5.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
- "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
- "dev": true,
- "requires": {
- "has-flag": "^3.0.0"
- }
- }
- }
- },
- "class-utils": {
- "version": "0.3.6",
- "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
- "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==",
- "dev": true,
- "requires": {
- "arr-union": "^3.1.0",
- "define-property": "^0.2.5",
- "isobject": "^3.0.0",
- "static-extend": "^0.1.1"
- },
- "dependencies": {
- "define-property": {
- "version": "0.2.5",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
- "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^0.1.0"
- }
- }
- }
- },
- "cliui": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
- "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
- "dev": true,
- "requires": {
- "string-width": "^3.1.0",
- "strip-ansi": "^5.2.0",
- "wrap-ansi": "^5.1.0"
- }
- },
- "collection-visit": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
- "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=",
- "dev": true,
- "requires": {
- "map-visit": "^1.0.0",
- "object-visit": "^1.0.0"
- }
- },
- "color-convert": {
- "version": "1.9.3",
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
- "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
- "dev": true,
- "requires": {
- "color-name": "1.1.3"
- }
- },
- "color-name": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
- "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
- "dev": true
- },
- "component-emitter": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
- "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==",
- "dev": true
- },
- "copy-descriptor": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
- "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
- "dev": true
- },
- "core-util-is": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
- "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
- "dev": true
- },
- "cross-spawn": {
- "version": "6.0.5",
- "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
- "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
- "dev": true,
- "requires": {
- "nice-try": "^1.0.4",
- "path-key": "^2.0.1",
- "semver": "^5.5.0",
- "shebang-command": "^1.2.0",
- "which": "^1.2.9"
- }
- },
- "debug": {
- "version": "2.6.9",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
- "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "dev": true,
- "requires": {
- "ms": "2.0.0"
- }
- },
- "decamelize": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
- "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
- "dev": true
- },
- "decode-uri-component": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
- "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
- "dev": true
- },
- "define-property": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
- "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==",
- "dev": true,
- "requires": {
- "is-descriptor": "^1.0.2",
- "isobject": "^3.0.1"
- },
- "dependencies": {
- "is-accessor-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
- "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-data-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
- "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-descriptor": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
- "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
- "dev": true,
- "requires": {
- "is-accessor-descriptor": "^1.0.0",
- "is-data-descriptor": "^1.0.0",
- "kind-of": "^6.0.2"
- }
- }
- }
- },
- "detect-file": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz",
- "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=",
- "dev": true
- },
- "emoji-regex": {
- "version": "7.0.3",
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
- "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
- "dev": true
- },
- "emojis-list": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz",
- "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=",
- "dev": true
- },
- "end-of-stream": {
- "version": "1.4.4",
- "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
- "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
- "dev": true,
- "requires": {
- "once": "^1.4.0"
- }
- },
- "enhanced-resolve": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz",
- "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==",
- "dev": true,
- "requires": {
- "graceful-fs": "^4.1.2",
- "memory-fs": "^0.4.0",
- "tapable": "^1.0.0"
- }
- },
- "errno": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
- "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
- "dev": true,
- "requires": {
- "prr": "~1.0.1"
- }
- },
- "escape-string-regexp": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
- "dev": true
- },
- "execa": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
- "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
- "dev": true,
- "requires": {
- "cross-spawn": "^6.0.0",
- "get-stream": "^4.0.0",
- "is-stream": "^1.1.0",
- "npm-run-path": "^2.0.0",
- "p-finally": "^1.0.0",
- "signal-exit": "^3.0.0",
- "strip-eof": "^1.0.0"
- }
- },
- "expand-brackets": {
- "version": "2.1.4",
- "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
- "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=",
- "dev": true,
- "requires": {
- "debug": "^2.3.3",
- "define-property": "^0.2.5",
- "extend-shallow": "^2.0.1",
- "posix-character-classes": "^0.1.0",
- "regex-not": "^1.0.0",
- "snapdragon": "^0.8.1",
- "to-regex": "^3.0.1"
- },
- "dependencies": {
- "define-property": {
- "version": "0.2.5",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
- "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^0.1.0"
- }
- },
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- }
- }
- },
- "expand-tilde": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz",
- "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=",
- "dev": true,
- "requires": {
- "homedir-polyfill": "^1.0.1"
- }
- },
- "extend-shallow": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
- "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=",
- "dev": true,
- "requires": {
- "assign-symbols": "^1.0.0",
- "is-extendable": "^1.0.1"
- },
- "dependencies": {
- "is-extendable": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
- "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
- "dev": true,
- "requires": {
- "is-plain-object": "^2.0.4"
- }
- }
- }
- },
- "extglob": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
- "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==",
- "dev": true,
- "requires": {
- "array-unique": "^0.3.2",
- "define-property": "^1.0.0",
- "expand-brackets": "^2.1.4",
- "extend-shallow": "^2.0.1",
- "fragment-cache": "^0.2.1",
- "regex-not": "^1.0.0",
- "snapdragon": "^0.8.1",
- "to-regex": "^3.0.1"
- },
- "dependencies": {
- "define-property": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
- "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^1.0.0"
- }
- },
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- },
- "is-accessor-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
- "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-data-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
- "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-descriptor": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
- "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
- "dev": true,
- "requires": {
- "is-accessor-descriptor": "^1.0.0",
- "is-data-descriptor": "^1.0.0",
- "kind-of": "^6.0.2"
- }
- }
- }
- },
- "fill-range": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
- "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=",
- "dev": true,
- "requires": {
- "extend-shallow": "^2.0.1",
- "is-number": "^3.0.0",
- "repeat-string": "^1.6.1",
- "to-regex-range": "^2.1.0"
- },
- "dependencies": {
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- }
- }
- },
- "find-up": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
- "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
- "dev": true,
- "requires": {
- "locate-path": "^3.0.0"
- }
- },
- "findup-sync": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz",
- "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==",
- "dev": true,
- "requires": {
- "detect-file": "^1.0.0",
- "is-glob": "^4.0.0",
- "micromatch": "^3.0.4",
- "resolve-dir": "^1.0.1"
- }
- },
- "for-in": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
- "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=",
- "dev": true
- },
- "fragment-cache": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
- "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=",
- "dev": true,
- "requires": {
- "map-cache": "^0.2.2"
- }
- },
- "get-caller-file": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
- "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
- "dev": true
- },
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "dev": true,
- "requires": {
- "pump": "^3.0.0"
- }
- },
- "get-value": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
- "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=",
- "dev": true
- },
- "global-modules": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-2.0.0.tgz",
- "integrity": "sha512-NGbfmJBp9x8IxyJSd1P+otYK8vonoJactOogrVfFRIAEY1ukil8RSKDz2Yo7wh1oihl51l/r6W4epkeKJHqL8A==",
- "dev": true,
- "requires": {
- "global-prefix": "^3.0.0"
- },
- "dependencies": {
- "global-prefix": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz",
- "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==",
- "dev": true,
- "requires": {
- "ini": "^1.3.5",
- "kind-of": "^6.0.2",
- "which": "^1.3.1"
- }
- }
- }
- },
- "global-prefix": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz",
- "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=",
- "dev": true,
- "requires": {
- "expand-tilde": "^2.0.2",
- "homedir-polyfill": "^1.0.1",
- "ini": "^1.3.4",
- "is-windows": "^1.0.1",
- "which": "^1.2.14"
- }
- },
- "graceful-fs": {
- "version": "4.2.2",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz",
- "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==",
- "dev": true
- },
- "has-flag": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
- "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
- "dev": true
- },
- "has-value": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz",
- "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=",
- "dev": true,
- "requires": {
- "get-value": "^2.0.6",
- "has-values": "^1.0.0",
- "isobject": "^3.0.0"
- }
- },
- "has-values": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz",
- "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=",
- "dev": true,
- "requires": {
- "is-number": "^3.0.0",
- "kind-of": "^4.0.0"
- },
- "dependencies": {
- "kind-of": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz",
- "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "homedir-polyfill": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
- "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==",
- "dev": true,
- "requires": {
- "parse-passwd": "^1.0.0"
- }
- },
- "import-local": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
- "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==",
- "dev": true,
- "requires": {
- "pkg-dir": "^3.0.0",
- "resolve-cwd": "^2.0.0"
- }
- },
- "inherits": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
- "dev": true
- },
- "ini": {
- "version": "1.3.5",
- "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
- "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
- "dev": true
- },
- "interpret": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
- "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==",
- "dev": true
- },
- "invert-kv": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz",
- "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==",
- "dev": true
- },
- "is-accessor-descriptor": {
- "version": "0.1.6",
- "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
- "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=",
- "dev": true,
- "requires": {
- "kind-of": "^3.0.2"
- },
- "dependencies": {
- "kind-of": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
- "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "is-buffer": {
- "version": "1.1.6",
- "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
- "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==",
- "dev": true
- },
- "is-data-descriptor": {
- "version": "0.1.4",
- "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz",
- "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=",
- "dev": true,
- "requires": {
- "kind-of": "^3.0.2"
- },
- "dependencies": {
- "kind-of": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
- "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "is-descriptor": {
- "version": "0.1.6",
- "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz",
- "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==",
- "dev": true,
- "requires": {
- "is-accessor-descriptor": "^0.1.6",
- "is-data-descriptor": "^0.1.4",
- "kind-of": "^5.0.0"
- },
- "dependencies": {
- "kind-of": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
- "dev": true
- }
- }
- },
- "is-extendable": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
- "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
- "dev": true
- },
- "is-extglob": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
- "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",
- "dev": true
- },
- "is-fullwidth-code-point": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
- "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
- "dev": true
- },
- "is-glob": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
- "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
- "dev": true,
- "requires": {
- "is-extglob": "^2.1.1"
- }
- },
- "is-number": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
- "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=",
- "dev": true,
- "requires": {
- "kind-of": "^3.0.2"
- },
- "dependencies": {
- "kind-of": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
- "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "is-plain-object": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
- "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
- "dev": true,
- "requires": {
- "isobject": "^3.0.1"
- }
- },
- "is-stream": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
- "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
- "dev": true
- },
- "is-windows": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
- "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
- "dev": true
- },
- "isarray": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
- "dev": true
- },
- "isexe": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
- "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
- "dev": true
- },
- "isobject": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
- "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
- "dev": true
- },
- "json5": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
- "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
- "dev": true,
- "requires": {
- "minimist": "^1.2.0"
- }
- },
- "kind-of": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
- "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
- "dev": true
- },
- "lcid": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz",
- "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==",
- "dev": true,
- "requires": {
- "invert-kv": "^2.0.0"
- }
- },
- "loader-utils": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
- "integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==",
- "dev": true,
- "requires": {
- "big.js": "^5.2.2",
- "emojis-list": "^2.0.0",
- "json5": "^1.0.1"
- }
- },
- "locate-path": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
- "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
- "dev": true,
- "requires": {
- "p-locate": "^3.0.0",
- "path-exists": "^3.0.0"
- }
- },
- "map-age-cleaner": {
- "version": "0.1.3",
- "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz",
- "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==",
- "dev": true,
- "requires": {
- "p-defer": "^1.0.0"
- }
- },
- "map-cache": {
- "version": "0.2.2",
- "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz",
- "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
- "dev": true
- },
- "map-visit": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
- "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=",
- "dev": true,
- "requires": {
- "object-visit": "^1.0.0"
- }
- },
- "mem": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
- "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==",
- "dev": true,
- "requires": {
- "map-age-cleaner": "^0.1.1",
- "mimic-fn": "^2.0.0",
- "p-is-promise": "^2.0.0"
- }
- },
- "memory-fs": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz",
- "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=",
- "dev": true,
- "requires": {
- "errno": "^0.1.3",
- "readable-stream": "^2.0.1"
- }
- },
- "micromatch": {
- "version": "3.1.10",
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz",
- "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==",
- "dev": true,
- "requires": {
- "arr-diff": "^4.0.0",
- "array-unique": "^0.3.2",
- "braces": "^2.3.1",
- "define-property": "^2.0.2",
- "extend-shallow": "^3.0.2",
- "extglob": "^2.0.4",
- "fragment-cache": "^0.2.1",
- "kind-of": "^6.0.2",
- "nanomatch": "^1.2.9",
- "object.pick": "^1.3.0",
- "regex-not": "^1.0.0",
- "snapdragon": "^0.8.1",
- "to-regex": "^3.0.2"
- }
- },
- "mimic-fn": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
- "dev": true
- },
- "minimist": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
- "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
- "dev": true
- },
- "mixin-deep": {
- "version": "1.3.2",
- "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
- "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
- "dev": true,
- "requires": {
- "for-in": "^1.0.2",
- "is-extendable": "^1.0.1"
- },
- "dependencies": {
- "is-extendable": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz",
- "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==",
- "dev": true,
- "requires": {
- "is-plain-object": "^2.0.4"
- }
- }
- }
- },
- "ms": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
- "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
- "dev": true
- },
- "nanomatch": {
- "version": "1.2.13",
- "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
- "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==",
- "dev": true,
- "requires": {
- "arr-diff": "^4.0.0",
- "array-unique": "^0.3.2",
- "define-property": "^2.0.2",
- "extend-shallow": "^3.0.2",
- "fragment-cache": "^0.2.1",
- "is-windows": "^1.0.2",
- "kind-of": "^6.0.2",
- "object.pick": "^1.3.0",
- "regex-not": "^1.0.0",
- "snapdragon": "^0.8.1",
- "to-regex": "^3.0.1"
- }
- },
- "nice-try": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
- "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
- "dev": true
- },
- "npm-run-path": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
- "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
- "dev": true,
- "requires": {
- "path-key": "^2.0.0"
- }
- },
- "object-copy": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz",
- "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=",
- "dev": true,
- "requires": {
- "copy-descriptor": "^0.1.0",
- "define-property": "^0.2.5",
- "kind-of": "^3.0.3"
- },
- "dependencies": {
- "define-property": {
- "version": "0.2.5",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
- "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^0.1.0"
- }
- },
- "kind-of": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
- "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "object-visit": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
- "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=",
- "dev": true,
- "requires": {
- "isobject": "^3.0.0"
- }
- },
- "object.pick": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz",
- "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=",
- "dev": true,
- "requires": {
- "isobject": "^3.0.1"
- }
- },
- "once": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
- "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
- "dev": true,
- "requires": {
- "wrappy": "1"
- }
- },
- "os-locale": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz",
- "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==",
- "dev": true,
- "requires": {
- "execa": "^1.0.0",
- "lcid": "^2.0.0",
- "mem": "^4.0.0"
- }
- },
- "p-defer": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz",
- "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=",
- "dev": true
- },
- "p-finally": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
- "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
- "dev": true
- },
- "p-is-promise": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz",
- "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==",
- "dev": true
- },
- "p-limit": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz",
- "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==",
- "dev": true,
- "requires": {
- "p-try": "^2.0.0"
- }
- },
- "p-locate": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
- "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
- "dev": true,
- "requires": {
- "p-limit": "^2.0.0"
- }
- },
- "p-try": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
- "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
- "dev": true
- },
- "parse-passwd": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
- "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
- "dev": true
- },
- "pascalcase": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
- "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
- "dev": true
- },
- "path-exists": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
- "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
- "dev": true
- },
- "path-key": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
- "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
- "dev": true
- },
- "pkg-dir": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz",
- "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==",
- "dev": true,
- "requires": {
- "find-up": "^3.0.0"
- }
- },
- "posix-character-classes": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
- "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=",
- "dev": true
- },
- "process-nextick-args": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
- "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
- "dev": true
- },
- "prr": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
- "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
- "dev": true
- },
- "pump": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
- "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
- "dev": true,
- "requires": {
- "end-of-stream": "^1.1.0",
- "once": "^1.3.1"
- }
- },
- "readable-stream": {
- "version": "2.3.6",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
- "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
- "dev": true,
- "requires": {
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.3",
- "isarray": "~1.0.0",
- "process-nextick-args": "~2.0.0",
- "safe-buffer": "~5.1.1",
- "string_decoder": "~1.1.1",
- "util-deprecate": "~1.0.1"
- }
- },
- "regex-not": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
- "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==",
- "dev": true,
- "requires": {
- "extend-shallow": "^3.0.2",
- "safe-regex": "^1.1.0"
- }
- },
- "repeat-element": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz",
- "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==",
- "dev": true
- },
- "repeat-string": {
- "version": "1.6.1",
- "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
- "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
- "dev": true
- },
- "require-directory": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
- "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
- "dev": true
- },
- "require-main-filename": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
- "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
- "dev": true
- },
- "resolve-cwd": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz",
- "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=",
- "dev": true,
- "requires": {
- "resolve-from": "^3.0.0"
- }
- },
- "resolve-dir": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz",
- "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=",
- "dev": true,
- "requires": {
- "expand-tilde": "^2.0.0",
- "global-modules": "^1.0.0"
- },
- "dependencies": {
- "global-modules": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz",
- "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==",
- "dev": true,
- "requires": {
- "global-prefix": "^1.0.1",
- "is-windows": "^1.0.1",
- "resolve-dir": "^1.0.0"
- }
- }
- }
- },
- "resolve-from": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
- "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
- "dev": true
- },
- "resolve-url": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
- "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",
- "dev": true
- },
- "ret": {
- "version": "0.1.15",
- "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
- "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
- "dev": true
- },
- "safe-buffer": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
- "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
- "dev": true
- },
- "safe-regex": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
- "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
- "dev": true,
- "requires": {
- "ret": "~0.1.10"
- }
- },
- "semver": {
- "version": "5.7.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
- "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
- "dev": true
- },
- "set-blocking": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
- "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
- "dev": true
- },
- "set-value": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
- "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==",
- "dev": true,
- "requires": {
- "extend-shallow": "^2.0.1",
- "is-extendable": "^0.1.1",
- "is-plain-object": "^2.0.3",
- "split-string": "^3.0.1"
- },
- "dependencies": {
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- }
- }
- },
- "shebang-command": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
- "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
- "dev": true,
- "requires": {
- "shebang-regex": "^1.0.0"
- }
- },
- "shebang-regex": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
- "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
- "dev": true
- },
- "signal-exit": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
- "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
- "dev": true
- },
- "snapdragon": {
- "version": "0.8.2",
- "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
- "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==",
- "dev": true,
- "requires": {
- "base": "^0.11.1",
- "debug": "^2.2.0",
- "define-property": "^0.2.5",
- "extend-shallow": "^2.0.1",
- "map-cache": "^0.2.2",
- "source-map": "^0.5.6",
- "source-map-resolve": "^0.5.0",
- "use": "^3.1.0"
- },
- "dependencies": {
- "define-property": {
- "version": "0.2.5",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
- "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^0.1.0"
- }
- },
- "extend-shallow": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
- "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
- "dev": true,
- "requires": {
- "is-extendable": "^0.1.0"
- }
- }
- }
- },
- "snapdragon-node": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz",
- "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==",
- "dev": true,
- "requires": {
- "define-property": "^1.0.0",
- "isobject": "^3.0.0",
- "snapdragon-util": "^3.0.1"
- },
- "dependencies": {
- "define-property": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
- "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^1.0.0"
- }
- },
- "is-accessor-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz",
- "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-data-descriptor": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz",
- "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==",
- "dev": true,
- "requires": {
- "kind-of": "^6.0.0"
- }
- },
- "is-descriptor": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz",
- "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==",
- "dev": true,
- "requires": {
- "is-accessor-descriptor": "^1.0.0",
- "is-data-descriptor": "^1.0.0",
- "kind-of": "^6.0.2"
- }
- }
- }
- },
- "snapdragon-util": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz",
- "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==",
- "dev": true,
- "requires": {
- "kind-of": "^3.2.0"
- },
- "dependencies": {
- "kind-of": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
- "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "source-map": {
- "version": "0.5.7",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
- "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
- "dev": true
- },
- "source-map-resolve": {
- "version": "0.5.2",
- "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz",
- "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==",
- "dev": true,
- "requires": {
- "atob": "^2.1.1",
- "decode-uri-component": "^0.2.0",
- "resolve-url": "^0.2.1",
- "source-map-url": "^0.4.0",
- "urix": "^0.1.0"
- }
- },
- "source-map-url": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz",
- "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=",
- "dev": true
- },
- "split-string": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
- "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==",
- "dev": true,
- "requires": {
- "extend-shallow": "^3.0.0"
- }
- },
- "static-extend": {
- "version": "0.1.2",
- "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
- "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=",
- "dev": true,
- "requires": {
- "define-property": "^0.2.5",
- "object-copy": "^0.1.0"
- },
- "dependencies": {
- "define-property": {
- "version": "0.2.5",
- "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz",
- "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=",
- "dev": true,
- "requires": {
- "is-descriptor": "^0.1.0"
- }
- }
- }
- },
- "string-width": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
- "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
- "dev": true,
- "requires": {
- "emoji-regex": "^7.0.1",
- "is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^5.1.0"
- }
- },
- "string_decoder": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
- "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
- "dev": true,
- "requires": {
- "safe-buffer": "~5.1.0"
- }
- },
- "strip-ansi": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
- "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
- "dev": true,
- "requires": {
- "ansi-regex": "^4.1.0"
- }
- },
- "strip-eof": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
- "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
- "dev": true
- },
- "supports-color": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
- "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
- "dev": true,
- "requires": {
- "has-flag": "^3.0.0"
- }
- },
- "tapable": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz",
- "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==",
- "dev": true
- },
- "to-object-path": {
- "version": "0.3.0",
- "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz",
- "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=",
- "dev": true,
- "requires": {
- "kind-of": "^3.0.2"
- },
- "dependencies": {
- "kind-of": {
- "version": "3.2.2",
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
- "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
- "dev": true,
- "requires": {
- "is-buffer": "^1.1.5"
- }
- }
- }
- },
- "to-regex": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz",
- "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==",
- "dev": true,
- "requires": {
- "define-property": "^2.0.2",
- "extend-shallow": "^3.0.2",
- "regex-not": "^1.0.2",
- "safe-regex": "^1.1.0"
- }
- },
- "to-regex-range": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz",
- "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=",
- "dev": true,
- "requires": {
- "is-number": "^3.0.0",
- "repeat-string": "^1.6.1"
- }
- },
- "union-value": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz",
- "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==",
- "dev": true,
- "requires": {
- "arr-union": "^3.1.0",
- "get-value": "^2.0.6",
- "is-extendable": "^0.1.1",
- "set-value": "^2.0.1"
- }
- },
- "unset-value": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz",
- "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=",
- "dev": true,
- "requires": {
- "has-value": "^0.3.1",
- "isobject": "^3.0.0"
- },
- "dependencies": {
- "has-value": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz",
- "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=",
- "dev": true,
- "requires": {
- "get-value": "^2.0.3",
- "has-values": "^0.1.4",
- "isobject": "^2.0.0"
- },
- "dependencies": {
- "isobject": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
- "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
- "dev": true,
- "requires": {
- "isarray": "1.0.0"
- }
- }
- }
- },
- "has-values": {
- "version": "0.1.4",
- "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz",
- "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=",
- "dev": true
- }
- }
- },
- "urix": {
- "version": "0.1.0",
- "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
- "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=",
- "dev": true
- },
- "use": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
- "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==",
- "dev": true
- },
- "util-deprecate": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
- "dev": true
- },
- "v8-compile-cache": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz",
- "integrity": "sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w==",
- "dev": true
- },
- "webpack-cli": {
- "version": "3.3.9",
- "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.9.tgz",
- "integrity": "sha512-xwnSxWl8nZtBl/AFJCOn9pG7s5CYUYdZxmmukv+fAHLcBIHM36dImfpQg3WfShZXeArkWlf6QRw24Klcsv8a5A==",
- "dev": true,
- "requires": {
- "chalk": "2.4.2",
- "cross-spawn": "6.0.5",
- "enhanced-resolve": "4.1.0",
- "findup-sync": "3.0.0",
- "global-modules": "2.0.0",
- "import-local": "2.0.0",
- "interpret": "1.2.0",
- "loader-utils": "1.2.3",
- "supports-color": "6.1.0",
- "v8-compile-cache": "2.0.3",
- "yargs": "13.2.4"
- }
- },
- "which": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
- "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
- "dev": true,
- "requires": {
- "isexe": "^2.0.0"
- }
- },
- "which-module": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
- "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
- "dev": true
- },
- "wrap-ansi": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
- "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
- "dev": true,
- "requires": {
- "ansi-styles": "^3.2.0",
- "string-width": "^3.0.0",
- "strip-ansi": "^5.0.0"
- }
- },
- "wrappy": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
- "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
- "dev": true
- },
- "y18n": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
- "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
- "dev": true
- },
- "yargs": {
- "version": "13.2.4",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz",
- "integrity": "sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg==",
- "dev": true,
- "requires": {
- "cliui": "^5.0.0",
- "find-up": "^3.0.0",
- "get-caller-file": "^2.0.1",
- "os-locale": "^3.1.0",
- "require-directory": "^2.1.1",
- "require-main-filename": "^2.0.0",
- "set-blocking": "^2.0.0",
- "string-width": "^3.0.0",
- "which-module": "^2.0.0",
- "y18n": "^4.0.0",
- "yargs-parser": "^13.1.0"
- }
- },
- "yargs-parser": {
- "version": "13.1.1",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
- "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
- "dev": true,
- "requires": {
- "camelcase": "^5.0.0",
- "decamelize": "^1.2.0"
- }
- }
- }
-}
diff --git a/packages/asset-swapper/package.json b/packages/asset-swapper/package.json
deleted file mode 100644
index f862f59b3d..0000000000
--- a/packages/asset-swapper/package.json
+++ /dev/null
@@ -1,95 +0,0 @@
-{
- "name": "@0x/asset-swapper",
- "version": "16.66.19",
- "private": true,
- "engines": {
- "node": ">=6.12"
- },
- "description": "Convenience package for discovering and buying assets on-chain and off-chain.",
- "main": "lib/src/index.js",
- "types": "lib/src/index.d.ts",
- "scripts": {},
- "config": {
- "publicInterfaceContracts": "ERC20BridgeSampler,BalanceChecker,FakeTaker",
- "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
- "abis": "./test/generated-artifacts/@(ApproximateBuys|BalanceChecker|BalancerSampler|BalancerV2BatchSampler|BalancerV2Common|BalancerV2Sampler|BancorSampler|BancorV3Sampler|CompoundSampler|CurveSampler|DODOSampler|DODOV2Sampler|ERC20BridgeSampler|FakeTaker|GMXSampler|IBalancer|IBalancerV2Vault|IBancor|IBancorV3|ICurve|IGMX|IMStable|IMooniswap|IMultiBridge|IPlatypus|IShell|IUniswapExchangeQuotes|IUniswapV2Router01|KyberDmmSampler|LidoSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|NativeOrderSampler|PlatypusSampler|SamplerUtils|ShellSampler|SynthetixSampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UniswapV3Sampler|UtilitySampler|VelodromeSampler|WooPPSampler).json",
- "postpublish": {
- "assets": []
- }
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/0xProject/protocol.git"
- },
- "author": "David Sun",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/0xProject/protocol/issues"
- },
- "homepage": "https://0x.org/asset-swapper",
- "gitpkg": {
- "registry": "git@github.com:0xProject/gitpkg-registry.git"
- },
- "dependencies": {
- "@0x/assert": "^3.0.35",
- "@0x/base-contract": "^7.0.0",
- "@0x/contract-addresses": "^7.4.0",
- "@0x/contract-wrappers": "^13.22.11",
- "@0x/contracts-erc20": "^3.3.52",
- "@0x/contracts-zero-ex": "^0.38.1",
- "@0x/dev-utils": "^5.0.0",
- "@0x/fast-abi": "^0.0.5",
- "@0x/json-schemas": "^6.4.4",
- "@0x/neon-router": "^0.3.5",
- "@0x/protocol-utils": "^11.17.1",
- "@0x/quote-server": "^8.0.0",
- "@0x/types": "^3.3.6",
- "@0x/utils": "^7.0.0",
- "@0x/web3-wrapper": "^8.0.0",
- "@balancer-labs/sdk": "0.1.6",
- "@bancor/sdk": "0.2.9",
- "@ethersproject/abi": "^5.0.1",
- "@ethersproject/address": "^5.0.1",
- "@ethersproject/contracts": "^5.0.1",
- "@ethersproject/providers": "^5.0.4",
- "@ethersproject/strings": "^5.0.10",
- "axios": "^0.21.1",
- "axios-mock-adapter": "^1.19.0",
- "balancer-labs-sor-v1": "npm:@balancer-labs/sor@0.3.2",
- "ethereum-types": "^3.7.1",
- "graphql": "^15.4.0",
- "graphql-request": "^3.4.0",
- "heartbeats": "^5.0.1",
- "lodash": "^4.17.15",
- "msw": "^0.44.2"
- },
- "devDependencies": {
- "@0x/abi-gen": "^5.8.1",
- "@0x/contracts-gen": "^2.0.47",
- "@0x/contracts-test-utils": "^5.4.42",
- "@0x/sol-compiler": "^4.8.2",
- "@0x/subproviders": "^7.0.0",
- "@0x/ts-doc-gen": "^0.0.28",
- "@0x/tslint-config": "^4.1.4",
- "@types/lodash": "4.14.137",
- "@types/mocha": "^5.2.7",
- "@types/node": "12.12.54",
- "chai": "^4.0.1",
- "chai-as-promised": "^7.1.0",
- "chai-bignumber": "^3.0.0",
- "dirty-chai": "^2.0.1",
- "gitpkg": "https://github.com/0xProject/gitpkg.git",
- "mocha": "^6.2.0",
- "npm-run-all": "^4.1.2",
- "nyc": "^11.0.1",
- "shx": "^0.2.2",
- "tslint": "^6.1.3",
- "typedoc": "~0.16.11",
- "typemoq": "^2.1.0",
- "typescript": "4.6.3"
- },
- "publishConfig": {
- "access": "public"
- },
- "gitHead": "4f91bfd907996b2f4dd383778b50c479c2602b56"
-}
diff --git a/packages/asset-swapper/src/artifacts.ts b/packages/asset-swapper/src/artifacts.ts
deleted file mode 100644
index 9ea4a461e9..0000000000
--- a/packages/asset-swapper/src/artifacts.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * -----------------------------------------------------------------------------
- * Warning: This file is auto-generated by contracts-gen. Don't edit manually.
- * -----------------------------------------------------------------------------
- */
-import { ContractArtifact } from 'ethereum-types';
-
-import * as BalanceChecker from '../generated-artifacts/BalanceChecker.json';
-import * as ERC20BridgeSampler from '../generated-artifacts/ERC20BridgeSampler.json';
-import * as FakeTaker from '../generated-artifacts/FakeTaker.json';
-export const artifacts = {
- ERC20BridgeSampler: ERC20BridgeSampler as ContractArtifact,
- BalanceChecker: BalanceChecker as ContractArtifact,
- FakeTaker: FakeTaker as ContractArtifact,
-};
diff --git a/packages/asset-swapper/src/constants.ts b/packages/asset-swapper/src/constants.ts
deleted file mode 100644
index c78f2b692e..0000000000
--- a/packages/asset-swapper/src/constants.ts
+++ /dev/null
@@ -1,128 +0,0 @@
-import { ChainId } from '@0x/contract-addresses';
-import { SignatureType } from '@0x/protocol-utils';
-import { BigNumber, logUtils } from '@0x/utils';
-
-import {
- AffiliateFeeType,
- ExchangeProxyContractOpts,
- LogFunction,
- OrderPrunerOpts,
- OrderPrunerPermittedFeeTypes,
- RfqRequestOpts,
- SwapQuoteGetOutputOpts,
- SwapQuoteRequestOpts,
- SwapQuoterOpts,
-} from './types';
-import {
- DEFAULT_GET_MARKET_ORDERS_OPTS,
- DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID,
- DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID,
-} from './utils/market_operation_utils/constants';
-
-const ZERO_EX_GAS_API_URL = 'https://gas.api.0x.org/source/median';
-const NULL_BYTES = '0x';
-const NULL_ERC20_ASSET_DATA = '0xf47261b00000000000000000000000000000000000000000000000000000000000000000';
-const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
-const MAINNET_CHAIN_ID = 1;
-const ONE_SECOND_MS = 1000;
-const ONE_MINUTE_SECS = 60;
-const ONE_MINUTE_MS = ONE_SECOND_MS * ONE_MINUTE_SECS;
-const DEFAULT_PER_PAGE = 1000;
-const ALT_MM_IMPUTED_INDICATIVE_EXPIRY_SECONDS = 180;
-
-const DEFAULT_ORDER_PRUNER_OPTS: OrderPrunerOpts = {
- expiryBufferMs: 120000, // 2 minutes
- permittedOrderFeeTypes: new Set([OrderPrunerPermittedFeeTypes.NoFees]), // Default asset-swapper for CFL oriented fee types
-};
-
-// 6 seconds polling interval
-const PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS = 6000;
-const PROTOCOL_FEE_MULTIPLIER = new BigNumber(0);
-
-// default 50% buffer for selecting native orders to be aggregated with other sources
-const MARKET_UTILS_AMOUNT_BUFFER_PERCENTAGE = 0.5;
-
-export const ZERO_AMOUNT = new BigNumber(0);
-const DEFAULT_SWAP_QUOTER_OPTS: SwapQuoterOpts = {
- chainId: ChainId.Mainnet,
- orderRefreshIntervalMs: 10000, // 10 seconds
- ...DEFAULT_ORDER_PRUNER_OPTS,
- samplerGasLimit: 500e6,
- zeroExGasApiUrl: ZERO_EX_GAS_API_URL,
- rfqt: {
- integratorsWhitelist: [],
- makerAssetOfferings: {},
- txOriginBlacklist: new Set(),
- },
- tokenAdjacencyGraph: DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID[ChainId.Mainnet],
-};
-
-const DEFAULT_EXCHANGE_PROXY_EXTENSION_CONTRACT_OPTS: ExchangeProxyContractOpts = {
- isFromETH: false,
- isToETH: false,
- affiliateFee: {
- feeType: AffiliateFeeType.None,
- recipient: NULL_ADDRESS,
- buyTokenFeeAmount: ZERO_AMOUNT,
- sellTokenFeeAmount: ZERO_AMOUNT,
- },
- refundReceiver: NULL_ADDRESS,
- isMetaTransaction: false,
- shouldSellEntireBalance: false,
-};
-
-const DEFAULT_EXCHANGE_PROXY_SWAP_QUOTE_GET_OPTS: SwapQuoteGetOutputOpts = {
- extensionContractOpts: DEFAULT_EXCHANGE_PROXY_EXTENSION_CONTRACT_OPTS,
-};
-
-const DEFAULT_SWAP_QUOTE_REQUEST_OPTS: SwapQuoteRequestOpts = {
- ...DEFAULT_GET_MARKET_ORDERS_OPTS,
-};
-
-const DEFAULT_RFQT_REQUEST_OPTS: Partial = {
- makerEndpointMaxResponseTimeMs: 1000,
-};
-
-export const DEFAULT_INFO_LOGGER: LogFunction = (obj, msg) =>
- logUtils.log(`${msg ? `${msg}: ` : ''}${JSON.stringify(obj)}`);
-export const DEFAULT_WARNING_LOGGER: LogFunction = (obj, msg) =>
- logUtils.warn(`${msg ? `${msg}: ` : ''}${JSON.stringify(obj)}`);
-
-const EMPTY_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
-export const INVALID_SIGNATURE = { signatureType: SignatureType.Invalid, v: 1, r: EMPTY_BYTES32, s: EMPTY_BYTES32 };
-
-export { DEFAULT_FEE_SCHEDULE, DEFAULT_GAS_SCHEDULE } from './utils/market_operation_utils/constants';
-
-export const POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS = new BigNumber(30000);
-
-export const KEEP_ALIVE_TTL = 5 * 60 * ONE_SECOND_MS;
-
-export const constants = {
- ZERO_EX_GAS_API_URL,
- PROTOCOL_FEE_MULTIPLIER,
- POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS,
- NULL_BYTES,
- ZERO_AMOUNT,
- NULL_ADDRESS,
- MAINNET_CHAIN_ID,
- DEFAULT_ORDER_PRUNER_OPTS,
- ETHER_TOKEN_DECIMALS: 18,
- ONE_AMOUNT: new BigNumber(1),
- ONE_SECOND_MS,
- ONE_MINUTE_MS,
- DEFAULT_SWAP_QUOTER_OPTS,
- DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID,
- DEFAULT_SWAP_QUOTE_REQUEST_OPTS,
- DEFAULT_EXCHANGE_PROXY_SWAP_QUOTE_GET_OPTS,
- DEFAULT_EXCHANGE_PROXY_EXTENSION_CONTRACT_OPTS,
- DEFAULT_PER_PAGE,
- DEFAULT_RFQT_REQUEST_OPTS,
- NULL_ERC20_ASSET_DATA,
- PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS,
- MARKET_UTILS_AMOUNT_BUFFER_PERCENTAGE,
- BRIDGE_ASSET_DATA_PREFIX: '0xdc1600f3',
- DEFAULT_INFO_LOGGER,
- DEFAULT_WARNING_LOGGER,
- EMPTY_BYTES32,
- ALT_MM_IMPUTED_INDICATIVE_EXPIRY_SECONDS,
-};
diff --git a/packages/asset-swapper/src/errors.ts b/packages/asset-swapper/src/errors.ts
deleted file mode 100644
index 8ce06f2905..0000000000
--- a/packages/asset-swapper/src/errors.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { BigNumber } from '@0x/utils';
-
-import { SwapQuoterError } from './types';
-
-/**
- * Error class representing insufficient asset liquidity
- */
-export class InsufficientAssetLiquidityError extends Error {
- /**
- * The amount availabe to fill (in base units) factoring in slippage.
- */
- public amountAvailableToFill: BigNumber;
- /**
- * @param amountAvailableToFill The amount availabe to fill (in base units) factoring in slippage
- */
- constructor(amountAvailableToFill: BigNumber) {
- super(SwapQuoterError.InsufficientAssetLiquidity);
- this.amountAvailableToFill = amountAvailableToFill;
- // Setting prototype so instanceof works. See https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
- Object.setPrototypeOf(this, InsufficientAssetLiquidityError.prototype);
- }
-}
diff --git a/packages/asset-swapper/src/globals.d.ts b/packages/asset-swapper/src/globals.d.ts
deleted file mode 100644
index c5df161a64..0000000000
--- a/packages/asset-swapper/src/globals.d.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-declare module '*.json' {
- const json: any;
- /* tslint:disable */
- export default json;
- /* tslint:enable */
-}
-
-declare module 'heartbeats';
diff --git a/packages/asset-swapper/src/index.ts b/packages/asset-swapper/src/index.ts
deleted file mode 100644
index 7f1dc8fe78..0000000000
--- a/packages/asset-swapper/src/index.ts
+++ /dev/null
@@ -1,196 +0,0 @@
-export {
- AwaitTransactionSuccessOpts,
- ContractFunctionObj,
- ContractTxFunctionObj,
- SendTransactionOpts,
-} from '@0x/base-contract';
-export { ContractAddresses, ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
-export {
- V4RFQFirmQuote,
- V4RFQIndicativeQuote,
- V4SignedRfqOrder,
- TakerRequestQueryParamsUnnested as TakerRequestQueryParams,
-} from '@0x/quote-server';
-export { Asset, AssetPairsItem, DecodedLogEvent, EventCallback, IndexedFilterValues } from '@0x/types';
-export { BigNumber } from '@0x/utils';
-export {
- RfqOrderFields,
- LimitOrderFields,
- FillQuoteTransformerOrderType,
- RfqOrder,
- LimitOrder,
- Signature,
- SignatureType,
-} from '@0x/protocol-utils';
-export { AxiosInstance } from 'axios';
-export {
- AbiDefinition,
- BlockParam,
- BlockParamLiteral,
- CallData,
- CompilerOpts,
- CompilerSettings,
- CompilerSettingsMetadata,
- ConstructorAbi,
- ConstructorStateMutability,
- ContractAbi,
- ContractArtifact,
- ContractChainData,
- ContractChains,
- ContractEventArg,
- DataItem,
- DecodedLogArgs,
- DevdocOutput,
- EIP1193Event,
- EIP1193Provider,
- EventAbi,
- EventParameter,
- EvmBytecodeOutput,
- EvmBytecodeOutputLinkReferences,
- EvmOutput,
- FallbackAbi,
- FunctionAbi,
- GanacheProvider,
- GethCallOverrides,
- JSONRPCErrorCallback,
- JSONRPCRequestPayload,
- JSONRPCResponseError,
- JSONRPCResponsePayload,
- LogWithDecodedArgs,
- MethodAbi,
- OptimizerSettings,
- OutputField,
- ParamDescription,
- RevertErrorAbi,
- StandardContractOutput,
- StateMutability,
- SupportedProvider,
- TupleDataItem,
- TxData,
- TxDataPayable,
- Web3JsProvider,
- Web3JsV1Provider,
- Web3JsV2Provider,
- Web3JsV3Provider,
- ZeroExProvider,
-} from 'ethereum-types';
-export { artifacts } from './artifacts';
-export { InsufficientAssetLiquidityError } from './errors';
-export { SwapQuoteConsumer } from './quote_consumers/swap_quote_consumer';
-export { SwapQuoter, Orderbook } from './swap_quoter';
-export {
- AltOffering,
- AltRfqMakerAssetOfferings,
- AffiliateFeeType,
- AffiliateFeeAmount,
- AssetSwapperContractAddresses,
- CalldataInfo,
- ExchangeProxyContractOpts,
- ExchangeProxyRefundReceiver,
- GetExtensionContractTypeOpts,
- Integrator,
- LogFunction,
- MarketBuySwapQuote,
- MarketOperation,
- MarketSellSwapQuote,
- MockedRfqQuoteResponse,
- OrderPrunerPermittedFeeTypes,
- RfqMakerAssetOfferings,
- RfqFirmQuoteValidator,
- RfqRequestOpts,
- SamplerOverrides,
- SignedNativeOrder,
- SignedOrder,
- SwapQuote,
- SwapQuoteConsumerBase,
- SwapQuoteConsumerError,
- SwapQuoteConsumerOpts,
- SwapQuoteExecutionOpts,
- SwapQuoteGetOutputOpts,
- SwapQuoteInfo,
- SwapQuoteOrdersBreakdown,
- SwapQuoteRequestOpts,
- SwapQuoterError,
- SwapQuoterOpts,
- SwapQuoterRfqOpts,
- SamplerMetrics,
-} from './types';
-export { affiliateFeeUtils } from './utils/affiliate_fee_utils';
-export {
- IRfqClient,
- RfqClientV1Price,
- RfqClientV1PriceRequest,
- RfqClientV1PriceResponse,
- RfqClientV1Quote,
- RfqClientV1QuoteRequest,
- RfqClientV1QuoteResponse,
-} from './utils/irfq_client';
-export {
- DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID,
- DEFAULT_GAS_SCHEDULE,
- SOURCE_FLAGS,
- BUY_SOURCE_FILTER_BY_CHAIN_ID,
- SELL_SOURCE_FILTER_BY_CHAIN_ID,
- NATIVE_FEE_TOKEN_BY_CHAIN_ID,
- ZERO_AMOUNT,
-} from './utils/market_operation_utils/constants';
-export {
- Parameters,
- SamplerContractCall,
- SamplerContractOperation,
-} from './utils/market_operation_utils/sampler_contract_operation';
-export {
- BalancerFillData,
- BancorFillData,
- CurveFillData,
- CurveFunctionSelectors,
- CurveInfo,
- DexSample,
- DODOFillData,
- ERC20BridgeSource,
- ExchangeProxyOverhead,
- FeeSchedule,
- GasSchedule,
- Fill,
- FillAdjustor,
- FillData,
- GetMarketOrdersRfqOpts,
- LiquidityProviderFillData,
- LiquidityProviderRegistry,
- MooniswapFillData,
- MultiHopFillData,
- NativeRfqOrderFillData,
- NativeLimitOrderFillData,
- NativeFillData,
- OptimizedMarketOrder,
- SourceQuoteOperation,
- UniswapV2FillData,
-} from './utils/market_operation_utils/types';
-
-export { TokenAdjacencyGraph, TokenAdjacencyGraphBuilder } from './utils/token_adjacency_graph';
-export { IdentityFillAdjustor } from './utils/market_operation_utils/identity_fill_adjustor';
-export { ProtocolFeeUtils } from './utils/protocol_fee_utils';
-export {
- BridgeQuoteReportEntry,
- jsonifyFillData,
- MultiHopQuoteReportEntry,
- NativeLimitOrderQuoteReportEntry,
- NativeRfqOrderQuoteReportEntry,
- QuoteReport,
- QuoteReportEntry,
- ExtendedQuoteReport,
- ExtendedQuoteReportSources,
- ExtendedQuoteReportEntry,
- ExtendedQuoteReportIndexedEntry,
- ExtendedQuoteReportIndexedEntryOutbound,
- PriceComparisonsReport,
-} from './utils/quote_report_generator';
-export { QuoteRequestor, V4RFQIndicativeQuoteMM } from './utils/quote_requestor';
-export { ERC20BridgeSamplerContract, BalanceCheckerContract, FakeTakerContract } from './wrappers';
-import { ERC20BridgeSource } from './utils/market_operation_utils/types';
-export type Native = ERC20BridgeSource.Native;
-export type MultiHop = ERC20BridgeSource.MultiHop;
-
-export { rfqtMocker, RfqtQuoteEndpoint } from './utils/rfqt_mocker';
-
-export { adjustOutput } from './utils/market_operation_utils/fills';
diff --git a/packages/asset-swapper/src/noop_samplers/AaveV2Sampler.ts b/packages/asset-swapper/src/noop_samplers/AaveV2Sampler.ts
deleted file mode 100644
index c56f12601e..0000000000
--- a/packages/asset-swapper/src/noop_samplers/AaveV2Sampler.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { BigNumber } from '@0x/utils';
-
-import { ZERO_AMOUNT } from '../constants';
-export interface AaveInfo {
- lendingPool: string;
- aToken: string;
- underlyingToken: string;
-}
-// tslint:disable-next-line:no-unnecessary-class
-export class AaveV2Sampler {
- public static sampleSellsFromAaveV2(
- aaveInfo: AaveInfo,
- takerToken: string,
- makerToken: string,
- takerTokenAmounts: BigNumber[],
- ): BigNumber[] {
- // Deposit/Withdrawal underlying <-> aToken is always 1:1
- if (
- (takerToken.toLowerCase() === aaveInfo.aToken.toLowerCase() &&
- makerToken.toLowerCase() === aaveInfo.underlyingToken.toLowerCase()) ||
- (takerToken.toLowerCase() === aaveInfo.underlyingToken.toLowerCase() &&
- makerToken.toLowerCase() === aaveInfo.aToken.toLowerCase())
- ) {
- return takerTokenAmounts;
- }
-
- // Not matching the reserve return 0 results
- const numSamples = takerTokenAmounts.length;
-
- const makerTokenAmounts = new Array(numSamples);
- makerTokenAmounts.fill(ZERO_AMOUNT);
- return makerTokenAmounts;
- }
-
- public static sampleBuysFromAaveV2(
- aaveInfo: AaveInfo,
- takerToken: string,
- makerToken: string,
- makerTokenAmounts: BigNumber[],
- ): BigNumber[] {
- // Deposit/Withdrawal underlying <-> aToken is always 1:1
- if (
- (takerToken.toLowerCase() === aaveInfo.aToken.toLowerCase() &&
- makerToken.toLowerCase() === aaveInfo.underlyingToken.toLowerCase()) ||
- (takerToken.toLowerCase() === aaveInfo.underlyingToken.toLowerCase() &&
- makerToken.toLowerCase() === aaveInfo.aToken.toLowerCase())
- ) {
- return makerTokenAmounts;
- }
-
- // Not matching the reserve return 0 results
- const numSamples = makerTokenAmounts.length;
- const takerTokenAmounts = new Array(numSamples);
- takerTokenAmounts.fill(ZERO_AMOUNT);
- return takerTokenAmounts;
- }
-}
diff --git a/packages/asset-swapper/src/noop_samplers/GeistSampler.ts b/packages/asset-swapper/src/noop_samplers/GeistSampler.ts
deleted file mode 100644
index 3e43de6efe..0000000000
--- a/packages/asset-swapper/src/noop_samplers/GeistSampler.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { BigNumber } from '@0x/utils';
-
-import { ZERO_AMOUNT } from '../constants';
-export interface GeistInfo {
- lendingPool: string;
- gToken: string;
- underlyingToken: string;
-}
-// tslint:disable-next-line:no-unnecessary-class
-export class GeistSampler {
- public static sampleSellsFromGeist(
- geistInfo: GeistInfo,
- takerToken: string,
- makerToken: string,
- takerTokenAmounts: BigNumber[],
- ): BigNumber[] {
- // Deposit/Withdrawal underlying <-> gToken is always 1:1
- if (
- (takerToken.toLowerCase() === geistInfo.gToken.toLowerCase() &&
- makerToken.toLowerCase() === geistInfo.underlyingToken.toLowerCase()) ||
- (takerToken.toLowerCase() === geistInfo.underlyingToken.toLowerCase() &&
- makerToken.toLowerCase() === geistInfo.gToken.toLowerCase())
- ) {
- return takerTokenAmounts;
- }
-
- // Not matching the reserve return 0 results
- const numSamples = takerTokenAmounts.length;
-
- const makerTokenAmounts = new Array(numSamples);
- makerTokenAmounts.fill(ZERO_AMOUNT);
- return makerTokenAmounts;
- }
-
- public static sampleBuysFromGeist(
- geistInfo: GeistInfo,
- takerToken: string,
- makerToken: string,
- makerTokenAmounts: BigNumber[],
- ): BigNumber[] {
- // Deposit/Withdrawal underlying <-> gToken is always 1:1
- if (
- (takerToken.toLowerCase() === geistInfo.gToken.toLowerCase() &&
- makerToken.toLowerCase() === geistInfo.underlyingToken.toLowerCase()) ||
- (takerToken.toLowerCase() === geistInfo.underlyingToken.toLowerCase() &&
- makerToken.toLowerCase() === geistInfo.gToken.toLowerCase())
- ) {
- return makerTokenAmounts;
- }
-
- // Not matching the reserve return 0 results
- const numSamples = makerTokenAmounts.length;
- const takerTokenAmounts = new Array(numSamples);
- takerTokenAmounts.fill(ZERO_AMOUNT);
- return takerTokenAmounts;
- }
-}
diff --git a/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts
deleted file mode 100644
index aafb6cfaf0..0000000000
--- a/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts
+++ /dev/null
@@ -1,733 +0,0 @@
-import { ChainId, ContractAddresses } from '@0x/contract-addresses';
-import { IZeroExContract } from '@0x/contract-wrappers';
-import {
- encodeAffiliateFeeTransformerData,
- encodeCurveLiquidityProviderData,
- encodeFillQuoteTransformerData,
- encodePayTakerTransformerData,
- encodePositiveSlippageFeeTransformerData,
- encodeWethTransformerData,
- ETH_TOKEN_ADDRESS,
- FillQuoteTransformerOrderType,
- FillQuoteTransformerSide,
- findTransformerNonce,
-} from '@0x/protocol-utils';
-import { BigNumber } from '@0x/utils';
-import * as _ from 'lodash';
-
-import { constants, POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS } from '../constants';
-import {
- AffiliateFeeType,
- CalldataInfo,
- ExchangeProxyContractOpts,
- MarketBuySwapQuote,
- MarketOperation,
- MarketSellSwapQuote,
- SwapQuote,
- SwapQuoteConsumerBase,
- SwapQuoteConsumerOpts,
- SwapQuoteExecutionOpts,
- SwapQuoteGetOutputOpts,
-} from '../types';
-import { assert } from '../utils/assert';
-import {
- CURVE_LIQUIDITY_PROVIDER_BY_CHAIN_ID,
- NATIVE_FEE_TOKEN_BY_CHAIN_ID,
-} from '../utils/market_operation_utils/constants';
-import {
- CurveFillData,
- ERC20BridgeSource,
- FinalUniswapV3FillData,
- LiquidityProviderFillData,
- NativeRfqOrderFillData,
- OptimizedMarketBridgeOrder,
- OptimizedMarketOrder,
- UniswapV2FillData,
-} from '../utils/market_operation_utils/types';
-
-import {
- multiplexPlpEncoder,
- multiplexRfqEncoder,
- MultiplexSubcall,
- multiplexTransformERC20Encoder,
- multiplexUniswapEncoder,
-} from './multiplex_encoders';
-import {
- getFQTTransformerDataFromOptimizedOrders,
- isBuyQuote,
- isDirectSwapCompatible,
- isMultiplexBatchFillCompatible,
- isMultiplexMultiHopFillCompatible,
- requiresTransformERC20,
-} from './quote_consumer_utils';
-
-const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
-const { NULL_ADDRESS, NULL_BYTES, ZERO_AMOUNT } = constants;
-
-// use the same order in IPancakeSwapFeature.sol
-const PANCAKE_SWAP_FORKS = [
- ERC20BridgeSource.PancakeSwap,
- ERC20BridgeSource.PancakeSwapV2,
- ERC20BridgeSource.BakerySwap,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.ApeSwap,
- ERC20BridgeSource.CheeseSwap,
-];
-const FAKE_PROVIDER: any = {
- sendAsync(): void {
- return;
- },
-};
-
-export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase {
- public readonly chainId: ChainId;
- public readonly transformerNonces: {
- wethTransformer: number;
- payTakerTransformer: number;
- fillQuoteTransformer: number;
- affiliateFeeTransformer: number;
- positiveSlippageFeeTransformer: number;
- };
-
- private readonly _exchangeProxy: IZeroExContract;
-
- constructor(public readonly contractAddresses: ContractAddresses, options: Partial = {}) {
- const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
- assert.isNumber('chainId', chainId);
- this.chainId = chainId;
- this.contractAddresses = contractAddresses;
- this._exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, FAKE_PROVIDER);
- this.transformerNonces = {
- wethTransformer: findTransformerNonce(
- contractAddresses.transformers.wethTransformer,
- contractAddresses.exchangeProxyTransformerDeployer,
- ),
- payTakerTransformer: findTransformerNonce(
- contractAddresses.transformers.payTakerTransformer,
- contractAddresses.exchangeProxyTransformerDeployer,
- ),
- fillQuoteTransformer: findTransformerNonce(
- contractAddresses.transformers.fillQuoteTransformer,
- contractAddresses.exchangeProxyTransformerDeployer,
- ),
- affiliateFeeTransformer: findTransformerNonce(
- contractAddresses.transformers.affiliateFeeTransformer,
- contractAddresses.exchangeProxyTransformerDeployer,
- ),
- positiveSlippageFeeTransformer: findTransformerNonce(
- contractAddresses.transformers.positiveSlippageFeeTransformer,
- contractAddresses.exchangeProxyTransformerDeployer,
- ),
- };
- }
-
- public async getCalldataOrThrowAsync(
- quote: MarketBuySwapQuote | MarketSellSwapQuote,
- opts: Partial = {},
- ): Promise {
- const optsWithDefaults: ExchangeProxyContractOpts = {
- ...constants.DEFAULT_EXCHANGE_PROXY_EXTENSION_CONTRACT_OPTS,
- ...opts.extensionContractOpts,
- };
- // tslint:disable-next-line:no-object-literal-type-assertion
- const { refundReceiver, affiliateFee, isFromETH, isToETH, shouldSellEntireBalance } = optsWithDefaults;
-
- const sellToken = quote.takerToken;
- const buyToken = quote.makerToken;
-
- // Take the bounds from the worst case
- const sellAmount = BigNumber.max(
- quote.bestCaseQuoteInfo.totalTakerAmount,
- quote.worstCaseQuoteInfo.totalTakerAmount,
- );
- let minBuyAmount = quote.worstCaseQuoteInfo.makerAmount;
- let ethAmount = quote.worstCaseQuoteInfo.protocolFeeInWeiAmount;
-
- if (isFromETH) {
- ethAmount = ethAmount.plus(sellAmount);
- }
-
- const slippedOrders = slipNonNativeOrders(quote);
-
- // VIP routes.
- if (
- this.chainId === ChainId.Mainnet &&
- isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap])
- ) {
- const source = slippedOrders[0].source;
- const fillData = (slippedOrders[0] as OptimizedMarketBridgeOrder).fillData;
- return {
- calldataHexString: this._exchangeProxy
- .sellToUniswap(
- fillData.tokenAddressPath.map((a, i) => {
- if (i === 0 && isFromETH) {
- return ETH_TOKEN_ADDRESS;
- }
- if (i === fillData.tokenAddressPath.length - 1 && isToETH) {
- return ETH_TOKEN_ADDRESS;
- }
- return a;
- }),
- sellAmount,
- minBuyAmount,
- source === ERC20BridgeSource.SushiSwap,
- )
- .getABIEncodedTransactionData(),
- ethAmount: isFromETH ? sellAmount : ZERO_AMOUNT,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
-
- if (
- this.chainId === ChainId.Mainnet &&
- isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.UniswapV3])
- ) {
- const fillData = (slippedOrders[0] as OptimizedMarketBridgeOrder).fillData;
- let _calldataHexString;
- if (isFromETH) {
- _calldataHexString = this._exchangeProxy
- .sellEthForTokenToUniswapV3(fillData.uniswapPath, minBuyAmount, NULL_ADDRESS)
- .getABIEncodedTransactionData();
- } else if (isToETH) {
- _calldataHexString = this._exchangeProxy
- .sellTokenForEthToUniswapV3(fillData.uniswapPath, sellAmount, minBuyAmount, NULL_ADDRESS)
- .getABIEncodedTransactionData();
- } else {
- _calldataHexString = this._exchangeProxy
- .sellTokenForTokenToUniswapV3(fillData.uniswapPath, sellAmount, minBuyAmount, NULL_ADDRESS)
- .getABIEncodedTransactionData();
- }
- return {
- calldataHexString: _calldataHexString,
- ethAmount: isFromETH ? sellAmount : ZERO_AMOUNT,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
-
- if (
- this.chainId === ChainId.BSC &&
- isDirectSwapCompatible(quote, optsWithDefaults, [
- ERC20BridgeSource.PancakeSwap,
- ERC20BridgeSource.PancakeSwapV2,
- ERC20BridgeSource.BakerySwap,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.ApeSwap,
- ERC20BridgeSource.CheeseSwap,
- ])
- ) {
- const source = slippedOrders[0].source;
- const fillData = (slippedOrders[0] as OptimizedMarketBridgeOrder).fillData;
- return {
- calldataHexString: this._exchangeProxy
- .sellToPancakeSwap(
- fillData.tokenAddressPath.map((a, i) => {
- if (i === 0 && isFromETH) {
- return ETH_TOKEN_ADDRESS;
- }
- if (i === fillData.tokenAddressPath.length - 1 && isToETH) {
- return ETH_TOKEN_ADDRESS;
- }
- return a;
- }),
- sellAmount,
- minBuyAmount,
- PANCAKE_SWAP_FORKS.indexOf(source),
- )
- .getABIEncodedTransactionData(),
- ethAmount: isFromETH ? sellAmount : ZERO_AMOUNT,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
-
- if (
- [ChainId.Mainnet, ChainId.BSC].includes(this.chainId) &&
- isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.LiquidityProvider])
- ) {
- const fillData = (slippedOrders[0] as OptimizedMarketBridgeOrder).fillData;
- const target = fillData.poolAddress;
- return {
- calldataHexString: this._exchangeProxy
- .sellToLiquidityProvider(
- isFromETH ? ETH_TOKEN_ADDRESS : sellToken,
- isToETH ? ETH_TOKEN_ADDRESS : buyToken,
- target,
- NULL_ADDRESS,
- sellAmount,
- minBuyAmount,
- NULL_BYTES,
- )
- .getABIEncodedTransactionData(),
- ethAmount: isFromETH ? sellAmount : ZERO_AMOUNT,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
-
- if (
- this.chainId === ChainId.Mainnet &&
- isDirectSwapCompatible(quote, optsWithDefaults, [ERC20BridgeSource.Curve]) &&
- // Curve VIP cannot currently support WETH buy/sell as the functionality needs to WITHDRAW or DEPOSIT
- // into WETH prior/post the trade.
- // ETH buy/sell is supported
- ![sellToken, buyToken].includes(NATIVE_FEE_TOKEN_BY_CHAIN_ID[ChainId.Mainnet])
- ) {
- const fillData = slippedOrders[0].fillData as CurveFillData;
- return {
- calldataHexString: this._exchangeProxy
- .sellToLiquidityProvider(
- isFromETH ? ETH_TOKEN_ADDRESS : sellToken,
- isToETH ? ETH_TOKEN_ADDRESS : buyToken,
- CURVE_LIQUIDITY_PROVIDER_BY_CHAIN_ID[this.chainId],
- NULL_ADDRESS,
- sellAmount,
- minBuyAmount,
- encodeCurveLiquidityProviderData({
- curveAddress: fillData.pool.poolAddress,
- exchangeFunctionSelector: fillData.pool.exchangeFunctionSelector,
- fromCoinIdx: new BigNumber(fillData.fromTokenIdx),
- toCoinIdx: new BigNumber(fillData.toTokenIdx),
- }),
- )
- .getABIEncodedTransactionData(),
- ethAmount: isFromETH ? sellAmount : ZERO_AMOUNT,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
-
- // RFQT VIP
- if (
- [ChainId.Mainnet, ChainId.Polygon].includes(this.chainId) &&
- !isToETH &&
- !isFromETH &&
- quote.orders.every(o => o.type === FillQuoteTransformerOrderType.Rfq) &&
- !requiresTransformERC20(optsWithDefaults)
- ) {
- const rfqOrdersData = quote.orders.map(o => o.fillData as NativeRfqOrderFillData);
- const fillAmountPerOrder = (() => {
- // Don't think order taker amounts are clipped to actual sell amount
- // (the last one might be too large) so figure them out manually.
- let remaining = sellAmount;
- const fillAmounts = [];
- for (const o of quote.orders) {
- const fillAmount = BigNumber.min(o.takerAmount, remaining);
- fillAmounts.push(fillAmount);
- remaining = remaining.minus(fillAmount);
- }
- return fillAmounts;
- })();
- const callData =
- quote.orders.length === 1
- ? this._exchangeProxy
- .fillRfqOrder(rfqOrdersData[0].order, rfqOrdersData[0].signature, fillAmountPerOrder[0])
- .getABIEncodedTransactionData()
- : this._exchangeProxy
- .batchFillRfqOrders(
- rfqOrdersData.map(d => d.order),
- rfqOrdersData.map(d => d.signature),
- fillAmountPerOrder,
- true,
- )
- .getABIEncodedTransactionData();
- return {
- calldataHexString: callData,
- ethAmount: ZERO_AMOUNT,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
-
- if (this.chainId === ChainId.Mainnet && isMultiplexBatchFillCompatible(quote, optsWithDefaults)) {
- return {
- calldataHexString: this._encodeMultiplexBatchFillCalldata(
- { ...quote, orders: slippedOrders },
- optsWithDefaults,
- ),
- ethAmount,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
- if (this.chainId === ChainId.Mainnet && isMultiplexMultiHopFillCompatible(quote, optsWithDefaults)) {
- return {
- calldataHexString: this._encodeMultiplexMultiHopFillCalldata(
- { ...quote, orders: slippedOrders },
- optsWithDefaults,
- ),
- ethAmount,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead: ZERO_AMOUNT,
- };
- }
-
- // Build up the transforms.
- const transforms = [];
- // Create a WETH wrapper if coming from ETH.
- // Dont add the wethTransformer to CELO. There is no wrap/unwrap logic for CELO.
- if (isFromETH && this.chainId !== ChainId.Celo) {
- transforms.push({
- deploymentNonce: this.transformerNonces.wethTransformer,
- data: encodeWethTransformerData({
- token: ETH_TOKEN_ADDRESS,
- amount: shouldSellEntireBalance ? MAX_UINT256 : sellAmount,
- }),
- });
- }
-
- // If it's two hop we have an intermediate token this is needed to encode the individual FQT
- // and we also want to ensure no dust amount is left in the flash wallet
- const intermediateToken = quote.isTwoHop ? slippedOrders[0].makerToken : NULL_ADDRESS;
- // This transformer will fill the quote.
- if (quote.isTwoHop) {
- const [firstHopOrder, secondHopOrder] = slippedOrders;
- transforms.push({
- deploymentNonce: this.transformerNonces.fillQuoteTransformer,
- data: encodeFillQuoteTransformerData({
- side: FillQuoteTransformerSide.Sell,
- sellToken,
- buyToken: intermediateToken,
- ...getFQTTransformerDataFromOptimizedOrders([firstHopOrder]),
- refundReceiver: refundReceiver || NULL_ADDRESS,
- fillAmount: shouldSellEntireBalance ? MAX_UINT256 : firstHopOrder.takerAmount,
- }),
- });
- transforms.push({
- deploymentNonce: this.transformerNonces.fillQuoteTransformer,
- data: encodeFillQuoteTransformerData({
- side: FillQuoteTransformerSide.Sell,
- buyToken,
- sellToken: intermediateToken,
- ...getFQTTransformerDataFromOptimizedOrders([secondHopOrder]),
- refundReceiver: refundReceiver || NULL_ADDRESS,
- fillAmount: MAX_UINT256,
- }),
- });
- } else {
- const fillAmount = isBuyQuote(quote) ? quote.makerTokenFillAmount : quote.takerTokenFillAmount;
- transforms.push({
- deploymentNonce: this.transformerNonces.fillQuoteTransformer,
- data: encodeFillQuoteTransformerData({
- side: isBuyQuote(quote) ? FillQuoteTransformerSide.Buy : FillQuoteTransformerSide.Sell,
- sellToken,
- buyToken,
- ...getFQTTransformerDataFromOptimizedOrders(slippedOrders),
- refundReceiver: refundReceiver || NULL_ADDRESS,
- fillAmount: !isBuyQuote(quote) && shouldSellEntireBalance ? MAX_UINT256 : fillAmount,
- }),
- });
- }
- // Create a WETH unwrapper if going to ETH.
- // Dont add the wethTransformer on CELO. There is no wrap/unwrap logic for CELO.
- if (isToETH && this.chainId !== ChainId.Celo) {
- transforms.push({
- deploymentNonce: this.transformerNonces.wethTransformer,
- data: encodeWethTransformerData({
- token: NATIVE_FEE_TOKEN_BY_CHAIN_ID[this.chainId],
- amount: MAX_UINT256,
- }),
- });
- }
-
- const { feeType, buyTokenFeeAmount, sellTokenFeeAmount, recipient: feeRecipient } = affiliateFee;
- let gasOverhead = ZERO_AMOUNT;
- if (feeType === AffiliateFeeType.PositiveSlippageFee && feeRecipient !== NULL_ADDRESS) {
- // bestCaseAmountWithSurplus is used to cover gas cost of sending positive slipapge fee to fee recipient
- // this helps avoid sending dust amounts which are not worth the gas cost to transfer
- let bestCaseAmountWithSurplus = quote.bestCaseQuoteInfo.makerAmount
- .plus(
- POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS.multipliedBy(quote.gasPrice).multipliedBy(
- quote.makerAmountPerEth,
- ),
- )
- .integerValue();
- // In the event makerAmountPerEth is unknown, we only allow for positive slippage which is greater than
- // the best case amount
- bestCaseAmountWithSurplus = BigNumber.max(bestCaseAmountWithSurplus, quote.bestCaseQuoteInfo.makerAmount);
- transforms.push({
- deploymentNonce: this.transformerNonces.positiveSlippageFeeTransformer,
- data: encodePositiveSlippageFeeTransformerData({
- token: isToETH ? ETH_TOKEN_ADDRESS : buyToken,
- bestCaseAmount: BigNumber.max(bestCaseAmountWithSurplus, quote.bestCaseQuoteInfo.makerAmount),
- recipient: feeRecipient,
- }),
- });
- // This may not be visible at eth_estimateGas time, so we explicitly add overhead
- gasOverhead = POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS;
- } else if (feeType === AffiliateFeeType.PercentageFee && feeRecipient !== NULL_ADDRESS) {
- // This transformer pays affiliate fees.
- if (buyTokenFeeAmount.isGreaterThan(0)) {
- transforms.push({
- deploymentNonce: this.transformerNonces.affiliateFeeTransformer,
- data: encodeAffiliateFeeTransformerData({
- fees: [
- {
- token: isToETH ? ETH_TOKEN_ADDRESS : buyToken,
- amount: buyTokenFeeAmount,
- recipient: feeRecipient,
- },
- ],
- }),
- });
- // Adjust the minimum buy amount by the fee.
- minBuyAmount = BigNumber.max(0, minBuyAmount.minus(buyTokenFeeAmount));
- }
- if (sellTokenFeeAmount.isGreaterThan(0)) {
- throw new Error('Affiliate fees denominated in sell token are not yet supported');
- }
- }
-
- // Return any unspent sell tokens.
- const payTakerTokens = [sellToken];
- // Return any unspent intermediate tokens for two-hop swaps.
- if (quote.isTwoHop) {
- payTakerTokens.push(intermediateToken);
- }
- // Return any unspent ETH. If ETH is the buy token, it will
- // be returned in TransformERC20Feature rather than PayTakerTransformer.
- if (!isToETH) {
- payTakerTokens.push(ETH_TOKEN_ADDRESS);
- }
- // The final transformer will send all funds to the taker.
- transforms.push({
- deploymentNonce: this.transformerNonces.payTakerTransformer,
- data: encodePayTakerTransformerData({
- tokens: payTakerTokens,
- amounts: [],
- }),
- });
- const TO_ETH_ADDRESS = this.chainId === ChainId.Celo ? this.contractAddresses.etherToken : ETH_TOKEN_ADDRESS;
- const calldataHexString = this._exchangeProxy
- .transformERC20(
- isFromETH ? ETH_TOKEN_ADDRESS : sellToken,
- isToETH ? TO_ETH_ADDRESS : buyToken,
- shouldSellEntireBalance ? MAX_UINT256 : sellAmount,
- minBuyAmount,
- transforms,
- )
- .getABIEncodedTransactionData();
-
- return {
- calldataHexString,
- ethAmount,
- toAddress: this._exchangeProxy.address,
- allowanceTarget: this._exchangeProxy.address,
- gasOverhead,
- };
- }
-
- // tslint:disable-next-line:prefer-function-over-method
- public async executeSwapQuoteOrThrowAsync(
- _quote: SwapQuote,
- _opts: Partial,
- ): Promise {
- throw new Error('Execution not supported for Exchange Proxy quotes');
- }
-
- private _encodeMultiplexBatchFillCalldata(quote: SwapQuote, opts: ExchangeProxyContractOpts): string {
- const subcalls = [];
- for_loop: for (const [i, order] of quote.orders.entries()) {
- switch_statement: switch (order.source) {
- case ERC20BridgeSource.Native:
- if (order.type !== FillQuoteTransformerOrderType.Rfq) {
- // Should never happen because we check `isMultiplexBatchFillCompatible`
- // before calling this function.
- throw new Error('Multiplex batch fill only supported for RFQ native orders');
- }
- subcalls.push({
- id: MultiplexSubcall.Rfq,
- sellAmount: order.takerAmount,
- data: multiplexRfqEncoder.encode({
- order: order.fillData.order,
- signature: order.fillData.signature,
- }),
- });
- break switch_statement;
- case ERC20BridgeSource.UniswapV2:
- case ERC20BridgeSource.SushiSwap:
- subcalls.push({
- id: MultiplexSubcall.UniswapV2,
- sellAmount: order.takerAmount,
- data: multiplexUniswapEncoder.encode({
- tokens: (order.fillData as UniswapV2FillData).tokenAddressPath,
- isSushi: order.source === ERC20BridgeSource.SushiSwap,
- }),
- });
- break switch_statement;
- case ERC20BridgeSource.LiquidityProvider:
- subcalls.push({
- id: MultiplexSubcall.LiquidityProvider,
- sellAmount: order.takerAmount,
- data: multiplexPlpEncoder.encode({
- provider: (order.fillData as LiquidityProviderFillData).poolAddress,
- auxiliaryData: NULL_BYTES,
- }),
- });
- break switch_statement;
- case ERC20BridgeSource.UniswapV3:
- const fillData = (order as OptimizedMarketBridgeOrder).fillData;
- subcalls.push({
- id: MultiplexSubcall.UniswapV3,
- sellAmount: order.takerAmount,
- data: fillData.uniswapPath,
- });
- break switch_statement;
- default:
- const fqtData = encodeFillQuoteTransformerData({
- side: FillQuoteTransformerSide.Sell,
- sellToken: quote.takerToken,
- buyToken: quote.makerToken,
- ...getFQTTransformerDataFromOptimizedOrders(quote.orders.slice(i)),
- refundReceiver: NULL_ADDRESS,
- fillAmount: MAX_UINT256,
- });
- const transformations = [
- { deploymentNonce: this.transformerNonces.fillQuoteTransformer, data: fqtData },
- {
- deploymentNonce: this.transformerNonces.payTakerTransformer,
- data: encodePayTakerTransformerData({
- tokens: [quote.takerToken],
- amounts: [],
- }),
- },
- ];
- subcalls.push({
- id: MultiplexSubcall.TransformERC20,
- sellAmount: BigNumber.sum(...quote.orders.slice(i).map(o => o.takerAmount)),
- data: multiplexTransformERC20Encoder.encode({
- transformations,
- }),
- });
- break for_loop;
- }
- }
- if (opts.isFromETH) {
- return this._exchangeProxy
- .multiplexBatchSellEthForToken(quote.makerToken, subcalls, quote.worstCaseQuoteInfo.makerAmount)
- .getABIEncodedTransactionData();
- } else if (opts.isToETH) {
- return this._exchangeProxy
- .multiplexBatchSellTokenForEth(
- quote.takerToken,
- subcalls,
- quote.worstCaseQuoteInfo.totalTakerAmount,
- quote.worstCaseQuoteInfo.makerAmount,
- )
- .getABIEncodedTransactionData();
- } else {
- return this._exchangeProxy
- .multiplexBatchSellTokenForToken(
- quote.takerToken,
- quote.makerToken,
- subcalls,
- quote.worstCaseQuoteInfo.totalTakerAmount,
- quote.worstCaseQuoteInfo.makerAmount,
- )
- .getABIEncodedTransactionData();
- }
- }
-
- private _encodeMultiplexMultiHopFillCalldata(quote: SwapQuote, opts: ExchangeProxyContractOpts): string {
- const subcalls = [];
- const [firstHopOrder, secondHopOrder] = quote.orders;
- const intermediateToken = firstHopOrder.makerToken;
- const tokens = [quote.takerToken, intermediateToken, quote.makerToken];
-
- for (const order of [firstHopOrder, secondHopOrder]) {
- switch (order.source) {
- case ERC20BridgeSource.UniswapV2:
- case ERC20BridgeSource.SushiSwap:
- subcalls.push({
- id: MultiplexSubcall.UniswapV2,
- data: multiplexUniswapEncoder.encode({
- tokens: (order.fillData as UniswapV2FillData).tokenAddressPath,
- isSushi: order.source === ERC20BridgeSource.SushiSwap,
- }),
- });
- break;
- case ERC20BridgeSource.LiquidityProvider:
- subcalls.push({
- id: MultiplexSubcall.LiquidityProvider,
- data: multiplexPlpEncoder.encode({
- provider: (order.fillData as LiquidityProviderFillData).poolAddress,
- auxiliaryData: NULL_BYTES,
- }),
- });
- break;
- case ERC20BridgeSource.UniswapV3:
- subcalls.push({
- id: MultiplexSubcall.UniswapV3,
- data: (order.fillData as FinalUniswapV3FillData).uniswapPath,
- });
- break;
- default:
- // Should never happen because we check `isMultiplexMultiHopFillCompatible`
- // before calling this function.
- throw new Error(`Multiplex multi-hop unsupported source: ${order.source}`);
- }
- }
- if (opts.isFromETH) {
- return this._exchangeProxy
- .multiplexMultiHopSellEthForToken(tokens, subcalls, quote.worstCaseQuoteInfo.makerAmount)
- .getABIEncodedTransactionData();
- } else if (opts.isToETH) {
- return this._exchangeProxy
- .multiplexMultiHopSellTokenForEth(
- tokens,
- subcalls,
- quote.worstCaseQuoteInfo.totalTakerAmount,
- quote.worstCaseQuoteInfo.makerAmount,
- )
- .getABIEncodedTransactionData();
- } else {
- return this._exchangeProxy
- .multiplexMultiHopSellTokenForToken(
- tokens,
- subcalls,
- quote.worstCaseQuoteInfo.totalTakerAmount,
- quote.worstCaseQuoteInfo.makerAmount,
- )
- .getABIEncodedTransactionData();
- }
- }
-}
-
-function slipNonNativeOrders(quote: MarketSellSwapQuote | MarketBuySwapQuote): OptimizedMarketOrder[] {
- const slippage = getMaxQuoteSlippageRate(quote);
- if (slippage === 0) {
- return quote.orders;
- }
- return quote.orders.map(o => {
- if (o.source === ERC20BridgeSource.Native) {
- return o;
- }
- return {
- ...o,
- ...(quote.type === MarketOperation.Sell
- ? {
- makerAmount: o.makerAmount.eq(MAX_UINT256)
- ? MAX_UINT256
- : o.makerAmount.times(1 - slippage).integerValue(BigNumber.ROUND_DOWN),
- }
- : {
- takerAmount: o.takerAmount.eq(MAX_UINT256)
- ? MAX_UINT256
- : o.takerAmount.times(1 + slippage).integerValue(BigNumber.ROUND_UP),
- }),
- };
- });
-}
-
-function getMaxQuoteSlippageRate(quote: MarketBuySwapQuote | MarketSellSwapQuote): number {
- return quote.worstCaseQuoteInfo.slippage;
-}
diff --git a/packages/asset-swapper/src/quote_consumers/multiplex_encoders.ts b/packages/asset-swapper/src/quote_consumers/multiplex_encoders.ts
deleted file mode 100644
index 0f26153719..0000000000
--- a/packages/asset-swapper/src/quote_consumers/multiplex_encoders.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { RfqOrder, SIGNATURE_ABI } from '@0x/protocol-utils';
-import { AbiEncoder } from '@0x/utils';
-
-export enum MultiplexSubcall {
- Invalid,
- Rfq,
- Otc,
- UniswapV2,
- UniswapV3,
- LiquidityProvider,
- TransformERC20,
- BatchSell,
- MultiHopSell,
-}
-export const multiplexTransformERC20Encoder = AbiEncoder.create([
- {
- name: 'transformations',
- type: 'tuple[]',
- components: [
- { name: 'deploymentNonce', type: 'uint32' },
- { name: 'data', type: 'bytes' },
- ],
- },
-]);
-export const multiplexRfqEncoder = AbiEncoder.create([
- { name: 'order', type: 'tuple', components: RfqOrder.STRUCT_ABI },
- { name: 'signature', type: 'tuple', components: SIGNATURE_ABI },
-]);
-export const multiplexUniswapEncoder = AbiEncoder.create([
- { name: 'tokens', type: 'address[]' },
- { name: 'isSushi', type: 'bool' },
-]);
-export const multiplexPlpEncoder = AbiEncoder.create([
- { name: 'provider', type: 'address' },
- { name: 'auxiliaryData', type: 'bytes' },
-]);
diff --git a/packages/asset-swapper/src/quote_consumers/quote_consumer_utils.ts b/packages/asset-swapper/src/quote_consumers/quote_consumer_utils.ts
deleted file mode 100644
index bc31f9022e..0000000000
--- a/packages/asset-swapper/src/quote_consumers/quote_consumer_utils.ts
+++ /dev/null
@@ -1,170 +0,0 @@
-import { FillQuoteTransformerData, FillQuoteTransformerOrderType } from '@0x/protocol-utils';
-
-import { ExchangeProxyContractOpts, MarketBuySwapQuote, MarketOperation, SwapQuote } from '../types';
-import {
- createBridgeDataForBridgeOrder,
- getErc20BridgeSourceToBridgeSource,
-} from '../utils/market_operation_utils/orders';
-import {
- ERC20BridgeSource,
- NativeLimitOrderFillData,
- NativeRfqOrderFillData,
- OptimizedMarketBridgeOrder,
- OptimizedMarketOrder,
- OptimizedMarketOrderBase,
-} from '../utils/market_operation_utils/types';
-
-const MULTIPLEX_BATCH_FILL_SOURCES = [
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.Native,
- ERC20BridgeSource.UniswapV3,
-];
-
-/**
- * Returns true iff a quote can be filled via `MultiplexFeature.batchFill`.
- */
-export function isMultiplexBatchFillCompatible(quote: SwapQuote, opts: ExchangeProxyContractOpts): boolean {
- if (requiresTransformERC20(opts)) {
- return false;
- }
- if (quote.isTwoHop) {
- return false;
- }
- if (quote.orders.map(o => o.type).includes(FillQuoteTransformerOrderType.Limit)) {
- return false;
- }
- // Use Multiplex if the non-fallback sources are a subset of
- // {UniswapV2, Sushiswap, RFQ, PLP, UniswapV3}
- const nonFallbackSources = Object.keys(quote.sourceBreakdown);
- return nonFallbackSources.every(source => MULTIPLEX_BATCH_FILL_SOURCES.includes(source as ERC20BridgeSource));
-}
-
-const MULTIPLEX_MULTIHOP_FILL_SOURCES = [
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.UniswapV3,
-];
-
-/**
- * Returns true iff a quote can be filled via `MultiplexFeature.multiHopFill`.
- */
-export function isMultiplexMultiHopFillCompatible(quote: SwapQuote, opts: ExchangeProxyContractOpts): boolean {
- if (requiresTransformERC20(opts)) {
- return false;
- }
- if (!quote.isTwoHop) {
- return false;
- }
- const [firstHopOrder, secondHopOrder] = quote.orders;
- return (
- MULTIPLEX_MULTIHOP_FILL_SOURCES.includes(firstHopOrder.source) &&
- MULTIPLEX_MULTIHOP_FILL_SOURCES.includes(secondHopOrder.source)
- );
-}
-
-/**
- * Returns true iff a quote can be filled via a VIP feature.
- */
-
-export function isDirectSwapCompatible(
- quote: SwapQuote,
- opts: ExchangeProxyContractOpts,
- directSources: ERC20BridgeSource[],
-): boolean {
- if (requiresTransformERC20(opts)) {
- return false;
- }
- // Must be a single order.
- if (quote.orders.length !== 1) {
- return false;
- }
- const order = quote.orders[0];
- if (!directSources.includes(order.source)) {
- return false;
- }
- return true;
-}
-
-/**
- * Whether a quote is a market buy or not.
- */
-export function isBuyQuote(quote: SwapQuote): quote is MarketBuySwapQuote {
- return quote.type === MarketOperation.Buy;
-}
-
-function isOptimizedBridgeOrder(x: OptimizedMarketOrder): x is OptimizedMarketBridgeOrder {
- return x.type === FillQuoteTransformerOrderType.Bridge;
-}
-
-function isOptimizedLimitOrder(x: OptimizedMarketOrder): x is OptimizedMarketOrderBase {
- return x.type === FillQuoteTransformerOrderType.Limit;
-}
-
-function isOptimizedRfqOrder(x: OptimizedMarketOrder): x is OptimizedMarketOrderBase {
- return x.type === FillQuoteTransformerOrderType.Rfq;
-}
-
-/**
- * Converts the given `OptimizedMarketOrder`s into bridge, limit, and RFQ orders for
- * FillQuoteTransformer.
- */
-export function getFQTTransformerDataFromOptimizedOrders(
- orders: OptimizedMarketOrder[],
-): Pick {
- const fqtData: Pick = {
- bridgeOrders: [],
- limitOrders: [],
- rfqOrders: [],
- fillSequence: [],
- };
-
- for (const order of orders) {
- if (isOptimizedBridgeOrder(order)) {
- fqtData.bridgeOrders.push({
- bridgeData: createBridgeDataForBridgeOrder(order),
- makerTokenAmount: order.makerAmount,
- takerTokenAmount: order.takerAmount,
- source: getErc20BridgeSourceToBridgeSource(order.source),
- });
- } else if (isOptimizedLimitOrder(order)) {
- fqtData.limitOrders.push({
- order: order.fillData.order,
- signature: order.fillData.signature,
- maxTakerTokenFillAmount: order.takerAmount,
- });
- } else if (isOptimizedRfqOrder(order)) {
- fqtData.rfqOrders.push({
- order: order.fillData.order,
- signature: order.fillData.signature,
- maxTakerTokenFillAmount: order.takerAmount,
- });
- } else {
- // Should never happen
- throw new Error('Unknown Order type');
- }
- fqtData.fillSequence.push(order.type);
- }
- return fqtData;
-}
-
-/**
- * Returns true if swap quote must go through `tranformERC20`.
- */
-export function requiresTransformERC20(opts: ExchangeProxyContractOpts): boolean {
- // Is a mtx.
- if (opts.isMetaTransaction) {
- return true;
- }
- // Has an affiliate fee.
- if (!opts.affiliateFee.buyTokenFeeAmount.eq(0) || !opts.affiliateFee.sellTokenFeeAmount.eq(0)) {
- return true;
- }
- // VIP does not support selling the entire balance
- if (opts.shouldSellEntireBalance) {
- return true;
- }
- return false;
-}
diff --git a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts
deleted file mode 100644
index 4f91003407..0000000000
--- a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
-import * as _ from 'lodash';
-
-import { constants } from '../constants';
-import {
- CalldataInfo,
- SwapQuote,
- SwapQuoteConsumerBase,
- SwapQuoteConsumerOpts,
- SwapQuoteExecutionOpts,
- SwapQuoteGetOutputOpts,
-} from '../types';
-import { assert } from '../utils/assert';
-
-import { ExchangeProxySwapQuoteConsumer } from './exchange_proxy_swap_quote_consumer';
-
-export class SwapQuoteConsumer implements SwapQuoteConsumerBase {
- public readonly chainId: number;
-
- private readonly _contractAddresses: ContractAddresses;
- private readonly _exchangeProxyConsumer: ExchangeProxySwapQuoteConsumer;
-
- public static getSwapQuoteConsumer(options: Partial = {}): SwapQuoteConsumer {
- return new SwapQuoteConsumer(options);
- }
-
- constructor(options: Partial = {}) {
- const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options);
- assert.isNumber('chainId', chainId);
-
- this.chainId = chainId;
- this._contractAddresses = options.contractAddresses || getContractAddressesForChainOrThrow(chainId);
- this._exchangeProxyConsumer = new ExchangeProxySwapQuoteConsumer(this._contractAddresses, options);
- }
-
- /**
- * Given a SwapQuote, returns 'CalldataInfo' for a 0x extesion or exchange call. See type definition of CalldataInfo for more information.
- * @param quote An object that conforms to SwapQuote. See type definition for more information.
- * @param opts Options for getting SmartContractParams. See type definition for more information.
- */
- public async getCalldataOrThrowAsync(
- quote: SwapQuote,
- opts: Partial = {},
- ): Promise {
- const consumer = await this._getConsumerForSwapQuoteAsync(opts);
- return consumer.getCalldataOrThrowAsync(quote, opts);
- }
-
- /**
- * Given a SwapQuote and desired rate (in takerAsset), attempt to execute the swap with 0x extension or exchange contract.
- * @param quote An object that conforms to SwapQuote. See type definition for more information.
- * @param opts Options for getting CalldataInfo. See type definition for more information.
- */
- public async executeSwapQuoteOrThrowAsync(
- quote: SwapQuote,
- opts: Partial = {},
- ): Promise {
- const consumer = await this._getConsumerForSwapQuoteAsync(opts);
- return consumer.executeSwapQuoteOrThrowAsync(quote, opts);
- }
-
- private async _getConsumerForSwapQuoteAsync(opts: Partial): Promise {
- return this._exchangeProxyConsumer;
- }
-}
diff --git a/packages/asset-swapper/src/swap_quoter.ts b/packages/asset-swapper/src/swap_quoter.ts
deleted file mode 100644
index b2fad503f8..0000000000
--- a/packages/asset-swapper/src/swap_quoter.ts
+++ /dev/null
@@ -1,620 +0,0 @@
-import { ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
-import { FastABI } from '@0x/fast-abi';
-import { FillQuoteTransformerOrderType, LimitOrder } from '@0x/protocol-utils';
-import { BigNumber, providerUtils } from '@0x/utils';
-import Axios, { AxiosInstance } from 'axios';
-import { BlockParamLiteral, MethodAbi, SupportedProvider, ZeroExProvider } from 'ethereum-types';
-import { Agent as HttpAgent } from 'http';
-import { Agent as HttpsAgent } from 'https';
-import * as _ from 'lodash';
-
-import { artifacts } from './artifacts';
-import { constants, INVALID_SIGNATURE, KEEP_ALIVE_TTL } from './constants';
-import {
- AssetSwapperContractAddresses,
- MarketBuySwapQuote,
- MarketOperation,
- OrderPrunerPermittedFeeTypes,
- RfqRequestOpts,
- SignedNativeOrder,
- SwapQuote,
- SwapQuoteInfo,
- SwapQuoteOrdersBreakdown,
- SwapQuoteRequestOpts,
- SwapQuoterOpts,
- SwapQuoterRfqOpts,
-} from './types';
-import { assert } from './utils/assert';
-import { IRfqClient } from './utils/irfq_client';
-import { MarketOperationUtils } from './utils/market_operation_utils';
-import { BancorService } from './utils/market_operation_utils/bancor_service';
-import { SAMPLER_ADDRESS, SOURCE_FLAGS, ZERO_AMOUNT } from './utils/market_operation_utils/constants';
-import { DexOrderSampler } from './utils/market_operation_utils/sampler';
-import { SourceFilters } from './utils/market_operation_utils/source_filters';
-import {
- ERC20BridgeSource,
- FillData,
- GasSchedule,
- GetMarketOrdersOpts,
- OptimizedMarketOrder,
- OptimizerResultWithReport,
-} from './utils/market_operation_utils/types';
-import { ProtocolFeeUtils } from './utils/protocol_fee_utils';
-import { QuoteRequestor } from './utils/quote_requestor';
-import { QuoteFillResult, simulateBestCaseFill, simulateWorstCaseFill } from './utils/quote_simulation';
-import { ERC20BridgeSamplerContract } from './wrappers';
-
-export abstract class Orderbook {
- public abstract getOrdersAsync(
- makerToken: string,
- takerToken: string,
- pruneFn?: (o: SignedNativeOrder) => boolean,
- ): Promise;
- public abstract getBatchOrdersAsync(
- makerTokens: string[],
- takerToken: string,
- pruneFn?: (o: SignedNativeOrder) => boolean,
- ): Promise;
- // tslint:disable-next-line:prefer-function-over-method
- public async destroyAsync(): Promise {
- return;
- }
-}
-
-// tslint:disable:max-classes-per-file
-export class SwapQuoter {
- public readonly provider: ZeroExProvider;
- public readonly orderbook: Orderbook;
- public readonly expiryBufferMs: number;
- public readonly chainId: number;
- public readonly permittedOrderFeeTypes: Set;
- private readonly _contractAddresses: AssetSwapperContractAddresses;
- private readonly _protocolFeeUtils: ProtocolFeeUtils;
- private readonly _marketOperationUtils: MarketOperationUtils;
- private readonly _rfqtOptions?: SwapQuoterRfqOpts;
- private readonly _quoteRequestorHttpClient: AxiosInstance;
- private readonly _integratorIdsSet: Set;
-
- /**
- * Instantiates a new SwapQuoter instance
- * @param supportedProvider The Provider instance you would like to use for interacting with the Ethereum network.
- * @param orderbook An object that conforms to Orderbook, see type for definition.
- * @param options Initialization options for the SwapQuoter. See type definition for details.
- *
- * @return An instance of SwapQuoter
- */
- constructor(supportedProvider: SupportedProvider, orderbook: Orderbook, options: Partial = {}) {
- const {
- chainId,
- expiryBufferMs,
- permittedOrderFeeTypes,
- samplerGasLimit,
- rfqt,
- tokenAdjacencyGraph,
- liquidityProviderRegistry,
- } = { ...constants.DEFAULT_SWAP_QUOTER_OPTS, ...options };
- const provider = providerUtils.standardizeOrThrow(supportedProvider);
- assert.isValidOrderbook('orderbook', orderbook);
- assert.isNumber('chainId', chainId);
- assert.isNumber('expiryBufferMs', expiryBufferMs);
- this.chainId = chainId;
- this.provider = provider;
- this.orderbook = orderbook;
- this.expiryBufferMs = expiryBufferMs;
- this.permittedOrderFeeTypes = permittedOrderFeeTypes;
-
- this._rfqtOptions = rfqt;
- this._contractAddresses = options.contractAddresses || {
- ...getContractAddressesForChainOrThrow(chainId),
- };
- this._protocolFeeUtils = ProtocolFeeUtils.getInstance(
- constants.PROTOCOL_FEE_UTILS_POLLING_INTERVAL_IN_MS,
- options.zeroExGasApiUrl,
- );
- // Allow the sampler bytecode to be overwritten using geths override functionality
- const samplerBytecode = _.get(artifacts.ERC20BridgeSampler, 'compilerOutput.evm.deployedBytecode.object');
- // Allow address of the Sampler to be overridden, i.e in Ganache where overrides do not work
- const samplerAddress = (options.samplerOverrides && options.samplerOverrides.to) || SAMPLER_ADDRESS;
- const defaultCodeOverrides = samplerBytecode
- ? {
- [samplerAddress]: { code: samplerBytecode },
- }
- : {};
- const samplerOverrides = _.assign(
- { block: BlockParamLiteral.Latest, overrides: defaultCodeOverrides },
- options.samplerOverrides,
- );
- const fastAbi = new FastABI(ERC20BridgeSamplerContract.ABI() as MethodAbi[], { BigNumber });
- const samplerContract = new ERC20BridgeSamplerContract(
- samplerAddress,
- this.provider,
- {
- gas: samplerGasLimit,
- },
- {},
- undefined,
- {
- encodeInput: (fnName: string, values: any) => fastAbi.encodeInput(fnName, values),
- decodeOutput: (fnName: string, data: string) => fastAbi.decodeOutput(fnName, data),
- },
- );
-
- this._marketOperationUtils = new MarketOperationUtils(
- new DexOrderSampler(
- this.chainId,
- samplerContract,
- samplerOverrides,
- undefined, // pools caches for balancer
- tokenAdjacencyGraph,
- liquidityProviderRegistry,
- this.chainId === ChainId.Mainnet // Enable Bancor only on Mainnet
- ? async () => BancorService.createAsync(provider)
- : async () => undefined,
- ),
- this._contractAddresses,
- {
- chainId,
- exchangeAddress: this._contractAddresses.exchange,
- },
- );
-
- this._quoteRequestorHttpClient = Axios.create({
- httpAgent: new HttpAgent({ keepAlive: true, timeout: KEEP_ALIVE_TTL }),
- httpsAgent: new HttpsAgent({ keepAlive: true, timeout: KEEP_ALIVE_TTL }),
- ...(rfqt ? rfqt.axiosInstanceOpts : {}),
- });
-
- const integratorIds = this._rfqtOptions?.integratorsWhitelist.map(integrator => integrator.integratorId) || [];
- this._integratorIdsSet = new Set(integratorIds);
- }
-
- public async getBatchMarketBuySwapQuoteAsync(
- makerTokens: string[],
- targetTakerToken: string,
- makerTokenBuyAmounts: BigNumber[],
- options: Partial = {},
- ): Promise {
- makerTokenBuyAmounts.map((a, i) => assert.isBigNumber(`makerAssetBuyAmounts[${i}]`, a));
- let gasPrice: BigNumber;
- if (!!options.gasPrice) {
- gasPrice = options.gasPrice;
- assert.isBigNumber('gasPrice', gasPrice);
- } else {
- gasPrice = await this.getGasPriceEstimationOrThrowAsync();
- }
-
- const allOrders = await this.orderbook.getBatchOrdersAsync(
- makerTokens,
- targetTakerToken,
- this._limitOrderPruningFn,
- );
-
- // Orders could be missing from the orderbook, so we create a dummy one as a placeholder
- allOrders.forEach((orders: SignedNativeOrder[], i: number) => {
- if (!orders || orders.length === 0) {
- allOrders[i] = [createDummyOrder(makerTokens[i], targetTakerToken)];
- }
- });
-
- const opts = { ...constants.DEFAULT_SWAP_QUOTE_REQUEST_OPTS, ...options };
- const optimizerResults = await this._marketOperationUtils.getBatchMarketBuyOrdersAsync(
- allOrders,
- makerTokenBuyAmounts,
- opts as GetMarketOrdersOpts,
- );
-
- const batchSwapQuotes = await Promise.all(
- optimizerResults.map(async (result, i) => {
- if (result) {
- const { makerToken, takerToken } = allOrders[i][0].order;
- return createSwapQuote(
- result,
- makerToken,
- takerToken,
- MarketOperation.Buy,
- makerTokenBuyAmounts[i],
- gasPrice,
- opts.gasSchedule,
- opts.bridgeSlippage,
- );
- } else {
- return undefined;
- }
- }),
- );
- return batchSwapQuotes.filter(x => x !== undefined) as MarketBuySwapQuote[];
- }
-
- /**
- * Returns the recommended gas price for a fast transaction
- */
- public async getGasPriceEstimationOrThrowAsync(): Promise {
- return this._protocolFeeUtils.getGasPriceEstimationOrThrowAsync();
- }
-
- /**
- * Destroys any subscriptions or connections.
- */
- public async destroyAsync(): Promise {
- await this._protocolFeeUtils.destroyAsync();
- await this.orderbook.destroyAsync();
- }
-
- /**
- * Utility function to get Ether token address
- */
- public getEtherToken(): string {
- return this._contractAddresses.etherToken;
- }
-
- /**
- * Get a `SwapQuote` containing all information relevant to fulfilling a swap between a desired ERC20 token address and ERC20 owned by a provided address.
- * You can then pass the `SwapQuote` to a `SwapQuoteConsumer` to execute a buy, or process SwapQuote for on-chain consumption.
- * @param makerToken The address of the maker asset
- * @param takerToken The address of the taker asset
- * @param assetFillAmount If a buy, the amount of maker asset to buy. If a sell, the amount of taker asset to sell.
- * @param marketOperation Either a Buy or a Sell quote
- * @param options Options for the request. See type definition for more information.
- *
- * @return An object that conforms to SwapQuote that satisfies the request. See type definition for more information.
- */
- public async getSwapQuoteAsync(
- makerToken: string,
- takerToken: string,
- assetFillAmount: BigNumber,
- marketOperation: MarketOperation,
- options: Partial,
- rfqClient?: IRfqClient | undefined,
- ): Promise {
- assert.isETHAddressHex('makerToken', makerToken);
- assert.isETHAddressHex('takerToken', takerToken);
- assert.isBigNumber('assetFillAmount', assetFillAmount);
- const opts = _.merge({}, constants.DEFAULT_SWAP_QUOTE_REQUEST_OPTS, options);
- let gasPrice: BigNumber;
- if (!!opts.gasPrice) {
- gasPrice = opts.gasPrice;
- assert.isBigNumber('gasPrice', gasPrice);
- } else {
- gasPrice = await this.getGasPriceEstimationOrThrowAsync();
- }
-
- const sourceFilters = new SourceFilters([], opts.excludedSources, opts.includedSources);
-
- opts.rfqt = this._validateRfqtOpts(sourceFilters, opts.rfqt);
- const rfqtOptions = this._rfqtOptions;
-
- // Get SRA orders (limit orders)
- const shouldSkipOpenOrderbook =
- !sourceFilters.isAllowed(ERC20BridgeSource.Native) ||
- (opts.rfqt && opts.rfqt.nativeExclusivelyRFQ === true);
- const nativeOrders = shouldSkipOpenOrderbook
- ? await Promise.resolve([])
- : await this.orderbook.getOrdersAsync(makerToken, takerToken, this._limitOrderPruningFn);
-
- // if no native orders, pass in a dummy order for the sampler to have required metadata for sampling
- if (nativeOrders.length === 0) {
- nativeOrders.push(createDummyOrder(makerToken, takerToken));
- }
-
- // ** Prepare options for fetching market side liquidity **
- // Scale fees by gas price.
- const cloneOpts = _.omit(opts, 'gasPrice') as GetMarketOrdersOpts;
- const calcOpts: GetMarketOrdersOpts = {
- ...cloneOpts,
- gasPrice,
- feeSchedule: _.mapValues(opts.gasSchedule, gasCost => (fillData: FillData) => {
- const gas = gasCost ? gasCost(fillData) : 0;
- const fee = gasPrice.times(gas);
- return { gas, fee };
- }),
- exchangeProxyOverhead: flags => gasPrice.times(opts.exchangeProxyOverhead(flags)),
- };
- // pass the QuoteRequestor on if rfqt enabled
- if (calcOpts.rfqt !== undefined) {
- calcOpts.rfqt.quoteRequestor = new QuoteRequestor(
- rfqtOptions?.makerAssetOfferings || {},
- {},
- this._quoteRequestorHttpClient,
- rfqtOptions?.altRfqCreds,
- rfqtOptions?.warningLogger,
- rfqtOptions?.infoLogger,
- this.expiryBufferMs,
- rfqtOptions?.metricsProxy,
- );
- calcOpts.rfqt.rfqClient = rfqClient;
- }
-
- const result: OptimizerResultWithReport = await this._marketOperationUtils.getOptimizerResultAsync(
- nativeOrders,
- assetFillAmount,
- marketOperation,
- calcOpts,
- );
-
- const swapQuote = createSwapQuote(
- result,
- makerToken,
- takerToken,
- marketOperation,
- assetFillAmount,
- gasPrice,
- opts.gasSchedule,
- opts.bridgeSlippage,
- );
-
- // Use the raw gas, not scaled by gas price
- const exchangeProxyOverhead = opts.exchangeProxyOverhead(result.sourceFlags).toNumber();
- swapQuote.bestCaseQuoteInfo.gas += exchangeProxyOverhead;
- swapQuote.worstCaseQuoteInfo.gas += exchangeProxyOverhead;
-
- return swapQuote;
- }
-
- private readonly _limitOrderPruningFn = (limitOrder: SignedNativeOrder) => {
- const order = new LimitOrder(limitOrder.order);
- const isOpenOrder = order.taker === constants.NULL_ADDRESS;
- const willOrderExpire = order.willExpire(this.expiryBufferMs / constants.ONE_SECOND_MS); // tslint:disable-line:boolean-naming
- const isFeeTypeAllowed =
- this.permittedOrderFeeTypes.has(OrderPrunerPermittedFeeTypes.NoFees) &&
- order.takerTokenFeeAmount.eq(constants.ZERO_AMOUNT);
- return isOpenOrder && !willOrderExpire && isFeeTypeAllowed;
- }; // tslint:disable-line:semicolon
-
- private _isIntegratorIdWhitelisted(integratorId: string | undefined): boolean {
- if (!integratorId) {
- return false;
- }
- return this._integratorIdsSet.has(integratorId);
- }
-
- private _isTxOriginBlacklisted(txOrigin: string | undefined): boolean {
- if (!txOrigin) {
- return false;
- }
- const blacklistedTxOrigins = this._rfqtOptions ? this._rfqtOptions.txOriginBlacklist : new Set();
- return blacklistedTxOrigins.has(txOrigin.toLowerCase());
- }
-
- private _validateRfqtOpts(
- sourceFilters: SourceFilters,
- rfqt: RfqRequestOpts | undefined,
- ): RfqRequestOpts | undefined {
- if (!rfqt) {
- return rfqt;
- }
- // tslint:disable-next-line: boolean-naming
- const { integrator, nativeExclusivelyRFQ, intentOnFilling, txOrigin } = rfqt;
- // If RFQ-T is enabled and `nativeExclusivelyRFQ` is set, then `ERC20BridgeSource.Native` should
- // never be excluded.
- if (nativeExclusivelyRFQ === true && !sourceFilters.isAllowed(ERC20BridgeSource.Native)) {
- throw new Error('Native liquidity cannot be excluded if "rfqt.nativeExclusivelyRFQ" is set');
- }
-
- // If an integrator ID was provided, but the ID is not whitelisted, raise a warning and disable RFQ
- if (!this._isIntegratorIdWhitelisted(integrator.integratorId)) {
- if (this._rfqtOptions && this._rfqtOptions.warningLogger) {
- this._rfqtOptions.warningLogger(
- {
- ...integrator,
- },
- 'Attempt at using an RFQ API key that is not whitelisted. Disabling RFQ for the request lifetime.',
- );
- }
- return undefined;
- }
-
- // If the requested tx origin is blacklisted, raise a warning and disable RFQ
- if (this._isTxOriginBlacklisted(txOrigin)) {
- if (this._rfqtOptions && this._rfqtOptions.warningLogger) {
- this._rfqtOptions.warningLogger(
- {
- txOrigin,
- },
- 'Attempt at using a tx Origin that is blacklisted. Disabling RFQ for the request lifetime.',
- );
- }
- return undefined;
- }
-
- // Otherwise check other RFQ options
- if (
- intentOnFilling && // The requestor is asking for a firm quote
- this._isIntegratorIdWhitelisted(integrator.integratorId) && // A valid API key was provided
- sourceFilters.isAllowed(ERC20BridgeSource.Native) // Native liquidity is not excluded
- ) {
- if (!txOrigin || txOrigin === constants.NULL_ADDRESS) {
- throw new Error('RFQ-T firm quote requests must specify a tx origin');
- }
- }
-
- return rfqt;
- }
-}
-// tslint:disable-next-line: max-file-line-count
-
-// begin formatting and report generation functions
-function createSwapQuote(
- optimizerResult: OptimizerResultWithReport,
- makerToken: string,
- takerToken: string,
- operation: MarketOperation,
- assetFillAmount: BigNumber,
- gasPrice: BigNumber,
- gasSchedule: GasSchedule,
- slippage: number,
-): SwapQuote {
- const {
- optimizedOrders,
- quoteReport,
- extendedQuoteReportSources,
- sourceFlags,
- takerAmountPerEth,
- makerAmountPerEth,
- priceComparisonsReport,
- } = optimizerResult;
- const isTwoHop = sourceFlags === SOURCE_FLAGS[ERC20BridgeSource.MultiHop];
-
- // Calculate quote info
- const { bestCaseQuoteInfo, worstCaseQuoteInfo, sourceBreakdown } = isTwoHop
- ? calculateTwoHopQuoteInfo(optimizedOrders, operation, gasSchedule, slippage)
- : calculateQuoteInfo(optimizedOrders, operation, assetFillAmount, gasPrice, gasSchedule, slippage);
-
- // Put together the swap quote
- const { makerTokenDecimals, takerTokenDecimals, blockNumber } = optimizerResult.marketSideLiquidity;
- const swapQuote = {
- makerToken,
- takerToken,
- gasPrice,
- orders: optimizedOrders,
- bestCaseQuoteInfo,
- worstCaseQuoteInfo,
- sourceBreakdown,
- makerTokenDecimals,
- takerTokenDecimals,
- takerAmountPerEth,
- makerAmountPerEth,
- quoteReport,
- extendedQuoteReportSources,
- isTwoHop,
- priceComparisonsReport,
- blockNumber,
- };
-
- if (operation === MarketOperation.Buy) {
- return {
- ...swapQuote,
- type: MarketOperation.Buy,
- makerTokenFillAmount: assetFillAmount,
- };
- } else {
- return {
- ...swapQuote,
- type: MarketOperation.Sell,
- takerTokenFillAmount: assetFillAmount,
- };
- }
-}
-
-function calculateQuoteInfo(
- optimizedOrders: OptimizedMarketOrder[],
- operation: MarketOperation,
- assetFillAmount: BigNumber,
- gasPrice: BigNumber,
- gasSchedule: GasSchedule,
- slippage: number,
-): { bestCaseQuoteInfo: SwapQuoteInfo; worstCaseQuoteInfo: SwapQuoteInfo; sourceBreakdown: SwapQuoteOrdersBreakdown } {
- const bestCaseFillResult = simulateBestCaseFill({
- gasPrice,
- orders: optimizedOrders,
- side: operation,
- fillAmount: assetFillAmount,
- opts: { gasSchedule },
- });
-
- const worstCaseFillResult = simulateWorstCaseFill({
- gasPrice,
- orders: optimizedOrders,
- side: operation,
- fillAmount: assetFillAmount,
- opts: { gasSchedule, slippage },
- });
-
- return {
- bestCaseQuoteInfo: fillResultsToQuoteInfo(bestCaseFillResult, 0),
- worstCaseQuoteInfo: fillResultsToQuoteInfo(worstCaseFillResult, slippage),
- sourceBreakdown: getSwapQuoteOrdersBreakdown(bestCaseFillResult.fillAmountBySource),
- };
-}
-
-function calculateTwoHopQuoteInfo(
- optimizedOrders: OptimizedMarketOrder[],
- operation: MarketOperation,
- gasSchedule: GasSchedule,
- slippage: number,
-): { bestCaseQuoteInfo: SwapQuoteInfo; worstCaseQuoteInfo: SwapQuoteInfo; sourceBreakdown: SwapQuoteOrdersBreakdown } {
- const [firstHopOrder, secondHopOrder] = optimizedOrders;
- const gas = new BigNumber(
- gasSchedule[ERC20BridgeSource.MultiHop]!({
- firstHopSource: _.pick(firstHopOrder, 'source', 'fillData'),
- secondHopSource: _.pick(secondHopOrder, 'source', 'fillData'),
- }),
- ).toNumber();
- const isSell = operation === MarketOperation.Sell;
-
- return {
- bestCaseQuoteInfo: {
- makerAmount: isSell ? secondHopOrder.fill.output : secondHopOrder.fill.input,
- takerAmount: isSell ? firstHopOrder.fill.input : firstHopOrder.fill.output,
- totalTakerAmount: isSell ? firstHopOrder.fill.input : firstHopOrder.fill.output,
- feeTakerTokenAmount: constants.ZERO_AMOUNT,
- protocolFeeInWeiAmount: constants.ZERO_AMOUNT,
- gas,
- slippage: 0,
- },
- // TODO jacob consolidate this with quote simulation worstCase
- worstCaseQuoteInfo: {
- makerAmount: isSell
- ? secondHopOrder.makerAmount.times(1 - slippage).integerValue()
- : secondHopOrder.makerAmount,
- takerAmount: isSell
- ? firstHopOrder.takerAmount
- : firstHopOrder.takerAmount.times(1 + slippage).integerValue(BigNumber.ROUND_UP),
- totalTakerAmount: isSell
- ? firstHopOrder.takerAmount
- : firstHopOrder.takerAmount.times(1 + slippage).integerValue(BigNumber.ROUND_UP),
- feeTakerTokenAmount: constants.ZERO_AMOUNT,
- protocolFeeInWeiAmount: constants.ZERO_AMOUNT,
- gas,
- slippage,
- },
- sourceBreakdown: {
- [ERC20BridgeSource.MultiHop]: {
- proportion: new BigNumber(1),
- intermediateToken: secondHopOrder.takerToken,
- hops: [firstHopOrder.source, secondHopOrder.source],
- },
- },
- };
-}
-
-function getSwapQuoteOrdersBreakdown(fillAmountBySource: { [source: string]: BigNumber }): SwapQuoteOrdersBreakdown {
- const totalFillAmount = BigNumber.sum(...Object.values(fillAmountBySource));
- const breakdown: SwapQuoteOrdersBreakdown = {};
- Object.entries(fillAmountBySource).forEach(([s, fillAmount]) => {
- const source = s as keyof SwapQuoteOrdersBreakdown;
- if (source === ERC20BridgeSource.MultiHop) {
- // TODO jacob has a different breakdown
- } else {
- breakdown[source] = fillAmount.div(totalFillAmount);
- }
- });
- return breakdown;
-}
-
-function fillResultsToQuoteInfo(fr: QuoteFillResult, slippage: number): SwapQuoteInfo {
- return {
- makerAmount: fr.totalMakerAssetAmount,
- takerAmount: fr.takerAssetAmount,
- totalTakerAmount: fr.totalTakerAssetAmount,
- feeTakerTokenAmount: fr.takerFeeTakerAssetAmount,
- protocolFeeInWeiAmount: fr.protocolFeeAmount,
- gas: fr.gas,
- slippage,
- };
-}
-
-function createDummyOrder(makerToken: string, takerToken: string): SignedNativeOrder {
- return {
- type: FillQuoteTransformerOrderType.Limit,
- order: {
- ...new LimitOrder({
- makerToken,
- takerToken,
- makerAmount: ZERO_AMOUNT,
- takerAmount: ZERO_AMOUNT,
- takerTokenFeeAmount: ZERO_AMOUNT,
- }),
- },
- signature: INVALID_SIGNATURE,
- };
-}
diff --git a/packages/asset-swapper/src/types.ts b/packages/asset-swapper/src/types.ts
deleted file mode 100644
index 52bc48d761..0000000000
--- a/packages/asset-swapper/src/types.ts
+++ /dev/null
@@ -1,467 +0,0 @@
-import { ChainId } from '@0x/contract-addresses';
-import { BlockParam, ContractAddresses, GethCallOverrides } from '@0x/contract-wrappers';
-import {
- FillQuoteTransformerOrderType,
- LimitOrderFields,
- RfqOrder,
- RfqOrderFields,
- Signature,
-} from '@0x/protocol-utils';
-import { TakerRequestQueryParamsUnnested, V4SignedRfqOrder } from '@0x/quote-server';
-import { Fee } from '@0x/quote-server/lib/src/types';
-import { BigNumber } from '@0x/utils';
-import { AxiosRequestConfig } from 'axios';
-
-import {
- ERC20BridgeSource,
- GetMarketOrdersOpts,
- LiquidityProviderRegistry,
- OptimizedMarketOrder,
-} from './utils/market_operation_utils/types';
-import { ExtendedQuoteReportSources, PriceComparisonsReport, QuoteReport } from './utils/quote_report_generator';
-import { MetricsProxy } from './utils/quote_requestor';
-import { TokenAdjacencyGraph } from './utils/token_adjacency_graph';
-export { SamplerMetrics } from './utils/market_operation_utils/types';
-
-export type Address = string;
-
-/**
- * expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
- * permittedOrderFeeTypes: A set of all the takerFee types that OrderPruner will filter for
- */
-export interface OrderPrunerOpts {
- expiryBufferMs: number;
- permittedOrderFeeTypes: Set;
-}
-
-export interface SignedOrder {
- order: T;
- type: FillQuoteTransformerOrderType.Limit | FillQuoteTransformerOrderType.Rfq;
- signature: Signature;
-}
-
-export type SignedNativeOrder = SignedOrder | SignedOrder;
-export type NativeOrderWithFillableAmounts = SignedNativeOrder & NativeOrderFillableAmountFields;
-
-/**
- * fillableMakerAmount: Amount of makerAsset that is fillable
- * fillableTakerAmount: Amount of takerAsset that is fillable
- * fillableTakerFeeAmount: Amount of takerFee paid to fill fillableTakerAmount
- */
-export interface NativeOrderFillableAmountFields {
- fillableMakerAmount: BigNumber;
- fillableTakerAmount: BigNumber;
- fillableTakerFeeAmount: BigNumber;
-}
-
-/**
- * Represents the metadata to call a smart contract with calldata.
- * calldataHexString: The hexstring of the calldata.
- * toAddress: The contract address to call.
- * ethAmount: The eth amount in wei to send with the smart contract call.
- * allowanceTarget: The address the taker should grant an allowance to.
- * gasOverhead: The gas overhead needed to be added to the gas limit to allow for optional
- * operations which may not visible at eth_estimateGas time
- */
-export interface CalldataInfo {
- calldataHexString: string;
- toAddress: string;
- ethAmount: BigNumber;
- allowanceTarget: string;
- gasOverhead: BigNumber;
-}
-
-/**
- * Interface that varying SwapQuoteConsumers adhere to (exchange consumer, router consumer, forwarder consumer, coordinator consumer)
- * getCalldataOrThrow: Get CalldataInfo to swap for tokens with provided SwapQuote. Throws if invalid SwapQuote is provided.
- * executeSwapQuoteOrThrowAsync: Executes a web3 transaction to swap for tokens with provided SwapQuote. Throws if invalid SwapQuote is provided.
- */
-export interface SwapQuoteConsumerBase {
- getCalldataOrThrowAsync(quote: SwapQuote, opts: Partial): Promise;
- executeSwapQuoteOrThrowAsync(quote: SwapQuote, opts: Partial): Promise;
-}
-
-/**
- * chainId: The chainId that the desired orders should be for.
- */
-export interface SwapQuoteConsumerOpts {
- chainId: number;
- contractAddresses?: ContractAddresses;
-}
-
-/**
- * Represents the options provided to a generic SwapQuoteConsumer
- */
-export interface SwapQuoteGetOutputOpts {
- extensionContractOpts?: ExchangeProxyContractOpts | any;
-}
-
-/**
- * ethAmount: The amount of eth sent with the execution of a swap.
- * takerAddress: The address to perform the buy. Defaults to the first available address from the provider.
- * gasLimit: The amount of gas to send with a transaction (in Gwei). Defaults to an eth_estimateGas rpc call.
- */
-export interface SwapQuoteExecutionOpts extends SwapQuoteGetOutputOpts {
- ethAmount?: BigNumber;
- takerAddress?: string;
- gasLimit?: number;
-}
-
-export enum AffiliateFeeType {
- None,
- PercentageFee,
- PositiveSlippageFee,
-}
-
-export interface AffiliateFeeAmount {
- feeType: AffiliateFeeType;
- recipient: string;
- buyTokenFeeAmount: BigNumber;
- sellTokenFeeAmount: BigNumber;
-}
-
-/**
- * Automatically resolved protocol fee refund receiver addresses.
- */
-export enum ExchangeProxyRefundReceiver {
- // Refund to the taker address.
- Taker = '0x0000000000000000000000000000000000000001',
- // Refund to the sender address.
- Sender = '0x0000000000000000000000000000000000000002',
-}
-
-/**
- * @param isFromETH Whether the input token is ETH.
- * @param isToETH Whether the output token is ETH.
- * @param affiliateFee Fee denominated in taker or maker asset to send to specified recipient.
- * @param refundReceiver The receiver of unspent protocol fees.
- * May be a valid address or one of:
- * `address(0)`: Stay in flash wallet.
- * `address(1)`: Send to the taker.
- * `address(2)`: Send to the sender (caller of `transformERC20()`).
- * @param shouldSellEntireBalance Whether the entire balance of the caller should be sold. Used
- * for contracts where the balance at transaction time is different to the quote amount.
- * This foregos certain VIP routes which do not support this feature.
- */
-export interface ExchangeProxyContractOpts {
- isFromETH: boolean;
- isToETH: boolean;
- affiliateFee: AffiliateFeeAmount;
- refundReceiver: string | ExchangeProxyRefundReceiver;
- isMetaTransaction: boolean;
- shouldSellEntireBalance: boolean;
-}
-
-export interface GetExtensionContractTypeOpts {
- takerAddress?: string;
- ethAmount?: BigNumber;
-}
-
-/**
- * takerToken: Address of the taker asset.
- * makerToken: Address of the maker asset.
- * gasPrice: gas price used to determine protocolFee amount, default to ethGasStation fast amount.
- * orders: An array of objects conforming to OptimizedMarketOrder. These orders can be used to cover the requested assetBuyAmount plus slippage.
- * bestCaseQuoteInfo: Info about the best case price for the asset.
- * worstCaseQuoteInfo: Info about the worst case price for the asset.
- */
-export interface SwapQuoteBase {
- takerToken: string;
- makerToken: string;
- gasPrice: BigNumber;
- orders: OptimizedMarketOrder[];
- bestCaseQuoteInfo: SwapQuoteInfo;
- worstCaseQuoteInfo: SwapQuoteInfo;
- sourceBreakdown: SwapQuoteOrdersBreakdown;
- quoteReport?: QuoteReport;
- extendedQuoteReportSources?: ExtendedQuoteReportSources;
- priceComparisonsReport?: PriceComparisonsReport;
- isTwoHop: boolean;
- makerTokenDecimals: number;
- takerTokenDecimals: number;
- takerAmountPerEth: BigNumber;
- makerAmountPerEth: BigNumber;
- blockNumber: number;
-}
-
-/**
- * takerAssetFillAmount: The amount of takerAsset sold for makerAsset.
- * type: Specified MarketOperation the SwapQuote is provided for
- */
-export interface MarketSellSwapQuote extends SwapQuoteBase {
- takerTokenFillAmount: BigNumber;
- type: MarketOperation.Sell;
-}
-
-/**
- * makerAssetFillAmount: The amount of makerAsset bought with takerAsset.
- * type: Specified MarketOperation the SwapQuote is provided for
- */
-export interface MarketBuySwapQuote extends SwapQuoteBase {
- makerTokenFillAmount: BigNumber;
- type: MarketOperation.Buy;
-}
-
-export type SwapQuote = MarketBuySwapQuote | MarketSellSwapQuote;
-
-/**
- * feeTakerTokenAmount: The amount of takerAsset reserved for paying takerFees when swapping for desired assets.
- * takerTokenAmount: The amount of takerAsset swapped for desired makerAsset.
- * totalTakerTokenAmount: The total amount of takerAsset required to complete the swap (filling orders, and paying takerFees).
- * makerTokenAmount: The amount of makerAsset that will be acquired through the swap.
- * protocolFeeInWeiAmount: The amount of ETH to pay (in WEI) as protocol fee to perform the swap for desired asset.
- * gas: Amount of estimated gas needed to fill the quote.
- * slippage: Amount of slippage to allow for.
- */
-export interface SwapQuoteInfo {
- feeTakerTokenAmount: BigNumber;
- takerAmount: BigNumber;
- totalTakerAmount: BigNumber;
- makerAmount: BigNumber;
- protocolFeeInWeiAmount: BigNumber;
- gas: number;
- slippage: number;
-}
-
-/**
- * percentage breakdown of each liquidity source used in quote
- */
-export type SwapQuoteOrdersBreakdown = Partial<
- { [key in Exclude]: BigNumber } & {
- [ERC20BridgeSource.MultiHop]: {
- proportion: BigNumber;
- intermediateToken: string;
- hops: ERC20BridgeSource[];
- };
- }
->;
-
-/**
- * nativeExclusivelyRFQ: if set to `true`, Swap quote will exclude Open Orderbook liquidity.
- * If set to `true` and `ERC20BridgeSource.Native` is part of the `excludedSources`
- * array in `SwapQuoteRequestOpts`, an Error will be raised.
- */
-
-export interface RfqmRequestOptions extends RfqRequestOpts {
- isLastLook: true;
- fee: Fee;
-}
-
-export interface RfqRequestOpts {
- takerAddress: string;
- txOrigin: string;
- integrator: Integrator;
- intentOnFilling: boolean;
- isIndicative?: boolean;
- makerEndpointMaxResponseTimeMs?: number;
- nativeExclusivelyRFQ?: boolean;
- altRfqAssetOfferings?: AltRfqMakerAssetOfferings;
- isLastLook?: boolean;
- fee?: Fee;
-}
-
-/**
- * gasPrice: gas price to determine protocolFee amount, default to ethGasStation fast amount
- */
-export interface SwapQuoteRequestOpts extends Omit {
- gasPrice?: BigNumber;
- rfqt?: RfqRequestOpts;
-}
-
-/**
- * A mapping from RFQ-T/M quote provider URLs to the trading pairs they support.
- * The value type represents an array of supported asset pairs, with each array element encoded as a 2-element array of token addresses.
- */
-export interface RfqMakerAssetOfferings {
- [endpoint: string]: Array<[string, string]>;
-}
-export interface AltOffering {
- id: string;
- baseAsset: string;
- quoteAsset: string;
- baseAssetDecimals: number;
- quoteAssetDecimals: number;
-}
-export interface AltRfqMakerAssetOfferings {
- [endpoint: string]: AltOffering[];
-}
-export enum RfqPairType {
- Standard = 'standard',
- Alt = 'alt',
-}
-export interface TypedMakerUrl {
- url: string;
- pairType: RfqPairType;
-}
-
-export type LogFunction = (obj: object, msg?: string, ...args: any[]) => void;
-
-export interface RfqFirmQuoteValidator {
- getRfqtTakerFillableAmountsAsync(quotes: RfqOrder[]): Promise;
-}
-
-export interface Integrator {
- integratorId: string;
- label: string;
- whitelistIntegratorUrls?: string[];
-}
-
-export interface SwapQuoterRfqOpts {
- integratorsWhitelist: Integrator[];
- makerAssetOfferings: RfqMakerAssetOfferings;
- txOriginBlacklist: Set;
- altRfqCreds?: {
- altRfqApiKey: string;
- altRfqProfile: string;
- };
- warningLogger?: LogFunction;
- infoLogger?: LogFunction;
- metricsProxy?: MetricsProxy;
- axiosInstanceOpts?: AxiosRequestConfig;
-}
-
-export type AssetSwapperContractAddresses = ContractAddresses;
-
-/**
- * chainId: The ethereum chain id. Defaults to 1 (mainnet).
- * orderRefreshIntervalMs: The interval in ms that getBuyQuoteAsync should trigger an refresh of orders and order states. Defaults to 10000ms (10s).
- * expiryBufferMs: The number of seconds to add when calculating whether an order is expired or not. Defaults to 300s (5m).
- * contractAddresses: Optionally override the contract addresses used for the chain
- * samplerGasLimit: The gas limit used when querying the sampler contract. Defaults to 36e6
- */
-export interface SwapQuoterOpts extends OrderPrunerOpts {
- chainId: ChainId;
- orderRefreshIntervalMs: number;
- expiryBufferMs: number;
- ethereumRpcUrl?: string;
- contractAddresses?: AssetSwapperContractAddresses;
- samplerGasLimit?: number;
- multiBridgeAddress?: string;
- zeroExGasApiUrl?: string;
- rfqt?: SwapQuoterRfqOpts;
- samplerOverrides?: SamplerOverrides;
- tokenAdjacencyGraph?: TokenAdjacencyGraph;
- liquidityProviderRegistry?: LiquidityProviderRegistry;
-}
-
-/**
- * Possible error messages thrown by an SwapQuoterConsumer instance or associated static methods.
- */
-export enum SwapQuoteConsumerError {
- InvalidMarketSellOrMarketBuySwapQuote = 'INVALID_MARKET_BUY_SELL_SWAP_QUOTE',
- InvalidForwarderSwapQuote = 'INVALID_FORWARDER_SWAP_QUOTE_PROVIDED',
- NoAddressAvailable = 'NO_ADDRESS_AVAILABLE',
- SignatureRequestDenied = 'SIGNATURE_REQUEST_DENIED',
- TransactionValueTooLow = 'TRANSACTION_VALUE_TOO_LOW',
-}
-
-/**
- * Possible error messages thrown by an SwapQuoter instance or associated static methods.
- */
-export enum SwapQuoterError {
- NoEtherTokenContractFound = 'NO_ETHER_TOKEN_CONTRACT_FOUND',
- StandardRelayerApiError = 'STANDARD_RELAYER_API_ERROR',
- InsufficientAssetLiquidity = 'INSUFFICIENT_ASSET_LIQUIDITY',
- AssetUnavailable = 'ASSET_UNAVAILABLE',
- NoGasPriceProvidedOrEstimated = 'NO_GAS_PRICE_PROVIDED_OR_ESTIMATED',
- AssetDataUnsupported = 'ASSET_DATA_UNSUPPORTED',
-}
-
-/**
- * Represents two main market operations supported by asset-swapper.
- */
-export enum MarketOperation {
- Sell = 'Sell',
- Buy = 'Buy',
-}
-
-/**
- * Represents varying order takerFee types that can be pruned for by OrderPruner.
- */
-export enum OrderPrunerPermittedFeeTypes {
- NoFees = 'NO_FEES',
- TakerDenominatedTakerFee = 'TAKER_DENOMINATED_TAKER_FEE',
-}
-
-/**
- * Represents a mocked RFQ-T/M maker responses.
- */
-export interface MockedRfqQuoteResponse {
- endpoint: string;
- requestApiKey: string;
- requestParams: TakerRequestQueryParamsUnnested;
- responseData: any;
- responseCode: number;
- callback?: (config: any) => Promise;
-}
-
-/**
- * Represents a mocked RFQ-T/M alternative maker responses.
- */
-export interface AltMockedRfqQuoteResponse {
- endpoint: string;
- mmApiKey: string;
- requestData: AltQuoteRequestData;
- responseData: any;
- responseCode: number;
-}
-
-export interface SamplerOverrides {
- overrides: GethCallOverrides;
- block: BlockParam;
- to?: string;
-}
-
-export interface SamplerCallResult {
- success: boolean;
- data: string;
-}
-
-export type Omit = Pick>;
-
-export enum AltQuoteModel {
- Firm = 'firm',
- Indicative = 'indicative',
-}
-
-export enum AltQuoteSide {
- Buy = 'buy',
- Sell = 'sell',
-}
-
-export interface AltQuoteRequestData {
- market: string;
- model: AltQuoteModel;
- profile: string;
- side: AltQuoteSide;
- value?: string;
- amount?: string;
- meta: {
- txOrigin: string;
- taker: string;
- client: string;
- existingOrder?: {
- price: string;
- value?: string;
- amount?: string;
- };
- };
-}
-
-export interface AltBaseRfqResponse extends AltQuoteRequestData {
- id: string;
- price?: string;
-}
-
-export interface AltIndicativeQuoteResponse extends AltBaseRfqResponse {
- model: AltQuoteModel.Indicative;
- status: 'live' | 'rejected';
-}
-
-export interface AltFirmQuoteResponse extends AltBaseRfqResponse {
- model: AltQuoteModel.Firm;
- data: {
- '0xv4order': V4SignedRfqOrder;
- };
- status: 'active' | 'rejected';
-}
diff --git a/packages/asset-swapper/src/utils/affiliate_fee_utils.ts b/packages/asset-swapper/src/utils/affiliate_fee_utils.ts
deleted file mode 100644
index 2f4bc93123..0000000000
--- a/packages/asset-swapper/src/utils/affiliate_fee_utils.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { BigNumber } from '@0x/utils';
-
-import { SwapQuoteInfo } from '../types';
-
-import { assert } from './assert';
-
-export const affiliateFeeUtils = {
- /**
- * Get the amount of eth to send for a forwarder contract call (includes takerAssetAmount, protocol fees, and specified affiliate fee amount)
- * @param swapQuoteInfo SwapQuoteInfo to generate total eth amount from
- * @param feePercentage Percentage of additive fees to apply to totalTakerAssetAmount + protocol fee.
- */
- getTotalEthAmountWithAffiliateFee(swapQuoteInfo: SwapQuoteInfo, feePercentage: number): BigNumber {
- const ethAmount = swapQuoteInfo.protocolFeeInWeiAmount.plus(swapQuoteInfo.totalTakerAmount);
- const ethAmountWithFees = ethAmount.plus(affiliateFeeUtils.getFeeAmount(swapQuoteInfo, feePercentage));
- return ethAmountWithFees;
- },
- /**
- * Get the affiliate fee owed to the forwarder fee recipient.
- * @param swapQuoteInfo SwapQuoteInfo to generate total eth amount from
- * @param feePercentage Percentage of additive fees to apply to totalTakerAssetAmount + protocol fee.
- */
- getFeeAmount(swapQuoteInfo: SwapQuoteInfo, feePercentage: number): BigNumber {
- assert.assert(feePercentage >= 0, 'feePercentage must be >= 0');
- const ethAmount = swapQuoteInfo.protocolFeeInWeiAmount.plus(swapQuoteInfo.totalTakerAmount);
- // HACK(dekz): This is actually in WEI amount not ETH
- return ethAmount.times(feePercentage).integerValue(BigNumber.ROUND_UP);
- },
-};
diff --git a/packages/asset-swapper/src/utils/alt_mm_implementation_utils.ts b/packages/asset-swapper/src/utils/alt_mm_implementation_utils.ts
deleted file mode 100644
index 75c0f9e2e7..0000000000
--- a/packages/asset-swapper/src/utils/alt_mm_implementation_utils.ts
+++ /dev/null
@@ -1,279 +0,0 @@
-import { Web3Wrapper } from '@0x/dev-utils';
-import { TakerRequestQueryParamsUnnested, V4RFQFirmQuote, V4RFQIndicativeQuote } from '@0x/quote-server';
-import { BigNumber } from '@0x/utils';
-import { AxiosInstance, CancelToken } from 'axios';
-
-import { constants } from '../constants';
-import {
- AltFirmQuoteResponse,
- AltIndicativeQuoteResponse,
- AltOffering,
- AltQuoteModel,
- AltQuoteRequestData,
- AltQuoteSide,
- AltRfqMakerAssetOfferings,
- LogFunction,
-} from '../types';
-
-const SUCCESS_CODE = 201;
-
-/**
- * Returns the AltOffering if it exists for a given pair
- */
-export function getAltMarketInfo(
- offerings: AltOffering[],
- buyTokenAddress: string,
- sellTokenAddress: string,
-): AltOffering | undefined {
- for (const offering of offerings) {
- if (
- (buyTokenAddress.toLowerCase() === offering.baseAsset.toLowerCase() &&
- sellTokenAddress.toLowerCase() === offering.quoteAsset.toLowerCase()) ||
- (sellTokenAddress.toLowerCase() === offering.baseAsset.toLowerCase() &&
- buyTokenAddress.toLowerCase() === offering.quoteAsset.toLowerCase())
- ) {
- return offering;
- }
- }
- return undefined;
-}
-
-function parseFirmQuoteResponseFromAltMM(altFirmQuoteReponse: AltFirmQuoteResponse): V4RFQFirmQuote {
- return {
- signedOrder: altFirmQuoteReponse.data['0xv4order'],
- };
-}
-
-function parseIndicativeQuoteResponseFromAltMM(
- altIndicativeQuoteResponse: AltIndicativeQuoteResponse,
- altPair: AltOffering,
- makerToken: string,
- takerToken: string,
-): V4RFQIndicativeQuote {
- let makerAmount: BigNumber;
- let takerAmount: BigNumber;
- let quoteAmount: BigNumber;
- let baseAmount: BigNumber;
-
- if (!altIndicativeQuoteResponse.price) {
- throw new Error('Price not returned by alt MM');
- }
- if (altIndicativeQuoteResponse.amount) {
- // if amount is specified, amount is the base token amount
- baseAmount = Web3Wrapper.toBaseUnitAmount(
- new BigNumber(altIndicativeQuoteResponse.amount),
- altPair.baseAssetDecimals,
- );
- // if amount is specified, use the price (quote/base) to get the quote amount
- quoteAmount = Web3Wrapper.toBaseUnitAmount(
- new BigNumber(altIndicativeQuoteResponse.amount)
- .times(new BigNumber(altIndicativeQuoteResponse.price))
- .decimalPlaces(altPair.quoteAssetDecimals, BigNumber.ROUND_DOWN),
- altPair.quoteAssetDecimals,
- );
- } else if (altIndicativeQuoteResponse.value) {
- // if value is specified, value is the quote token amount
- quoteAmount = Web3Wrapper.toBaseUnitAmount(
- new BigNumber(altIndicativeQuoteResponse.value),
- altPair.quoteAssetDecimals,
- );
- // if value is specified, use the price (quote/base) to get the base amount
- baseAmount = Web3Wrapper.toBaseUnitAmount(
- new BigNumber(altIndicativeQuoteResponse.value)
- .dividedBy(new BigNumber(altIndicativeQuoteResponse.price))
- .decimalPlaces(altPair.baseAssetDecimals, BigNumber.ROUND_DOWN),
- altPair.baseAssetDecimals,
- );
- } else {
- throw new Error('neither amount or value were specified');
- }
- if (makerToken.toLowerCase() === altPair.baseAsset.toLowerCase()) {
- makerAmount = baseAmount;
- takerAmount = quoteAmount;
- } else if (makerToken.toLowerCase() === altPair.quoteAsset.toLowerCase()) {
- makerAmount = quoteAmount;
- takerAmount = baseAmount;
- } else {
- throw new Error(`Base, quote tokens don't align with maker, taker tokens`);
- }
-
- return {
- makerToken,
- makerAmount,
- takerToken,
- takerAmount,
- // HACK: alt implementation does not return an expiration with indicative quotes
- // return now + { IMPUTED EXPIRY SECONDS } to have it included after order checks
- expiry: new BigNumber(Date.now() / 1000)
- .integerValue(BigNumber.ROUND_DOWN)
- .plus(constants.ALT_MM_IMPUTED_INDICATIVE_EXPIRY_SECONDS),
- };
-}
-
-/**
- * Turn a standard quote request into an alt quote request
- * and return the appropriate standard quote response
- */
-export async function returnQuoteFromAltMMAsync(
- url: string,
- apiKey: string,
- profile: string,
- integratorKey: string,
- quoteModel: AltQuoteModel,
- makerToken: string,
- takerToken: string,
- maxResponseTimeMs: number,
- altRfqAssetOfferings: AltRfqMakerAssetOfferings,
- takerRequestQueryParams: TakerRequestQueryParamsUnnested,
- axiosInstance: AxiosInstance,
- warningLogger: LogFunction,
- cancelToken: CancelToken,
-): Promise<{ data: ResponseT; status: number }> {
- const altPair = getAltMarketInfo(
- altRfqAssetOfferings[url],
- takerRequestQueryParams.buyTokenAddress,
- takerRequestQueryParams.sellTokenAddress,
- );
-
- if (!altPair) {
- throw new Error(`Alt pair not found`);
- }
- const side = altPair.baseAsset === takerRequestQueryParams.buyTokenAddress ? AltQuoteSide.Sell : AltQuoteSide.Buy;
-
- // comparison price needs to be quote/base
- // in the standard implementation, it's maker/taker
- let altComparisonPrice: string | undefined;
- if (altPair.quoteAsset === makerToken) {
- altComparisonPrice = takerRequestQueryParams.comparisonPrice
- ? takerRequestQueryParams.comparisonPrice
- : undefined;
- } else {
- altComparisonPrice = takerRequestQueryParams.comparisonPrice
- ? new BigNumber(takerRequestQueryParams.comparisonPrice).pow(-1).toString()
- : undefined;
- }
-
- let data: AltQuoteRequestData;
- data = {
- market: `${altPair.id}`,
- model: quoteModel,
- profile,
- side,
- meta: {
- txOrigin: takerRequestQueryParams.txOrigin!,
- taker: takerRequestQueryParams.takerAddress,
- client: integratorKey,
- },
- };
-
- // specify a comparison price if it exists
- if (altComparisonPrice) {
- data.meta.existingOrder = {
- price: altComparisonPrice,
- };
- }
-
- // need to specify amount or value
- // amount is units of the base asset
- // value is units of the quote asset
- let requestSize: string;
- if (takerRequestQueryParams.buyAmountBaseUnits) {
- requestSize = Web3Wrapper.toUnitAmount(
- new BigNumber(takerRequestQueryParams.buyAmountBaseUnits),
- takerRequestQueryParams.buyTokenAddress === altPair.baseAsset
- ? altPair.baseAssetDecimals
- : altPair.quoteAssetDecimals,
- ).toString();
- if (takerRequestQueryParams.buyTokenAddress === altPair.baseAsset) {
- data.amount = requestSize;
- // add to 'existing order' if there is a comparison price
- if (data.meta.existingOrder) {
- data.meta.existingOrder.amount = requestSize;
- }
- } else {
- data.value = requestSize;
- // add to 'existing order' if there is a comparison price
- if (data.meta.existingOrder) {
- data.meta.existingOrder.value = requestSize;
- }
- }
- } else if (takerRequestQueryParams.sellAmountBaseUnits) {
- requestSize = Web3Wrapper.toUnitAmount(
- new BigNumber(takerRequestQueryParams.sellAmountBaseUnits),
- takerRequestQueryParams.sellTokenAddress === altPair.baseAsset
- ? altPair.baseAssetDecimals
- : altPair.quoteAssetDecimals,
- ).toString();
- if (takerRequestQueryParams.sellTokenAddress === altPair.baseAsset) {
- data.amount = requestSize;
- if (data.meta.existingOrder) {
- data.meta.existingOrder.amount = requestSize;
- }
- } else {
- data.value = requestSize;
- if (data.meta.existingOrder) {
- data.meta.existingOrder.value = requestSize;
- }
- }
- }
-
- const response = await axiosInstance
- .post(`${url}/quotes`, data, {
- headers: { Authorization: `Bearer ${apiKey}` },
- timeout: maxResponseTimeMs,
- cancelToken,
- })
- .catch(err => {
- if (err.response) {
- // request was made and market maker responded
- warningLogger(
- { data: err.response.data, status: err.response.status, headers: err.response.headers },
- `Alt RFQ MM request failed`,
- );
- } else if (err.request) {
- warningLogger({}, 'Alt RFQ MM no response received');
- } else {
- warningLogger({ err: err.message }, 'Failed to construct Alt RFQ MM request');
- }
- throw new Error(`Alt RFQ MM request failed`);
- });
-
- // empty response will get filtered out in validation
- const emptyResponse = {};
-
- if (response.status !== SUCCESS_CODE) {
- const rejectedRequestInfo = {
- status: response.status,
- message: response.data,
- };
- warningLogger(rejectedRequestInfo, `Alt RFQ MM did not return a status of ${SUCCESS_CODE}`);
- return {
- data: (emptyResponse as unknown) as ResponseT,
- status: response.status,
- };
- }
- // successful handling but no quote is indicated by status = 'rejected'
- if (response.data.status === 'rejected') {
- warningLogger(
- response.data.id,
- `Alt RFQ MM handled the request successfully but did not return a quote (status = 'rejected')`,
- );
- return {
- data: (emptyResponse as unknown) as ResponseT,
- // hack: set the http status to 204 no content so we can more
- // easily track when no quote is returned
- status: 204,
- };
- }
-
- const parsedResponse =
- quoteModel === 'firm'
- ? parseFirmQuoteResponseFromAltMM(response.data)
- : parseIndicativeQuoteResponseFromAltMM(response.data, altPair, makerToken, takerToken);
-
- return {
- // hack to appease type checking
- data: (parsedResponse as unknown) as ResponseT,
- status: response.status,
- };
-}
diff --git a/packages/asset-swapper/src/utils/assert.ts b/packages/asset-swapper/src/utils/assert.ts
deleted file mode 100644
index 7392a4fc1c..0000000000
--- a/packages/asset-swapper/src/utils/assert.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { assert as sharedAssert } from '@0x/assert';
-import * as _ from 'lodash';
-
-import { Orderbook } from '../swap_quoter';
-
-export const assert = {
- ...sharedAssert,
- isValidOrderbook(variableName: string, orderFetcher: Orderbook): void {
- sharedAssert.isFunction(`${variableName}.getOrdersAsync`, orderFetcher.getOrdersAsync.bind(orderFetcher));
- sharedAssert.isFunction(
- `${variableName}.getBatchOrdersAsync`,
- orderFetcher.getBatchOrdersAsync.bind(orderFetcher),
- );
- },
- isValidPercentage(variableName: string, percentage: number): void {
- assert.isNumber(variableName, percentage);
- assert.assert(
- percentage >= 0 && percentage <= 1,
- `Expected ${variableName} to be between 0 and 1, but is ${percentage}`,
- );
- },
-};
diff --git a/packages/asset-swapper/src/utils/irfq_client.ts b/packages/asset-swapper/src/utils/irfq_client.ts
deleted file mode 100644
index d59cf5f874..0000000000
--- a/packages/asset-swapper/src/utils/irfq_client.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import { RfqOrder, Signature } from '@0x/protocol-utils';
-import { BigNumber } from '@0x/utils';
-
-import { AltRfqMakerAssetOfferings } from '../types';
-
-export interface RfqClientV1PriceRequest {
- altRfqAssetOfferings: AltRfqMakerAssetOfferings | undefined;
- assetFillAmount: BigNumber;
- chainId: number;
- comparisonPrice: BigNumber | undefined;
- integratorId: string;
- intentOnFilling: boolean;
- makerToken: string;
- marketOperation: 'Sell' | 'Buy';
- takerAddress: string;
- takerToken: string;
- txOrigin: string;
-}
-
-export interface RfqClientV1QuoteRequest extends RfqClientV1PriceRequest {}
-
-export interface RfqClientV1Price {
- expiry: BigNumber;
- kind: 'rfq' | 'otc';
- makerAmount: BigNumber;
- makerToken: string;
- makerUri: string;
- takerAmount: BigNumber;
- takerToken: string;
-}
-
-export interface RfqClientV1PriceResponse {
- prices: RfqClientV1Price[];
-}
-
-export interface RfqClientV1Quote {
- makerUri: string;
- order: RfqOrder;
- signature: Signature;
-}
-
-export interface RfqClientV1QuoteResponse {
- quotes: RfqClientV1Quote[];
-}
-
-/**
- * IRfqClient is an interface that defines how to connect with an Rfq system.
- */
-export interface IRfqClient {
- /**
- * Fetches a list of "indicative quotes" or prices from a remote Rfq server
- */
- getV1PricesAsync(request: RfqClientV1PriceRequest): Promise;
-
- /**
- * Fetches a list of "firm quotes" or signed quotes from a remote Rfq server.
- */
- getV1QuotesAsync(request: RfqClientV1QuoteRequest): Promise;
-}
diff --git a/packages/asset-swapper/src/utils/market_operation_utils/aave_reserves_cache.ts b/packages/asset-swapper/src/utils/market_operation_utils/aave_reserves_cache.ts
deleted file mode 100644
index ac99a889db..0000000000
--- a/packages/asset-swapper/src/utils/market_operation_utils/aave_reserves_cache.ts
+++ /dev/null
@@ -1,105 +0,0 @@
-import { logUtils } from '@0x/utils';
-import { gql, request } from 'graphql-request';
-
-import { constants } from '../../constants';
-
-const RESERVES_GQL_QUERY = gql`
- {
- reserves(
- first: 300
- where: { isActive: true, isFrozen: false }
- orderBy: totalLiquidity
- orderDirection: desc
- ) {
- id
- underlyingAsset
- aToken {
- id
- }
- pool {
- id
- lendingPool
- }
- }
- }
-`;
-
-export interface AaveReserve {
- id: string;
- underlyingAsset: string;
- aToken: {
- id: string;
- };
- pool: {
- id: string;
- lendingPool: string;
- };
-}
-
-interface Cache {
- [key: string]: AaveReserve[];
-}
-
-const RESERVES_REFRESH_INTERVAL_MS = 30 * constants.ONE_MINUTE_MS;
-
-/**
- * Fetches Aave V2 reserve information from the official subgraph(s).
- * The reserve information is updated every 30 minutes and cached
- * so that it can be accessed with the underlying token's address
- */
-export class AaveV2ReservesCache {
- private _cache: Cache = {};
- constructor(private readonly _subgraphUrl: string) {
- const resfreshReserves = async () => this.fetchAndUpdateReservesAsync();
- // tslint:disable-next-line:no-floating-promises
- resfreshReserves();
- setInterval(resfreshReserves, RESERVES_REFRESH_INTERVAL_MS);
- }
- /**
- * Fetches Aave V2 reserves from the subgraph and updates the cache
- */
- public async fetchAndUpdateReservesAsync(): Promise {
- try {
- const { reserves } = await request<{ reserves: AaveReserve[] }>(this._subgraphUrl, RESERVES_GQL_QUERY);
- const newCache = reserves.reduce((memo, reserve) => {
- const underlyingAsset = reserve.underlyingAsset.toLowerCase();
- if (!memo[underlyingAsset]) {
- memo[underlyingAsset] = [];
- }
-
- memo[underlyingAsset].push(reserve);
- return memo;
- }, {});
-
- this._cache = newCache;
- } catch (err) {
- logUtils.warn(`Failed to update Aave V2 reserves cache: ${err.message}`);
- // Empty cache just to be safe
- this._cache = {};
- }
- }
- public get(takerToken: string, makerToken: string): AaveReserve | undefined {
- // Deposit takerToken into reserve
- if (this._cache[takerToken.toLowerCase()]) {
- const matchingReserve = this._cache[takerToken.toLowerCase()].find(
- r => r.aToken.id === makerToken.toLowerCase(),
- );
- if (matchingReserve) {
- return matchingReserve;
- }
- }
-
- // Withdraw makerToken from reserve
- if (this._cache[makerToken.toLowerCase()]) {
- const matchingReserve = this._cache[makerToken.toLowerCase()].find(
- r => r.aToken.id === takerToken.toLowerCase(),
- );
- if (matchingReserve) {
- return matchingReserve;
- }
- }
-
- // No match
- return undefined;
- }
-}
diff --git a/packages/asset-swapper/src/utils/market_operation_utils/bancor_service.ts b/packages/asset-swapper/src/utils/market_operation_utils/bancor_service.ts
deleted file mode 100644
index eccea376eb..0000000000
--- a/packages/asset-swapper/src/utils/market_operation_utils/bancor_service.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { SupportedProvider } from '@0x/dev-utils';
-import { SDK } from '@bancor/sdk';
-import { Ethereum } from '@bancor/sdk/dist/blockchains/ethereum';
-import { BlockchainType } from '@bancor/sdk/dist/types';
-
-import { MAINNET_TOKENS } from './constants';
-
-const findToken = (tokenAddress: string, graph: object): string =>
- // If we're looking for WETH it is stored by Bancor as the 0xeee address
- tokenAddress.toLowerCase() === MAINNET_TOKENS.WETH.toLowerCase()
- ? '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
- : Object.keys(graph).filter(k => k.toLowerCase() === tokenAddress.toLowerCase())[0];
-
-export class BancorService {
- public static async createAsync(provider: SupportedProvider): Promise {
- const sdk = await SDK.create({ ethereumNodeEndpoint: provider });
- const service = new BancorService(sdk);
- return service;
- }
-
- constructor(public sdk: SDK) {}
- public getPaths(_fromToken: string, _toToken: string): string[][] {
- // HACK: We reach into the blockchain object and pull in it's cache of tokens
- // and we use it's internal non-async getPathsFunc
- try {
- const blockchain = this.sdk._core.blockchains[BlockchainType.Ethereum] as Ethereum;
- const fromToken = findToken(_fromToken, blockchain.graph);
- const toToken = findToken(_toToken, blockchain.graph);
- return blockchain.getPathsFunc.bind(blockchain)(fromToken, toToken);
- } catch (e) {
- return [];
- }
- }
-}
diff --git a/packages/asset-swapper/src/utils/market_operation_utils/bridge_source_utils.ts b/packages/asset-swapper/src/utils/market_operation_utils/bridge_source_utils.ts
deleted file mode 100644
index b129372dff..0000000000
--- a/packages/asset-swapper/src/utils/market_operation_utils/bridge_source_utils.ts
+++ /dev/null
@@ -1,574 +0,0 @@
-import { ChainId } from '@0x/contract-addresses';
-import { BigNumber } from '@0x/utils';
-
-import {
- ACRYPTOS_BSC_INFOS,
- APESWAP_ROUTER_BY_CHAIN_ID,
- BAKERYSWAP_ROUTER_BY_CHAIN_ID,
- BELT_BSC_INFOS,
- BISWAP_ROUTER_BY_CHAIN_ID,
- CHEESESWAP_ROUTER_BY_CHAIN_ID,
- COMPONENT_POOLS_BY_CHAIN_ID,
- CRYPTO_COM_ROUTER_BY_CHAIN_ID,
- CURVE_AVALANCHE_INFOS,
- CURVE_FANTOM_INFOS,
- CURVE_MAINNET_INFOS,
- CURVE_OPTIMISM_INFOS,
- CURVE_POLYGON_INFOS,
- CURVE_V2_AVALANCHE_INFOS,
- CURVE_V2_FANTOM_INFOS,
- CURVE_V2_MAINNET_INFOS,
- CURVE_V2_POLYGON_INFOS,
- DFYN_ROUTER_BY_CHAIN_ID,
- ELLIPSIS_BSC_INFOS,
- FIREBIRDONESWAP_BSC_INFOS,
- FIREBIRDONESWAP_POLYGON_INFOS,
- IRONSWAP_POLYGON_INFOS,
- KNIGHTSWAP_ROUTER_BY_CHAIN_ID,
- MAX_DODOV2_POOLS_QUERIED,
- MDEX_ROUTER_BY_CHAIN_ID,
- MESHSWAP_ROUTER_BY_CHAIN_ID,
- MOBIUSMONEY_CELO_INFOS,
- MORPHEUSSWAP_ROUTER_BY_CHAIN_ID,
- MSTABLE_POOLS_BY_CHAIN_ID,
- NERVE_BSC_INFOS,
- NULL_ADDRESS,
- PANCAKESWAPV2_ROUTER_BY_CHAIN_ID,
- PANCAKESWAP_ROUTER_BY_CHAIN_ID,
- PANGOLIN_ROUTER_BY_CHAIN_ID,
- PLATYPUS_AVALANCHE_INFOS,
- QUICKSWAP_ROUTER_BY_CHAIN_ID,
- SADDLE_MAINNET_INFOS,
- SHELL_POOLS_BY_CHAIN_ID,
- SHIBASWAP_ROUTER_BY_CHAIN_ID,
- SPIRITSWAP_ROUTER_BY_CHAIN_ID,
- SPOOKYSWAP_ROUTER_BY_CHAIN_ID,
- SUSHISWAP_ROUTER_BY_CHAIN_ID,
- SYNAPSE_AVALANCHE_INFOS,
- SYNAPSE_BSC_INFOS,
- SYNAPSE_FANTOM_INFOS,
- SYNAPSE_MAINNET_INFOS,
- SYNAPSE_OPTIMISM_INFOS,
- SYNAPSE_POLYGON_INFOS,
- TRADER_JOE_ROUTER_BY_CHAIN_ID,
- UBESWAP_ROUTER_BY_CHAIN_ID,
- UNISWAPV2_ROUTER_BY_CHAIN_ID,
- WAULTSWAP_ROUTER_BY_CHAIN_ID,
- XSIGMA_MAINNET_INFOS,
- YOSHI_ROUTER_BY_CHAIN_ID,
-} from './constants';
-import { CurveInfo, ERC20BridgeSource, PlatypusInfo } from './types';
-
-// tslint:disable-next-line: completed-docs ban-types
-export function isValidAddress(address: string | String): address is string {
- return (typeof address === 'string' || address instanceof String) && address.toString() !== NULL_ADDRESS;
-}
-
-// tslint:disable completed-docs
-export function getDodoV2Offsets(): BigNumber[] {
- return Array(MAX_DODOV2_POOLS_QUERIED)
- .fill(0)
- .map((_v, i) => new BigNumber(i));
-}
-
-// tslint:disable completed-docs
-export function getShellsForPair(chainId: ChainId, takerToken: string, makerToken: string): string[] {
- if (chainId !== ChainId.Mainnet) {
- return [];
- }
- return Object.values(SHELL_POOLS_BY_CHAIN_ID[chainId])
- .filter(c => [makerToken, takerToken].every(t => c.tokens.includes(t)))
- .map(i => i.poolAddress);
-}
-
-// tslint:disable completed-docs
-export function getComponentForPair(chainId: ChainId, takerToken: string, makerToken: string): string[] {
- if (chainId !== ChainId.Mainnet) {
- return [];
- }
- return Object.values(COMPONENT_POOLS_BY_CHAIN_ID[chainId])
- .filter(c => [makerToken, takerToken].every(t => c.tokens.includes(t)))
- .map(i => i.poolAddress);
-}
-
-// tslint:disable completed-docs
-export function getMStableForPair(chainId: ChainId, takerToken: string, makerToken: string): string[] {
- if (chainId !== ChainId.Mainnet && chainId !== ChainId.Polygon) {
- return [];
- }
- return Object.values(MSTABLE_POOLS_BY_CHAIN_ID[chainId])
- .filter(c => [makerToken, takerToken].every(t => c.tokens.includes(t)))
- .map(i => i.poolAddress);
-}
-
-// tslint:disable completed-docs
-export function getCurveInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- switch (chainId) {
- case ChainId.Mainnet:
- return Object.values(CURVE_MAINNET_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Polygon:
- return Object.values(CURVE_POLYGON_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Fantom:
- return Object.values(CURVE_FANTOM_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Avalanche:
- return Object.values(CURVE_AVALANCHE_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Optimism:
- return Object.values(CURVE_OPTIMISM_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- default:
- return [];
- }
-}
-
-// tslint:disable completed-docs
-export function getCurveV2InfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- switch (chainId) {
- case ChainId.Mainnet:
- return Object.values(CURVE_V2_MAINNET_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Polygon:
- return Object.values(CURVE_V2_POLYGON_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Fantom:
- return Object.values(CURVE_V2_FANTOM_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Avalanche:
- return Object.values(CURVE_V2_AVALANCHE_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- default:
- return [];
- }
-}
-
-export function getNerveInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.BSC) {
- return [];
- }
- return Object.values(NERVE_BSC_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-
-export function getSynapseInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- switch (chainId) {
- case ChainId.Mainnet:
- return Object.values(SYNAPSE_MAINNET_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Optimism:
- return Object.values(SYNAPSE_OPTIMISM_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.BSC:
- return Object.values(SYNAPSE_BSC_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Polygon:
- return Object.values(SYNAPSE_POLYGON_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Fantom:
- return Object.values(SYNAPSE_FANTOM_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- case ChainId.Avalanche:
- return Object.values(SYNAPSE_AVALANCHE_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- default:
- return [];
- }
-}
-
-export function getFirebirdOneSwapInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId === ChainId.BSC) {
- return Object.values(FIREBIRDONESWAP_BSC_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- } else if (chainId === ChainId.Polygon) {
- return Object.values(FIREBIRDONESWAP_POLYGON_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) &&
- [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
- } else {
- return [];
- }
-}
-
-export function getBeltInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.BSC) {
- return [];
- }
- return Object.values(BELT_BSC_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-
-export function getEllipsisInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.BSC) {
- return [];
- }
- return Object.values(ELLIPSIS_BSC_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-
-export function getSaddleInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.Mainnet) {
- return [];
- }
- return Object.values(SADDLE_MAINNET_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-
-export function getIronSwapInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.Polygon) {
- return [];
- }
- return Object.values(IRONSWAP_POLYGON_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-
-export function getXSigmaInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.Mainnet) {
- return [];
- }
- return Object.values(XSIGMA_MAINNET_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-
-export function getAcryptosInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.BSC) {
- return [];
- }
- return Object.values(ACRYPTOS_BSC_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-export function getMobiusMoneyInfoForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
- if (chainId !== ChainId.Celo) {
- return [];
- }
- return Object.values(MOBIUSMONEY_CELO_INFOS).filter(c =>
- [makerToken, takerToken].every(
- t =>
- (c.tokens.includes(t) && c.metaTokens === undefined) ||
- (c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
- ),
- );
-}
-
-export function getPlatypusInfoForPair(chainId: ChainId, takerToken: string, makerToken: string): PlatypusInfo[] {
- if (chainId !== ChainId.Avalanche) {
- return [];
- }
- return Object.values(PLATYPUS_AVALANCHE_INFOS).filter(c =>
- [makerToken, takerToken].every(t => c.tokens.includes(t)),
- );
-}
-
-export function getShellLikeInfosForPair(
- chainId: ChainId,
- takerToken: string,
- makerToken: string,
- source: ERC20BridgeSource.Shell | ERC20BridgeSource.Component | ERC20BridgeSource.MStable,
-): string[] {
- switch (source) {
- case ERC20BridgeSource.Shell:
- return getShellsForPair(chainId, takerToken, makerToken);
- case ERC20BridgeSource.Component:
- return getComponentForPair(chainId, takerToken, makerToken);
- case ERC20BridgeSource.MStable:
- return getMStableForPair(chainId, takerToken, makerToken);
- default:
- throw new Error(`Unknown Shell like source ${source}`);
- }
-}
-
-export interface CurveDetailedInfo extends CurveInfo {
- makerTokenIdx: number;
- takerTokenIdx: number;
-}
-
-export function getCurveLikeInfosForPair(
- chainId: ChainId,
- takerToken: string,
- makerToken: string,
- source:
- | ERC20BridgeSource.Curve
- | ERC20BridgeSource.CurveV2
- | ERC20BridgeSource.Nerve
- | ERC20BridgeSource.Synapse
- | ERC20BridgeSource.Belt
- | ERC20BridgeSource.Ellipsis
- | ERC20BridgeSource.Saddle
- | ERC20BridgeSource.IronSwap
- | ERC20BridgeSource.XSigma
- | ERC20BridgeSource.FirebirdOneSwap
- | ERC20BridgeSource.ACryptos
- | ERC20BridgeSource.MobiusMoney,
-): CurveDetailedInfo[] {
- let pools: CurveInfo[] = [];
- switch (source) {
- case ERC20BridgeSource.Curve:
- pools = getCurveInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.CurveV2:
- pools = getCurveV2InfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.Nerve:
- pools = getNerveInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.Synapse:
- pools = getSynapseInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.Belt:
- pools = getBeltInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.Ellipsis:
- pools = getEllipsisInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.Saddle:
- pools = getSaddleInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.XSigma:
- pools = getXSigmaInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.FirebirdOneSwap:
- pools = getFirebirdOneSwapInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.IronSwap:
- pools = getIronSwapInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.ACryptos:
- pools = getAcryptosInfosForPair(chainId, takerToken, makerToken);
- break;
- case ERC20BridgeSource.MobiusMoney:
- pools = getMobiusMoneyInfoForPair(chainId, takerToken, makerToken);
- break;
- default:
- throw new Error(`Unknown Curve like source ${source}`);
- }
- return pools.map(pool => ({
- ...pool,
- makerTokenIdx: pool.tokens.indexOf(makerToken),
- takerTokenIdx: pool.tokens.indexOf(takerToken),
- }));
-}
-
-export function uniswapV2LikeRouterAddress(
- chainId: ChainId,
- source:
- | ERC20BridgeSource.UniswapV2
- | ERC20BridgeSource.SushiSwap
- | ERC20BridgeSource.CryptoCom
- | ERC20BridgeSource.PancakeSwap
- | ERC20BridgeSource.PancakeSwapV2
- | ERC20BridgeSource.BakerySwap
- | ERC20BridgeSource.ApeSwap
- | ERC20BridgeSource.CheeseSwap
- | ERC20BridgeSource.QuickSwap
- | ERC20BridgeSource.Dfyn
- | ERC20BridgeSource.WaultSwap
- | ERC20BridgeSource.ShibaSwap
- | ERC20BridgeSource.TraderJoe
- | ERC20BridgeSource.Pangolin
- | ERC20BridgeSource.UbeSwap
- | ERC20BridgeSource.MorpheusSwap
- | ERC20BridgeSource.SpookySwap
- | ERC20BridgeSource.SpiritSwap
- | ERC20BridgeSource.BiSwap
- | ERC20BridgeSource.Yoshi
- | ERC20BridgeSource.MDex
- | ERC20BridgeSource.KnightSwap
- | ERC20BridgeSource.MeshSwap,
-): string {
- switch (source) {
- case ERC20BridgeSource.UniswapV2:
- return UNISWAPV2_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.SushiSwap:
- return SUSHISWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.CryptoCom:
- return CRYPTO_COM_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.PancakeSwap:
- return PANCAKESWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.PancakeSwapV2:
- return PANCAKESWAPV2_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.BakerySwap:
- return BAKERYSWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.ApeSwap:
- return APESWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.CheeseSwap:
- return CHEESESWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.QuickSwap:
- return QUICKSWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.Dfyn:
- return DFYN_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.WaultSwap:
- return WAULTSWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.ShibaSwap:
- return SHIBASWAP_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];
- case ERC20BridgeSource.UbeSwap:
- return UBESWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.MorpheusSwap:
- return MORPHEUSSWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.SpookySwap:
- return SPOOKYSWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.SpiritSwap:
- return SPIRITSWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.BiSwap:
- return BISWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.Yoshi:
- return YOSHI_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.MeshSwap:
- return MESHSWAP_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.MDex:
- return MDEX_ROUTER_BY_CHAIN_ID[chainId];
- case ERC20BridgeSource.KnightSwap:
- return KNIGHTSWAP_ROUTER_BY_CHAIN_ID[chainId];
- default:
- throw new Error(`Unknown UniswapV2 like source ${source}`);
- }
-}
-
-const BAD_TOKENS_BY_SOURCE: Partial<{ [key in ERC20BridgeSource]: string[] }> = {
- [ERC20BridgeSource.Uniswap]: [
- '0xb8c77482e45f1f44de1745f52c74426c631bdd52', // BNB
- ],
-};
-
-export function isBadTokenForSource(token: string, source: ERC20BridgeSource): boolean {
- return (BAD_TOKENS_BY_SOURCE[source] || []).includes(token.toLowerCase());
-}
diff --git a/packages/asset-swapper/src/utils/market_operation_utils/comparison_price.ts b/packages/asset-swapper/src/utils/market_operation_utils/comparison_price.ts
deleted file mode 100644
index 2fbbe05605..0000000000
--- a/packages/asset-swapper/src/utils/market_operation_utils/comparison_price.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-import { Web3Wrapper } from '@0x/dev-utils';
-import { FillQuoteTransformerOrderType } from '@0x/protocol-utils';
-import { BigNumber, logUtils } from '@0x/utils';
-import * as _ from 'lodash';
-
-import { MarketOperation } from '../../types';
-
-import { COMPARISON_PRICE_DECIMALS, SOURCE_FLAGS } from './constants';
-import {
- ComparisonPrice,
- ERC20BridgeSource,
- ExchangeProxyOverhead,
- FeeEstimate,
- FeeSchedule,
- MarketSideLiquidity,
-} from './types';
-
-/**
- * Takes in an optimizer response and returns a price for RFQT MMs to beat
- * returns the price of the taker asset in terms of the maker asset
- * So the RFQT MM should aim for a higher price
- * @param adjustedRate the adjusted rate (accounting for fees) from the optimizer, maker/taker
- * @param amount the amount specified by the client
- * @param marketSideLiquidity the results from querying liquidity sources
- * @param feeSchedule the fee schedule passed to the Optimizer
- * @return ComparisonPrice object with the prices for RFQ MMs to beat
- */
-export function getComparisonPrices(
- adjustedRate: BigNumber,
- amount: BigNumber,
- marketSideLiquidity: MarketSideLiquidity,
- feeSchedule: FeeSchedule,
- exchangeProxyOverhead: ExchangeProxyOverhead,
-): ComparisonPrice {
- let wholeOrder: BigNumber | undefined;
- let feeInEth: BigNumber | number;
-
- // HACK: get the fee penalty of a single 0x native order
- // The FeeSchedule function takes in a `FillData` object and returns a fee estimate in ETH
- // We don't have fill data here, we just want the cost of a single native order, so we pass in undefined
- // This works because the feeSchedule returns a constant for Native orders, this will need
- // to be tweaked if the feeSchedule for native orders uses the fillData passed in
- // 2 potential issues: there is no native fee schedule or the fee schedule depends on fill data
- if (feeSchedule[ERC20BridgeSource.Native] === undefined) {
- logUtils.warn('ComparisonPrice function did not find native order fee schedule');
-
- return { wholeOrder };
- } else {
- try {
- const fillFeeInEth = new BigNumber(
- (feeSchedule[ERC20BridgeSource.Native] as FeeEstimate)({ type: FillQuoteTransformerOrderType.Rfq }).fee,
- );
- const exchangeProxyOverheadInEth = new BigNumber(exchangeProxyOverhead(SOURCE_FLAGS.RfqOrder));
- feeInEth = fillFeeInEth.plus(exchangeProxyOverheadInEth);
- } catch {
- logUtils.warn('Native order fee schedule requires fill data');
-
- return { wholeOrder };
- }
- }
-
- // Calc native order fee penalty in output unit (maker units for sells, taker unit for buys)
- const feePenalty = !marketSideLiquidity.outputAmountPerEth.isZero()
- ? marketSideLiquidity.outputAmountPerEth.times(feeInEth)
- : // if it's a sell, the input token is the taker token
- marketSideLiquidity.inputAmountPerEth
- .times(feeInEth)
- .times(marketSideLiquidity.side === MarketOperation.Sell ? adjustedRate : adjustedRate.pow(-1));
-
- // the adjusted rate is defined as maker/taker
- // input is the taker token for sells, input is the maker token for buys
- const orderMakerAmount =
- marketSideLiquidity.side === MarketOperation.Sell ? adjustedRate.times(amount).plus(feePenalty) : amount;
- const orderTakerAmount =
- marketSideLiquidity.side === MarketOperation.Sell ? amount : amount.dividedBy(adjustedRate).minus(feePenalty);
-
- if (orderTakerAmount.gt(0) && orderMakerAmount.gt(0)) {
- const optimalMakerUnitAmount = Web3Wrapper.toUnitAmount(
- // round up maker amount -- err to giving more competitive price
- orderMakerAmount.integerValue(BigNumber.ROUND_UP),
- marketSideLiquidity.makerTokenDecimals,
- );
- const optimalTakerUnitAmount = Web3Wrapper.toUnitAmount(
- // round down taker amount -- err to giving more competitive price
- orderTakerAmount.integerValue(BigNumber.ROUND_DOWN),
- marketSideLiquidity.takerTokenDecimals,
- );
- wholeOrder = optimalMakerUnitAmount.div(optimalTakerUnitAmount).decimalPlaces(COMPARISON_PRICE_DECIMALS);
- }
-
- return { wholeOrder };
-}
diff --git a/packages/asset-swapper/src/utils/market_operation_utils/compound_ctoken_cache.ts b/packages/asset-swapper/src/utils/market_operation_utils/compound_ctoken_cache.ts
deleted file mode 100644
index cb07bef487..0000000000
--- a/packages/asset-swapper/src/utils/market_operation_utils/compound_ctoken_cache.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import { logUtils } from '@0x/utils';
-import axios from 'axios';
-
-import { constants } from '../../constants';
-
-export interface CToken {
- tokenAddress: string;
- underlyingAddress: string;
-}
-
-interface CTokenApiResponse {
- cToken: Array<{
- token_address: string;
- underlying_address: string;
- }>;
-}
-
-interface Cache {
- [key: string]: CToken;
-}
-
-const CTOKEN_REFRESH_INTERVAL_MS = 30 * constants.ONE_MINUTE_MS;
-
-/**
- * Fetches a list of CTokens from Compound's official API.
- * The token information is updated every 30 minutes and cached
- * so that it can be accessed with the underlying token's address.
- */
-export class CompoundCTokenCache {
- private _cache: Cache = {};
- constructor(private readonly _apiUrl: string, private readonly _wethAddress: string) {
- const refreshCTokenCache = async () => this.fetchAndUpdateCTokensAsync();
- // tslint:disable-next-line:no-floating-promises
- refreshCTokenCache();
- setInterval(refreshCTokenCache, CTOKEN_REFRESH_INTERVAL_MS);
- }
-
- public async fetchAndUpdateCTokensAsync(): Promise {
- try {
- const { data } = await axios.get(`${this._apiUrl}/ctoken`);
- const newCache = data?.cToken.reduce((memo, cToken) => {
- // NOTE: Re-map cETH with null underlying token address to WETH address (we only handle WETH internally)
- const underlyingAddressClean = cToken.underlying_address
- ? cToken.underlying_address.toLowerCase()
- : this._wethAddress;
-
- const tokenData: CToken = {
- tokenAddress: cToken.token_address.toLowerCase(),
- underlyingAddress: underlyingAddressClean,
- };
- memo[underlyingAddressClean] = tokenData;
- return memo;
- }, {});
-
- this._cache = newCache;
- } catch (err) {
- logUtils.warn(`Failed to update Compound cToken cache: ${err.message}`);
- // NOTE: Safe to keep already cached data as tokens should only be added to the list
- }
- }
- public get(takerToken: string, makerToken: string): CToken | undefined {
- // mint cToken
- let cToken = this._cache[takerToken.toLowerCase()];
- if (cToken && makerToken.toLowerCase() === cToken.tokenAddress.toLowerCase()) {
- return cToken;
- }
-
- // redeem cToken
- cToken = this._cache[makerToken.toLowerCase()];
- if (cToken && takerToken.toLowerCase() === cToken.tokenAddress.toLowerCase()) {
- return cToken;
- }
-
- // No match
- return undefined;
- }
-}
diff --git a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts b/packages/asset-swapper/src/utils/market_operation_utils/constants.ts
deleted file mode 100644
index 55727d2b39..0000000000
--- a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts
+++ /dev/null
@@ -1,2773 +0,0 @@
-import { ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
-import { FillQuoteTransformerOrderType } from '@0x/protocol-utils';
-import { BigNumber } from '@0x/utils';
-import { formatBytes32String, parseBytes32String } from '@ethersproject/strings';
-
-import { TokenAdjacencyGraph, TokenAdjacencyGraphBuilder } from '../token_adjacency_graph';
-
-import { IdentityFillAdjustor } from './identity_fill_adjustor';
-import { SourceFilters } from './source_filters';
-import {
- AaveV2FillData,
- BalancerV2BatchSwapFillData,
- BancorFillData,
- CompoundFillData,
- CurveFillData,
- CurveFunctionSelectors,
- CurveInfo,
- DODOFillData,
- ERC20BridgeSource,
- FeeSchedule,
- FillData,
- FinalUniswapV3FillData,
- GasSchedule,
- GeistFillData,
- GetMarketOrdersOpts,
- isFinalUniswapV3FillData,
- LidoFillData,
- LidoInfo,
- LiquidityProviderFillData,
- LiquidityProviderRegistry,
- MakerPsmFillData,
- MultiHopFillData,
- PlatypusInfo,
- PsmInfo,
- SynthetixFillData,
- UniswapV2FillData,
- UniswapV3FillData,
- WOOFiFillData,
-} from './types';
-
-// tslint:disable: no-bitwise
-
-export const ERC20_PROXY_ID = '0xf47261b0';
-export const WALLET_SIGNATURE = '0x04';
-export const ONE_ETHER = new BigNumber(1e18);
-export const NEGATIVE_INF = new BigNumber('-Infinity');
-export const POSITIVE_INF = new BigNumber('Infinity');
-export const ZERO_AMOUNT = new BigNumber(0);
-export const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
-export const ONE_HOUR_IN_SECONDS = 60 * 60;
-export const ONE_SECOND_MS = 1000;
-export const NULL_BYTES = '0x';
-export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
-export const SAMPLER_ADDRESS = '0x5555555555555555555555555555555555555555';
-export const COMPARISON_PRICE_DECIMALS = 10;
-
-// TODO(kimpers): Consolidate this implementation with the one in @0x/token-metadata
-function valueByChainId(rest: Partial<{ [key in ChainId]: T }>, defaultValue: T): { [key in ChainId]: T } {
- // TODO I don't like this but iterating through enums is weird
- return {
- [ChainId.Mainnet]: defaultValue,
- [ChainId.Ropsten]: defaultValue,
- [ChainId.Rinkeby]: defaultValue,
- [ChainId.Goerli]: defaultValue,
- [ChainId.Kovan]: defaultValue,
- [ChainId.Ganache]: defaultValue,
- [ChainId.BSC]: defaultValue,
- [ChainId.Polygon]: defaultValue,
- [ChainId.PolygonMumbai]: defaultValue,
- [ChainId.Avalanche]: defaultValue,
- [ChainId.Fantom]: defaultValue,
- [ChainId.Celo]: defaultValue,
- [ChainId.Optimism]: defaultValue,
- [ChainId.ArbitrumRinkeby]: defaultValue,
- [ChainId.Arbitrum]: defaultValue,
- ...(rest || {}),
- };
-}
-
-/**
- * Valid sources for market sell.
- */
-export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: new SourceFilters([
- ERC20BridgeSource.Native,
- ERC20BridgeSource.Uniswap,
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.Balancer,
- ERC20BridgeSource.BalancerV2,
- ERC20BridgeSource.Bancor,
- ERC20BridgeSource.BancorV3,
- ERC20BridgeSource.MStable,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Shell,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Dodo,
- ERC20BridgeSource.DodoV2,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.CryptoCom,
- ERC20BridgeSource.Lido,
- ERC20BridgeSource.MakerPsm,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.Component,
- ERC20BridgeSource.Saddle,
- ERC20BridgeSource.XSigma,
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.ShibaSwap,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.Synthetix,
- // TODO: enable after FQT has been redeployed on Ethereum mainnet
- // ERC20BridgeSource.AaveV2,
- // ERC20BridgeSource.Compound,
- ]),
- [ChainId.Ropsten]: new SourceFilters([
- ERC20BridgeSource.Native,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Uniswap,
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.Curve,
- ]),
- [ChainId.Rinkeby]: new SourceFilters([ERC20BridgeSource.Native]),
- [ChainId.Kovan]: new SourceFilters([ERC20BridgeSource.Native]),
- [ChainId.Goerli]: new SourceFilters([
- ERC20BridgeSource.Native,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Uniswap,
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.UniswapV3,
- ]),
- [ChainId.PolygonMumbai]: new SourceFilters([ERC20BridgeSource.Native, ERC20BridgeSource.UniswapV3]),
- [ChainId.Ganache]: new SourceFilters([ERC20BridgeSource.Native]),
- [ChainId.BSC]: new SourceFilters([
- ERC20BridgeSource.BakerySwap,
- ERC20BridgeSource.Belt,
- ERC20BridgeSource.Dodo,
- ERC20BridgeSource.DodoV2,
- ERC20BridgeSource.Ellipsis,
- ERC20BridgeSource.Mooniswap,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Nerve,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.PancakeSwap,
- ERC20BridgeSource.PancakeSwapV2,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.ApeSwap,
- ERC20BridgeSource.CheeseSwap,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.WaultSwap,
- ERC20BridgeSource.FirebirdOneSwap,
- ERC20BridgeSource.ACryptos,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.BiSwap,
- ERC20BridgeSource.MDex,
- ERC20BridgeSource.KnightSwap,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Polygon]: new SourceFilters([
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.QuickSwap,
- ERC20BridgeSource.Dfyn,
- ERC20BridgeSource.MStable,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.DodoV2,
- ERC20BridgeSource.Dodo,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.WaultSwap,
- ERC20BridgeSource.ApeSwap,
- ERC20BridgeSource.FirebirdOneSwap,
- ERC20BridgeSource.BalancerV2,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.IronSwap,
- ERC20BridgeSource.AaveV2,
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.MeshSwap,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Avalanche]: new SourceFilters([
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Pangolin,
- ERC20BridgeSource.TraderJoe,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.AaveV2,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.GMX,
- ERC20BridgeSource.Platypus,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Fantom]: new SourceFilters([
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Beethovenx,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.Geist,
- ERC20BridgeSource.MorpheusSwap,
- ERC20BridgeSource.SpiritSwap,
- ERC20BridgeSource.SpookySwap,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.Yoshi,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Celo]: new SourceFilters([
- ERC20BridgeSource.UbeSwap,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.MobiusMoney,
- ]),
- [ChainId.Optimism]: new SourceFilters([
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Velodrome,
- ERC20BridgeSource.Synthetix,
- ]),
- [ChainId.ArbitrumRinkeby]: new SourceFilters([ERC20BridgeSource.Native, ERC20BridgeSource.UniswapV3]),
- },
- new SourceFilters([]),
-);
-
-/**
- * Valid sources for market buy.
- */
-export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: new SourceFilters([
- ERC20BridgeSource.Native,
- ERC20BridgeSource.Uniswap,
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.Balancer,
- ERC20BridgeSource.BalancerV2,
- // ERC20BridgeSource.Bancor, // FIXME: Bancor Buys not implemented in Sampler
- ERC20BridgeSource.BancorV3,
- ERC20BridgeSource.MStable,
- ERC20BridgeSource.Shell,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Dodo,
- ERC20BridgeSource.DodoV2,
- ERC20BridgeSource.Lido,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.CryptoCom,
- ERC20BridgeSource.MakerPsm,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.Component,
- ERC20BridgeSource.Saddle,
- ERC20BridgeSource.XSigma,
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.ShibaSwap,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.Synthetix,
- // TODO: enable after FQT has been redeployed on Ethereum mainnet
- // ERC20BridgeSource.AaveV2,
- // ERC20BridgeSource.Compound,
- ]),
- [ChainId.Ropsten]: new SourceFilters([
- ERC20BridgeSource.Native,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Uniswap,
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.Curve,
- ]),
- [ChainId.Goerli]: new SourceFilters([
- ERC20BridgeSource.Native,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Uniswap,
- ERC20BridgeSource.UniswapV2,
- ERC20BridgeSource.UniswapV3,
- ]),
- [ChainId.PolygonMumbai]: new SourceFilters([ERC20BridgeSource.Native, ERC20BridgeSource.UniswapV3]),
- [ChainId.Rinkeby]: new SourceFilters([ERC20BridgeSource.Native]),
- [ChainId.Kovan]: new SourceFilters([ERC20BridgeSource.Native]),
- [ChainId.Ganache]: new SourceFilters([ERC20BridgeSource.Native]),
- [ChainId.BSC]: new SourceFilters([
- ERC20BridgeSource.BakerySwap,
- ERC20BridgeSource.Belt,
- ERC20BridgeSource.Dodo,
- ERC20BridgeSource.DodoV2,
- ERC20BridgeSource.Ellipsis,
- ERC20BridgeSource.Mooniswap,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Nerve,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.PancakeSwap,
- ERC20BridgeSource.PancakeSwapV2,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.ApeSwap,
- ERC20BridgeSource.CheeseSwap,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.WaultSwap,
- ERC20BridgeSource.FirebirdOneSwap,
- ERC20BridgeSource.ACryptos,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.BiSwap,
- ERC20BridgeSource.MDex,
- ERC20BridgeSource.KnightSwap,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Polygon]: new SourceFilters([
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.QuickSwap,
- ERC20BridgeSource.Dfyn,
- ERC20BridgeSource.MStable,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.DodoV2,
- ERC20BridgeSource.Dodo,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.WaultSwap,
- ERC20BridgeSource.ApeSwap,
- ERC20BridgeSource.FirebirdOneSwap,
- ERC20BridgeSource.BalancerV2,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.LiquidityProvider,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.IronSwap,
- ERC20BridgeSource.AaveV2,
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.MeshSwap,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Avalanche]: new SourceFilters([
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Pangolin,
- ERC20BridgeSource.TraderJoe,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.KyberDmm,
- ERC20BridgeSource.AaveV2,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.GMX,
- ERC20BridgeSource.Platypus,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Fantom]: new SourceFilters([
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Beethovenx,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.Geist,
- ERC20BridgeSource.MorpheusSwap,
- ERC20BridgeSource.SpiritSwap,
- ERC20BridgeSource.SpookySwap,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.Yoshi,
- ERC20BridgeSource.WOOFi,
- ]),
- [ChainId.Celo]: new SourceFilters([
- ERC20BridgeSource.UbeSwap,
- ERC20BridgeSource.SushiSwap,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.MobiusMoney,
- ]),
- [ChainId.Optimism]: new SourceFilters([
- ERC20BridgeSource.UniswapV3,
- ERC20BridgeSource.Synapse,
- ERC20BridgeSource.Curve,
- ERC20BridgeSource.CurveV2,
- ERC20BridgeSource.MultiHop,
- ERC20BridgeSource.Velodrome,
- ERC20BridgeSource.Synthetix,
- ]),
- [ChainId.ArbitrumRinkeby]: new SourceFilters([ERC20BridgeSource.Native, ERC20BridgeSource.UniswapV3]),
- },
- new SourceFilters([]),
-);
-
-/**
- * 0x Protocol Fee Multiplier
- */
-export const PROTOCOL_FEE_MULTIPLIER = new BigNumber(0);
-
-/**
- * Sources to poll for ETH fee price estimates.
- */
-export const FEE_QUOTE_SOURCES_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap, ERC20BridgeSource.UniswapV3],
- [ChainId.BSC]: [ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.Mooniswap, ERC20BridgeSource.SushiSwap],
- [ChainId.Ropsten]: [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap],
- [ChainId.Goerli]: [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap],
- [ChainId.PolygonMumbai]: [ERC20BridgeSource.UniswapV3],
- [ChainId.Polygon]: [ERC20BridgeSource.QuickSwap, ERC20BridgeSource.SushiSwap, ERC20BridgeSource.UniswapV3],
- [ChainId.Avalanche]: [ERC20BridgeSource.Pangolin, ERC20BridgeSource.TraderJoe, ERC20BridgeSource.SushiSwap],
- [ChainId.Fantom]: [ERC20BridgeSource.SpiritSwap, ERC20BridgeSource.SpookySwap, ERC20BridgeSource.SushiSwap],
- [ChainId.Celo]: [ERC20BridgeSource.UbeSwap, ERC20BridgeSource.SushiSwap],
- [ChainId.Optimism]: [ERC20BridgeSource.UniswapV3],
- [ChainId.ArbitrumRinkeby]: [ERC20BridgeSource.UniswapV3],
- },
- [],
-);
-
-// HACK(mzhu25): Limit and RFQ orders need to be treated as different sources
-// when computing the exchange proxy gas overhead.
-export const SOURCE_FLAGS: { [key in ERC20BridgeSource]: bigint } & {
- RfqOrder: bigint;
- LimitOrder: bigint;
-} = Object.assign(
- {},
- ...['RfqOrder', 'LimitOrder', ...Object.values(ERC20BridgeSource)].map((source, index) => ({
- [source]: source === ERC20BridgeSource.Native ? BigInt(0) : BigInt(1) << BigInt(index),
- })),
-);
-
-// Mainnet tokens
-// Not an exhaustive list, just enough so we don't repeat ourselves
-export const MAINNET_TOKENS = {
- WETH: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
- // Stable Coins
- DAI: '0x6b175474e89094c44da98b954eedeac495271d0f',
- USDC: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
- USDT: '0xdac17f958d2ee523a2206206994597c13d831ec7',
- sUSD: '0x57ab1ec28d129707052df4df418d58a2d46d5f51',
- BUSD: '0x4fabb145d64652a948d72533023f6e7a623c7c53',
- TUSD: '0x0000000000085d4780b73119b644ae5ecd22b376',
- PAX: '0x8e870d67f660d95d5be530380d0ec0bd388289e1',
- GUSD: '0x056fd409e1d7a124bd7017459dfea2f387b6d5cd',
- HUSD: '0xdf574c24545e5ffecb9a659c229253d4111d87e1',
- mUSD: '0xe2f2a5c287993345a840db3b0845fbc70f5935a5',
- USDN: '0x674c6ad92fd080e4004b2312b45f796a192d27a0',
- dUSD: '0x5bc25f649fc4e26069ddf4cf4010f9f706c23831',
- USDP: '0x1456688345527be1f37e9e627da0837d6f08c925',
- // Bitcoins
- WBTC: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
- RenBTC: '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d',
- sBTC: '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6',
- tBTC: '0x8daebade922df735c38c80c7ebd708af50815faa',
- tBTCv2: '0x18084fbA666a33d37592fA2633fD49a74DD93a88',
- hBTC: '0x0316eb71485b0ab14103307bf65a021042c6d380',
- pBTC: '0x5228a22e72ccc52d415ecfd199f99d0665e7733b',
- bBTC: '0x9be89d2a4cd102d8fecc6bf9da793be995c22541',
- oBTC: '0x8064d9ae6cdf087b1bcd5bdf3531bd5d8c537a68',
- // aTokens (Aave)
- aDAI: '0x028171bca77440897b824ca71d1c56cac55b68a3',
- aUSDC: '0xbcca60bb61934080951369a648fb03df4f96263c',
- aUSDT: '0x3ed3b47dd13ec9a98b44e6204a523e766b225811',
- aSUSD: '0x6c5024cd4f8a59110119c56f8933403a539555eb',
- // Other
- MKR: '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2',
- EURS: '0xdb25f211ab05b1c97d595516f45794528a807ad8',
- sEUR: '0xd71ecff9342a5ced620049e616c5035f1db98620',
- sETH: '0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb',
- sJPY: '0xf6b1c627e95bfc3c1b4c9b825a032ff0fbf3e07d',
- sGBP: '0x97fe22e7341a0cd8db6f6c021a24dc8f4dad855f',
- sAUD: '0xf48e200eaf9906362bb1442fca31e0835773b8b4',
- sKRW: '0x269895a3df4d73b077fc823dd6da1b95f72aaf9b',
- sCHF: '0x0f83287ff768d1c1e17a42f44d644d7f22e8ee1d',
- stETH: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
- wstETH: '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
- LINK: '0x514910771af9ca656af840dff83e8264ecf986ca',
- MANA: '0x0f5d2fb29fb7d3cfee444a200298f468908cc942',
- KNC: '0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202',
- AAVE: '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9',
- sLINK: '0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6',
- yUSD: '0x5dbcf33d8c2e976c6b560249878e6f1491bca25c',
- ybCRV: '0x2994529c0652d127b7842094103715ec5299bbed',
- yCRV: '0xdf5e0e81dff6faf3a7e52ba697820c5e32d806a8',
- bCRV: '0x3b3ac5386837dc563660fb6a0937dfaa5924333b',
- yDAI: '0xacd43e627e64355f1861cec6d3a6688b31a6f952',
- yUSDC: '0x597ad1e0c13bfe8025993d9e79c69e1c0233522e',
- yUSDT: '0x2f08119c6f07c006695e079aafc638b8789faf18',
- yTUSD: '0x37d19d1c4e1fa9dc47bd1ea12f742a0887eda74a',
- crETH: '0xcbc1065255cbc3ab41a6868c22d1f1c573ab89fd',
- ankrETH: '0xe95a203b1a91a908f9b9ce46459d101078c2c3cb',
- vETH: '0x898bad2774eb97cf6b94605677f43b41871410b1',
- alETH: '0x0100546f2cd4c9d97f798ffc9755e47865ff7ee6',
- HT: '0x6f259637dcD74C767781E37Bc6133cd6A68aa161',
- UST: '0xa47c8bf37f92abed4a126bda807a7b7498661acd',
- // StableSwap "open pools" (crv.finance)
- STABLEx: '0xcd91538b91b4ba7797d39a2f66e63810b50a33d0',
- alUSD: '0xbc6da0fe9ad5f3b0d58160288917aa56653660e9',
- // Frax ecosystem
- FRAX: '0x853d955acef822db058eb8505911ed77f175b99e',
- cvxFXS: '0xfeef77d3f69374f66429c91d732a244f074bdf74',
- FXS: '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0',
- OHM: '0x383518188c0c6d7730d91b2c03a03c837814a899',
- OHMV2: '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5',
- BTRFLY: '0xc0d4ceb216b3ba9c3701b291766fdcba977cec3a',
- // Stargate
- STG: '0xaf5191b0de278c7286d6c7cc6ab6bb8a73ba2cd6',
- //
- LUSD: '0x5f98805a4e8be255a32880fdec7f6728c6568ba0',
- // Fei Ecosystem
- FEI: '0x956f47f50a910163d8bf957cf5846d573e7f87ca',
- TRIBE: '0xc7283b66eb1eb5fb86327f08e1b5816b0720212b',
- //
- DSU: '0x605d26fbd5be761089281d5cec2ce86eea667109',
- ESS: '0x24ae124c4cc33d6791f8e8b63520ed7107ac8b3e',
- cvxCRV: '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7',
- CRV: '0xd533a949740bb3306d119cc777fa900ba034cd52',
- MIM: '0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3',
- EURT: '0xc581b735a1688071a1746c968e0798d642ede491',
- // Synapse ecosystem
- nUSD: '0x1b84765de8b7566e4ceaf4d0fd3c5af52d3dde4f',
- CVX: '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b',
- UST_WORMHOLE: '0xa693b19d2931d498c5b318df961919bb4aee87a5',
- RAI: '0x03ab458634910aad20ef5f1c8ee96f1d6ac54919',
- DOLA: '0x865377367054516e17014ccded1e7d814edc9ce4',
- OUSD: '0x2a8e1e676ec238d8a992307b495b45b3feaa5e86',
- agEUR: '0x1a7e4e63778b4f12a199c062f3efdd288afcbce8',
- ibEUR: '0x96e61422b6a9ba0e068b6c5add4ffabc6a4aae27',
- YFI: '0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e',
-};
-
-export const BSC_TOKENS = {
- WBNB: '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',
- BUSD: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
- USDT: '0x55d398326f99059ff775485246999027b3197955',
- USDC: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d',
- DAI: '0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3',
- PAX: '0xb7f8cd00c5a06c0537e2abff0b58033d02e5e094',
- UST: '0x23396cf899ca06c4472205fc903bdb4de249d6fc',
- VAI: '0x4bd17003473389a42daf6a0a729f6fdb328bbbd7',
- WEX: '0xa9c41a46a6b3531d28d5c32f6633dd2ff05dfb90',
- WETH: '0x2170ed0880ac9a755fd29b2688956bd959f933f8',
- BTCB: '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c',
- renBTC: '0xfce146bf3146100cfe5db4129cf6c82b0ef4ad8c',
- pBTC: '0xed28a457a5a76596ac48d87c0f577020f6ea1c4c',
- nUSD: '0x23b891e5c62e0955ae2bd185990103928ab817b3',
- BSW: '0x965F527D9159dCe6288a2219DB51fc6Eef120dD1',
- WOO: '0x4691937a7508860f876c9c0a2a617e7d9e945d4b',
-};
-
-export const POLYGON_TOKENS = {
- DAI: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063',
- USDC: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
- USDT: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
- amDAI: '0x27f8d03b3a2196956ed754badc28d73be8830a6e',
- amUSDC: '0x1a13f4ca1d028320a707d99520abfefca3998b7f',
- amUSDT: '0x60d55f02a771d515e077c9c2403a1ef324885cec',
- WBTC: '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6',
- WMATIC: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
- WETH: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
- renBTC: '0xdbf31df14b66535af65aac99c32e9ea844e14501',
- QUICK: '0x831753dd7087cac61ab5644b308642cc1c33dc13',
- DFYN: '0xc168e40227e4ebd8c1cae80f7a55a4f0e6d66c97',
- BANANA: '0x5d47baba0d66083c52009271faf3f50dcc01023c',
- WEXPOLY: '0x4c4bf319237d98a30a929a96112effa8da3510eb',
- nUSD: '0xb6c473756050de474286bed418b77aeac39b02af',
- ANY: '0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8',
- WOO: '0x1b815d120b3ef02039ee11dc2d33de7aa4a8c603',
-};
-
-export const AVALANCHE_TOKENS = {
- WAVAX: '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
- WETH: '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab',
- WBTC: '0x50b7545627a5162f82a992c33b87adc75187b218',
- DAI: '0xd586e7f844cea2f87f50152665bcbc2c279d8d70',
- // bridged USDC
- USDC: '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664',
- // native USDC on Avalanche usdc.e
- nUSDC: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
- // usdt.e
- USDt: '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7',
- USDT: '0xc7198437980c041c805a1edcba50c1ce5db95118',
- aDAI: '0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a',
- aUSDC: '0x46a51127c3ce23fb7ab1de06226147f446e4a857',
- aUSDT: '0x532e6537fea298397212f09a61e03311686f548e',
- nETH: '0x19e1ae0ee35c0404f835521146206595d37981ae',
- nUSD: '0xcfc37a6ab183dd4aed08c204d1c2773c0b1bdf46',
- aWETH: '0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21',
- MIM: '0x130966628846bfd36ff31a822705796e8cb8c18d',
- MAG: '0x1d60109178C48E4A937D8AB71699D8eBb6F7c5dE',
- sAVAX: '0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be',
- UST: '0xb599c3590f42f8f995ecfa0f85d2980b76862fc1',
- FRAX: '0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64',
- YUSD: '0x111111111111ed1d73f860f57b2798b683f2d325',
- WOO: '0xabc9547b534519ff73921b1fba6e672b5f58d083',
-};
-
-export const CELO_TOKENS = {
- WCELO: '0x471ece3750da237f93b8e339c536989b8978a438',
- // Some of these tokens are Optics bridge? tokens which
- // had an issue and migrated from v1 to v2
- WETHv1: '0xe919f65739c26a42616b7b8eedc6b5524d1e3ac4',
- oWETH: '0x122013fd7df1c6f636a5bb8f03108e876548b455',
- WBTC: '0xbaab46e28388d2779e6e31fd00cf0e5ad95e327b',
- cUSD: '0x765de816845861e75a25fca122bb6898b8b1282a',
- // ??
- cBTC: '0xd629eb00deced2a080b7ec630ef6ac117e614f1b',
- cETH: '0x2def4285787d58a2f811af24755a8150622f4361',
- UBE: '0x00be915b9dcf56a3cbe739d9b9c202ca692409ec',
- // Moolah
- mCELO: '0x7d00cd74ff385c955ea3d79e47bf06bd7386387d',
- mCUSD: '0x918146359264c492bd6934071c6bd31c854edbc3',
- mCEUR: '0xe273ad7ee11dcfaa87383ad5977ee1504ac07568',
- amCUSD: '0x64defa3544c695db8c535d289d843a189aa26b98',
- MOO: '0x17700282592d6917f6a73d0bf8accf4d578c131e',
-
- //
- wBTC: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
- wETH: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
- wBTCO: '0xbe50a3013a1c94768a1abb78c3cb79ab28fc1ace',
- pUSDC: '0xcc82628f6a8defa1e2b0ad7ed448bef3647f7941',
- cUSDC: '0x2a3684e9dc20b857375ea04235f2f7edbe818fa7',
- cUSDC_V2: '0xef4229c8c3250c675f21bcefa42f58efbff6002a',
- pUSDC_V2: '0x1bfc26ce035c368503fae319cc2596716428ca44',
- pUSD: '0xeadf4a7168a82d30ba0619e64d5bcf5b30b45226',
- pCELO: '0x301a61d01a63c8d670c2b8a43f37d12ef181f997',
- aaUSDC: '0xb70e0a782b058bfdb0d109a3599bec1f19328e36',
- asUSDC: '0xcd7d7ff64746c1909e44db8e95331f9316478817',
- mcUSDT: '0xcfffe0c89a779c09df3df5624f54cdf7ef5fdd5d',
- mcUSDC: '0x93db49be12b864019da9cb147ba75cdc0506190e',
- DAI: '0x90ca507a5d4458a4c6c6249d186b6dcb02a5bccd',
-};
-
-export const FANTOM_TOKENS = {
- WFTM: '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83',
- WETH: '0x74b23882a30290451a17c44f4f05243b6b58c76d',
- USDC: '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
- DAI: '0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e',
- fUSDT: '0x049d68029688eabf473097a2fc38ef61633a3c7a',
- WBTC: '0x321162cd933e2be498cd2267a90534a804051b11',
- WCRV: '0x1e4f97b9f9f913c46f1632781732927b9019c68b',
- renBTC: '0xdbf31df14b66535af65aac99c32e9ea844e14501',
- MIM: '0x82f0b8b456c1a451378467398982d4834b6829c1',
- nUSD: '0xed2a7edd7413021d440b09d654f3b87712abab66',
- nETH: '0x67c10c397dd0ba417329543c1a40eb48aaa7cd00',
- gfUSDT: '0x940f41f0ec9ba1a34cf001cc03347ac092f5f6b5',
- gUSDC: '0xe578c856933d8e1082740bf7661e379aa2a30b26',
- gDAI: '0x07e6332dd090d287d3489245038daf987955dcfb',
- FRAX: '0xdc301622e621166bd8e82f2ca0a26c13ad0be355',
- gFTM: '0x39b3bd37208cbade74d0fcbdbb12d606295b430a',
- gETH: '0x25c130b2624cf12a4ea30143ef50c5d68cefa22f',
- gWBTC: '0x38aca5484b8603373acc6961ecd57a6a594510a3',
- gCRV: '0x690754a168b022331caa2467207c61919b3f8a98',
- gMIM: '0xc664fc7b8487a3e10824cda768c1d239f2403bbe',
- WOO: '0x6626c47c00f1d87902fc13eecfac3ed06d5e8d8a',
-};
-
-export const OPTIMISM_TOKENS = {
- WETH: '0x4200000000000000000000000000000000000006',
- USDC: '0x7f5c764cbc14f9669b88837ca1490cca17c31607',
- USDT: '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58',
- DAI: '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1',
- WBTC: '0x68f180fcce6836688e9084f035309e29bf0a2095',
- nETH: '0x809dc529f07651bd43a172e8db6f4a7a0d771036',
- sWETH: '0x121ab82b49b2bc4c7901ca46b8277962b4350204',
- // Synthetix synths:
- sAAVE: '0x00b8d5a5e1ac97cb4341c4bc4367443c8776e8d9',
- sAVAX: '0xb2b42b231c68cbb0b4bf2ffebf57782fd97d3da4',
- sBTC: '0x298b9b95708152ff6968aafd889c6586e9169f1d',
- sETH: '0xe405de8f52ba7559f9df3c368500b6e6ae6cee49',
- sEUR: '0xfbc4198702e81ae77c06d58f81b629bdf36f0a71',
- sLINK: '0xc5db22719a06418028a40a9b5e9a7c02959d0d08',
- sMATIC: '0x81ddfac111913d3d5218dea999216323b7cd6356',
- sSOL: '0x8b2f7ae8ca8ee8428b6d76de88326bb413db2766',
- sUNI: '0xf5a6115aa582fd1beea22bc93b7dc7a785f60d03',
- sUSD: '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9',
-};
-
-export const GEIST_FANTOM_POOLS = {
- lendingPool: '0x9fad24f572045c7869117160a571b2e50b10d068',
-};
-
-export const CURVE_POOLS = {
- compound: '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56', // 0.Compound
- // 1.USDT is dead
- PAX: '0x06364f10b501e868329afbc005b3492902d6c763', // 2.PAX
- // 3.y is dead
- // 3.bUSD is dead
- sUSD: '0xa5407eae9ba41422680e2e00537571bcc53efbfd', // 5.sUSD
- renBTC: '0x93054188d876f558f4a66b2ef1d97d16edf0895b', // 6.ren
- sBTC: '0x7fc77b5c7614e1533320ea6ddc2eb61fa00a9714', // 7.sbtc
- HBTC: '0x4ca9b3063ec5866a4b82e437059d2c43d1be596f', // 8.hbtc
- TRI: '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7', // 9.3pool
- GUSD: '0x4f062658eaaf2c1ccf8c8e36d6824cdf41167956', // 10.gusd
- HUSD: '0x3ef6a01a0f81d6046290f3e2a8c5b843e738e604', // 11.husd
- // 12.usdk is dead
- USDN: '0x0f9cb53ebe405d49a0bbdbd291a65ff571bc83e1', // 13.usdn
- // 14.linkusd is dead
- mUSD: '0x8474ddbe98f5aa3179b3b3f5942d724afcdec9f6', // 15.musd
- // 16.rsv is dead
- dUSD: '0x8038c01a0390a8c547446a0b2c18fc9aefecc10c', // 17.dusd
- tBTC: '0xc25099792e9349c7dd09759744ea681c7de2cb66', // 18.tbtc
- pBTC: '0x7f55dde206dbad629c080068923b36fe9d6bdbef', // 19.pbtc
- bBTC: '0x071c661b4deefb59e2a3ddb20db036821eee8f4b', // 20.bbtc
- oBTC: '0xd81da8d904b52208541bade1bd6595d8a251f8dd', // 21.obtc
- UST: '0x890f4e345b1daed0367a877a1612f86a1f86985f', // 22.ust
- eurs: '0x0ce6a5ff5217e38315f87032cf90686c96627caa', // 23.eurs
- seth: '0xc5424b857f758e906013f3555dad202e4bdb4567', // 24.seth
- aave: '0xdebf20617708857ebe4f679508e7b7863a8a8eee', // 25.aave
- steth: '0xdc24316b9ae028f1497c275eb9192a3ea0f67022', // 26.stETH
- saave: '0xeb16ae0052ed37f479f7fe63849198df1765a733', // saave
- ankreth: '0xa96a65c051bf88b4095ee1f2451c2a9d43f53ae2', // ankreth
- USDP: '0x42d7025938bec20b69cbae5a77421082407f053a', // usdp
- ib: '0x2dded6da1bf5dbdf597c45fcfaa3194e53ecfeaf', // iron bank
- link: '0xf178c0b5bb7e7abf4e12a4838c7b7c5ba2c623c0', // link
- btrflyweth: '0xf43b15ab692fde1f9c24a9fce700adcc809d5391', // redacted cartel
- stgusdc: '0x3211c6cbef1429da3d0d58494938299c92ad5860', // stargate
- // StableSwap "open pools" (crv.finance)
- TUSD: '0xecd5e75afb02efa118af914515d6521aabd189f1',
- STABLEx: '0x3252efd4ea2d6c78091a1f43982ee2c3659cc3d1',
- alUSD: '0x43b4fdfd4ff969587185cdb6f0bd875c5fc83f8c',
- FRAX: '0xd632f22692fac7611d2aa1c0d552930d43caed3b',
- LUSD: '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca',
- BUSD: '0x4807862aa8b2bf68830e4c8dc86d0e9a998e085a',
- DSU3CRV: '0x6ec80df362d7042c50d4469bcfbc174c9dd9109a',
- cvxcrv: '0x9d0464996170c6b9e75eed71c68b99ddedf279e8',
- cvxfxs: '0xd658a338613198204dca1143ac3f01a722b5d94a',
- mim: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b',
- eurt: '0xfd5db7463a3ab53fd211b4af195c5bccc1a03890',
- ethcrv: '0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511',
- ethcvx: '0xb576491f1e6e5e62f1d8f26062ee822b40b0e0d4',
- fei_tri: '0x06cb22615ba53e60d67bf6c341a0fd5e718e1655',
- rai_tri: '0x618788357d0ebd8a37e763adab3bc575d54c2c7d',
- DOLA_tri: '0xaa5a67c256e27a5d80712c51971408db3370927d',
- OUSD_tri: '0x87650d7bbfc3a9f10587d7778206671719d9910d',
- d3pool: '0xbaaa1f5dba42c3389bdbc2c9d2de134f5cd0dc89',
- triEURpool: '0xb9446c4ef5ebe66268da6700d26f96273de3d571',
- ibEURsEUR: '0x19b080fe1ffa0553469d20ca36219f17fcf03859',
- wethyfi: '0xc26b89a667578ec7b3f11b2f98d6fd15c07c54ba',
-};
-
-export const CURVE_V2_POOLS = {
- tricrypto: '0x80466c64868e1ab14a1ddf27a676c3fcbe638fe5',
- tricrypto2: '0xd51a44d3fae010294c616388b506acda1bfaae46',
-};
-
-export const CURVE_POLYGON_POOLS = {
- aave: '0x445fe580ef8d70ff569ab36e80c647af338db351',
- ren: '0xc2d95eef97ec6c17551d45e77b590dc1f9117c67',
-};
-
-export const CURVE_V2_POLYGON_POOLS = {
- atricrypto3: '0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8',
-};
-
-export const CURVE_AVALANCHE_POOLS = {
- aave: '0x7f90122bf0700f9e7e1f688fe926940e8839f353',
- mim: '0xaea2e71b631fa93683bcf256a8689dfa0e094fcd',
- USDC: '0x3a43a5851a3e3e0e25a3c1089670269786be1577',
-};
-
-export const CURVE_V2_AVALANCHE_POOLS = {
- atricrypto: '0x58e57ca18b7a47112b877e31929798cd3d703b0f',
-};
-
-export const CURVE_FANTOM_POOLS = {
- fUSDT: '0x92d5ebf3593a92888c25c0abef126583d4b5312e',
- twoPool: '0x27e611fd27b276acbd5ffd632e5eaebec9761e40',
- ren: '0x3ef6a01a0f81d6046290f3e2a8c5b843e738e604',
- tri_v2: '0x2dd7c9371965472e5a5fd28fbe165007c61439e1',
- geist: '0x0fa949783947bf6c1b171db13aeacbb488845b3f',
- FRAX_twoPool: '0x7a656b342e14f745e2b164890e88017e27ae7320',
-};
-
-export const CURVE_V2_FANTOM_POOLS = {
- tricrypto: '0x3a1659ddcf2339be3aea159ca010979fb49155ff',
-};
-
-export const CURVE_OPTIMISM_POOLS = {
- tri: '0x1337bedc9d22ecbe766df105c9623922a27963ec',
-};
-
-export const SADDLE_POOLS = {
- stablesV2: '0xaCb83E0633d6605c5001e2Ab59EF3C745547C8C7',
- bitcoinsV2: '0xdf3309771d2BF82cb2B6C56F9f5365C8bD97c4f2',
- alETH: '0xa6018520eaacc06c30ff2e1b3ee2c7c22e64196a',
- d4: '0xc69ddcd4dfef25d8a793241834d4cc4b3668ead6',
-};
-
-export const IRONSWAP_POOLS = {
- is3usd: '0x837503e8a8753ae17fb8c8151b8e6f586defcb57',
-};
-
-export const NERVE_POOLS = {
- threePool: '0x1b3771a66ee31180906972580ade9b81afc5fcdc',
-};
-
-export const SYNAPSE_MAINNET_POOLS = {
- nUSDLP: '0x1116898dda4015ed8ddefb84b6e8bc24528af2d8',
-};
-
-export const SYNAPSE_OPTIMISM_POOLS = {
- nETHLP: '0xe27bff97ce92c3e1ff7aa9f86781fdd6d48f5ee9',
-};
-
-export const SYNAPSE_BSC_POOLS = {
- nUSDLP: '0x28ec0b36f0819ecb5005cab836f4ed5a2eca4d13',
-};
-
-export const SYNAPSE_POLYGON_POOLS = {
- nUSDLP: '0x85fcd7dd0a1e1a9fcd5fd886ed522de8221c3ee5',
-};
-
-export const SYNAPSE_FANTOM_POOLS = {
- nUSDLP: '0x2913e812cf0dcca30fb28e6cac3d2dcff4497688',
- nETHLP: '0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1',
-};
-
-export const SYNAPSE_AVALANCHE_POOLS = {
- nUSDLP: '0xed2a7edd7413021d440b09d654f3b87712abab66',
- nETHLP: '0x77a7e60555bc18b4be44c181b2575eee46212d44',
-};
-
-export const SYNAPSE_ARBITRUM_POOLS = {
- nUSDLP: '0x0db3fe3b770c95a0b99d1ed6f2627933466c0dd8',
- nETHLP: '0xd70a52248e546a3b260849386410c7170c7bd1e9',
-};
-
-export const BELT_POOLS = {
- vPool: '0xf16d312d119c13dd27fd0dc814b0bcdcaaa62dfd',
-};
-
-export const ELLIPSIS_POOLS = {
- threePool: '0x160caed03795365f3a589f10c379ffa7d75d4e76',
-};
-
-export const XSIGMA_POOLS = {
- stable: '0x3333333ACdEdBbC9Ad7bda0876e60714195681c5',
-};
-
-export const FIREBIRDONESWAP_BSC_POOLS = {
- oneswap: '0x01c9475dbd36e46d1961572c8de24b74616bae9e',
-};
-
-export const FIREBIRDONESWAP_POLYGON_POOLS = {
- oneswap: '0x01c9475dbd36e46d1961572c8de24b74616bae9e',
-};
-export const MOBIUSMONEY_CELO_POOLS = {
- usdc_optics_v2: '0x9906589ea8fd27504974b7e8201df5bbde986b03',
- dai_optics_v2: '0xf3f65dfe0c8c8f2986da0fec159abe6fd4e700b4',
- weth_optics_v2: '0x74ef28d635c6c5800dd3cd62d4c4f8752daacb09',
- pusdc_optics_v2: '0xcce0d62ce14fb3e4363eb92db37ff3630836c252',
- usdc_allbridge_solana: '0x63c1914bf00a9b395a2bf89aada55a5615a3656e',
- usdc_poly_optics: '0xa2f0e57d4ceacf025e81c76f28b9ad6e9fbe8735',
-};
-
-export const ACRYPTOS_POOLS = {
- acs4usd: '0xb3f0c9ea1f05e312093fdb031e789a756659b0ac',
- acs4vai: '0x191409d5a4effe25b0f4240557ba2192d18a191e',
- acs4ust: '0x99c92765efc472a9709ced86310d64c4573c4b77',
- acs3btc: '0xbe7caa236544d1b9a0e7f91e94b9f5bfd3b5ca81',
-};
-
-export const PLATYPUS_AVALANCHE_POOLS = {
- usd: '0x66357dcace80431aee0a7507e2e361b7e2402370',
- yusd: '0xc828d995c686aaba78a4ac89dfc8ec0ff4c5be83',
- frax: '0xb8e567fc23c39c94a1f6359509d7b43d1fbed824',
- mim: '0x30c30d826be87cd0a4b90855c2f38f7fcfe4eaa7',
- sAVAX: '0x4658ea7e9960d6158a261104aaa160cc953bb6ba',
-};
-
-export const WOOFI_POOL_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0xbf365ce9cfcb2d5855521985e351ba3bcf77fd3f',
- [ChainId.Fantom]: '0x9503e7517d3c5bc4f9e4a1c6ae4f8b33ac2546f2',
- [ChainId.Avalanche]: '0x1df3009c57a8b143c6246149f00b090bce3b8f88',
- [ChainId.Polygon]: '0x7400b665c8f4f3a951a99f1ee9872efb8778723d',
- },
- NULL_ADDRESS,
-);
-
-export const WOOFI_SUPPORTED_TOKENS = new Set([
- BSC_TOKENS.USDT,
- BSC_TOKENS.WBNB,
- BSC_TOKENS.WOO,
- BSC_TOKENS.WETH,
- BSC_TOKENS.BTCB,
- AVALANCHE_TOKENS.nUSDC,
- AVALANCHE_TOKENS.WAVAX,
- AVALANCHE_TOKENS.WBTC,
- AVALANCHE_TOKENS.WETH,
- AVALANCHE_TOKENS.WOO,
- FANTOM_TOKENS.USDC,
- FANTOM_TOKENS.WFTM,
- FANTOM_TOKENS.WETH,
- FANTOM_TOKENS.WBTC,
- FANTOM_TOKENS.WOO,
- POLYGON_TOKENS.USDC,
- POLYGON_TOKENS.WMATIC,
- POLYGON_TOKENS.WBTC,
- POLYGON_TOKENS.WETH,
- POLYGON_TOKENS.WOO,
-]);
-
-export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: [
- MAINNET_TOKENS.WETH,
- MAINNET_TOKENS.USDT,
- MAINNET_TOKENS.DAI,
- MAINNET_TOKENS.USDC,
- MAINNET_TOKENS.WBTC,
- ],
- [ChainId.BSC]: [
- BSC_TOKENS.WBNB,
- BSC_TOKENS.BUSD,
- BSC_TOKENS.DAI,
- BSC_TOKENS.USDC,
- BSC_TOKENS.WETH,
- BSC_TOKENS.USDT,
- BSC_TOKENS.WEX,
- ],
- [ChainId.Ropsten]: [
- getContractAddressesForChainOrThrow(ChainId.Ropsten).etherToken,
- '0xad6d458402f60fd3bd25163575031acdce07538d', // DAI
- '0x07865c6e87b9f70255377e024ace6630c1eaa37f', // USDC
- ],
- [ChainId.Goerli]: [
- getContractAddressesForChainOrThrow(ChainId.Goerli).etherToken,
- '0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844', // DAI
- '0x07865c6E87B9F70255377e024ace6630C1Eaa37F', // USDC
- ],
- [ChainId.ArbitrumRinkeby]: [
- getContractAddressesForChainOrThrow(ChainId.ArbitrumRinkeby).etherToken,
- '0x237b3B5238D2022aA80cAd1f67dAE53f353F74bF', // USDT
- '0xF61Cffd6071a8DB7cD5E8DF1D3A5450D9903cF1c', // USDC
- ],
- [ChainId.PolygonMumbai]: [
- getContractAddressesForChainOrThrow(ChainId.PolygonMumbai).etherToken,
- '0xe6b8a5CF854791412c1f6EFC7CAf629f5Df1c747', // USDC
- ],
- [ChainId.Polygon]: [
- POLYGON_TOKENS.WMATIC,
- POLYGON_TOKENS.WETH,
- POLYGON_TOKENS.USDC,
- POLYGON_TOKENS.DAI,
- POLYGON_TOKENS.USDT,
- POLYGON_TOKENS.WBTC,
- ],
- [ChainId.Avalanche]: [
- AVALANCHE_TOKENS.WAVAX,
- AVALANCHE_TOKENS.WETH,
- AVALANCHE_TOKENS.DAI,
- AVALANCHE_TOKENS.USDT,
- AVALANCHE_TOKENS.USDC,
- AVALANCHE_TOKENS.nUSD,
- AVALANCHE_TOKENS.nETH,
- AVALANCHE_TOKENS.aWETH,
- AVALANCHE_TOKENS.MIM,
- ],
- [ChainId.Fantom]: [
- FANTOM_TOKENS.WFTM,
- FANTOM_TOKENS.WETH,
- FANTOM_TOKENS.DAI,
- FANTOM_TOKENS.USDC,
- FANTOM_TOKENS.nUSD,
- FANTOM_TOKENS.nETH,
- FANTOM_TOKENS.MIM,
- ],
- [ChainId.Celo]: [
- CELO_TOKENS.WCELO,
- CELO_TOKENS.mCUSD,
- CELO_TOKENS.WETHv1,
- CELO_TOKENS.amCUSD,
- CELO_TOKENS.WBTC,
- ],
- [ChainId.Optimism]: [
- OPTIMISM_TOKENS.WETH,
- OPTIMISM_TOKENS.DAI,
- OPTIMISM_TOKENS.USDC,
- OPTIMISM_TOKENS.USDT,
- OPTIMISM_TOKENS.nETH,
- OPTIMISM_TOKENS.sWETH,
- ],
- },
- [],
-);
-
-// Note be careful here as a UNION is performed when finding intermediary tokens
-// attaching to a default intermediary token (stables or ETH etc) can have a large impact
-export const DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: new TokenAdjacencyGraphBuilder(DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Mainnet])
- .tap(builder => {
- // Convex and Curve
- builder.addBidirectional(MAINNET_TOKENS.cvxCRV, MAINNET_TOKENS.CRV);
- // Convex and FXS
- builder.addBidirectional(MAINNET_TOKENS.cvxFXS, MAINNET_TOKENS.FXS);
- // FEI TRIBE liquid in UniV2
- builder.addBidirectional(MAINNET_TOKENS.FEI, MAINNET_TOKENS.TRIBE);
- // FRAX ecosystem
- builder.addBidirectional(MAINNET_TOKENS.FRAX, MAINNET_TOKENS.FXS);
- builder.addBidirectional(MAINNET_TOKENS.FRAX, MAINNET_TOKENS.OHM);
- // REDACTED CARTEL
- builder.addBidirectional(MAINNET_TOKENS.OHMV2, MAINNET_TOKENS.BTRFLY);
- // Lido
- builder.addBidirectional(MAINNET_TOKENS.stETH, MAINNET_TOKENS.wstETH);
- // Synthetix Atomic Swap
- builder.addCompleteSubgraph([
- MAINNET_TOKENS.sBTC,
- MAINNET_TOKENS.sETH,
- MAINNET_TOKENS.sUSD,
- MAINNET_TOKENS.sEUR,
- MAINNET_TOKENS.sJPY,
- MAINNET_TOKENS.sGBP,
- MAINNET_TOKENS.sAUD,
- MAINNET_TOKENS.sKRW,
- MAINNET_TOKENS.sCHF,
- ]);
- })
- .build(),
- [ChainId.BSC]: new TokenAdjacencyGraphBuilder(DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.BSC]).build(),
- [ChainId.Polygon]: new TokenAdjacencyGraphBuilder(DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Polygon])
- .tap(builder => {
- builder.addBidirectional(POLYGON_TOKENS.QUICK, POLYGON_TOKENS.ANY);
- })
- .build(),
- [ChainId.Avalanche]: new TokenAdjacencyGraphBuilder(DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Avalanche])
- .tap(builder => {
- // Synapse nETH/aWETH pool
- builder.addBidirectional(AVALANCHE_TOKENS.aWETH, AVALANCHE_TOKENS.nETH);
- // Trader Joe MAG/MIM pool
- builder.addBidirectional(AVALANCHE_TOKENS.MIM, AVALANCHE_TOKENS.MAG);
- })
- .build(),
- [ChainId.Fantom]: new TokenAdjacencyGraphBuilder(
- DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Fantom],
- ).build(),
- [ChainId.Celo]: new TokenAdjacencyGraphBuilder(DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Celo]).build(),
- [ChainId.Optimism]: new TokenAdjacencyGraphBuilder(DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Optimism])
- .tap(builder => {
- // Synthetix Atomic Swap
- builder.addCompleteSubgraph([
- OPTIMISM_TOKENS.sAAVE,
- OPTIMISM_TOKENS.sAVAX,
- OPTIMISM_TOKENS.sBTC,
- OPTIMISM_TOKENS.sETH,
- OPTIMISM_TOKENS.sEUR,
- OPTIMISM_TOKENS.sLINK,
- OPTIMISM_TOKENS.sMATIC,
- OPTIMISM_TOKENS.sSOL,
- OPTIMISM_TOKENS.sUNI,
- OPTIMISM_TOKENS.sUSD,
- ]);
- })
- .build(),
- },
- TokenAdjacencyGraph.getEmptyGraph(),
-);
-
-export const NATIVE_FEE_TOKEN_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: getContractAddressesForChainOrThrow(ChainId.Mainnet).etherToken,
- [ChainId.BSC]: getContractAddressesForChainOrThrow(ChainId.BSC).etherToken,
- [ChainId.Ganache]: getContractAddressesForChainOrThrow(ChainId.Ganache).etherToken,
- [ChainId.Ropsten]: getContractAddressesForChainOrThrow(ChainId.Ropsten).etherToken,
- [ChainId.Goerli]: getContractAddressesForChainOrThrow(ChainId.Goerli).etherToken,
- [ChainId.PolygonMumbai]: getContractAddressesForChainOrThrow(ChainId.PolygonMumbai).etherToken,
- [ChainId.ArbitrumRinkeby]: getContractAddressesForChainOrThrow(ChainId.ArbitrumRinkeby).etherToken,
- [ChainId.Rinkeby]: getContractAddressesForChainOrThrow(ChainId.Rinkeby).etherToken,
- [ChainId.Kovan]: getContractAddressesForChainOrThrow(ChainId.Kovan).etherToken,
- [ChainId.Polygon]: getContractAddressesForChainOrThrow(ChainId.Polygon).etherToken,
- [ChainId.Avalanche]: getContractAddressesForChainOrThrow(ChainId.Avalanche).etherToken,
- [ChainId.Fantom]: getContractAddressesForChainOrThrow(ChainId.Fantom).etherToken,
- [ChainId.Celo]: getContractAddressesForChainOrThrow(ChainId.Celo).etherToken,
- [ChainId.Optimism]: getContractAddressesForChainOrThrow(ChainId.Optimism).etherToken,
- },
- NULL_ADDRESS,
-);
-
-export const NATIVE_FEE_TOKEN_AMOUNT_BY_CHAIN_ID = valueByChainId(
- { [ChainId.Mainnet]: ONE_ETHER.times(0.1) },
- ONE_ETHER,
-);
-
-// Order dependent
-const CURVE_TRI_POOL_MAINNET_TOKENS = [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT];
-const CURVE_TRI_BTC_POOL_TOKEN = [MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.sBTC];
-const CURVE_POLYGON_ATRICRYPTO_UNDERLYING_TOKENS = [POLYGON_TOKENS.DAI, POLYGON_TOKENS.USDC, POLYGON_TOKENS.USDT];
-const CURVE_POLYGON_ATRICRYPTO_TOKENS = [POLYGON_TOKENS.amDAI, POLYGON_TOKENS.amUSDC, POLYGON_TOKENS.amUSDT];
-const CURVE_FANTOM_TWO_POOL_TOKENS = [FANTOM_TOKENS.DAI, FANTOM_TOKENS.USDC];
-
-const createCurveExchangePool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: info.tokens,
- metaTokens: undefined,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-const createCurveExchangeUnderlyingPool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: info.tokens,
- metaTokens: undefined,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-const createCurveMetaTriPool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: [...info.tokens, ...CURVE_TRI_POOL_MAINNET_TOKENS],
- metaTokens: info.tokens,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-const createCurveMetaTriBtcPool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: [...info.tokens, ...CURVE_TRI_BTC_POOL_TOKEN],
- metaTokens: info.tokens,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-const createCurveMetaTwoPoolFantom = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: [...info.tokens, ...CURVE_FANTOM_TWO_POOL_TOKENS],
- metaTokens: info.tokens,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-const createCurveExchangeV2Pool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_v2,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_v2,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: info.tokens,
- metaTokens: undefined,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-const createCurveV2MetaTriPool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_v2,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying_v2,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: [...CURVE_POLYGON_ATRICRYPTO_UNDERLYING_TOKENS, ...info.tokens],
- metaTokens: info.tokens,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-const createCurveFactoryCryptoExchangePool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_uint256,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_uint256,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: info.tokens,
- metaTokens: undefined,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-const MOBIUSMONEY_CELO_SHARED: CurveInfo = {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- metaTokens: undefined,
- gasSchedule: 150e3,
- poolAddress: NULL_ADDRESS,
- tokens: [],
-};
-
-/**
- * Mainnet Curve configuration
- * The tokens are in order of their index, which each curve defines
- * I.e DaiUsdc curve has DAI as index 0 and USDC as index 1
- */
-export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
- [CURVE_POOLS.compound]: createCurveExchangeUnderlyingPool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC],
- pool: CURVE_POOLS.compound,
- gasSchedule: 587e3,
- }),
- [CURVE_POOLS.PAX]: createCurveExchangeUnderlyingPool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT, MAINNET_TOKENS.PAX],
- pool: CURVE_POOLS.PAX,
- gasSchedule: 742e3,
- }),
- [CURVE_POOLS.sUSD]: createCurveExchangeUnderlyingPool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT, MAINNET_TOKENS.sUSD],
- pool: CURVE_POOLS.sUSD,
- gasSchedule: 302e3,
- }),
- [CURVE_POOLS.renBTC]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.WBTC],
- pool: CURVE_POOLS.renBTC,
- gasSchedule: 171e3,
- }),
- [CURVE_POOLS.sBTC]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.sBTC],
- pool: CURVE_POOLS.sBTC,
- gasSchedule: 327e3,
- }),
- [CURVE_POOLS.HBTC]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.hBTC, MAINNET_TOKENS.WBTC],
- pool: CURVE_POOLS.HBTC,
- gasSchedule: 210e3,
- }),
- [CURVE_POOLS.TRI]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- pool: CURVE_POOLS.TRI,
- gasSchedule: 176e3,
- }),
- [CURVE_POOLS.GUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.GUSD],
- pool: CURVE_POOLS.GUSD,
- gasSchedule: 411e3,
- }),
- [CURVE_POOLS.HUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.HUSD],
- pool: CURVE_POOLS.HUSD,
- gasSchedule: 396e3,
- }),
- [CURVE_POOLS.USDN]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.USDN],
- pool: CURVE_POOLS.USDN,
- gasSchedule: 398e3,
- }),
- [CURVE_POOLS.mUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.mUSD],
- pool: CURVE_POOLS.mUSD,
- gasSchedule: 385e3,
- }),
- [CURVE_POOLS.dUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.dUSD],
- pool: CURVE_POOLS.dUSD,
- gasSchedule: 371e3,
- }),
- [CURVE_POOLS.tBTC]: createCurveMetaTriBtcPool({
- tokens: [MAINNET_TOKENS.tBTC],
- pool: CURVE_POOLS.tBTC,
- gasSchedule: 482e3,
- }),
- [CURVE_POOLS.pBTC]: createCurveMetaTriBtcPool({
- tokens: [MAINNET_TOKENS.pBTC],
- pool: CURVE_POOLS.pBTC,
- gasSchedule: 503e3,
- }),
- [CURVE_POOLS.bBTC]: createCurveMetaTriBtcPool({
- tokens: [MAINNET_TOKENS.bBTC],
- pool: CURVE_POOLS.bBTC,
- gasSchedule: 497e3,
- }),
- [CURVE_POOLS.oBTC]: createCurveMetaTriBtcPool({
- tokens: [MAINNET_TOKENS.oBTC],
- pool: CURVE_POOLS.oBTC,
- gasSchedule: 488e3,
- }),
- [CURVE_POOLS.UST]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.UST],
- pool: CURVE_POOLS.UST,
- gasSchedule: 340e3,
- }),
- [CURVE_POOLS.eurs]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.EURS, MAINNET_TOKENS.sEUR],
- pool: CURVE_POOLS.eurs,
- gasSchedule: 320e3,
- }),
- [CURVE_POOLS.eurt]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.EURT, MAINNET_TOKENS.sEUR],
- pool: CURVE_POOLS.eurt,
- gasSchedule: 320e3,
- }),
- [CURVE_POOLS.aave]: createCurveExchangeUnderlyingPool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- pool: CURVE_POOLS.aave,
- gasSchedule: 580e3,
- }),
- [CURVE_POOLS.aave]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.aDAI, MAINNET_TOKENS.aUSDC, MAINNET_TOKENS.aUSDT],
- pool: CURVE_POOLS.aave,
- gasSchedule: 580e3,
- }),
- [CURVE_POOLS.saave]: createCurveExchangeUnderlyingPool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.sUSD],
- pool: CURVE_POOLS.saave,
- gasSchedule: 580e3,
- }),
- [CURVE_POOLS.saave]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.aDAI, MAINNET_TOKENS.aSUSD],
- pool: CURVE_POOLS.saave,
- gasSchedule: 580e3,
- }),
- [CURVE_POOLS.USDP]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.USDP],
- pool: CURVE_POOLS.USDP,
- gasSchedule: 374e3,
- }),
- [CURVE_POOLS.ib]: createCurveExchangeUnderlyingPool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- pool: CURVE_POOLS.ib,
- gasSchedule: 646e3,
- }),
- [CURVE_POOLS.link]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.LINK, MAINNET_TOKENS.sLINK],
- pool: CURVE_POOLS.link,
- gasSchedule: 319e3,
- }),
- [CURVE_POOLS.TUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.TUSD],
- pool: CURVE_POOLS.TUSD,
- gasSchedule: 404e3,
- }),
- [CURVE_POOLS.STABLEx]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.STABLEx],
- pool: CURVE_POOLS.STABLEx,
- gasSchedule: 397e3,
- }),
- [CURVE_POOLS.alUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.alUSD],
- pool: CURVE_POOLS.alUSD,
- gasSchedule: 387e3,
- }),
- [CURVE_POOLS.FRAX]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.FRAX],
- pool: CURVE_POOLS.FRAX,
- gasSchedule: 387e3,
- }),
- [CURVE_POOLS.LUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.LUSD],
- pool: CURVE_POOLS.LUSD,
- gasSchedule: 387e3,
- }),
- [CURVE_POOLS.BUSD]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.BUSD],
- pool: CURVE_POOLS.BUSD,
- gasSchedule: 387e3,
- }),
- [CURVE_POOLS.steth]: createCurveExchangePool({
- // This pool uses ETH
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.stETH],
- pool: CURVE_POOLS.steth,
- gasSchedule: 151e3,
- }),
- [CURVE_POOLS.seth]: createCurveExchangePool({
- // This pool uses ETH
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.sETH],
- pool: CURVE_POOLS.seth,
- gasSchedule: 187e3,
- }),
- [CURVE_POOLS.ankreth]: createCurveExchangePool({
- // This pool uses ETH
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.ankrETH],
- pool: CURVE_POOLS.ankreth,
- gasSchedule: 125e3,
- }),
- [CURVE_POOLS.DSU3CRV]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.DSU],
- pool: CURVE_POOLS.DSU3CRV,
- 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,
- }),
- [CURVE_POOLS.ethcrv]: {
- ...createCurveExchangePool({
- // This pool uses ETH
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.CRV],
- pool: CURVE_POOLS.ethcrv,
- gasSchedule: 350e3,
- }),
- // This pool has a custom get_dy and exchange selector with uint256
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_uint256,
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_uint256,
- },
- [CURVE_POOLS.ethcvx]: {
- ...createCurveExchangePool({
- // This pool uses ETH
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.CVX],
- pool: CURVE_POOLS.ethcvx,
- gasSchedule: 350e3,
- }),
- // This pool has a custom get_dy and exchange selector with uint256
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_uint256,
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_uint256,
- },
- [CURVE_POOLS.fei_tri]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.FEI],
- pool: CURVE_POOLS.fei_tri,
- gasSchedule: 340e3,
- }),
- [CURVE_POOLS.rai_tri]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.RAI],
- pool: CURVE_POOLS.rai_tri,
- gasSchedule: 340e3,
- }),
- [CURVE_POOLS.DOLA_tri]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.DOLA],
- pool: CURVE_POOLS.DOLA_tri,
- gasSchedule: 340e3,
- }),
- [CURVE_POOLS.OUSD_tri]: createCurveMetaTriPool({
- tokens: [MAINNET_TOKENS.OUSD],
- pool: CURVE_POOLS.OUSD_tri,
- gasSchedule: 340e3,
- }),
- [CURVE_POOLS.d3pool]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.FRAX, MAINNET_TOKENS.FEI, MAINNET_TOKENS.alUSD],
- pool: CURVE_POOLS.d3pool,
- gasSchedule: 176e3,
- }),
- [CURVE_POOLS.triEURpool]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.agEUR, MAINNET_TOKENS.EURT, MAINNET_TOKENS.EURS],
- pool: CURVE_POOLS.triEURpool,
- gasSchedule: 176e3,
- }),
- [CURVE_POOLS.ibEURsEUR]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.ibEUR, MAINNET_TOKENS.sEUR],
- pool: CURVE_POOLS.ibEURsEUR,
- gasSchedule: 176e3,
- }),
- [CURVE_POOLS.btrflyweth]: createCurveFactoryCryptoExchangePool({
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.BTRFLY],
- pool: CURVE_POOLS.btrflyweth,
- gasSchedule: 250e3,
- }),
- [CURVE_POOLS.wethyfi]: createCurveFactoryCryptoExchangePool({
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.YFI],
- pool: CURVE_POOLS.wethyfi,
- gasSchedule: 250e3,
- }),
- [CURVE_POOLS.stgusdc]: createCurveFactoryCryptoExchangePool({
- tokens: [MAINNET_TOKENS.STG, MAINNET_TOKENS.USDC],
- pool: CURVE_POOLS.stgusdc,
- gasSchedule: 250e3,
- }),
- [CURVE_POOLS.cvxfxs]: createCurveFactoryCryptoExchangePool({
- tokens: [MAINNET_TOKENS.FXS, MAINNET_TOKENS.cvxFXS],
- pool: CURVE_POOLS.cvxfxs,
- gasSchedule: 390e3,
- }),
-};
-
-export const CURVE_V2_MAINNET_INFOS: { [name: string]: CurveInfo } = {
- [CURVE_V2_POOLS.tricrypto]: createCurveExchangeV2Pool({
- tokens: [MAINNET_TOKENS.USDT, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.WETH],
- pool: CURVE_V2_POOLS.tricrypto,
- gasSchedule: 300e3,
- }),
- [CURVE_V2_POOLS.tricrypto2]: createCurveExchangeV2Pool({
- tokens: [MAINNET_TOKENS.USDT, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.WETH],
- pool: CURVE_V2_POOLS.tricrypto2,
- gasSchedule: 300e3,
- }),
-};
-
-export const CURVE_POLYGON_INFOS: { [name: string]: CurveInfo } = {
- ['aave_exchangeunderlying']: createCurveExchangeUnderlyingPool({
- tokens: CURVE_POLYGON_ATRICRYPTO_UNDERLYING_TOKENS,
- pool: CURVE_POLYGON_POOLS.aave,
- gasSchedule: 300e3,
- }),
- ['aave_exchange']: createCurveExchangePool({
- tokens: CURVE_POLYGON_ATRICRYPTO_TOKENS,
- pool: CURVE_POLYGON_POOLS.aave,
- gasSchedule: 150e3,
- }),
- [CURVE_POLYGON_POOLS.ren]: createCurveExchangeUnderlyingPool({
- tokens: [POLYGON_TOKENS.WBTC, POLYGON_TOKENS.renBTC],
- pool: CURVE_POLYGON_POOLS.ren,
- gasSchedule: 350e3,
- }),
-};
-
-export const CURVE_V2_POLYGON_INFOS: { [name: string]: CurveInfo } = {
- [CURVE_V2_POLYGON_POOLS.atricrypto3]: createCurveV2MetaTriPool({
- tokens: [POLYGON_TOKENS.WBTC, POLYGON_TOKENS.WETH],
- pool: CURVE_V2_POLYGON_POOLS.atricrypto3,
- gasSchedule: 300e3,
- }),
-};
-
-export const CURVE_AVALANCHE_INFOS: { [name: string]: CurveInfo } = {
- ['aave_exchangeunderlying']: createCurveExchangeUnderlyingPool({
- tokens: [AVALANCHE_TOKENS.DAI, AVALANCHE_TOKENS.USDC, AVALANCHE_TOKENS.USDT],
- pool: CURVE_AVALANCHE_POOLS.aave,
- gasSchedule: 850e3,
- }),
- ['aave_exchange']: createCurveExchangePool({
- tokens: [AVALANCHE_TOKENS.aDAI, AVALANCHE_TOKENS.aUSDC, AVALANCHE_TOKENS.aUSDT],
- pool: CURVE_AVALANCHE_POOLS.aave,
- gasSchedule: 150e3,
- }),
- [CURVE_AVALANCHE_POOLS.mim]: createCurveExchangePool({
- tokens: [AVALANCHE_TOKENS.MIM, AVALANCHE_TOKENS.USDT, AVALANCHE_TOKENS.USDC],
- pool: CURVE_AVALANCHE_POOLS.mim,
- gasSchedule: 150e3,
- }),
- [CURVE_AVALANCHE_POOLS.USDC]: createCurveExchangePool({
- tokens: [AVALANCHE_TOKENS.USDC, AVALANCHE_TOKENS.nUSDC],
- pool: CURVE_AVALANCHE_POOLS.USDC,
- gasSchedule: 150e3,
- }),
-};
-
-export const CURVE_V2_AVALANCHE_INFOS: { [name: string]: CurveInfo } = {
- [CURVE_V2_AVALANCHE_POOLS.atricrypto]: {
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_v2,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying_v2,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: [
- AVALANCHE_TOKENS.DAI,
- AVALANCHE_TOKENS.USDC,
- AVALANCHE_TOKENS.USDT,
- AVALANCHE_TOKENS.WBTC,
- AVALANCHE_TOKENS.WETH,
- ],
- metaTokens: undefined,
- poolAddress: CURVE_V2_AVALANCHE_POOLS.atricrypto,
- gasSchedule: 1300e3,
- },
-};
-
-// TODO: modify gasSchedule
-export const CURVE_FANTOM_INFOS: { [name: string]: CurveInfo } = {
- [CURVE_FANTOM_POOLS.ren]: createCurveExchangePool({
- tokens: [FANTOM_TOKENS.WBTC, FANTOM_TOKENS.renBTC],
- pool: CURVE_FANTOM_POOLS.ren,
- gasSchedule: 171e3,
- }),
- [CURVE_FANTOM_POOLS.twoPool]: createCurveExchangePool({
- tokens: [FANTOM_TOKENS.DAI, FANTOM_TOKENS.USDC],
- pool: CURVE_FANTOM_POOLS.twoPool,
- gasSchedule: 176e3,
- }),
- [CURVE_FANTOM_POOLS.fUSDT]: createCurveExchangeUnderlyingPool({
- tokens: [FANTOM_TOKENS.fUSDT, FANTOM_TOKENS.DAI, FANTOM_TOKENS.USDC],
- pool: CURVE_FANTOM_POOLS.fUSDT,
- gasSchedule: 587e3,
- }),
- [CURVE_FANTOM_POOLS.tri_v2]: createCurveExchangePool({
- tokens: [FANTOM_TOKENS.MIM, FANTOM_TOKENS.fUSDT, FANTOM_TOKENS.USDC],
- pool: CURVE_FANTOM_POOLS.tri_v2,
- gasSchedule: 176e3,
- }),
- ['geist_exchangeunderlying']: createCurveExchangeUnderlyingPool({
- tokens: [FANTOM_TOKENS.DAI, FANTOM_TOKENS.USDC, FANTOM_TOKENS.fUSDT],
- pool: CURVE_FANTOM_POOLS.geist,
- gasSchedule: 850e3,
- }),
- ['geist_exchange']: createCurveExchangePool({
- tokens: [FANTOM_TOKENS.gDAI, FANTOM_TOKENS.gUSDC, FANTOM_TOKENS.gfUSDT],
- pool: CURVE_FANTOM_POOLS.geist,
- gasSchedule: 150e3,
- }),
- [CURVE_FANTOM_POOLS.FRAX_twoPool]: createCurveMetaTwoPoolFantom({
- tokens: [FANTOM_TOKENS.FRAX],
- pool: CURVE_FANTOM_POOLS.FRAX_twoPool,
- gasSchedule: 411e3,
- }),
-};
-
-export const CURVE_V2_FANTOM_INFOS: { [name: string]: CurveInfo } = {
- [CURVE_V2_FANTOM_POOLS.tricrypto]: createCurveExchangeV2Pool({
- tokens: [FANTOM_TOKENS.fUSDT, FANTOM_TOKENS.WBTC, FANTOM_TOKENS.WETH],
- pool: CURVE_V2_FANTOM_POOLS.tricrypto,
- gasSchedule: 300e3,
- }),
-};
-
-export const CURVE_OPTIMISM_INFOS: { [name: string]: CurveInfo } = {
- [CURVE_OPTIMISM_POOLS.tri]: createCurveExchangePool({
- tokens: [OPTIMISM_TOKENS.DAI, OPTIMISM_TOKENS.USDC, OPTIMISM_TOKENS.USDT],
- pool: CURVE_OPTIMISM_POOLS.tri,
- gasSchedule: 150e3,
- }),
-};
-
-export const BELT_BSC_INFOS: { [name: string]: CurveInfo } = {
- [BELT_POOLS.vPool]: createCurveExchangeUnderlyingPool({
- tokens: [BSC_TOKENS.DAI, BSC_TOKENS.USDC, BSC_TOKENS.USDT, BSC_TOKENS.BUSD],
- pool: BELT_POOLS.vPool,
- gasSchedule: 4490e3,
- }),
-};
-
-export const ELLIPSIS_BSC_INFOS: { [name: string]: CurveInfo } = {
- [ELLIPSIS_POOLS.threePool]: createCurveExchangePool({
- tokens: [BSC_TOKENS.BUSD, BSC_TOKENS.USDC, BSC_TOKENS.USDT],
- pool: ELLIPSIS_POOLS.threePool,
- gasSchedule: 140e3,
- }),
-};
-
-export const XSIGMA_MAINNET_INFOS: { [name: string]: CurveInfo } = {
- [XSIGMA_POOLS.stable]: createCurveExchangePool({
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- pool: XSIGMA_POOLS.stable,
- gasSchedule: 150e3,
- }),
-};
-
-// Curve-like sources using custom selectors
-export const SADDLE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
- [SADDLE_POOLS.stablesV2]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SADDLE_POOLS.stablesV2,
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- metaTokens: undefined,
- gasSchedule: 150e3,
- },
- [SADDLE_POOLS.bitcoinsV2]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SADDLE_POOLS.bitcoinsV2,
- tokens: [MAINNET_TOKENS.WBTC, MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.sBTC],
- metaTokens: undefined,
- gasSchedule: 150e3,
- },
- [SADDLE_POOLS.alETH]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SADDLE_POOLS.alETH,
- tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.alETH, MAINNET_TOKENS.sETH],
- metaTokens: undefined,
- gasSchedule: 200e3,
- },
- [SADDLE_POOLS.d4]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SADDLE_POOLS.d4,
- tokens: [MAINNET_TOKENS.alUSD, MAINNET_TOKENS.FEI, MAINNET_TOKENS.FRAX, MAINNET_TOKENS.LUSD],
- metaTokens: undefined,
- gasSchedule: 150e3,
- },
-};
-
-export const IRONSWAP_POLYGON_INFOS: { [name: string]: CurveInfo } = {
- [IRONSWAP_POOLS.is3usd]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: IRONSWAP_POOLS.is3usd,
- tokens: [POLYGON_TOKENS.USDC, POLYGON_TOKENS.USDT, POLYGON_TOKENS.DAI],
- metaTokens: undefined,
- gasSchedule: 150e3,
- },
-};
-
-export const NERVE_BSC_INFOS: { [name: string]: CurveInfo } = {
- [NERVE_POOLS.threePool]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: NERVE_POOLS.threePool,
- tokens: [BSC_TOKENS.BUSD, BSC_TOKENS.USDT, BSC_TOKENS.USDC],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
-};
-
-export const SYNAPSE_BSC_INFOS: { [name: string]: CurveInfo } = {
- [SYNAPSE_BSC_POOLS.nUSDLP]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SYNAPSE_BSC_POOLS.nUSDLP,
- tokens: [BSC_TOKENS.nUSD, BSC_TOKENS.BUSD, BSC_TOKENS.USDC, BSC_TOKENS.USDT],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
-};
-
-export const SYNAPSE_FANTOM_INFOS: { [name: string]: CurveInfo } = {
- [SYNAPSE_FANTOM_POOLS.nUSDLP]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SYNAPSE_FANTOM_POOLS.nUSDLP,
- tokens: [FANTOM_TOKENS.nUSD, FANTOM_TOKENS.MIM, FANTOM_TOKENS.USDC, FANTOM_TOKENS.fUSDT],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
-};
-
-export const SYNAPSE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
- [SYNAPSE_MAINNET_POOLS.nUSDLP]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SYNAPSE_MAINNET_POOLS.nUSDLP,
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
-};
-
-export const SYNAPSE_OPTIMISM_INFOS: { [name: string]: CurveInfo } = {
- [SYNAPSE_OPTIMISM_POOLS.nETHLP]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SYNAPSE_OPTIMISM_POOLS.nETHLP,
- tokens: [OPTIMISM_TOKENS.nETH, OPTIMISM_TOKENS.sWETH],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
-};
-
-export const SYNAPSE_POLYGON_INFOS: { [name: string]: CurveInfo } = {
- [SYNAPSE_POLYGON_POOLS.nUSDLP]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SYNAPSE_POLYGON_POOLS.nUSDLP,
- tokens: [POLYGON_TOKENS.nUSD, POLYGON_TOKENS.DAI, POLYGON_TOKENS.USDC, POLYGON_TOKENS.USDT],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
-};
-
-export const SYNAPSE_AVALANCHE_INFOS: { [name: string]: CurveInfo } = {
- [SYNAPSE_AVALANCHE_POOLS.nUSDLP]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SYNAPSE_AVALANCHE_POOLS.nUSDLP,
- tokens: [AVALANCHE_TOKENS.nUSD, AVALANCHE_TOKENS.DAI, AVALANCHE_TOKENS.USDC, AVALANCHE_TOKENS.USDT],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
- [SYNAPSE_AVALANCHE_POOLS.nETHLP]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: SYNAPSE_AVALANCHE_POOLS.nETHLP,
- tokens: [AVALANCHE_TOKENS.nETH, AVALANCHE_TOKENS.aWETH],
- metaTokens: undefined,
- gasSchedule: 140e3,
- },
-};
-
-export const FIREBIRDONESWAP_BSC_INFOS: { [name: string]: CurveInfo } = {
- [FIREBIRDONESWAP_BSC_POOLS.oneswap]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: FIREBIRDONESWAP_BSC_POOLS.oneswap,
- tokens: [BSC_TOKENS.BUSD, BSC_TOKENS.USDT, BSC_TOKENS.DAI, BSC_TOKENS.USDC],
- metaTokens: undefined,
- gasSchedule: 100e3,
- },
-};
-
-export const FIREBIRDONESWAP_POLYGON_INFOS: { [name: string]: CurveInfo } = {
- [FIREBIRDONESWAP_POLYGON_POOLS.oneswap]: {
- exchangeFunctionSelector: CurveFunctionSelectors.swap,
- sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- poolAddress: FIREBIRDONESWAP_POLYGON_POOLS.oneswap,
- tokens: [POLYGON_TOKENS.DAI, POLYGON_TOKENS.USDC, POLYGON_TOKENS.USDT],
- metaTokens: undefined,
- gasSchedule: 100e3,
- },
-};
-
-export const MOBIUSMONEY_CELO_INFOS: { [name: string]: CurveInfo } = {
- [MOBIUSMONEY_CELO_POOLS.usdc_optics_v2]: {
- ...MOBIUSMONEY_CELO_SHARED,
- poolAddress: MOBIUSMONEY_CELO_POOLS.usdc_optics_v2,
- tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.cUSDC_V2],
- },
- [MOBIUSMONEY_CELO_POOLS.weth_optics_v2]: {
- ...MOBIUSMONEY_CELO_SHARED,
- poolAddress: MOBIUSMONEY_CELO_POOLS.weth_optics_v2,
- tokens: [CELO_TOKENS.cETH, CELO_TOKENS.oWETH],
- },
- [MOBIUSMONEY_CELO_POOLS.pusdc_optics_v2]: {
- ...MOBIUSMONEY_CELO_SHARED,
- poolAddress: MOBIUSMONEY_CELO_POOLS.pusdc_optics_v2,
- tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.pUSDC_V2],
- },
- [MOBIUSMONEY_CELO_POOLS.usdc_allbridge_solana]: {
- ...MOBIUSMONEY_CELO_SHARED,
- poolAddress: MOBIUSMONEY_CELO_POOLS.usdc_allbridge_solana,
- tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.asUSDC],
- },
- [MOBIUSMONEY_CELO_POOLS.usdc_poly_optics]: {
- ...MOBIUSMONEY_CELO_SHARED,
- poolAddress: MOBIUSMONEY_CELO_POOLS.usdc_poly_optics,
- tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.pUSD],
- },
- [MOBIUSMONEY_CELO_POOLS.dai_optics_v2]: {
- ...MOBIUSMONEY_CELO_SHARED,
- poolAddress: MOBIUSMONEY_CELO_POOLS.dai_optics_v2,
- tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.DAI],
- },
-};
-
-const ACRYPTOS_ACS4USD_POOL_BSC_TOKENS = [BSC_TOKENS.BUSD, BSC_TOKENS.USDT, BSC_TOKENS.DAI, BSC_TOKENS.USDC];
-
-const createAcryptosMetaUsdPool = (info: { tokens: string[]; pool: string; gasSchedule: number }) => ({
- exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying,
- sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_underlying,
- buyQuoteFunctionSelector: CurveFunctionSelectors.None,
- tokens: [...info.tokens, ...ACRYPTOS_ACS4USD_POOL_BSC_TOKENS],
- metaTokens: info.tokens,
- poolAddress: info.pool,
- gasSchedule: info.gasSchedule,
-});
-
-export const ACRYPTOS_BSC_INFOS: { [name: string]: CurveInfo } = {
- [ACRYPTOS_POOLS.acs4usd]: createCurveExchangePool({
- tokens: ACRYPTOS_ACS4USD_POOL_BSC_TOKENS,
- pool: ACRYPTOS_POOLS.acs4usd,
- gasSchedule: 145e3,
- }),
-
- [ACRYPTOS_POOLS.acs4vai]: createAcryptosMetaUsdPool({
- tokens: [BSC_TOKENS.VAI],
- pool: ACRYPTOS_POOLS.acs4vai,
- gasSchedule: 300e3,
- }),
-
- [ACRYPTOS_POOLS.acs4ust]: createAcryptosMetaUsdPool({
- tokens: [BSC_TOKENS.UST],
- pool: ACRYPTOS_POOLS.acs4ust,
- gasSchedule: 300e3,
- }),
-
- [ACRYPTOS_POOLS.acs3btc]: createCurveExchangePool({
- tokens: [BSC_TOKENS.BTCB, BSC_TOKENS.renBTC, BSC_TOKENS.pBTC],
- pool: ACRYPTOS_POOLS.acs3btc,
- gasSchedule: 145e3,
- }),
-};
-
-export const PLATYPUS_AVALANCHE_INFOS: { [name: string]: PlatypusInfo } = {
- [PLATYPUS_AVALANCHE_POOLS.usd]: {
- poolAddress: PLATYPUS_AVALANCHE_POOLS.usd,
- tokens: [
- AVALANCHE_TOKENS.USDT,
- AVALANCHE_TOKENS.USDC,
- AVALANCHE_TOKENS.DAI,
- AVALANCHE_TOKENS.nUSDC,
- AVALANCHE_TOKENS.USDt,
- ],
- gasSchedule: 300e3,
- },
- [PLATYPUS_AVALANCHE_POOLS.yusd]: {
- poolAddress: PLATYPUS_AVALANCHE_POOLS.yusd,
- tokens: [AVALANCHE_TOKENS.YUSD, AVALANCHE_TOKENS.nUSDC],
- gasSchedule: 300e3,
- },
- [PLATYPUS_AVALANCHE_POOLS.frax]: {
- poolAddress: PLATYPUS_AVALANCHE_POOLS.frax,
- tokens: [AVALANCHE_TOKENS.FRAX, AVALANCHE_TOKENS.nUSDC],
- gasSchedule: 300e3,
- },
- [PLATYPUS_AVALANCHE_POOLS.mim]: {
- poolAddress: PLATYPUS_AVALANCHE_POOLS.mim,
- tokens: [AVALANCHE_TOKENS.MIM, AVALANCHE_TOKENS.nUSDC],
- gasSchedule: 300e3,
- },
- [PLATYPUS_AVALANCHE_POOLS.sAVAX]: {
- poolAddress: PLATYPUS_AVALANCHE_POOLS.sAVAX,
- tokens: [AVALANCHE_TOKENS.WAVAX, AVALANCHE_TOKENS.sAVAX],
- gasSchedule: 300e3,
- },
-};
-
-export const LIQUIDITY_PROVIDER_REGISTRY_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: {
- ['0x1d0d407c5af8c86f0a6494de86e56ae21e46a951']: {
- tokens: [
- MAINNET_TOKENS.WETH,
- MAINNET_TOKENS.USDC,
- MAINNET_TOKENS.USDT,
- MAINNET_TOKENS.WBTC,
- MAINNET_TOKENS.PAX,
- MAINNET_TOKENS.LINK,
- MAINNET_TOKENS.KNC,
- MAINNET_TOKENS.MANA,
- MAINNET_TOKENS.DAI,
- MAINNET_TOKENS.BUSD,
- MAINNET_TOKENS.AAVE,
- MAINNET_TOKENS.HT,
- ],
- gasCost: (takerToken: string, makerToken: string) =>
- [takerToken, makerToken].includes(MAINNET_TOKENS.WETH) ? 160e3 : 280e3,
- },
- },
- },
- {},
-);
-
-export const UNISWAPV1_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0xc0a47dfe034b400b47bdad5fecda2621de6c4d95',
- [ChainId.Ropsten]: '0x9c83dce8ca20e9aaf9d3efc003b2ea62abc08351',
- [ChainId.Goerli]: '0x6Ce570d02D73d4c384b46135E87f8C592A8c86dA',
- },
- NULL_ADDRESS,
-);
-
-export const UNISWAPV2_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0xf164fc0ec4e93095b804a4795bbe1e041497b92a',
- [ChainId.Ropsten]: '0xf164fc0ec4e93095b804a4795bbe1e041497b92a',
- [ChainId.Goerli]: '0xf164fc0ec4e93095b804a4795bbe1e041497b92a',
- },
- NULL_ADDRESS,
-);
-
-export const SUSHISWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f',
- [ChainId.BSC]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
- [ChainId.Ropsten]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
- [ChainId.Goerli]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
- [ChainId.Polygon]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
- [ChainId.Avalanche]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
- [ChainId.Fantom]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
- [ChainId.Celo]: '0x1421bde4b10e8dd459b3bcb598810b1337d56842',
- },
- NULL_ADDRESS,
-);
-
-export const CRYPTO_COM_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0xceb90e4c17d626be0facd78b79c9c87d7ca181b3',
- },
- NULL_ADDRESS,
-);
-
-export const SHIBASWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0x03f7724180aa6b939894b5ca4314783b0b36b329',
- },
- NULL_ADDRESS,
-);
-
-export const MSTABLE_POOLS_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: {
- mUSD: {
- poolAddress: '0xe2f2a5c287993345a840db3b0845fbc70f5935a5',
- tokens: [MAINNET_TOKENS.DAI, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- },
- mBTC: {
- poolAddress: '0x945facb997494cc2570096c74b5f66a3507330a1',
- tokens: [MAINNET_TOKENS.WBTC, MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.sBTC],
- },
- },
- [ChainId.Polygon]: {
- mUSD: {
- poolAddress: '0xe840b73e5287865eec17d250bfb1536704b43b21',
- tokens: [POLYGON_TOKENS.DAI, POLYGON_TOKENS.USDC, POLYGON_TOKENS.USDT],
- },
- mBTC: {
- poolAddress: NULL_ADDRESS,
- tokens: [] as string[],
- },
- },
- },
- {
- mUSD: {
- poolAddress: NULL_ADDRESS,
- tokens: [] as string[],
- },
- mBTC: {
- poolAddress: NULL_ADDRESS,
- tokens: [] as string[],
- },
- },
-);
-
-export const KYBER_DMM_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0x1c87257f5e8609940bc751a07bb085bb7f8cdbe6',
- [ChainId.Polygon]: '0x546c79662e028b661dfb4767664d0273184e4dd1',
- [ChainId.BSC]: '0x78df70615ffc8066cc0887917f2cd72092c86409',
- [ChainId.Avalanche]: '0x8efa5a9ad6d594cf76830267077b78ce0bc5a5f8',
- [ChainId.Fantom]: '0x5d5a5a0a465129848c2549669e12cdc2f8de039a',
- },
- NULL_ADDRESS,
-);
-
-export const BISWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0x3a6d8ca21d1cf76f653a67577fa0d27453350dd8',
- },
- NULL_ADDRESS,
-);
-
-export const MDEX_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0x7dae51bd3e3376b8c7c4900e9107f12be3af1ba8',
- },
- NULL_ADDRESS,
-);
-
-export const KNIGHTSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0x05e61e0cdcd2170a76f9568a110cee3afdd6c46f',
- },
- NULL_ADDRESS,
-);
-
-export const MOONISWAP_REGISTRIES_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: ['0xd41b24bba51fac0e4827b6f94c0d6ddeb183cd64'],
- },
- [] as string[],
-);
-
-export const DODOV1_CONFIG_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: {
- helper: '0x533da777aedce766ceae696bf90f8541a4ba80eb',
- registry: '0x3A97247DF274a17C59A3bd12735ea3FcDFb49950',
- },
- [ChainId.BSC]: {
- helper: '0x0f859706aee7fcf61d5a8939e8cb9dbb6c1eda33',
- registry: '0xca459456a45e300aa7ef447dbb60f87cccb42828',
- },
- [ChainId.Polygon]: {
- helper: '0xdfaf9584f5d229a9dbe5978523317820a8897c5a',
- registry: '0x357c5e9cfa8b834edcef7c7aabd8f9db09119d11',
- },
- },
- { helper: NULL_ADDRESS, registry: NULL_ADDRESS },
-);
-
-export const DODOV2_FACTORIES_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: [
- '0x6b4fa0bc61eddc928e0df9c7f01e407bfcd3e5ef', // Private Pool
- '0x72d220ce168c4f361dd4dee5d826a01ad8598f6c', // Vending Machine
- '0x6fddb76c93299d985f4d3fc7ac468f9a168577a4', // Stability Pool
- ],
- [ChainId.BSC]: [
- '0xafe0a75dffb395eaabd0a7e1bbbd0b11f8609eef', // Private Pool
- '0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb', // Vending Machine
- '0x0fb9815938ad069bf90e14fe6c596c514bede767', // Stability Pool
- ],
- [ChainId.Polygon]: [
- '0x95e887adf9eaa22cc1c6e3cb7f07adc95b4b25a8', // Private Pool
- '0x79887f65f83bdf15bcc8736b5e5bcdb48fb8fe13', // Vending Machine
- '0x43c49f8dd240e1545f147211ec9f917376ac1e87', // Stability Pool
- ],
- },
- [] as string[],
-);
-export const MAX_DODOV2_POOLS_QUERIED = 3;
-
-export const CURVE_LIQUIDITY_PROVIDER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0x561b94454b65614ae3db0897b74303f4acf7cc75',
- [ChainId.Ropsten]: '0xae241c6fc7f28f6dc0cb58b4112ba7f63fcaf5e2',
- },
- NULL_ADDRESS,
-);
-
-export const MAKER_PSM_INFO_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: {
- // Currently only USDC is supported
- gemTokenAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
- ilkIdentifier: formatBytes32String('PSM-USDC-A'),
- psmAddress: '0x89b78cfa322f6c5de0abceecab66aee45393cc5a',
- },
- },
- {
- gemTokenAddress: NULL_ADDRESS,
- ilkIdentifier: NULL_BYTES,
- psmAddress: NULL_ADDRESS,
- },
-);
-
-export const BANCOR_REGISTRY_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0x52Ae12ABe5D8BD778BD5397F99cA900624CfADD4',
- },
- NULL_ADDRESS,
-);
-
-export const BANCORV3_NETWORK_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0xeef417e1d5cc832e619ae18d2f140de2999dd4fb',
- },
- NULL_ADDRESS,
-);
-
-export const BANCORV3_NETWORK_INFO_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0x8e303d296851b320e6a697bacb979d13c9d6e760',
- },
- NULL_ADDRESS,
-);
-
-export const SHELL_POOLS_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: {
- StableCoins: {
- poolAddress: '0x8f26d7bab7a73309141a291525c965ecdea7bf42',
- tokens: [MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT, MAINNET_TOKENS.sUSD, MAINNET_TOKENS.DAI],
- },
- Bitcoin: {
- poolAddress: '0xc2d019b901f8d4fdb2b9a65b5d226ad88c66ee8d',
- tokens: [MAINNET_TOKENS.RenBTC, MAINNET_TOKENS.WBTC, MAINNET_TOKENS.sBTC],
- },
- },
- },
- {
- StableCoins: {
- poolAddress: NULL_ADDRESS,
- tokens: [] as string[],
- },
- Bitcoin: {
- poolAddress: NULL_ADDRESS,
- tokens: [] as string[],
- },
- },
-);
-
-export const COMPONENT_POOLS_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: {
- USDP_USDC_USDT: {
- poolAddress: '0x49519631b404e06ca79c9c7b0dc91648d86f08db',
- tokens: [MAINNET_TOKENS.USDP, MAINNET_TOKENS.USDC, MAINNET_TOKENS.USDT],
- },
- USDP_DAI_SUSD: {
- poolAddress: '0x6477960dd932d29518d7e8087d5ea3d11e606068',
- tokens: [MAINNET_TOKENS.USDP, MAINNET_TOKENS.DAI, MAINNET_TOKENS.sUSD],
- },
- },
- },
- {
- USDP_USDC_USDT: {
- poolAddress: NULL_ADDRESS,
- tokens: [] as string[],
- },
- USDP_DAI_SUSD: {
- poolAddress: NULL_ADDRESS,
- tokens: [] as string[],
- },
- },
-);
-
-export const GEIST_INFO_ADDRESS_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Fantom]: '0xd8321aa83fb0a4ecd6348d4577431310a6e0814d',
- },
- NULL_ADDRESS,
-);
-
-export const BALANCER_V2_VAULT_ADDRESS_BY_CHAIN = valueByChainId(
- {
- [ChainId.Mainnet]: '0xba12222222228d8ba445958a75a0704d566bf2c8',
- [ChainId.Polygon]: '0xba12222222228d8ba445958a75a0704d566bf2c8',
- },
- NULL_ADDRESS,
-);
-
-export const BEETHOVEN_X_VAULT_ADDRESS_BY_CHAIN = valueByChainId(
- {
- [ChainId.Fantom]: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
- },
- NULL_ADDRESS,
-);
-
-export const LIDO_INFO_BY_CHAIN = valueByChainId(
- {
- [ChainId.Mainnet]: {
- stEthToken: MAINNET_TOKENS.stETH,
- wstEthToken: MAINNET_TOKENS.wstETH,
- wethToken: MAINNET_TOKENS.WETH,
- },
- },
- {
- wstEthToken: NULL_ADDRESS,
- stEthToken: NULL_ADDRESS,
- wethToken: NULL_ADDRESS,
- },
-);
-
-export const BALANCER_TOP_POOLS_FETCHED = 250;
-export const BALANCER_MAX_POOLS_FETCHED = 3;
-
-export const BALANCER_V2_SUBGRAPH_URL_BY_CHAIN = valueByChainId(
- {
- [ChainId.Mainnet]: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2',
- [ChainId.Polygon]: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2',
- },
- null,
-);
-
-export const UNISWAPV3_CONFIG_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: {
- quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
- router: '0xe592427a0aece92de3edee1f18e0157c05861564',
- },
- [ChainId.Ropsten]: {
- quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
- router: '0xe592427a0aece92de3edee1f18e0157c05861564',
- },
- [ChainId.Goerli]: {
- quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
- router: '0xe592427a0aece92de3edee1f18e0157c05861564',
- },
- [ChainId.PolygonMumbai]: {
- quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
- router: '0xe592427a0aece92de3edee1f18e0157c05861564',
- },
- [ChainId.Polygon]: {
- quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
- router: '0xe592427a0aece92de3edee1f18e0157c05861564',
- },
- [ChainId.Optimism]: {
- quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
- router: '0xe592427a0aece92de3edee1f18e0157c05861564',
- },
- [ChainId.ArbitrumRinkeby]: {
- quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
- router: '0xe592427a0aece92de3edee1f18e0157c05861564',
- },
- },
- { quoter: NULL_ADDRESS, router: NULL_ADDRESS },
-);
-
-export const AAVE_V2_SUBGRAPH_URL_BY_CHAIN_ID = valueByChainId(
- {
- // TODO: enable after FQT has been redeployed on Ethereum mainnet
- // [ChainId.Mainnet]: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v2',
- [ChainId.Polygon]: 'https://api.thegraph.com/subgraphs/name/aave/aave-v2-matic',
- [ChainId.Avalanche]: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v2-avalanche',
- },
- null,
-);
-
-export const COMPOUND_API_URL_BY_CHAIN_ID = valueByChainId(
- {
- // TODO: enable after FQT has been redeployed on Ethereum mainnet
- // [ChainId.Mainnet]: 'https://api.compound.finance/api/v2',
- },
- null,
-);
-
-//
-// BSC
-//
-export const PANCAKESWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0x05ff2b0db69458a0750badebc4f9e13add608c7f',
- },
- NULL_ADDRESS,
-);
-
-export const PANCAKESWAPV2_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0x10ed43c718714eb63d5aa57b78b54704e256024e',
- },
- NULL_ADDRESS,
-);
-
-export const BAKERYSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0xcde540d7eafe93ac5fe6233bee57e1270d3e330f',
- },
- NULL_ADDRESS,
-);
-
-export const APESWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0xc0788a3ad43d79aa53b09c2eacc313a787d1d607',
- [ChainId.Polygon]: '0xc0788a3ad43d79aa53b09c2eacc313a787d1d607',
- },
- NULL_ADDRESS,
-);
-
-export const CHEESESWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0x3047799262d8d2ef41ed2a222205968bc9b0d895',
- },
- NULL_ADDRESS,
-);
-
-//
-// Polygon
-//
-export const QUICKSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Polygon]: '0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff',
- },
- NULL_ADDRESS,
-);
-
-export const DFYN_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Polygon]: '0xa102072a4c07f06ec3b4900fdc4c7b80b6c57429',
- },
- NULL_ADDRESS,
-);
-
-export const WAULTSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.BSC]: '0xd48745e39bbed146eec15b79cbf964884f9877c2',
- [ChainId.Polygon]: '0x3a1d87f206d12415f5b0a33e786967680aab4f6d',
- },
- NULL_ADDRESS,
-);
-
-export const MESHSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Polygon]: '0x10f4a785f458bc144e3706575924889954946639',
- },
- NULL_ADDRESS,
-);
-
-export const PANGOLIN_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Avalanche]: '0xe54ca86531e17ef3616d22ca28b0d458b6c89106',
- },
- NULL_ADDRESS,
-);
-
-export const TRADER_JOE_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Avalanche]: '0x60ae616a2155ee3d9a68541ba4544862310933d4',
- },
- NULL_ADDRESS,
-);
-
-export const UBESWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Celo]: '0x7d28570135a2b1930f331c507f65039d4937f66c',
- },
- NULL_ADDRESS,
-);
-
-export const MORPHEUSSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Fantom]: '0x8ac868293d97761a1fed6d4a01e9ff17c5594aa3',
- },
- NULL_ADDRESS,
-);
-
-export const SPIRITSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Fantom]: '0x16327e3fbdaca3bcf7e38f5af2599d2ddc33ae52',
- },
- NULL_ADDRESS,
-);
-
-export const SPOOKYSWAP_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Fantom]: '0xf491e7b69e4244ad4002bc14e878a34207e38c29',
- },
- NULL_ADDRESS,
-);
-
-export const GMX_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Avalanche]: '0x5f719c2f1095f7b9fc68a68e35b51194f4b6abe8',
- },
- NULL_ADDRESS,
-);
-
-export const GMX_READER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Avalanche]: '0x67b789d48c926006f5132bfce4e976f0a7a63d5d',
- },
- NULL_ADDRESS,
-);
-
-export const GMX_VAULT_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Avalanche]: '0x9ab2de34a33fb459b538c43f251eb825645e8595',
- },
- NULL_ADDRESS,
-);
-
-export const PLATYPUS_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Avalanche]: '0x73256ec7575d999c360c1eec118ecbefd8da7d12',
- },
- NULL_ADDRESS,
-);
-
-export const YOSHI_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Fantom]: '0xe4a4642b19c4d0cba965673cd51422b1eda0a78d',
- },
- NULL_ADDRESS,
-);
-
-export const VELODROME_ROUTER_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Optimism]: '0xa132dab612db5cb9fc9ac426a0cc215a3423f9c9',
- },
- NULL_ADDRESS,
-);
-
-export const SYNTHETIX_READ_PROXY_BY_CHAIN_ID = valueByChainId(
- {
- [ChainId.Mainnet]: '0x4e3b31eb0e5cb73641ee1e65e7dcefe520ba3ef2',
- [ChainId.Optimism]: '0x1cb059b7e74fd21665968c908806143e744d5f30',
- },
- NULL_ADDRESS,
-);
-
-export const SYNTHETIX_CURRENCY_KEYS_BY_CHAIN_ID = valueByChainId