Compare commits

...

7 Commits

Author SHA1 Message Date
Noah Khamliche
d52d882b14 temp storage of hidden hops on ptp 2022-05-16 15:27:34 -04:00
Noah Khamliche
4c8629840b platypus integration 2022-05-09 23:15:43 -04:00
Noah Khamliche
feede28293 fixed linting issues 2022-04-28 14:04:25 -04:00
Noah Khamliche
08cf51b101 working sampling and mixin 2022-04-28 11:52:15 -04:00
Noah Khamliche
4ba6918e06 working mixin 2022-04-28 11:51:49 -04:00
Noah Khamliche
52a3ffa77c updates to mixin 2022-04-08 14:29:06 -04:00
Noah Khamliche
afe77a432c sampling trouble 2022-03-30 15:00:08 -04:00
27 changed files with 687 additions and 14 deletions

View File

@@ -33,6 +33,7 @@ import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinCryptoCom.sol";
import "./mixins/MixinDodo.sol";
import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinGMX.sol";
import "./mixins/MixinKyber.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinLido.sol";
@@ -60,6 +61,7 @@ contract BridgeAdapter is
MixinCryptoCom,
MixinDodo,
MixinDodoV2,
MixinGMX,
MixinKyber,
MixinKyberDmm,
MixinLido,
@@ -87,6 +89,7 @@ contract BridgeAdapter is
MixinCryptoCom()
MixinDodo()
MixinDodoV2()
MixinGMX()
MixinKyber(weth)
MixinLido(weth)
MixinMakerPSM()
@@ -265,6 +268,12 @@ contract BridgeAdapter is
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.GMX) {
boughtAmount = _tradeGMX(
buyToken,
sellAmount,
order.bridgeData
);
} else {
boughtAmount = _tradeZeroExBridge(
sellToken,

View File

@@ -52,4 +52,5 @@ library BridgeProtocols {
uint128 internal constant CLIPPER = 22; // Not used: Clipper is now using PLP interface
uint128 internal constant AAVEV2 = 23;
uint128 internal constant COMPOUND = 24;
uint128 internal constant GMX = 25;
}

View File

@@ -0,0 +1,104 @@
// 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/LibERC20TokenV06.sol";
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
import "../IBridgeAdapter.sol";
/*
UniswapV2
*/
interface IGmxRouter {
// /// @dev Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path.
// /// The first element of path is the input token, the last is the output token, and any intermediate elements represent
// /// intermediate pairs to trade through (if, for example, a direct pair does not exist).
// /// @param _path An array of token addresses. path.length must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
// /// @param _amountIn The amount of input tokens to send.
// /// @param _minOut The minimum amount of output tokens that must be received for the transaction not to revert.
// /// @param _reciever Recipient of the output tokens.
function swap(
address[] calldata _path, uint256 _amountIn, uint256 _minOut, address _receiver
) external;
}
contract MixinGMX {
using LibERC20TokenV06 for IERC20TokenV06;
using LibSafeMathV06 for uint256;
function _tradeGMX(
IERC20TokenV06 buyToken,
uint256 sellAmount,
bytes memory bridgeData
)
public
returns (uint256 boughtAmount)
{
address _router;
address reader;
address vault;
address[] memory _path;
IGmxRouter router;
IERC20TokenV06[] memory path;
{
//decode the bridge data
(_router, reader, vault, _path) = abi.decode(bridgeData, (address, address, address, address[]));
// To get around `abi.decode()` not supporting interface array types.
assembly { path := _path }
}
require(path.length >= 2, "MixinGMX/PATH_LENGTH_MUST_BE_AT_LEAST_TWO");
require(
path[path.length - 1] == buyToken,
"MixinGMX/LAST_ELEMENT_OF_PATH_MUST_MATCH_OUTPUT_TOKEN"
);
//connect to the GMX router
router = IGmxRouter(_router);
// Grant the GMX router an allowance to sell the first token.
path[0].approveIfBelow(address(router), sellAmount);
//track the balance to know how much we bought
uint256 beforeBalance = buyToken.balanceOf(address(this));
router.swap(
// Convert to `buyToken` along this path.
_path,
// Sell all tokens we hold.
sellAmount,
// Minimum buy amount.
0,
// Recipient is `this`.
address(this)
);
//calculate the difference in balance from preswap->postswap to find how many tokens out
boughtAmount = buyToken.balanceOf(address(this)).safeSub(beforeBalance);
return boughtAmount;
}
}

View File

@@ -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|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2|MixinBancor|MixinCoFiX|MixinCompound|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|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|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|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2|MixinBancor|MixinCoFiX|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyber|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|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",

View File

@@ -109,6 +109,7 @@ import * as MixinCurve from '../test/generated-artifacts/MixinCurve.json';
import * as MixinCurveV2 from '../test/generated-artifacts/MixinCurveV2.json';
import * as MixinDodo from '../test/generated-artifacts/MixinDodo.json';
import * as MixinDodoV2 from '../test/generated-artifacts/MixinDodoV2.json';
import * as MixinGMX from '../test/generated-artifacts/MixinGMX.json';
import * as MixinKyber from '../test/generated-artifacts/MixinKyber.json';
import * as MixinKyberDmm from '../test/generated-artifacts/MixinKyberDmm.json';
import * as MixinLido from '../test/generated-artifacts/MixinLido.json';
@@ -321,6 +322,7 @@ export const artifacts = {
MixinCurveV2: MixinCurveV2 as ContractArtifact,
MixinDodo: MixinDodo as ContractArtifact,
MixinDodoV2: MixinDodoV2 as ContractArtifact,
MixinGMX: MixinGMX as ContractArtifact,
MixinKyber: MixinKyber as ContractArtifact,
MixinKyberDmm: MixinKyberDmm as ContractArtifact,
MixinLido: MixinLido as ContractArtifact,

View File

@@ -107,6 +107,7 @@ export * from '../test/generated-wrappers/mixin_curve';
export * from '../test/generated-wrappers/mixin_curve_v2';
export * from '../test/generated-wrappers/mixin_dodo';
export * from '../test/generated-wrappers/mixin_dodo_v2';
export * from '../test/generated-wrappers/mixin_g_m_x';
export * from '../test/generated-wrappers/mixin_kyber';
export * from '../test/generated-wrappers/mixin_kyber_dmm';
export * from '../test/generated-wrappers/mixin_lido';

View File

@@ -140,6 +140,7 @@
"test/generated-artifacts/MixinCurveV2.json",
"test/generated-artifacts/MixinDodo.json",
"test/generated-artifacts/MixinDodoV2.json",
"test/generated-artifacts/MixinGMX.json",
"test/generated-artifacts/MixinKyber.json",
"test/generated-artifacts/MixinKyberDmm.json",
"test/generated-artifacts/MixinLido.json",

View File

@@ -75,6 +75,7 @@
"wsrun": "^5.2.4"
},
"resolutions": {
"merkle-patricia-tree": "3.0.0"
"merkle-patricia-tree": "3.0.0",
"bignumber.js": "9.0.2"
}
}

View File

@@ -22,9 +22,9 @@ pragma experimental ABIEncoderV2;
import "./interfaces/IBancor.sol";
contract CompilerHack {}
contract BancorSampler is CompilerHack {
contract BancorSampler {
/// @dev Base gas limit for Bancor calls.
uint256 constant private BANCOR_CALL_GAS = 300e3; // 300k

View File

@@ -27,6 +27,7 @@ import "./CompoundSampler.sol";
import "./CurveSampler.sol";
import "./DODOSampler.sol";
import "./DODOV2Sampler.sol";
import "./GMXSampler.sol";
import "./KyberSampler.sol";
import "./KyberDmmSampler.sol";
import "./LidoSampler.sol";
@@ -36,6 +37,7 @@ import "./MultiBridgeSampler.sol";
import "./MStableSampler.sol";
import "./MooniswapSampler.sol";
import "./NativeOrderSampler.sol";
import "./PlatypusSampler.sol";
import "./ShellSampler.sol";
import "./SmoothySampler.sol";
import "./TwoHopSampler.sol";
@@ -53,6 +55,7 @@ contract ERC20BridgeSampler is
CurveSampler,
DODOSampler,
DODOV2Sampler,
GMXSampler,
KyberSampler,
KyberDmmSampler,
LidoSampler,
@@ -62,6 +65,7 @@ contract ERC20BridgeSampler is
MooniswapSampler,
MultiBridgeSampler,
NativeOrderSampler,
PlatypusSampler,
ShellSampler,
SmoothySampler,
TwoHopSampler,

View File

@@ -0,0 +1,99 @@
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;
}
// address immutable WAVAX = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
// address immutable AVAX = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
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;
}
// solhint-disable-next-line indent
return abi.decode(resultData, (uint256[]))[0];
}
}

