Compare commits
32 Commits
@0x/asset-
...
protocol@0
Author | SHA1 | Date | |
---|---|---|---|
|
0479bb5fe1 | ||
|
9ecc31ed54 | ||
|
eb29abd36c | ||
|
d202e01522 | ||
|
e838a6801b | ||
|
7439871aa0 | ||
|
317f2138c5 | ||
|
e5834f1901 | ||
|
5063446f93 | ||
|
0caf495a1a | ||
|
a20de0fc69 | ||
|
9aa0065d2d | ||
|
c24855e627 | ||
|
6bb72dd775 | ||
|
77d1ed257c | ||
|
5d265360c4 | ||
|
c9097f6e8b | ||
|
d3df985a42 | ||
|
7267420874 | ||
|
17e81432f1 | ||
|
57c767c3b1 | ||
|
dbb1c88ad9 | ||
|
254b850a8b | ||
|
e2242e5955 | ||
|
7a0255fee7 | ||
|
ec6522cfbf | ||
|
1bf96e91bb | ||
|
eb733cc58f | ||
|
d9fdcf813b | ||
|
88bd1c9cea | ||
|
9e759e82b4 | ||
|
da433854ac |
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1631120757,
|
||||
"version": "3.3.19",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "3.3.18",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1629353596,
|
||||
"version": "3.3.17",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v3.3.19 - _September 8, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.18 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v3.3.17 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-erc20",
|
||||
"version": "3.3.17",
|
||||
"version": "3.3.19",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -53,8 +53,8 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.9",
|
||||
"@0x/contracts-utils": "^4.7.17",
|
||||
"@0x/contracts-test-utils": "^5.4.10",
|
||||
"@0x/contracts-utils": "^4.8.0",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "5.4.10",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1629353596,
|
||||
"version": "5.4.9",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v5.4.10 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v5.4.9 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-test-utils",
|
||||
"version": "5.4.9",
|
||||
"version": "5.4.10",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -44,7 +44,7 @@
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.27",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contract-addresses": "^6.6.1",
|
||||
"@0x/contract-addresses": "^6.7.0",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/json-schemas": "^6.1.3",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1631120757,
|
||||
"version": "1.3.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "1.3.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1629353596,
|
||||
"version": "1.3.3",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.3.5 - _September 8, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.3.4 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.3.3 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-treasury",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.5",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -47,12 +47,12 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contract-addresses": "^6.6.1",
|
||||
"@0x/contract-addresses": "^6.7.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||
"@0x/contracts-erc20": "^3.3.17",
|
||||
"@0x/contracts-erc20": "^3.3.19",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-staking": "^2.0.45",
|
||||
"@0x/contracts-test-utils": "^5.4.9",
|
||||
"@0x/contracts-test-utils": "^5.4.10",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
"@0x/tslint-config": "^4.1.4",
|
||||
@@ -73,7 +73,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/protocol-utils": "^1.8.3",
|
||||
"@0x/protocol-utils": "^1.8.4",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
|
@@ -1,4 +1,23 @@
|
||||
[
|
||||
{
|
||||
"version": "4.8.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added FundRecoveryFeature to the 0x EP",
|
||||
"pr": 306
|
||||
}
|
||||
],
|
||||
"timestamp": 1631120757
|
||||
},
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "4.7.18",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1629353596,
|
||||
"version": "4.7.17",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v4.8.0 - _September 8, 2021_
|
||||
|
||||
* Added FundRecoveryFeature to the 0x EP (#306)
|
||||
|
||||
## v4.7.18 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v4.7.17 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-utils",
|
||||
"version": "4.7.17",
|
||||
"version": "4.8.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -52,7 +52,7 @@
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.9",
|
||||
"@0x/contracts-test-utils": "^5.4.10",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1631120757,
|
||||
"version": "0.28.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "0.28.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.28.2",
|
||||
"changes": [
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v0.28.4 - _September 8, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.28.3 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.28.2 - _August 19, 2021_
|
||||
|
||||
* Add ethers as an explicit dependency (#310)
|
||||
|
@@ -33,6 +33,7 @@ import "./features/interfaces/INativeOrdersFeature.sol";
|
||||
import "./features/interfaces/IBatchFillNativeOrdersFeature.sol";
|
||||
import "./features/interfaces/IMultiplexFeature.sol";
|
||||
import "./features/interfaces/IOtcOrdersFeature.sol";
|
||||
import "./features/interfaces/IFundRecoveryFeature.sol";
|
||||
|
||||
|
||||
/// @dev Interface for a fully featured Exchange Proxy.
|
||||
@@ -48,7 +49,8 @@ interface IZeroEx is
|
||||
INativeOrdersFeature,
|
||||
IBatchFillNativeOrdersFeature,
|
||||
IMultiplexFeature,
|
||||
IOtcOrdersFeature
|
||||
IOtcOrdersFeature,
|
||||
IFundRecoveryFeature
|
||||
{
|
||||
// solhint-disable state-visibility
|
||||
|
||||
|
@@ -0,0 +1,66 @@
|
||||
// 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.5;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||
import "../migrations/LibMigrate.sol";
|
||||
import "../fixins/FixinCommon.sol";
|
||||
import "./interfaces/IFeature.sol";
|
||||
import "./interfaces/IFundRecoveryFeature.sol";
|
||||
import "../transformers/LibERC20Transformer.sol";
|
||||
|
||||
contract FundRecoveryFeature is
|
||||
IFeature,
|
||||
IFundRecoveryFeature,
|
||||
FixinCommon
|
||||
{
|
||||
/// @dev Name of this feature.
|
||||
string public constant override FEATURE_NAME = "FundRecoveryFeature";
|
||||
/// @dev Version of this feature.
|
||||
uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);
|
||||
|
||||
/// @dev Initialize and register this feature.
|
||||
/// Should be delegatecalled by `Migrate.migrate()`.
|
||||
/// @return success `LibMigrate.SUCCESS` on success.
|
||||
function migrate()
|
||||
external
|
||||
returns (bytes4 success)
|
||||
{
|
||||
_registerFeatureFunction(this.transferTrappedTokensTo.selector);
|
||||
return LibMigrate.MIGRATE_SUCCESS;
|
||||
}
|
||||
|
||||
/// @dev Recovers ERC20 tokens or ETH from the 0x Exchange Proxy contract
|
||||
/// @param erc20 ERC20 Token Address. (You can also pass in `0xeeeee...` to indicate ETH)
|
||||
/// @param amountOut Amount of tokens to withdraw.
|
||||
/// @param recipientWallet Recipient wallet address.
|
||||
function transferTrappedTokensTo(
|
||||
IERC20TokenV06 erc20,
|
||||
uint256 amountOut,
|
||||
address payable recipientWallet
|
||||
)
|
||||
external
|
||||
override
|
||||
onlyOwner
|
||||
{
|
||||
if(amountOut == uint256(-1)) {
|
||||
amountOut = LibERC20Transformer.getTokenBalanceOf(erc20, address(this));
|
||||
}
|
||||
LibERC20Transformer.transformerTransfer(erc20, recipientWallet, amountOut);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
// 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.5;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
|
||||
|
||||
|
||||
/// @dev Exchange Proxy Recovery Functions
|
||||
interface IFundRecoveryFeature {
|
||||
|
||||
/// @dev calledFrom FundRecoveryFeature.transferTrappedTokensTo() This will be delegatecalled
|
||||
/// in the context of the Exchange Proxy instance being used.
|
||||
/// @param erc20 ERC20 Token Address.
|
||||
/// @param amountOut Amount of tokens to withdraw.
|
||||
/// @param recipientWallet Recipient wallet address.
|
||||
function transferTrappedTokensTo(
|
||||
IERC20TokenV06 erc20,
|
||||
uint256 amountOut,
|
||||
address payable recipientWallet
|
||||
)
|
||||
external;
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-zero-ex",
|
||||
"version": "0.28.2",
|
||||
"version": "0.28.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -43,7 +43,7 @@
|
||||
"config": {
|
||||
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature,OtcOrdersFeature,IOtcOrdersFeature",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBalancerV2|MixinBancor|MixinClipper|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinKyber|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
|
||||
"abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBalancerV2|MixinBancor|MixinClipper|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinKyber|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -56,10 +56,10 @@
|
||||
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^5.6.0",
|
||||
"@0x/contract-addresses": "^6.6.1",
|
||||
"@0x/contracts-erc20": "^3.3.17",
|
||||
"@0x/contract-addresses": "^6.7.0",
|
||||
"@0x/contracts-erc20": "^3.3.19",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.9",
|
||||
"@0x/contracts-test-utils": "^5.4.10",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/order-utils": "^10.4.28",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
@@ -83,7 +83,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/protocol-utils": "^1.8.3",
|
||||
"@0x/protocol-utils": "^1.8.4",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
|
@@ -21,6 +21,7 @@ import * as FixinReentrancyGuard from '../test/generated-artifacts/FixinReentran
|
||||
import * as FixinTokenSpender from '../test/generated-artifacts/FixinTokenSpender.json';
|
||||
import * as FlashWallet from '../test/generated-artifacts/FlashWallet.json';
|
||||
import * as FullMigration from '../test/generated-artifacts/FullMigration.json';
|
||||
import * as FundRecoveryFeature from '../test/generated-artifacts/FundRecoveryFeature.json';
|
||||
import * as IBatchFillNativeOrdersFeature from '../test/generated-artifacts/IBatchFillNativeOrdersFeature.json';
|
||||
import * as IBootstrapFeature from '../test/generated-artifacts/IBootstrapFeature.json';
|
||||
import * as IBridgeAdapter from '../test/generated-artifacts/IBridgeAdapter.json';
|
||||
@@ -28,6 +29,7 @@ import * as IERC20Bridge from '../test/generated-artifacts/IERC20Bridge.json';
|
||||
import * as IERC20Transformer from '../test/generated-artifacts/IERC20Transformer.json';
|
||||
import * as IFeature from '../test/generated-artifacts/IFeature.json';
|
||||
import * as IFlashWallet from '../test/generated-artifacts/IFlashWallet.json';
|
||||
import * as IFundRecoveryFeature from '../test/generated-artifacts/IFundRecoveryFeature.json';
|
||||
import * as ILiquidityProvider from '../test/generated-artifacts/ILiquidityProvider.json';
|
||||
import * as ILiquidityProviderFeature from '../test/generated-artifacts/ILiquidityProviderFeature.json';
|
||||
import * as ILiquidityProviderSandbox from '../test/generated-artifacts/ILiquidityProviderSandbox.json';
|
||||
@@ -198,6 +200,7 @@ export const artifacts = {
|
||||
TransformerDeployer: TransformerDeployer as ContractArtifact,
|
||||
BatchFillNativeOrdersFeature: BatchFillNativeOrdersFeature as ContractArtifact,
|
||||
BootstrapFeature: BootstrapFeature as ContractArtifact,
|
||||
FundRecoveryFeature: FundRecoveryFeature as ContractArtifact,
|
||||
LiquidityProviderFeature: LiquidityProviderFeature as ContractArtifact,
|
||||
MetaTransactionsFeature: MetaTransactionsFeature as ContractArtifact,
|
||||
NativeOrdersFeature: NativeOrdersFeature as ContractArtifact,
|
||||
@@ -211,6 +214,7 @@ export const artifacts = {
|
||||
IBatchFillNativeOrdersFeature: IBatchFillNativeOrdersFeature as ContractArtifact,
|
||||
IBootstrapFeature: IBootstrapFeature as ContractArtifact,
|
||||
IFeature: IFeature as ContractArtifact,
|
||||
IFundRecoveryFeature: IFundRecoveryFeature as ContractArtifact,
|
||||
ILiquidityProviderFeature: ILiquidityProviderFeature as ContractArtifact,
|
||||
IMetaTransactionsFeature: IMetaTransactionsFeature as ContractArtifact,
|
||||
IMultiplexFeature: IMultiplexFeature as ContractArtifact,
|
||||
|
96
contracts/zero-ex/test/features/fund_recovery_tests.ts
Normal file
96
contracts/zero-ex/test/features/fund_recovery_tests.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import { blockchainTests, constants, expect, randomAddress } from '@0x/contracts-test-utils';
|
||||
import { BigNumber, OwnableRevertErrors } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
|
||||
import { IOwnableFeatureContract, IZeroExContract } from '../../src/wrappers';
|
||||
import { artifacts } from '../artifacts';
|
||||
import { FundRecoveryFeatureContract } from '../generated-wrappers/fund_recovery_feature';
|
||||
import { abis } from '../utils/abis';
|
||||
import { fullMigrateAsync } from '../utils/migration';
|
||||
import { TestMintableERC20TokenContract } from '../wrappers';
|
||||
|
||||
blockchainTests('FundRecovery', async env => {
|
||||
let owner: string;
|
||||
let zeroEx: IZeroExContract;
|
||||
let token: TestMintableERC20TokenContract;
|
||||
before(async () => {
|
||||
const INITIAL_ERC20_BALANCE = Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18);
|
||||
[owner] = await env.getAccountAddressesAsync();
|
||||
zeroEx = await fullMigrateAsync(owner, env.provider, env.txDefaults, {});
|
||||
token = await TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestMintableERC20Token,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
);
|
||||
await token.mint(zeroEx.address, INITIAL_ERC20_BALANCE).awaitTransactionSuccessAsync();
|
||||
const featureImpl = await FundRecoveryFeatureContract.deployFrom0xArtifactAsync(
|
||||
artifacts.FundRecoveryFeature,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
artifacts,
|
||||
);
|
||||
await new IOwnableFeatureContract(zeroEx.address, env.provider, env.txDefaults, abis)
|
||||
.migrate(featureImpl.address, featureImpl.migrate().getABIEncodedTransactionData(), owner)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
});
|
||||
blockchainTests.resets('Should delegatecall `transferTrappedTokensTo` from the exchange proxy', () => {
|
||||
const ETH_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||
const recipientAddress = randomAddress();
|
||||
it('Tranfers an arbitrary ERC-20 Token', async () => {
|
||||
const amountOut = Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18);
|
||||
await zeroEx
|
||||
.transferTrappedTokensTo(token.address, amountOut, recipientAddress)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
const recipientAddressBalanceAferTransfer = await token.balanceOf(recipientAddress).callAsync();
|
||||
return expect(recipientAddressBalanceAferTransfer).to.bignumber.equal(amountOut);
|
||||
});
|
||||
it('Amount -1 transfers entire balance of ERC-20', async () => {
|
||||
const balanceOwner = await token.balanceOf(zeroEx.address).callAsync();
|
||||
await zeroEx
|
||||
.transferTrappedTokensTo(token.address, constants.MAX_UINT256, recipientAddress)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
const recipientAddressBalanceAferTransfer = await token.balanceOf(recipientAddress).callAsync();
|
||||
return expect(recipientAddressBalanceAferTransfer).to.bignumber.equal(balanceOwner);
|
||||
});
|
||||
it('Amount -1 transfers entire balance of ETH', async () => {
|
||||
const amountOut = new BigNumber(20);
|
||||
await env.web3Wrapper.awaitTransactionMinedAsync(
|
||||
await env.web3Wrapper.sendTransactionAsync({
|
||||
from: owner,
|
||||
to: zeroEx.address,
|
||||
value: amountOut,
|
||||
}),
|
||||
);
|
||||
const balanceOwner = await env.web3Wrapper.getBalanceInWeiAsync(zeroEx.address);
|
||||
await zeroEx
|
||||
.transferTrappedTokensTo(ETH_TOKEN_ADDRESS, constants.MAX_UINT256, recipientAddress)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
const recipientAddressBalanceAferTransfer = await env.web3Wrapper.getBalanceInWeiAsync(recipientAddress);
|
||||
return expect(recipientAddressBalanceAferTransfer).to.bignumber.equal(balanceOwner);
|
||||
});
|
||||
it('Transfers ETH ', async () => {
|
||||
const amountOut = new BigNumber(20);
|
||||
await env.web3Wrapper.awaitTransactionMinedAsync(
|
||||
await env.web3Wrapper.sendTransactionAsync({
|
||||
from: owner,
|
||||
to: zeroEx.address,
|
||||
value: amountOut,
|
||||
}),
|
||||
);
|
||||
await zeroEx
|
||||
.transferTrappedTokensTo(ETH_TOKEN_ADDRESS, amountOut.minus(1), recipientAddress)
|
||||
.awaitTransactionSuccessAsync({ from: owner });
|
||||
const recipientAddressBalance = await env.web3Wrapper.getBalanceInWeiAsync(recipientAddress);
|
||||
return expect(recipientAddressBalance).to.bignumber.be.equal(amountOut.minus(1));
|
||||
});
|
||||
it('Feature `transferTrappedTokensTo` can only be called by owner', async () => {
|
||||
const notOwner = randomAddress();
|
||||
return expect(
|
||||
zeroEx
|
||||
.transferTrappedTokensTo(ETH_TOKEN_ADDRESS, constants.MAX_UINT256, recipientAddress)
|
||||
.awaitTransactionSuccessAsync({ from: notOwner }),
|
||||
).to.revertWith(new OwnableRevertErrors.OnlyOwnerError(notOwner, owner));
|
||||
});
|
||||
});
|
||||
});
|
@@ -19,6 +19,7 @@ export * from '../test/generated-wrappers/fixin_reentrancy_guard';
|
||||
export * from '../test/generated-wrappers/fixin_token_spender';
|
||||
export * from '../test/generated-wrappers/flash_wallet';
|
||||
export * from '../test/generated-wrappers/full_migration';
|
||||
export * from '../test/generated-wrappers/fund_recovery_feature';
|
||||
export * from '../test/generated-wrappers/i_batch_fill_native_orders_feature';
|
||||
export * from '../test/generated-wrappers/i_bootstrap_feature';
|
||||
export * from '../test/generated-wrappers/i_bridge_adapter';
|
||||
@@ -26,6 +27,7 @@ export * from '../test/generated-wrappers/i_erc20_bridge';
|
||||
export * from '../test/generated-wrappers/i_erc20_transformer';
|
||||
export * from '../test/generated-wrappers/i_feature';
|
||||
export * from '../test/generated-wrappers/i_flash_wallet';
|
||||
export * from '../test/generated-wrappers/i_fund_recovery_feature';
|
||||
export * from '../test/generated-wrappers/i_liquidity_provider';
|
||||
export * from '../test/generated-wrappers/i_liquidity_provider_feature';
|
||||
export * from '../test/generated-wrappers/i_liquidity_provider_sandbox';
|
||||
|
@@ -52,6 +52,7 @@
|
||||
"test/generated-artifacts/FixinTokenSpender.json",
|
||||
"test/generated-artifacts/FlashWallet.json",
|
||||
"test/generated-artifacts/FullMigration.json",
|
||||
"test/generated-artifacts/FundRecoveryFeature.json",
|
||||
"test/generated-artifacts/IBatchFillNativeOrdersFeature.json",
|
||||
"test/generated-artifacts/IBootstrapFeature.json",
|
||||
"test/generated-artifacts/IBridgeAdapter.json",
|
||||
@@ -59,6 +60,7 @@
|
||||
"test/generated-artifacts/IERC20Transformer.json",
|
||||
"test/generated-artifacts/IFeature.json",
|
||||
"test/generated-artifacts/IFlashWallet.json",
|
||||
"test/generated-artifacts/IFundRecoveryFeature.json",
|
||||
"test/generated-artifacts/ILiquidityProvider.json",
|
||||
"test/generated-artifacts/ILiquidityProviderFeature.json",
|
||||
"test/generated-artifacts/ILiquidityProviderSandbox.json",
|
||||
|
@@ -51,7 +51,7 @@
|
||||
"verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio"
|
||||
},
|
||||
"config": {
|
||||
"contractsPackages": "@0x/contracts-erc20 @0x/contracts-test-utils @0x/contracts-utils @0x/contracts-zero-ex @0x/contracts-treasury",
|
||||
"contractsPackages": "@0x/contracts-erc20 @0x/contracts-test-utils @0x/contracts-utils @0x/contracts-zero-ex @0x/contracts-treasury",
|
||||
"nonContractPackages": "@0x/migrations @0x/contract-wrappers @0x/contract-addresses @0x/contract-artifacts @0x/contract-wrappers-test @0x/asset-swapper",
|
||||
"ignoreTestsForPackages": "",
|
||||
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
|
||||
@@ -60,7 +60,7 @@
|
||||
"ignoreDependencyVersionsForPackage": "contract-wrappers"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x/monorepo-scripts": "^3.1.7",
|
||||
"@0x/monorepo-scripts": "^3.2.0",
|
||||
"@0x-lerna-fork/lerna": "3.16.10",
|
||||
"@0xproject/npm-cli-login": "^0.0.11",
|
||||
"async-child-process": "^1.1.1",
|
||||
|
@@ -1,4 +1,33 @@
|
||||
[
|
||||
{
|
||||
"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",
|
||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## 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
|
||||
|
@@ -77,6 +77,7 @@ contract ApproximateBuys {
|
||||
}
|
||||
|
||||
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(
|
||||
@@ -108,7 +109,7 @@ contract ApproximateBuys {
|
||||
buyAmount = _buyAmount;
|
||||
// If we've reached our goal, exit early
|
||||
if (buyAmount >= makerTokenAmounts[i]) {
|
||||
uint256 eps =
|
||||
eps =
|
||||
(buyAmount - makerTokenAmounts[i]) * ONE_HUNDED_PERCENT_BPS /
|
||||
makerTokenAmounts[i];
|
||||
if (eps <= APPROXIMATE_BUY_TARGET_EPSILON_BPS) {
|
||||
@@ -116,6 +117,9 @@ contract ApproximateBuys {
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/asset-swapper",
|
||||
"version": "16.26.1",
|
||||
"version": "16.27.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -60,13 +60,13 @@
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.27",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contract-addresses": "^6.6.1",
|
||||
"@0x/contract-wrappers": "^13.17.5",
|
||||
"@0x/contracts-erc20": "^3.3.17",
|
||||
"@0x/contract-addresses": "^6.7.0",
|
||||
"@0x/contract-wrappers": "^13.17.6",
|
||||
"@0x/contracts-erc20": "^3.3.19",
|
||||
"@0x/contracts-zero-ex": "^0.27.0",
|
||||
"@0x/dev-utils": "^4.2.7",
|
||||
"@0x/json-schemas": "^6.1.3",
|
||||
"@0x/protocol-utils": "^1.8.3",
|
||||
"@0x/protocol-utils": "^1.8.4",
|
||||
"@0x/quote-server": "^6.0.2",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
@@ -97,10 +97,10 @@
|
||||
"@0x/contracts-exchange": "^3.2.38",
|
||||
"@0x/contracts-exchange-libs": "^4.3.37",
|
||||
"@0x/contracts-gen": "^2.0.38",
|
||||
"@0x/contracts-test-utils": "^5.4.9",
|
||||
"@0x/contracts-utils": "^4.7.17",
|
||||
"@0x/contracts-test-utils": "^5.4.10",
|
||||
"@0x/contracts-utils": "^4.8.0",
|
||||
"@0x/mesh-rpc-client": "^9.4.2",
|
||||
"@0x/migrations": "^8.1.3",
|
||||
"@0x/migrations": "^8.1.5",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/ts-doc-gen": "^0.0.28",
|
||||
|
@@ -244,6 +244,7 @@ export interface RfqRequestOpts {
|
||||
takerAddress: string;
|
||||
txOrigin: string;
|
||||
apiKey: string;
|
||||
apiKeyWhitelist?: string[];
|
||||
intentOnFilling: boolean;
|
||||
isIndicative?: boolean;
|
||||
makerEndpointMaxResponseTimeMs?: number;
|
||||
|
@@ -31,6 +31,7 @@ import {
|
||||
NULL_ADDRESS,
|
||||
PANCAKESWAP_ROUTER_BY_CHAIN_ID,
|
||||
PANCAKESWAPV2_ROUTER_BY_CHAIN_ID,
|
||||
PANGOLIN_ROUTER_BY_CHAIN_ID,
|
||||
POLYDEX_ROUTER_BY_CHAIN_ID,
|
||||
QUICKSWAP_ROUTER_BY_CHAIN_ID,
|
||||
SADDLE_MAINNET_INFOS,
|
||||
@@ -41,6 +42,7 @@ import {
|
||||
SNOWSWAP_MAINNET_INFOS,
|
||||
SUSHISWAP_ROUTER_BY_CHAIN_ID,
|
||||
SWERVE_MAINNET_INFOS,
|
||||
TRADER_JOE_ROUTER_BY_CHAIN_ID,
|
||||
UNISWAPV2_ROUTER_BY_CHAIN_ID,
|
||||
WAULTSWAP_ROUTER_BY_CHAIN_ID,
|
||||
XSIGMA_MAINNET_INFOS,
|
||||
@@ -439,7 +441,9 @@ export function uniswapV2LikeRouterAddress(
|
||||
| ERC20BridgeSource.WaultSwap
|
||||
| ERC20BridgeSource.Polydex
|
||||
| ERC20BridgeSource.ShibaSwap
|
||||
| ERC20BridgeSource.JetSwap,
|
||||
| ERC20BridgeSource.JetSwap
|
||||
| ERC20BridgeSource.TraderJoe
|
||||
| ERC20BridgeSource.Pangolin,
|
||||
): string {
|
||||
switch (source) {
|
||||
case ERC20BridgeSource.UniswapV2:
|
||||
@@ -476,6 +480,10 @@ export function uniswapV2LikeRouterAddress(
|
||||
return SHIBASWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.JetSwap:
|
||||
return JETSWAP_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.Pangolin:
|
||||
return PANGOLIN_ROUTER_BY_CHAIN_ID[chainId];
|
||||
case ERC20BridgeSource.TraderJoe:
|
||||
return TRADER_JOE_ROUTER_BY_CHAIN_ID[chainId];
|
||||
default:
|
||||
throw new Error(`Unknown UniswapV2 like source ${source}`);
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ function valueByChainId<T>(rest: Partial<{ [key in ChainId]: T }>, defaultValue:
|
||||
[ChainId.BSC]: defaultValue,
|
||||
[ChainId.Polygon]: defaultValue,
|
||||
[ChainId.PolygonMumbai]: defaultValue,
|
||||
[ChainId.Avalanche]: defaultValue,
|
||||
...(rest || {}),
|
||||
};
|
||||
}
|
||||
@@ -157,6 +158,12 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.JetSwap,
|
||||
ERC20BridgeSource.IronSwap,
|
||||
]),
|
||||
[ChainId.Avalanche]: new SourceFilters([
|
||||
ERC20BridgeSource.MultiHop,
|
||||
ERC20BridgeSource.Pangolin,
|
||||
ERC20BridgeSource.TraderJoe,
|
||||
ERC20BridgeSource.SushiSwap,
|
||||
]),
|
||||
},
|
||||
new SourceFilters([]),
|
||||
);
|
||||
@@ -258,6 +265,12 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
|
||||
ERC20BridgeSource.JetSwap,
|
||||
ERC20BridgeSource.IronSwap,
|
||||
]),
|
||||
[ChainId.Avalanche]: new SourceFilters([
|
||||
ERC20BridgeSource.MultiHop,
|
||||
ERC20BridgeSource.Pangolin,
|
||||
ERC20BridgeSource.TraderJoe,
|
||||
ERC20BridgeSource.SushiSwap,
|
||||
]),
|
||||
},
|
||||
new SourceFilters([]),
|
||||
);
|
||||
@@ -276,6 +289,7 @@ export const FEE_QUOTE_SOURCES_BY_CHAIN_ID = valueByChainId<ERC20BridgeSource[]>
|
||||
[ChainId.BSC]: [ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.Mooniswap, ERC20BridgeSource.SushiSwap],
|
||||
[ChainId.Ropsten]: [ERC20BridgeSource.UniswapV2, ERC20BridgeSource.SushiSwap],
|
||||
[ChainId.Polygon]: [ERC20BridgeSource.QuickSwap, ERC20BridgeSource.SushiSwap],
|
||||
[ChainId.Avalanche]: [ERC20BridgeSource.Pangolin, ERC20BridgeSource.TraderJoe, ERC20BridgeSource.SushiSwap],
|
||||
},
|
||||
[],
|
||||
);
|
||||
@@ -379,6 +393,8 @@ export const MAINNET_TOKENS = {
|
||||
ESS: '0x24ae124c4cc33d6791f8e8b63520ed7107ac8b3e',
|
||||
cvxCRV: '0x62b9c7356a2dc64a1969e19c23e4f579f9810aa7',
|
||||
CRV: '0xd533a949740bb3306d119cc777fa900ba034cd52',
|
||||
MIM: '0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3',
|
||||
EURT: '0xc581b735a1688071a1746c968e0798d642ede491',
|
||||
};
|
||||
|
||||
export const BSC_TOKENS = {
|
||||
@@ -414,6 +430,13 @@ export const POLYGON_TOKENS = {
|
||||
WEXPOLY: '0x4c4bf319237d98a30a929a96112effa8da3510eb',
|
||||
};
|
||||
|
||||
export const AVALANCHE_TOKENS = {
|
||||
WAVAX: '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
|
||||
WETH: '0x49d5c2bdffac6ce2bfdb6640f4f80f226bc10bab',
|
||||
USDT: '0xc7198437980c041c805a1edcba50c1ce5db95118',
|
||||
DAI: '0xd586e7f844cea2f87f50152665bcbc2c279d8d70',
|
||||
};
|
||||
|
||||
export const CURVE_POOLS = {
|
||||
compound: '0xa2b47e3d5c44877cca798226b7b8118f9bfb7a56', // 0.Compound
|
||||
// 1.USDT is dead
|
||||
@@ -455,6 +478,9 @@ export const CURVE_POOLS = {
|
||||
LUSD: '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca',
|
||||
BUSD: '0x4807862aa8b2bf68830e4c8dc86d0e9a998e085a',
|
||||
DSU3CRV: '0x6ec80df362d7042c50d4469bcfbc174c9dd9109a',
|
||||
cvxcrv: '0x9d0464996170c6b9e75eed71c68b99ddedf279e8',
|
||||
mim: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b',
|
||||
eurt: '0xfd5db7463a3ab53fd211b4af195c5bccc1a03890',
|
||||
};
|
||||
|
||||
export const CURVE_V2_POOLS = {
|
||||
@@ -469,6 +495,7 @@ export const CURVE_POLYGON_POOLS = {
|
||||
|
||||
export const CURVE_V2_POLYGON_POOLS = {
|
||||
atricrypto: '0x3fcd5de6a9fc8a99995c406c77dda3ed7e406f81',
|
||||
atricrypto3: '0x1d8b86e3d88cdb2d34688e87e72f388cb541b7c8',
|
||||
};
|
||||
|
||||
export const SWERVE_POOLS = {
|
||||
@@ -563,6 +590,12 @@ export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId<string[]>(
|
||||
POLYGON_TOKENS.USDT,
|
||||
POLYGON_TOKENS.WBTC,
|
||||
],
|
||||
[ChainId.Avalanche]: [
|
||||
AVALANCHE_TOKENS.WAVAX,
|
||||
AVALANCHE_TOKENS.WETH,
|
||||
AVALANCHE_TOKENS.DAI,
|
||||
AVALANCHE_TOKENS.USDT,
|
||||
],
|
||||
},
|
||||
[],
|
||||
);
|
||||
@@ -576,10 +609,7 @@ export const DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID = valueByChainId<TokenAdj
|
||||
})
|
||||
.tap(builder => {
|
||||
// Mirror Protocol
|
||||
builder
|
||||
.add(MAINNET_TOKENS.MIR, MAINNET_TOKENS.UST)
|
||||
.add(MAINNET_TOKENS.UST, [MAINNET_TOKENS.MIR, ...Object.values(MIRROR_WRAPPED_TOKENS)]);
|
||||
Object.values(MIRROR_WRAPPED_TOKENS).forEach(t => builder.add(t, MAINNET_TOKENS.UST));
|
||||
builder.add(MAINNET_TOKENS.MIR, MAINNET_TOKENS.UST);
|
||||
// Convex and Curve
|
||||
builder.add(MAINNET_TOKENS.cvxCRV, MAINNET_TOKENS.CRV).add(MAINNET_TOKENS.CRV, MAINNET_TOKENS.cvxCRV);
|
||||
})
|
||||
@@ -591,6 +621,9 @@ export const DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID = valueByChainId<TokenAdj
|
||||
[ChainId.Polygon]: new TokenAdjacencyGraphBuilder({
|
||||
default: DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Polygon],
|
||||
}).build(),
|
||||
[ChainId.Avalanche]: new TokenAdjacencyGraphBuilder({
|
||||
default: DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Avalanche],
|
||||
}).build(),
|
||||
},
|
||||
new TokenAdjacencyGraphBuilder({ default: [] }).build(),
|
||||
);
|
||||
@@ -604,6 +637,7 @@ export const NATIVE_FEE_TOKEN_BY_CHAIN_ID = valueByChainId<string>(
|
||||
[ChainId.Rinkeby]: getContractAddressesForChainOrThrow(ChainId.Rinkeby).etherToken,
|
||||
[ChainId.Kovan]: getContractAddressesForChainOrThrow(ChainId.Kovan).etherToken,
|
||||
[ChainId.Polygon]: getContractAddressesForChainOrThrow(ChainId.Polygon).etherToken,
|
||||
[ChainId.Avalanche]: getContractAddressesForChainOrThrow(ChainId.Avalanche).etherToken,
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
@@ -775,6 +809,11 @@ export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
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,
|
||||
@@ -863,6 +902,16 @@ export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
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,
|
||||
}),
|
||||
};
|
||||
|
||||
export const CURVE_V2_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
@@ -902,6 +951,11 @@ export const CURVE_V2_POLYGON_INFOS: { [name: string]: CurveInfo } = {
|
||||
pool: CURVE_V2_POLYGON_POOLS.atricrypto,
|
||||
gasSchedule: 300e3,
|
||||
}),
|
||||
[CURVE_V2_POLYGON_POOLS.atricrypto3]: createCurveV2MetaTriPool({
|
||||
tokens: [POLYGON_TOKENS.WBTC, POLYGON_TOKENS.WETH],
|
||||
pool: CURVE_V2_POLYGON_POOLS.atricrypto3,
|
||||
gasSchedule: 300e3,
|
||||
}),
|
||||
};
|
||||
|
||||
export const SWERVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
|
||||
@@ -1196,6 +1250,7 @@ export const SUSHISWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
[ChainId.BSC]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||
[ChainId.Ropsten]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||
[ChainId.Polygon]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||
[ChainId.Avalanche]: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
@@ -1568,6 +1623,20 @@ export const JETSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
export const PANGOLIN_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
{
|
||||
[ChainId.Avalanche]: '0xe54ca86531e17ef3616d22ca28b0d458b6c89106',
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
export const TRADER_JOE_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
|
||||
{
|
||||
[ChainId.Avalanche]: '0x60ae616a2155ee3d9a68541ba4544862310933d4',
|
||||
},
|
||||
NULL_ADDRESS,
|
||||
);
|
||||
|
||||
const uniswapV2CloneGasSchedule = (fillData?: FillData) => {
|
||||
// TODO: Different base cost if to/from ETH.
|
||||
let gas = 90e3;
|
||||
@@ -1696,6 +1765,12 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
|
||||
[ERC20BridgeSource.Dfyn]: uniswapV2CloneGasSchedule,
|
||||
[ERC20BridgeSource.Polydex]: uniswapV2CloneGasSchedule,
|
||||
[ERC20BridgeSource.JetSwap]: uniswapV2CloneGasSchedule,
|
||||
|
||||
//
|
||||
// Avalanche
|
||||
//
|
||||
[ERC20BridgeSource.Pangolin]: uniswapV2CloneGasSchedule,
|
||||
[ERC20BridgeSource.TraderJoe]: uniswapV2CloneGasSchedule,
|
||||
};
|
||||
|
||||
export const DEFAULT_FEE_SCHEDULE: Required<FeeSchedule> = { ...DEFAULT_GAS_SCHEDULE };
|
||||
|
@@ -182,6 +182,10 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
|
||||
return encodeBridgeSourceId(BridgeProtocol.Curve, 'ACryptoS');
|
||||
case ERC20BridgeSource.Clipper:
|
||||
return encodeBridgeSourceId(BridgeProtocol.Clipper, 'Clipper');
|
||||
case ERC20BridgeSource.Pangolin:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'Pangolin');
|
||||
case ERC20BridgeSource.TraderJoe:
|
||||
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'TraderJoe');
|
||||
default:
|
||||
throw new Error(AggregationError.NoBridgeForSource);
|
||||
}
|
||||
@@ -256,6 +260,8 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
|
||||
case ERC20BridgeSource.Polydex:
|
||||
case ERC20BridgeSource.ShibaSwap:
|
||||
case ERC20BridgeSource.JetSwap:
|
||||
case ERC20BridgeSource.Pangolin:
|
||||
case ERC20BridgeSource.TraderJoe:
|
||||
const uniswapV2FillData = (order as OptimizedMarketBridgeOrder<UniswapV2FillData>).fillData;
|
||||
bridgeData = encoder.encode([uniswapV2FillData.router, uniswapV2FillData.tokenAddressPath]);
|
||||
break;
|
||||
@@ -448,6 +454,8 @@ export const BRIDGE_ENCODERS: {
|
||||
[ERC20BridgeSource.CryptoCom]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.Linkswap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.ShibaSwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.Pangolin]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.TraderJoe]: routerAddressPathEncoder,
|
||||
// BSC
|
||||
[ERC20BridgeSource.PancakeSwap]: routerAddressPathEncoder,
|
||||
[ERC20BridgeSource.PancakeSwapV2]: routerAddressPathEncoder,
|
||||
|
@@ -1196,6 +1196,8 @@ export class SamplerOperations {
|
||||
case ERC20BridgeSource.Polydex:
|
||||
case ERC20BridgeSource.ShibaSwap:
|
||||
case ERC20BridgeSource.JetSwap:
|
||||
case ERC20BridgeSource.Pangolin:
|
||||
case ERC20BridgeSource.TraderJoe:
|
||||
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
||||
if (!isValidAddress(uniLikeRouter)) {
|
||||
return [];
|
||||
@@ -1489,6 +1491,8 @@ export class SamplerOperations {
|
||||
case ERC20BridgeSource.Polydex:
|
||||
case ERC20BridgeSource.ShibaSwap:
|
||||
case ERC20BridgeSource.JetSwap:
|
||||
case ERC20BridgeSource.Pangolin:
|
||||
case ERC20BridgeSource.TraderJoe:
|
||||
const uniLikeRouter = uniswapV2LikeRouterAddress(this.chainId, source);
|
||||
if (!isValidAddress(uniLikeRouter)) {
|
||||
return [];
|
||||
|
@@ -91,6 +91,9 @@ export enum ERC20BridgeSource {
|
||||
FirebirdOneSwap = 'FirebirdOneSwap',
|
||||
JetSwap = 'JetSwap',
|
||||
IronSwap = 'IronSwap',
|
||||
// Avalanche
|
||||
Pangolin = 'Pangolin',
|
||||
TraderJoe = 'TraderJoe',
|
||||
}
|
||||
export type SourcesWithPoolsCache = ERC20BridgeSource.Balancer | ERC20BridgeSource.BalancerV2 | ERC20BridgeSource.Cream;
|
||||
|
||||
|
@@ -25,6 +25,7 @@ import {
|
||||
} from '../types';
|
||||
|
||||
import { returnQuoteFromAltMMAsync } from './alt_mm_implementation_utils';
|
||||
import { ONE_SECOND_MS } from './market_operation_utils/constants';
|
||||
import { RfqMakerBlacklist } from './rfq_maker_blacklist';
|
||||
|
||||
const MAKER_TIMEOUT_STREAK_LENGTH = 10;
|
||||
@@ -177,6 +178,48 @@ export class QuoteRequestor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets both standard RFQ makers and "alternative" RFQ makers and combines them together
|
||||
* in a single configuration map. If an integration key whitelist is present, it will be used
|
||||
* to filter a specific makers.
|
||||
*
|
||||
* @param options the RfqmRequestOptions passed in
|
||||
* @param assetOfferings the RFQM or RFQT maker offerings
|
||||
* @returns a list of TypedMakerUrl instances
|
||||
*/
|
||||
public static getTypedMakerUrlsAndWhitelist(
|
||||
options: Pick<RfqmRequestOptions, 'apiKeyWhitelist' | 'altRfqAssetOfferings'>,
|
||||
assetOfferings: RfqMakerAssetOfferings,
|
||||
): TypedMakerUrl[] {
|
||||
const standardUrls = Object.keys(assetOfferings).map(
|
||||
(mm: string): TypedMakerUrl => {
|
||||
return { pairType: RfqPairType.Standard, url: mm };
|
||||
},
|
||||
);
|
||||
const altUrls = options.altRfqAssetOfferings
|
||||
? Object.keys(options.altRfqAssetOfferings).map(
|
||||
(mm: string): TypedMakerUrl => {
|
||||
return { pairType: RfqPairType.Alt, url: mm };
|
||||
},
|
||||
)
|
||||
: [];
|
||||
|
||||
let typedMakerUrls = standardUrls.concat(altUrls);
|
||||
|
||||
// If there is a whitelist, only allow approved maker URLs
|
||||
if (options.apiKeyWhitelist !== undefined) {
|
||||
const whitelist = new Set(options.apiKeyWhitelist.map(key => key.toLowerCase()));
|
||||
typedMakerUrls = typedMakerUrls.filter(makerUrl => whitelist.has(makerUrl.url.toLowerCase()));
|
||||
}
|
||||
return typedMakerUrls;
|
||||
}
|
||||
|
||||
public static getDurationUntilExpirationMs(expirationTimeSeconds: BigNumber): BigNumber {
|
||||
const expirationTimeMs = expirationTimeSeconds.times(constants.ONE_SECOND_MS);
|
||||
const currentTimeMs = new BigNumber(Date.now());
|
||||
return BigNumber.max(expirationTimeMs.minus(currentTimeMs), 0);
|
||||
}
|
||||
|
||||
private static _makerSupportsPair(
|
||||
typedMakerUrl: TypedMakerUrl,
|
||||
makerToken: string,
|
||||
@@ -361,12 +404,6 @@ export class QuoteRequestor {
|
||||
return true;
|
||||
}
|
||||
|
||||
private _isExpirationTooSoon(expirationTimeSeconds: BigNumber): boolean {
|
||||
const expirationTimeMs = expirationTimeSeconds.times(constants.ONE_SECOND_MS);
|
||||
const currentTimeMs = new BigNumber(Date.now());
|
||||
return expirationTimeMs.isLessThan(currentTimeMs.plus(this._expiryBufferMs));
|
||||
}
|
||||
|
||||
private async _getQuotesAsync<ResponseT>(
|
||||
makerToken: string,
|
||||
takerToken: string,
|
||||
@@ -400,21 +437,6 @@ export class QuoteRequestor {
|
||||
}
|
||||
})();
|
||||
|
||||
const standardUrls = Object.keys(assetOfferings).map(
|
||||
(mm: string): TypedMakerUrl => {
|
||||
return { pairType: RfqPairType.Standard, url: mm };
|
||||
},
|
||||
);
|
||||
const altUrls = options.altRfqAssetOfferings
|
||||
? Object.keys(options.altRfqAssetOfferings).map(
|
||||
(mm: string): TypedMakerUrl => {
|
||||
return { pairType: RfqPairType.Alt, url: mm };
|
||||
},
|
||||
)
|
||||
: [];
|
||||
|
||||
const typedMakerUrls = standardUrls.concat(altUrls);
|
||||
|
||||
const timeoutMs =
|
||||
options.makerEndpointMaxResponseTimeMs ||
|
||||
constants.DEFAULT_RFQT_REQUEST_OPTS.makerEndpointMaxResponseTimeMs!;
|
||||
@@ -426,6 +448,7 @@ export class QuoteRequestor {
|
||||
cancelTokenSource.cancel('timeout via cancel token');
|
||||
}, timeoutMs + bufferMs);
|
||||
|
||||
const typedMakerUrls = QuoteRequestor.getTypedMakerUrlsAndWhitelist(options, assetOfferings);
|
||||
const quotePromises = typedMakerUrls.map(async typedMakerUrl => {
|
||||
// filter out requests to skip
|
||||
const isBlacklisted = rfqMakerBlacklist.isMakerBlacklisted(typedMakerUrl.url);
|
||||
@@ -587,12 +610,15 @@ export class QuoteRequestor {
|
||||
return false;
|
||||
}
|
||||
const isLastLook = Boolean(options.isLastLook);
|
||||
if (this._isExpirationTooSoon(new BigNumber(order.expiry))) {
|
||||
const msRemainingUntilExpiration = QuoteRequestor.getDurationUntilExpirationMs(new BigNumber(order.expiry));
|
||||
const isExpirationTooSoon = msRemainingUntilExpiration.lt(this._expiryBufferMs);
|
||||
if (isExpirationTooSoon) {
|
||||
this._warningLogger(order, 'Expiry too soon in RFQ-T firm quote, filtering out');
|
||||
this._metrics?.incrementExpirationToSoonCounter(isLastLook, order.maker);
|
||||
return false;
|
||||
} else {
|
||||
this._metrics?.measureExpirationForValidOrder(isLastLook, order.maker, order.expiry);
|
||||
const secondsRemaining = msRemainingUntilExpiration.div(ONE_SECOND_MS);
|
||||
this._metrics?.measureExpirationForValidOrder(isLastLook, order.maker, secondsRemaining);
|
||||
|
||||
const takerAmount = new BigNumber(order.takerAmount);
|
||||
const fillRatio = takerAmount.div(assetFillAmount);
|
||||
@@ -673,7 +699,9 @@ export class QuoteRequestor {
|
||||
this._warningLogger(order, 'Unexpected token or taker address in RFQ order, filtering out');
|
||||
return false;
|
||||
}
|
||||
if (this._isExpirationTooSoon(new BigNumber(order.expiry))) {
|
||||
const msRemainingUntilExpiration = QuoteRequestor.getDurationUntilExpirationMs(new BigNumber(order.expiry));
|
||||
const isExpirationTooSoon = msRemainingUntilExpiration.lt(this._expiryBufferMs);
|
||||
if (isExpirationTooSoon) {
|
||||
this._warningLogger(order, 'Expiry too soon in RFQ indicative quote, filtering out');
|
||||
return false;
|
||||
} else {
|
||||
|
@@ -834,6 +834,39 @@ describe('QuoteRequestor', async () => {
|
||||
quoteRequestorHttpClient,
|
||||
);
|
||||
});
|
||||
it('should be able to handle and filter RFQ offerings', () => {
|
||||
const tests: Array<[string[] | undefined, string[]]> = [
|
||||
[['https://top.maker'], []],
|
||||
[undefined, ['https://foo.bar/', 'https://lorem.ipsum/']],
|
||||
[['https://lorem.ipsum/'], ['https://lorem.ipsum/']],
|
||||
];
|
||||
for (const test of tests) {
|
||||
const [apiKeyWhitelist, results] = test;
|
||||
const response = QuoteRequestor.getTypedMakerUrlsAndWhitelist(
|
||||
{
|
||||
apiKeyWhitelist,
|
||||
altRfqAssetOfferings: {},
|
||||
},
|
||||
{
|
||||
'https://foo.bar/': [
|
||||
[
|
||||
'0xA6cD4cb8c62aCDe44739E3Ed0F1d13E0e31f2d94',
|
||||
'0xF45107c0200a04A8aB9C600cc52A3C89AE5D0489',
|
||||
],
|
||||
],
|
||||
'https://lorem.ipsum/': [
|
||||
[
|
||||
'0xA6cD4cb8c62aCDe44739E3Ed0F1d13E0e31f2d94',
|
||||
'0xF45107c0200a04A8aB9C600cc52A3C89AE5D0489',
|
||||
],
|
||||
],
|
||||
},
|
||||
);
|
||||
const typedUrls = response.map(typed => typed.url);
|
||||
expect(typedUrls).to.eql(results);
|
||||
}
|
||||
});
|
||||
|
||||
it('should return successful alt indicative quotes', async () => {
|
||||
const takerAddress = '0xd209925defc99488e3afff1174e48b4fa628302a';
|
||||
const txOrigin = '0xf209925defc99488e3afff1174e48b4fa628302a';
|
||||
|
@@ -1,4 +1,14 @@
|
||||
[
|
||||
{
|
||||
"version": "6.7.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Avalanche deployment",
|
||||
"pr": 312
|
||||
}
|
||||
],
|
||||
"timestamp": 1630459879
|
||||
},
|
||||
{
|
||||
"timestamp": 1629353596,
|
||||
"version": "6.6.1",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v6.7.0 - _September 1, 2021_
|
||||
|
||||
* Avalanche deployment (#312)
|
||||
|
||||
## v6.6.1 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -334,5 +334,47 @@
|
||||
"fillQuoteTransformer": "0x750cb81ee6d64e29e1e358ba155925000bf044d4",
|
||||
"positiveSlippageFeeTransformer": "0x30aebc4c68effa70e21612b39b94299a8778d0cb"
|
||||
}
|
||||
},
|
||||
"43114": {
|
||||
"erc20Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc721Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"zrxToken": "0x0000000000000000000000000000000000000000",
|
||||
"etherToken": "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",
|
||||
"exchangeV2": "0x0000000000000000000000000000000000000000",
|
||||
"exchange": "0x0000000000000000000000000000000000000000",
|
||||
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
|
||||
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
|
||||
"forwarder": "0x0000000000000000000000000000000000000000",
|
||||
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
|
||||
"coordinator": "0x0000000000000000000000000000000000000000",
|
||||
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
|
||||
"staticCallProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
|
||||
"devUtils": "0x0000000000000000000000000000000000000000",
|
||||
"zrxVault": "0x0000000000000000000000000000000000000000",
|
||||
"staking": "0x0000000000000000000000000000000000000000",
|
||||
"stakingProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
|
||||
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
|
||||
"chaiBridge": "0x0000000000000000000000000000000000000000",
|
||||
"dydxBridge": "0x0000000000000000000000000000000000000000",
|
||||
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
|
||||
"broker": "0x0000000000000000000000000000000000000000",
|
||||
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
|
||||
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
|
||||
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
|
||||
"exchangeProxyGovernor": "0xca7bab1b2d1ec7d81710b7f9e2ab4e6788930588",
|
||||
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
|
||||
"exchangeProxyTransformerDeployer": "0xa60b57833dce6260f4f2411c811755dd980bc0a7",
|
||||
"exchangeProxyFlashWallet": "0xdb6f1920a889355780af7570773609bd8cb1f498",
|
||||
"exchangeProxyLiquidityProviderSandbox": "0x8953c63d0858d286cc407cd6f8e26b9cbd02a511",
|
||||
"zrxTreasury": "0x0000000000000000000000000000000000000000",
|
||||
"transformers": {
|
||||
"wethTransformer": "0x9b8b52391071d71cd4ad1e61d7f273268fa34c6c",
|
||||
"payTakerTransformer": "0x898c6fde239d646c73f0a57e3570b6f86a3d62a3",
|
||||
"affiliateFeeTransformer": "0x34617b855411e52fbc05899435f44cbd0503022c",
|
||||
"fillQuoteTransformer": "0x8a5417dd7ffde61ec61e11b45797e16686e1d6b9",
|
||||
"positiveSlippageFeeTransformer": "0x470ba89da18a6db6e8a0567b3c9214b960861857"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-addresses",
|
||||
"version": "6.6.1",
|
||||
"version": "6.7.0",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
|
@@ -52,6 +52,7 @@ export enum ChainId {
|
||||
BSC = 56,
|
||||
Polygon = 137,
|
||||
PolygonMumbai = 80001,
|
||||
Avalanche = 43114,
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "13.17.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1629353596,
|
||||
"version": "13.17.5",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v13.17.6 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v13.17.5 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contract-wrappers",
|
||||
"version": "13.17.5",
|
||||
"version": "13.17.6",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -57,7 +57,7 @@
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.27",
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contract-addresses": "^6.6.1",
|
||||
"@0x/contract-addresses": "^6.7.0",
|
||||
"@0x/json-schemas": "^6.1.3",
|
||||
"@0x/types": "^3.3.3",
|
||||
"@0x/utils": "^6.4.3",
|
||||
|
@@ -1,4 +1,22 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1631120757,
|
||||
"version": "8.1.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "8.1.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1629414734,
|
||||
"version": "8.1.3",
|
||||
|
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v8.1.5 - _September 8, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.4 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v8.1.3 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/migrations",
|
||||
"version": "8.1.3",
|
||||
"version": "8.1.5",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -68,20 +68,20 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^6.4.0",
|
||||
"@0x/contract-addresses": "^6.6.1",
|
||||
"@0x/contract-addresses": "^6.7.0",
|
||||
"@0x/contracts-asset-proxy": "^3.7.19",
|
||||
"@0x/contracts-coordinator": "^3.1.38",
|
||||
"@0x/contracts-dev-utils": "^1.3.36",
|
||||
"@0x/contracts-erc1155": "^2.1.37",
|
||||
"@0x/contracts-erc20": "^3.3.17",
|
||||
"@0x/contracts-erc20": "^3.3.19",
|
||||
"@0x/contracts-erc721": "^3.1.37",
|
||||
"@0x/contracts-exchange": "^3.2.38",
|
||||
"@0x/contracts-exchange-forwarder": "^4.2.38",
|
||||
"@0x/contracts-extensions": "^6.2.32",
|
||||
"@0x/contracts-multisig": "^4.1.38",
|
||||
"@0x/contracts-staking": "^2.0.45",
|
||||
"@0x/contracts-utils": "^4.7.17",
|
||||
"@0x/contracts-zero-ex": "^0.28.2",
|
||||
"@0x/contracts-utils": "^4.8.0",
|
||||
"@0x/contracts-zero-ex": "^0.28.4",
|
||||
"@0x/sol-compiler": "^4.7.3",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/typescript-typings": "^5.2.0",
|
||||
|
@@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1630459879,
|
||||
"version": "1.8.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1629353596,
|
||||
"version": "1.8.3",
|
||||
|
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.8.4 - _September 1, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.8.3 - _August 19, 2021_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/protocol-utils",
|
||||
"version": "1.8.3",
|
||||
"version": "1.8.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -63,8 +63,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/assert": "^3.0.27",
|
||||
"@0x/contract-addresses": "^6.6.1",
|
||||
"@0x/contract-wrappers": "^13.17.5",
|
||||
"@0x/contract-addresses": "^6.7.0",
|
||||
"@0x/contract-wrappers": "^13.17.6",
|
||||
"@0x/json-schemas": "^6.1.3",
|
||||
"@0x/subproviders": "^6.5.3",
|
||||
"@0x/utils": "^6.4.3",
|
||||
|
60
yarn.lock
60
yarn.lock
@@ -902,12 +902,13 @@
|
||||
web3-providers "^2.0.0-alpha.1"
|
||||
websocket "^1.0.29"
|
||||
|
||||
"@0x/monorepo-scripts@^3.1.7":
|
||||
version "3.1.7"
|
||||
resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-3.1.7.tgz#17e719b9e26875958562532ed705cd770d107a43"
|
||||
"@0x/monorepo-scripts@^3.2.0":
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-3.2.0.tgz#a4cacf2fd7f4d8f23cd042e4f6aa8fe360aa2c08"
|
||||
integrity sha512-5z6LYHUIIyZOBGZALZL23LZ76NFfNF9B8IgZS4Oc+j6fFj2bFgTzyj8KqpYHOQXtYmFAom4lSfBelvP9li/oGQ==
|
||||
dependencies:
|
||||
"@0x/types" "^3.3.3"
|
||||
"@0x/utils" "^6.4.3"
|
||||
"@0x/types" "^3.3.4"
|
||||
"@0x/utils" "^6.4.4"
|
||||
"@lerna/batch-packages" "^3.0.0-beta.18"
|
||||
"@types/depcheck" "^0.6.0"
|
||||
"@types/node" "12.12.54"
|
||||
@@ -1140,6 +1141,15 @@
|
||||
bignumber.js "~9.0.0"
|
||||
ethereum-types "^3.5.0"
|
||||
|
||||
"@0x/types@^3.3.4":
|
||||
version "3.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@0x/types/-/types-3.3.4.tgz#184946b1674f7f5b4cfb73105952b499a67fc23e"
|
||||
integrity sha512-lB6maU/D1TEBrJXQcbwzGilmugX9qrfhxbyPr8r89TinSHe2SS694tTKIyI+ijnTbhyVjWzEnA95iuWxhPmP5g==
|
||||
dependencies:
|
||||
"@types/node" "12.12.54"
|
||||
bignumber.js "~9.0.0"
|
||||
ethereum-types "^3.6.0"
|
||||
|
||||
"@0x/typescript-typings@^5.0.1", "@0x/typescript-typings@^5.1.5":
|
||||
version "5.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@0x/typescript-typings/-/typescript-typings-5.1.5.tgz#dd0ad20ef42dad9d054886fd1da72839145b5863"
|
||||
@@ -1173,6 +1183,18 @@
|
||||
ethereum-types "^3.5.0"
|
||||
popper.js "1.14.3"
|
||||
|
||||
"@0x/typescript-typings@^5.2.1":
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@0x/typescript-typings/-/typescript-typings-5.2.1.tgz#bc82d0f39688b174142ebb5b2fd6a01c1d2f0163"
|
||||
integrity sha512-2yswstFMy/cpF+MrJclEZc8BNceBAVovwzRYdz1CyGPfzMT1Kh8jVGeexx0KvVw58KrhxMgcRD4mzCSHNqzjPA==
|
||||
dependencies:
|
||||
"@types/bn.js" "^4.11.0"
|
||||
"@types/node" "12.12.54"
|
||||
"@types/react" "*"
|
||||
bignumber.js "~9.0.0"
|
||||
ethereum-types "^3.6.0"
|
||||
popper.js "1.14.3"
|
||||
|
||||
"@0x/utils@^5.1.1", "@0x/utils@^5.4.0", "@0x/utils@^5.4.1":
|
||||
version "5.6.4"
|
||||
resolved "https://registry.yarnpkg.com/@0x/utils/-/utils-5.6.4.tgz#0158ec3243bbee444d90afbd79981321d19ccdfd"
|
||||
@@ -1228,6 +1250,26 @@
|
||||
js-sha3 "^0.7.0"
|
||||
lodash "^4.17.11"
|
||||
|
||||
"@0x/utils@^6.4.4":
|
||||
version "6.4.4"
|
||||
resolved "https://registry.yarnpkg.com/@0x/utils/-/utils-6.4.4.tgz#de9782a7ee2af77580a98a8c6db010dda7f56b94"
|
||||
integrity sha512-gTfK14tdMNtsmHC6FCrWz221+MYJNdDBdhA1hhnT+Kvru22uvhdTpP2udy7296/4yHZaEkDt5ZkvgJMsJCEhbg==
|
||||
dependencies:
|
||||
"@0x/types" "^3.3.4"
|
||||
"@0x/typescript-typings" "^5.2.1"
|
||||
"@types/mocha" "^5.2.7"
|
||||
"@types/node" "12.12.54"
|
||||
abortcontroller-polyfill "^1.1.9"
|
||||
bignumber.js "~9.0.0"
|
||||
chalk "^2.3.0"
|
||||
detect-node "2.0.3"
|
||||
ethereum-types "^3.6.0"
|
||||
ethereumjs-util "^7.1.0"
|
||||
ethers "~4.0.4"
|
||||
isomorphic-fetch "2.2.1"
|
||||
js-sha3 "^0.7.0"
|
||||
lodash "^4.17.11"
|
||||
|
||||
"@0x/web3-wrapper@^7.5.3":
|
||||
version "7.5.3"
|
||||
resolved "https://registry.yarnpkg.com/@0x/web3-wrapper/-/web3-wrapper-7.5.3.tgz#f36c3a2e5ffcbca2b3deef1a15e7485eb91dba7e"
|
||||
@@ -5805,6 +5847,14 @@ ethereum-types@^3.5.0:
|
||||
"@types/node" "12.12.54"
|
||||
bignumber.js "~9.0.0"
|
||||
|
||||
ethereum-types@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/ethereum-types/-/ethereum-types-3.6.0.tgz#7cf0a7258537b1f8d113dd51d050189a742a9a6e"
|
||||
integrity sha512-iJX96C9W1elWhCZKUiSQfWn9fC+EO+xU2TvAE/p7QhMwcGibihKsxcG27B/4WZAudd8jNoeIhY4PH2qQPLuUfw==
|
||||
dependencies:
|
||||
"@types/node" "12.12.54"
|
||||
bignumber.js "~9.0.0"
|
||||
|
||||
ethereumjs-abi@0.6.5:
|
||||
version "0.6.5"
|
||||
resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.5.tgz#5a637ef16ab43473fa72a29ad90871405b3f5241"
|
||||
|
Reference in New Issue
Block a user