View File

@@ -0,0 +1,118 @@
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 router,
address[] memory path,
address[] memory pool,
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(router).quotePotentialSwaps(path, pool, 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 sampleBuysFromPlatypus(
address router,
address[] memory path,
address[] memory pool,
uint256[] memory makerTokenAmounts
)
public
view
returns (uint256[] memory takerTokenAmounts)
{
address[] memory invertBuyPath;
address[] memory invertPoolPath;
if(path.length > 2){
invertBuyPath = new address[](3);
invertPoolPath = new address[](2);
invertBuyPath[0] = path[2];
invertBuyPath[2] = path[0];
invertBuyPath[1] = path[1];
invertPoolPath[0] = pool[1];
invertPoolPath[1] = pool[0];
}
else {
invertBuyPath = new address[](2);
invertPoolPath = new address[](1);
invertBuyPath[0] = path[1];
invertBuyPath[1] = path[0];
invertPoolPath[0] = pool[0];
}
uint256[] memory result = _sampleApproximateBuys(
ApproximateBuyQuoteOpts({
makerTokenData: abi.encode(router, invertBuyPath, invertPoolPath),
takerTokenData: abi.encode(router, path, pool),
getSellQuoteCallback: _sampleSellForApproximateBuyFromPlatypus
}),
makerTokenAmounts
);
return result;
}
function _sampleSellForApproximateBuyFromPlatypus(
bytes memory makerTokenData,
bytes memory takerTokenData,
uint256 sellAmount
)
private
view
returns (uint256 buyAmount)
{
(address router, address[] memory _path, address[] memory _pool ) = abi.decode(makerTokenData, (address, address[], address[]));
(bool success, bytes memory resultData) = address(this).staticcall(abi.encodeWithSelector(
this.sampleSellsFromPlatypus.selector,
router,
_path,
_pool,
_toSingleValueArray(sellAmount)
));
if(!success) {
return 0;
}
// solhint-disable-next-line indent
return abi.decode(resultData, (uint256[]))[0];
}
}

View File

@@ -0,0 +1,23 @@
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);
}

View File

@@ -0,0 +1,10 @@
pragma solidity ^0.6;
interface IPlatypus {
function quotePotentialSwaps(
address[] memory tokenPath,
address[] memory poolPath,
uint256 fromAmount
) external view returns (uint256 potentialOutcome, uint256 haircut);
}

View File

@@ -39,7 +39,7 @@
"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|BalancerV2Sampler|BancorSampler|CompoundSampler|CurveSampler|DODOSampler|DODOV2Sampler|DummyLiquidityProvider|ERC20BridgeSampler|FakeTaker|IBalancer|IBancor|ICurve|IKyberNetwork|IMStable|IMooniswap|IMultiBridge|IShell|ISmoothy|IUniswapExchangeQuotes|IUniswapV2Router01|KyberDmmSampler|KyberSampler|LidoSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|MultiBridgeSampler|NativeOrderSampler|SamplerUtils|ShellSampler|SmoothySampler|TestERC20BridgeSampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UniswapV3Sampler|UtilitySampler).json",
"abis": "./test/generated-artifacts/@(ApproximateBuys|BalanceChecker|BalancerSampler|BalancerV2Sampler|BancorSampler|CompoundSampler|CurveSampler|DODOSampler|DODOV2Sampler|DummyLiquidityProvider|ERC20BridgeSampler|FakeTaker|GMXSampler|IBalancer|IBancor|ICurve|IGMX|IKyberNetwork|IMStable|IMooniswap|IMultiBridge|IPlatypus|IShell|ISmoothy|IUniswapExchangeQuotes|IUniswapV2Router01|KyberDmmSampler|KyberSampler|LidoSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|MultiBridgeSampler|NativeOrderSampler|PlatypusSampler|SamplerUtils|ShellSampler|SmoothySampler|TestERC20BridgeSampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UniswapV3Sampler|UtilitySampler).json",
"postpublish": {
"assets": []
}
@@ -128,5 +128,6 @@
"publishConfig": {
"access": "public"
},
"gitHead": "4f91bfd907996b2f4dd383778b50c479c2602b56"
"gitHead": "4f91bfd907996b2f4dd383778b50c479c2602b56",
"resolutions": {}
}

View File

@@ -357,7 +357,7 @@ export class SwapQuoter {
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;

View File

@@ -62,8 +62,9 @@ import {
UNISWAPV2_ROUTER_BY_CHAIN_ID,
WAULTSWAP_ROUTER_BY_CHAIN_ID,
XSIGMA_MAINNET_INFOS,
PLATYPUS_AVALANCHE_INFOS,
} from './constants';
import { CurveInfo, ERC20BridgeSource } from './types';
import { CurveInfo, ERC20BridgeSource, PlatypusInfo } from './types';
/**
* Filter Kyber reserves which should not be used (0xbb bridged reserves)
@@ -463,6 +464,48 @@ export function getMobiusMoneyInfoForPair(chainId: ChainId, takerToken: string,
);
}
export function getPlatypusInfoForPair(chainId: ChainId, takerToken: string, makerToken: string): PlatypusInfo[] {
if (chainId !== ChainId.Avalanche) {
return [];
}
let ptpPools: PlatypusInfo[] = [];
const makerTokenPool = Object.values(PLATYPUS_AVALANCHE_INFOS).filter(c =>
[makerToken].every(
t =>
c.tokens.includes(t),
),
);
const takerTokenPool = Object.values(PLATYPUS_AVALANCHE_INFOS).filter(c =>
[takerToken].every(
t =>
c.tokens.includes(t),
),
);
if( makerTokenPool[0].tokens.includes(takerToken)){
let pool: PlatypusInfo = {
gasSchedule: makerTokenPool[0].gasSchedule,
poolAddress: [makerTokenPool[0].poolAddress[0]],
tokens: [makerToken,takerToken],
};
ptpPools.push(pool);
}
else{
const intermediateToken = makerTokenPool[0].tokens.filter(element => takerTokenPool[0].tokens.includes(element));
//return similar values from two arrays
let pool: PlatypusInfo = {
gasSchedule: makerTokenPool[0].gasSchedule + makerTokenPool[0].gasSchedule,
poolAddress: [makerTokenPool[0].poolAddress[0], takerTokenPool[0].poolAddress[0]],
tokens: [makerToken,intermediateToken[0],takerToken],
};
ptpPools.push(pool);
}
return ptpPools;
}
export function getShellLikeInfosForPair(
chainId: ChainId,
takerToken: string,

View File

@@ -27,6 +27,8 @@ import {
LiquidityProviderRegistry,
MakerPsmFillData,
MultiHopFillData,
PlatypusFillData,
PlatypusInfo,
PsmInfo,
TokenAdjacencyGraph,
UniswapV2FillData,
@@ -184,6 +186,8 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.KyberDmm,
ERC20BridgeSource.AaveV2,
ERC20BridgeSource.Synapse,
ERC20BridgeSource.GMX,
ERC20BridgeSource.Platypus,
]),
[ChainId.Fantom]: new SourceFilters([
ERC20BridgeSource.MultiHop,
@@ -331,6 +335,8 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.KyberDmm,
ERC20BridgeSource.AaveV2,
ERC20BridgeSource.Synapse,
ERC20BridgeSource.GMX,
ERC20BridgeSource.Platypus,
]),
[ChainId.Fantom]: new SourceFilters([
ERC20BridgeSource.MultiHop,
@@ -551,6 +557,7 @@ export const AVALANCHE_TOKENS = {
// native USDC on Avalanche
nUSDC: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
USDT: '0xc7198437980c041c805a1edcba50c1ce5db95118',
USDt: '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7',
aDAI: '0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a',
aUSDC: '0x46a51127c3ce23fb7ab1de06226147f446e4a857',
aUSDT: '0x532e6537fea298397212f09a61e03311686f548e',
@@ -558,6 +565,10 @@ export const AVALANCHE_TOKENS = {
nUSD: '0xcfc37a6ab183dd4aed08c204d1c2773c0b1bdf46',
aWETH: '0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21',
MIM: '0x130966628846bfd36ff31a822705796e8cb8c18d',
sAVAX: '0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be',
UST: '0xb599c3590f42f8f995ecfa0f85d2980b76862fc1',
FRAX: '0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64',
};
export const CELO_TOKENS = {
@@ -833,6 +844,14 @@ export const ACRYPTOS_POOLS = {
acs3btc: '0xbe7caa236544d1b9a0e7f91e94b9f5bfd3b5ca81',
};
export const PLATYPUS_AVALANCHE_POOLS = {
usd: '0x66357dcace80431aee0a7507e2e361b7e2402370',
ust: '0xe0d166de15665bc4b7185b2e35e847e51316e126',
frax: '0xb8e567fc23c39c94a1f6359509d7b43d1fbed824',
mim: '0x30c30d826be87cd0a4b90855c2f38f7fcfe4eaa7',
sAVAX: '0x4658ea7e9960d6158a261104aaa160cc953bb6ba',
};
export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId<string[]>(
{
[ChainId.Mainnet]: [
@@ -1816,6 +1835,34 @@ export const ACRYPTOS_BSC_INFOS: { [name: string]: CurveInfo } = {
}),
};
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: 350e3,
},
[PLATYPUS_AVALANCHE_POOLS.ust]: {
poolAddress: [PLATYPUS_AVALANCHE_POOLS.ust],
tokens: [AVALANCHE_TOKENS.nUSDC, AVALANCHE_TOKENS.UST],
gasSchedule: 350e3,
},
[PLATYPUS_AVALANCHE_POOLS.frax]: {
poolAddress: [PLATYPUS_AVALANCHE_POOLS.frax],
tokens: [AVALANCHE_TOKENS.nUSDC, AVALANCHE_TOKENS.FRAX], //liq issues
gasSchedule: 350e3,
},
[PLATYPUS_AVALANCHE_POOLS.mim]: {
poolAddress: [PLATYPUS_AVALANCHE_POOLS.mim],
tokens: [AVALANCHE_TOKENS.MIM, AVALANCHE_TOKENS.nUSDC],
gasSchedule: 350e3,
},
[PLATYPUS_AVALANCHE_POOLS.sAVAX]: {
poolAddress: [PLATYPUS_AVALANCHE_POOLS.sAVAX],
tokens: [AVALANCHE_TOKENS.WAVAX, AVALANCHE_TOKENS.sAVAX], //add unwrapping
gasSchedule: 350e3,
},
};
/**
* Kyber reserve prefixes
* 0xff Fed price reserve
@@ -2344,6 +2391,33 @@ export const SPOOKYSWAP_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
},
NULL_ADDRESS,
);
export const GMX_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
{
[ChainId.Avalanche]: '0x5f719c2f1095f7b9fc68a68e35b51194f4b6abe8',
},
NULL_ADDRESS,
);
export const GMX_READER_BY_CHAIN_ID = valueByChainId<string>(
{
[ChainId.Avalanche]: '0x67b789d48c926006f5132bfce4e976f0a7a63d5d',
},
NULL_ADDRESS,
);
export const GMX_VAULT_BY_CHAIN_ID = valueByChainId<string>(
{
[ChainId.Avalanche]: '0x9ab2de34a33fb459b538c43f251eb825645e8595',
},
NULL_ADDRESS,
);
export const PLATYPUS_ROUTER_BY_CHAIN_ID = valueByChainId<string>(
{
[ChainId.Avalanche]: '0x73256ec7575d999c360c1eec118ecbefd8da7d12',
},
NULL_ADDRESS,
);
export const VIP_ERC20_BRIDGE_SOURCES_BY_CHAIN_ID = valueByChainId<ERC20BridgeSource[]>(
{
@@ -2548,6 +2622,8 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
//
[ERC20BridgeSource.Pangolin]: uniswapV2CloneGasSchedule,
[ERC20BridgeSource.TraderJoe]: uniswapV2CloneGasSchedule,
[ERC20BridgeSource.GMX]: () => 450e3,
[ERC20BridgeSource.Platypus]: () => 450e3,
//
// Celo

View File

@@ -20,6 +20,7 @@ import {
FinalUniswapV3FillData,
GeistFillData,
GenericRouterFillData,
GMXFillData,
KyberDmmFillData,
KyberFillData,
LidoFillData,
@@ -34,6 +35,7 @@ import {
OptimizedMarketOrder,
OptimizedMarketOrderBase,
OrderDomain,
PlatypusFillData,
ShellFillData,
UniswapV2FillData,
UniswapV3FillData,
@@ -208,6 +210,10 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
return encodeBridgeSourceId(BridgeProtocol.AaveV2, 'Geist');
case ERC20BridgeSource.MobiusMoney:
return encodeBridgeSourceId(BridgeProtocol.Nerve, 'MobiusMoney');
case ERC20BridgeSource.GMX:
return encodeBridgeSourceId(BridgeProtocol.GMX, 'GMX');
case ERC20BridgeSource.Platypus:
return encodeBridgeSourceId(BridgeProtocol.Platypus, 'Platypus');
default:
throw new Error(AggregationError.NoBridgeForSource);
}
@@ -367,6 +373,23 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
const geistFillData = (order as OptimizedMarketBridgeOrder<GeistFillData>).fillData;
bridgeData = encoder.encode([geistFillData.lendingPool, geistFillData.gToken]);
break;
case ERC20BridgeSource.GMX:
const gmxFillData = (order as OptimizedMarketBridgeOrder<GMXFillData>).fillData;
bridgeData = encoder.encode([
gmxFillData.router,
gmxFillData.reader,
gmxFillData.vault,
gmxFillData.tokenAddressPath,
]);
break;
case ERC20BridgeSource.Platypus:
const platypusFillData = (order as OptimizedMarketBridgeOrder<PlatypusFillData>).fillData;
bridgeData = encoder.encode([
platypusFillData.router,
platypusFillData.pool,
platypusFillData.tokenAddressPath,
]);
break;
default:
throw new Error(AggregationError.NoBridgeForSource);
@@ -452,6 +475,8 @@ const balancerV2Encoder = AbiEncoder.create([
{ name: 'poolId', type: 'bytes32' },
]);
const routerAddressPathEncoder = AbiEncoder.create('(address,address[])');
const gmxAddressPathEncoder = AbiEncoder.create('(address,address,address,address[])');
const platypusAddressPathEncoder = AbiEncoder.create('(address,address[],address[])');
const tokenAddressEncoder = AbiEncoder.create([{ name: 'tokenAddress', type: 'address' }]);
export const BRIDGE_ENCODERS: {
@@ -505,6 +530,9 @@ export const BRIDGE_ENCODERS: {
[ERC20BridgeSource.SpiritSwap]: routerAddressPathEncoder,
[ERC20BridgeSource.SpookySwap]: routerAddressPathEncoder,
[ERC20BridgeSource.MorpheusSwap]: routerAddressPathEncoder,
// Avalanche
[ERC20BridgeSource.GMX]: gmxAddressPathEncoder,
[ERC20BridgeSource.Platypus]: platypusAddressPathEncoder,
// Celo
[ERC20BridgeSource.UbeSwap]: routerAddressPathEncoder,
// BSC

View File

@@ -14,6 +14,7 @@ import {
getCurveLikeInfosForPair,
getDodoV2Offsets,
getKyberOffsets,
getPlatypusInfoForPair,
getShellLikeInfosForPair,
isAllowedKyberReserveId,
isBadTokenForSource,
@@ -30,6 +31,9 @@ import {
COMPOUND_API_URL_BY_CHAIN_ID,
DODOV1_CONFIG_BY_CHAIN_ID,
DODOV2_FACTORIES_BY_CHAIN_ID,
GMX_READER_BY_CHAIN_ID,
GMX_ROUTER_BY_CHAIN_ID,
GMX_VAULT_BY_CHAIN_ID,
KYBER_CONFIG_BY_CHAIN_ID,
KYBER_DMM_ROUTER_BY_CHAIN_ID,
LIDO_INFO_BY_CHAIN,
@@ -42,6 +46,7 @@ import {
NATIVE_FEE_TOKEN_BY_CHAIN_ID,
NULL_ADDRESS,
NULL_BYTES,
PLATYPUS_ROUTER_BY_CHAIN_ID,
SELL_SOURCE_FILTER_BY_CHAIN_ID,
UNISWAPV1_ROUTER_BY_CHAIN_ID,
UNISWAPV3_CONFIG_BY_CHAIN_ID,
@@ -71,6 +76,7 @@ import {
GeistFillData,
GeistInfo,
GenericRouterFillData,
GMXFillData,
HopInfo,
KyberDmmFillData,
KyberFillData,
@@ -82,6 +88,7 @@ import {
MakerPsmFillData,
MooniswapFillData,
MultiHopFillData,
PlatypusFillData,
PsmInfo,
ShellFillData,
SourceQuoteOperation,
@@ -1213,6 +1220,65 @@ export class SamplerOperations {
params: [cToken, takerToken, makerToken, makerFillAmounts],
});
}
public getGMXSellQuotes(
router: string,
reader: string,
vault: string,
tokenAddressPath: string[],
takerFillAmounts: BigNumber[],
): SourceQuoteOperation<GMXFillData> {
return new SamplerContractOperation({
source: ERC20BridgeSource.GMX,
fillData: { router, reader, vault, tokenAddressPath },
contract: this._samplerContract,
function: this._samplerContract.sampleSellsFromGMX,
params: [reader, vault, tokenAddressPath, takerFillAmounts],
});
}
public getGMXBuyQuotes(
router: string,
reader: string,
vault: string,
tokenAddressPath: string[],
makerFillAmounts: BigNumber[],
): SourceQuoteOperation<GMXFillData> {
return new SamplerContractOperation({
source: ERC20BridgeSource.GMX,
fillData: { router, reader, vault, tokenAddressPath },
contract: this._samplerContract,
function: this._samplerContract.sampleBuysFromGMX,
params: [reader, vault, tokenAddressPath, makerFillAmounts],
});
}
public getPlatypusSellQuotes(
router: string,
pool: string[],
tokenAddressPath: string[],
takerFillAmounts: BigNumber[],
): SourceQuoteOperation<PlatypusFillData> {
return new SamplerContractOperation({
source: ERC20BridgeSource.Platypus,
fillData: { router, pool, tokenAddressPath },
contract: this._samplerContract,
function: this._samplerContract.sampleSellsFromPlatypus,
params: [router, tokenAddressPath, pool, takerFillAmounts],
});
}
public getPlatypusBuyQuotes(
router: string,
pool: string[],
tokenAddressPath: string[],
makerFillAmounts: BigNumber[],
): SourceQuoteOperation<PlatypusFillData> {
return new SamplerContractOperation({
source: ERC20BridgeSource.Platypus,
fillData: { router, tokenAddressPath, pool },
contract: this._samplerContract,
function: this._samplerContract.sampleBuysFromPlatypus,
params: [router, tokenAddressPath, pool, makerFillAmounts],
});
}
public getMedianSellRate(
sources: ERC20BridgeSource[],
@@ -1605,8 +1671,28 @@ export class SamplerOperations {
takerFillAmounts,
);
}
default:
throw new Error(`Unsupported sell sample source: ${source}`);
case ERC20BridgeSource.GMX: {
return this.getGMXSellQuotes(
GMX_ROUTER_BY_CHAIN_ID[this.chainId],
GMX_READER_BY_CHAIN_ID[this.chainId],
GMX_VAULT_BY_CHAIN_ID[this.chainId],
[takerToken, makerToken],
takerFillAmounts,
);
}
case ERC20BridgeSource.Platypus: {
return getPlatypusInfoForPair(this.chainId, takerToken, makerToken).map(pool =>
this.getPlatypusSellQuotes(
PLATYPUS_ROUTER_BY_CHAIN_ID[this.chainId],
pool.poolAddress,
pool.tokens,
takerFillAmounts,
),
);
}
default:
throw new Error(`Unsupported sell sample source: ${source}`);
}
}),
);
@@ -1909,6 +1995,25 @@ export class SamplerOperations {
}
return this.getCompoundBuyQuotes(cToken.tokenAddress, makerToken, takerToken, makerFillAmounts);
}
case ERC20BridgeSource.GMX: {
return this.getGMXBuyQuotes(
GMX_ROUTER_BY_CHAIN_ID[this.chainId],
GMX_READER_BY_CHAIN_ID[this.chainId],
GMX_VAULT_BY_CHAIN_ID[this.chainId],
[takerToken, makerToken],
makerFillAmounts,
);
}
case ERC20BridgeSource.Platypus: {
return getPlatypusInfoForPair(this.chainId, takerToken, makerToken).map(pool =>
this.getPlatypusBuyQuotes(
PLATYPUS_ROUTER_BY_CHAIN_ID[this.chainId],
pool.poolAddress,
pool.tokens,
makerFillAmounts,
),
);
}
default:
throw new Error(`Unsupported buy sample source: ${source}`);
}

View File

@@ -94,6 +94,9 @@ export enum ERC20BridgeSource {
// Avalanche
Pangolin = 'Pangolin',
TraderJoe = 'TraderJoe',
// tslint:disable-next-line: enum-naming
GMX = 'GMX',
Platypus = 'Platypus',
// Celo only
UbeSwap = 'UbeSwap',
MobiusMoney = 'MobiusMoney',
@@ -188,6 +191,11 @@ export interface GeistInfo {
underlyingToken: string;
}
export interface PlatypusInfo {
poolAddress: string[];
tokens: string[];
gasSchedule: number;
}
// Internal `fillData` field for `Fill` objects.
export interface FillData {}
@@ -223,6 +231,19 @@ export interface UniswapV2FillData extends FillData {
router: string;
}
export interface GMXFillData extends FillData {
router: string;
reader: string;
vault: string;
tokenAddressPath: string[];
}
export interface PlatypusFillData extends FillData {
router: string;
pool: string[];
tokenAddressPath: string[];
}
export interface ShellFillData extends FillData {
poolAddress: string;
}

View File

@@ -17,13 +17,16 @@ import * as DODOV2Sampler from '../test/generated-artifacts/DODOV2Sampler.json';
import * as DummyLiquidityProvider from '../test/generated-artifacts/DummyLiquidityProvider.json';
import * as ERC20BridgeSampler from '../test/generated-artifacts/ERC20BridgeSampler.json';
import * as FakeTaker from '../test/generated-artifacts/FakeTaker.json';
import * as GMXSampler from '../test/generated-artifacts/GMXSampler.json';
import * as IBalancer from '../test/generated-artifacts/IBalancer.json';
import * as IBancor from '../test/generated-artifacts/IBancor.json';
import * as ICurve from '../test/generated-artifacts/ICurve.json';
import * as IGMX from '../test/generated-artifacts/IGMX.json';
import * as IKyberNetwork from '../test/generated-artifacts/IKyberNetwork.json';
import * as IMooniswap from '../test/generated-artifacts/IMooniswap.json';
import * as IMStable from '../test/generated-artifacts/IMStable.json';
import * as IMultiBridge from '../test/generated-artifacts/IMultiBridge.json';
import * as IPlatypus from '../test/generated-artifacts/IPlatypus.json';
import * as IShell from '../test/generated-artifacts/IShell.json';
import * as ISmoothy from '../test/generated-artifacts/ISmoothy.json';
import * as IUniswapExchangeQuotes from '../test/generated-artifacts/IUniswapExchangeQuotes.json';
@@ -37,6 +40,7 @@ import * as MooniswapSampler from '../test/generated-artifacts/MooniswapSampler.
import * as MStableSampler from '../test/generated-artifacts/MStableSampler.json';
import * as MultiBridgeSampler from '../test/generated-artifacts/MultiBridgeSampler.json';
import * as NativeOrderSampler from '../test/generated-artifacts/NativeOrderSampler.json';
import * as PlatypusSampler from '../test/generated-artifacts/PlatypusSampler.json';
import * as SamplerUtils from '../test/generated-artifacts/SamplerUtils.json';
import * as ShellSampler from '../test/generated-artifacts/ShellSampler.json';
import * as SmoothySampler from '../test/generated-artifacts/SmoothySampler.json';
@@ -59,6 +63,7 @@ export const artifacts = {
DODOV2Sampler: DODOV2Sampler as ContractArtifact,
ERC20BridgeSampler: ERC20BridgeSampler as ContractArtifact,
FakeTaker: FakeTaker as ContractArtifact,
GMXSampler: GMXSampler as ContractArtifact,
KyberDmmSampler: KyberDmmSampler as ContractArtifact,
KyberSampler: KyberSampler as ContractArtifact,
LidoSampler: LidoSampler as ContractArtifact,
@@ -68,6 +73,7 @@ export const artifacts = {
MooniswapSampler: MooniswapSampler as ContractArtifact,
MultiBridgeSampler: MultiBridgeSampler as ContractArtifact,
NativeOrderSampler: NativeOrderSampler as ContractArtifact,
PlatypusSampler: PlatypusSampler as ContractArtifact,
SamplerUtils: SamplerUtils as ContractArtifact,
ShellSampler: ShellSampler as ContractArtifact,
SmoothySampler: SmoothySampler as ContractArtifact,
@@ -79,10 +85,12 @@ export const artifacts = {
IBalancer: IBalancer as ContractArtifact,
IBancor: IBancor as ContractArtifact,
ICurve: ICurve as ContractArtifact,
IGMX: IGMX as ContractArtifact,
IKyberNetwork: IKyberNetwork as ContractArtifact,
IMStable: IMStable as ContractArtifact,
IMooniswap: IMooniswap as ContractArtifact,
IMultiBridge: IMultiBridge as ContractArtifact,
IPlatypus: IPlatypus as ContractArtifact,
IShell: IShell as ContractArtifact,
ISmoothy: ISmoothy as ContractArtifact,
IUniswapExchangeQuotes: IUniswapExchangeQuotes as ContractArtifact,

View File

@@ -15,6 +15,7 @@ export * from '../test/generated-wrappers/d_o_d_o_v2_sampler';
export * from '../test/generated-wrappers/dummy_liquidity_provider';
export * from '../test/generated-wrappers/erc20_bridge_sampler';
export * from '../test/generated-wrappers/fake_taker';
export * from '../test/generated-wrappers/g_m_x_sampler';
export * from '../test/generated-wrappers/i_balancer';
export * from '../test/generated-wrappers/i_bancor';
export * from '../test/generated-wrappers/i_curve';
@@ -22,10 +23,12 @@ export * from '../test/generated-wrappers/i_kyber_network';
export * from '../test/generated-wrappers/i_m_stable';
export * from '../test/generated-wrappers/i_mooniswap';
export * from '../test/generated-wrappers/i_multi_bridge';
export * from '../test/generated-wrappers/i_platypus';
export * from '../test/generated-wrappers/i_shell';
export * from '../test/generated-wrappers/i_smoothy';
export * from '../test/generated-wrappers/i_uniswap_exchange_quotes';
export * from '../test/generated-wrappers/i_uniswap_v2_router01';
export * from '../test/generated-wrappers/igmx';
export * from '../test/generated-wrappers/kyber_dmm_sampler';
export * from '../test/generated-wrappers/kyber_sampler';
export * from '../test/generated-wrappers/lido_sampler';
@@ -35,6 +38,7 @@ export * from '../test/generated-wrappers/maker_p_s_m_sampler';
export * from '../test/generated-wrappers/mooniswap_sampler';
export * from '../test/generated-wrappers/multi_bridge_sampler';
export * from '../test/generated-wrappers/native_order_sampler';
export * from '../test/generated-wrappers/platypus_sampler';
export * from '../test/generated-wrappers/sampler_utils';
export * from '../test/generated-wrappers/shell_sampler';
export * from '../test/generated-wrappers/smoothy_sampler';

View File

@@ -18,13 +18,16 @@
"test/generated-artifacts/DummyLiquidityProvider.json",
"test/generated-artifacts/ERC20BridgeSampler.json",
"test/generated-artifacts/FakeTaker.json",
"test/generated-artifacts/GMXSampler.json",
"test/generated-artifacts/IBalancer.json",
"test/generated-artifacts/IBancor.json",
"test/generated-artifacts/ICurve.json",
"test/generated-artifacts/IGMX.json",
"test/generated-artifacts/IKyberNetwork.json",
"test/generated-artifacts/IMStable.json",
"test/generated-artifacts/IMooniswap.json",
"test/generated-artifacts/IMultiBridge.json",
"test/generated-artifacts/IPlatypus.json",
"test/generated-artifacts/IShell.json",
"test/generated-artifacts/ISmoothy.json",
"test/generated-artifacts/IUniswapExchangeQuotes.json",
@@ -38,6 +41,7 @@
"test/generated-artifacts/MooniswapSampler.json",
"test/generated-artifacts/MultiBridgeSampler.json",
"test/generated-artifacts/NativeOrderSampler.json",
"test/generated-artifacts/PlatypusSampler.json",
"test/generated-artifacts/SamplerUtils.json",
"test/generated-artifacts/ShellSampler.json",
"test/generated-artifacts/SmoothySampler.json",

View File

@@ -1,4 +1,12 @@
[
{
"version": "1.12.0",
"changes": [
{
"note": "Added Support for GMX liquidity source on Avalanche"
}
]
},
{
"timestamp": 1646225739,
"version": "1.11.1",

View File

@@ -134,6 +134,8 @@ export enum BridgeProtocol {
Clipper, // Not used: Clipper is now using PLP interface
AaveV2,
Compound,
GMX,
Platypus,
}
// tslint:enable: enum-naming

View File

@@ -3755,10 +3755,10 @@ bigi@1.4.2, bigi@^1.1.0:
version "1.4.2"
resolved "https://registry.yarnpkg.com/bigi/-/bigi-1.4.2.tgz#9c665a95f88b8b08fc05cfd731f561859d725825"
bignumber.js@7.2.1, bignumber.js@9.0.1, bignumber.js@^9.0.0, bignumber.js@~4.1.0, bignumber.js@~9.0.0:
version "9.0.1"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.1.tgz#8d7ba124c882bfd8e43260c67475518d0689e4e5"
integrity sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==
bignumber.js@7.2.1, bignumber.js@9.0.2, bignumber.js@^9.0.0, bignumber.js@~4.1.0, bignumber.js@~9.0.0:
version "9.0.2"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.2.tgz#71c6c6bed38de64e24a65ebe16cfcf23ae693673"
integrity sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw==
binary-extensions@^2.0.0:
version "2.1.0"