diff --git a/packages/asset-swapper/CHANGELOG.json b/packages/asset-swapper/CHANGELOG.json index 23cb5c8c7d..97e399f7b5 100644 --- a/packages/asset-swapper/CHANGELOG.json +++ b/packages/asset-swapper/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "16.62.2", + "changes": [ + { + "note": "Offboard Smoothy and ComethSwap", + "pr": 509 + } + ] + }, { "version": "16.62.1", "changes": [ diff --git a/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol b/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol index 23b969c682..47986ad9aa 100644 --- a/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol +++ b/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol @@ -39,7 +39,6 @@ import "./MooniswapSampler.sol"; import "./NativeOrderSampler.sol"; import "./PlatypusSampler.sol"; import "./ShellSampler.sol"; -import "./SmoothySampler.sol"; import "./TwoHopSampler.sol"; import "./UniswapSampler.sol"; import "./UniswapV2Sampler.sol"; @@ -68,7 +67,6 @@ contract ERC20BridgeSampler is NativeOrderSampler, PlatypusSampler, ShellSampler, - SmoothySampler, TwoHopSampler, UniswapSampler, UniswapV2Sampler, diff --git a/packages/asset-swapper/contracts/src/SmoothySampler.sol b/packages/asset-swapper/contracts/src/SmoothySampler.sol deleted file mode 100644 index bd9e06bc04..0000000000 --- a/packages/asset-swapper/contracts/src/SmoothySampler.sol +++ /dev/null @@ -1,156 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -/* - - Copyright 2020 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.6; -pragma experimental ABIEncoderV2; - -// import "./interfaces/ISmoothy.sol"; -import "./ApproximateBuys.sol"; -import "./SamplerUtils.sol"; -import "./interfaces/ISmoothy.sol"; - -contract SmoothySampler is - SamplerUtils, - ApproximateBuys -{ - /// @dev Information for sampling from smoothy sources. - struct SmoothyInfo { - address poolAddress; - bytes4 sellQuoteFunctionSelector; - bytes4 buyQuoteFunctionSelector; - } - - /// @dev Base gas limit for Smoothy calls. - uint256 constant private SMOOTHY_CALL_GAS = 600e3; - - /// @dev Sample sell quotes from Smoothy. - /// @param smoothyInfo Smoothy information specific to this token pair. - /// @param fromTokenIdx Index of the taker token (what to sell). - /// @param toTokenIdx Index of the maker token (what to buy). - /// @param takerTokenAmounts Taker token sell amount for each sample. - /// @return makerTokenAmounts Maker amounts bought at each taker token - /// amount. - function sampleSellsFromSmoothy( - SmoothyInfo memory smoothyInfo, - int128 fromTokenIdx, - int128 toTokenIdx, - uint256[] memory takerTokenAmounts - ) - public - view - returns (uint256[] memory makerTokenAmounts) - { - // Basically a Curve fork - - // Smoothy only keep a percentage of its tokens available in reserve - uint256 poolReserveMakerAmount = ISmoothy(smoothyInfo.poolAddress).getBalance(uint256(toTokenIdx)) - - ISmoothy(smoothyInfo.poolAddress)._yBalances(uint256(toTokenIdx)); - (, , , uint256 decimals) = ISmoothy(smoothyInfo.poolAddress).getTokenStats(uint256(toTokenIdx)); - poolReserveMakerAmount = poolReserveMakerAmount/(10**(18-decimals)); - - uint256 numSamples = takerTokenAmounts.length; - makerTokenAmounts = new uint256[](numSamples); - for (uint256 i = 0; i < numSamples; i++) { - (bool didSucceed, bytes memory resultData) = - smoothyInfo.poolAddress.staticcall.gas(SMOOTHY_CALL_GAS)( - abi.encodeWithSelector( - smoothyInfo.sellQuoteFunctionSelector, - fromTokenIdx, - toTokenIdx, - takerTokenAmounts[i] - )); - uint256 buyAmount = 0; - if (didSucceed) { - buyAmount = abi.decode(resultData, (uint256)); - } - - // Make sure the quoted buyAmount is available in the pool reserve - if (buyAmount >= poolReserveMakerAmount) { - // Assign pool reserve amount for all higher samples to break early - for (uint256 j = i; j < numSamples; j++) { - makerTokenAmounts[j] = poolReserveMakerAmount; - } - break; - } else { - makerTokenAmounts[i] = buyAmount; - } - - // Break early if there are 0 amounts - if (makerTokenAmounts[i] == 0) { - break; - } - } - } - - /// @dev Sample buy quotes from Smoothy. - /// @param smoothyInfo Smoothy information specific to this token pair. - /// @param fromTokenIdx Index of the taker token (what to sell). - /// @param toTokenIdx Index of the maker token (what to buy). - /// @param makerTokenAmounts Maker token buy amount for each sample. - /// @return takerTokenAmounts Taker amounts sold at each maker token - /// amount. - function sampleBuysFromSmoothy( - SmoothyInfo memory smoothyInfo, - int128 fromTokenIdx, - int128 toTokenIdx, - uint256[] memory makerTokenAmounts - ) - public - view - returns (uint256[] memory takerTokenAmounts) - { - // Buys not supported so approximate it. - return _sampleApproximateBuys( - ApproximateBuyQuoteOpts({ - makerTokenData: abi.encode(toTokenIdx, smoothyInfo), - takerTokenData: abi.encode(fromTokenIdx, smoothyInfo), - getSellQuoteCallback: _sampleSellForApproximateBuyFromSmoothy - }), - makerTokenAmounts - ); - } - - function _sampleSellForApproximateBuyFromSmoothy( - bytes memory takerTokenData, - bytes memory makerTokenData, - uint256 sellAmount - ) - private - view - returns (uint256 buyAmount) - { - (int128 takerTokenIdx, SmoothyInfo memory smoothyInfo) = - abi.decode(takerTokenData, (int128, SmoothyInfo)); - (int128 makerTokenIdx) = - abi.decode(makerTokenData, (int128)); - (bool success, bytes memory resultData) = - address(this).staticcall(abi.encodeWithSelector( - this.sampleSellsFromSmoothy.selector, - smoothyInfo, - takerTokenIdx, - makerTokenIdx, - _toSingleValueArray(sellAmount) - )); - if (!success) { - return 0; - } - // solhint-disable-next-line indent - return abi.decode(resultData, (uint256[]))[0]; - } -} diff --git a/packages/asset-swapper/contracts/src/interfaces/ISmoothy.sol b/packages/asset-swapper/contracts/src/interfaces/ISmoothy.sol deleted file mode 100644 index 5feb975346..0000000000 --- a/packages/asset-swapper/contracts/src/interfaces/ISmoothy.sol +++ /dev/null @@ -1,45 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -/* - - Copyright 2021 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.6; - - -interface ISmoothy { - - function getBalance ( - uint256 tid - ) - external - view - returns (uint256 balance); - - function _yBalances ( - uint256 tid - ) - external - view - returns (uint256 balance); - - function getTokenStats ( - uint256 tid - ) - external - view - returns (uint256 softWeight, uint256 hardWeight, uint256 balance, uint256 decimals); -} diff --git a/packages/asset-swapper/package.json b/packages/asset-swapper/package.json index 3ed88bdfff..eb83be5070 100644 --- a/packages/asset-swapper/package.json +++ b/packages/asset-swapper/package.json @@ -40,7 +40,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|BalancerV2BatchSampler|BalancerV2Common|BalancerV2Sampler|BancorSampler|BancorV3Sampler|CompoundSampler|CurveSampler|DODOSampler|DODOV2Sampler|ERC20BridgeSampler|FakeTaker|GMXSampler|IBalancer|IBalancerV2Vault|IBancor|IBancorV3|ICurve|IGMX|IMStable|IMooniswap|IMultiBridge|IPlatypus|IShell|ISmoothy|IUniswapExchangeQuotes|IUniswapV2Router01|KyberDmmSampler|LidoSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|NativeOrderSampler|PlatypusSampler|SamplerUtils|ShellSampler|SmoothySampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UniswapV3Sampler|UtilitySampler|VelodromeSampler).json", + "abis": "./test/generated-artifacts/@(ApproximateBuys|BalanceChecker|BalancerSampler|BalancerV2BatchSampler|BalancerV2Common|BalancerV2Sampler|BancorSampler|BancorV3Sampler|CompoundSampler|CurveSampler|DODOSampler|DODOV2Sampler|ERC20BridgeSampler|FakeTaker|GMXSampler|IBalancer|IBalancerV2Vault|IBancor|IBancorV3|ICurve|IGMX|IMStable|IMooniswap|IMultiBridge|IPlatypus|IShell|IUniswapExchangeQuotes|IUniswapV2Router01|KyberDmmSampler|LidoSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|NativeOrderSampler|PlatypusSampler|SamplerUtils|ShellSampler|SmoothySampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UniswapV3Sampler|UtilitySampler|VelodromeSampler).json", "postpublish": { "assets": [] } diff --git a/packages/asset-swapper/src/utils/market_operation_utils/bridge_source_utils.ts b/packages/asset-swapper/src/utils/market_operation_utils/bridge_source_utils.ts index 29676ffa67..c503d65ae3 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/bridge_source_utils.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/bridge_source_utils.ts @@ -8,7 +8,6 @@ import { BELT_BSC_INFOS, BISWAP_ROUTER_BY_CHAIN_ID, CHEESESWAP_ROUTER_BY_CHAIN_ID, - COMETHSWAP_ROUTER_BY_CHAIN_ID, COMPONENT_POOLS_BY_CHAIN_ID, CRYPTO_COM_ROUTER_BY_CHAIN_ID, CURVE_AVALANCHE_INFOS, @@ -42,8 +41,6 @@ import { SADDLE_MAINNET_INFOS, SHELL_POOLS_BY_CHAIN_ID, SHIBASWAP_ROUTER_BY_CHAIN_ID, - SMOOTHY_BSC_INFOS, - SMOOTHY_MAINNET_INFOS, SPIRITSWAP_ROUTER_BY_CHAIN_ID, SPOOKYSWAP_ROUTER_BY_CHAIN_ID, SUSHISWAP_ROUTER_BY_CHAIN_ID, @@ -325,30 +322,6 @@ export function getEllipsisInfosForPair(chainId: ChainId, takerToken: string, ma ); } -export function getSmoothyInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] { - if (chainId === ChainId.BSC) { - return Object.values(SMOOTHY_BSC_INFOS).filter(c => - [makerToken, takerToken].every( - t => - (c.tokens.includes(t) && c.metaTokens === undefined) || - (c.tokens.includes(t) && - [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0), - ), - ); - } else if (chainId === ChainId.Mainnet) { - return Object.values(SMOOTHY_MAINNET_INFOS).filter(c => - [makerToken, takerToken].every( - t => - (c.tokens.includes(t) && c.metaTokens === undefined) || - (c.tokens.includes(t) && - [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0), - ), - ); - } else { - return []; - } -} - export function getSaddleInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] { if (chainId !== ChainId.Mainnet) { return []; @@ -456,7 +429,6 @@ export function getCurveLikeInfosForPair( | ERC20BridgeSource.Synapse | ERC20BridgeSource.Belt | ERC20BridgeSource.Ellipsis - | ERC20BridgeSource.Smoothy | ERC20BridgeSource.Saddle | ERC20BridgeSource.IronSwap | ERC20BridgeSource.XSigma @@ -484,9 +456,6 @@ export function getCurveLikeInfosForPair( case ERC20BridgeSource.Ellipsis: pools = getEllipsisInfosForPair(chainId, takerToken, makerToken); break; - case ERC20BridgeSource.Smoothy: - pools = getSmoothyInfosForPair(chainId, takerToken, makerToken); - break; case ERC20BridgeSource.Saddle: pools = getSaddleInfosForPair(chainId, takerToken, makerToken); break; @@ -527,7 +496,6 @@ export function uniswapV2LikeRouterAddress( | ERC20BridgeSource.ApeSwap | ERC20BridgeSource.CheeseSwap | ERC20BridgeSource.QuickSwap - | ERC20BridgeSource.ComethSwap | ERC20BridgeSource.Dfyn | ERC20BridgeSource.WaultSwap | ERC20BridgeSource.ShibaSwap @@ -562,8 +530,6 @@ export function uniswapV2LikeRouterAddress( return CHEESESWAP_ROUTER_BY_CHAIN_ID[chainId]; case ERC20BridgeSource.QuickSwap: return QUICKSWAP_ROUTER_BY_CHAIN_ID[chainId]; - case ERC20BridgeSource.ComethSwap: - return COMETHSWAP_ROUTER_BY_CHAIN_ID[chainId]; case ERC20BridgeSource.Dfyn: return DFYN_ROUTER_BY_CHAIN_ID[chainId]; case ERC20BridgeSource.WaultSwap: diff --git a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts b/packages/asset-swapper/src/utils/market_operation_utils/constants.ts index 06f0405a69..c8e26062f8 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/constants.ts @@ -98,7 +98,6 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.Lido, ERC20BridgeSource.MakerPsm, ERC20BridgeSource.KyberDmm, - ERC20BridgeSource.Smoothy, ERC20BridgeSource.Component, ERC20BridgeSource.Saddle, ERC20BridgeSource.XSigma, @@ -135,7 +134,6 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.PancakeSwapV2, ERC20BridgeSource.SushiSwap, - ERC20BridgeSource.Smoothy, ERC20BridgeSource.ApeSwap, ERC20BridgeSource.CheeseSwap, ERC20BridgeSource.LiquidityProvider, @@ -150,7 +148,6 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( [ChainId.Polygon]: new SourceFilters([ ERC20BridgeSource.SushiSwap, ERC20BridgeSource.QuickSwap, - ERC20BridgeSource.ComethSwap, ERC20BridgeSource.Dfyn, ERC20BridgeSource.MStable, ERC20BridgeSource.Curve, @@ -241,7 +238,6 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.CryptoCom, ERC20BridgeSource.MakerPsm, ERC20BridgeSource.KyberDmm, - ERC20BridgeSource.Smoothy, ERC20BridgeSource.Component, ERC20BridgeSource.Saddle, ERC20BridgeSource.XSigma, @@ -278,7 +274,6 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.PancakeSwap, ERC20BridgeSource.PancakeSwapV2, ERC20BridgeSource.SushiSwap, - ERC20BridgeSource.Smoothy, ERC20BridgeSource.ApeSwap, ERC20BridgeSource.CheeseSwap, ERC20BridgeSource.LiquidityProvider, @@ -293,7 +288,6 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( [ChainId.Polygon]: new SourceFilters([ ERC20BridgeSource.SushiSwap, ERC20BridgeSource.QuickSwap, - ERC20BridgeSource.ComethSwap, ERC20BridgeSource.Dfyn, ERC20BridgeSource.MStable, ERC20BridgeSource.Curve, @@ -744,10 +738,6 @@ export const CURVE_OPTIMISM_POOLS = { tri: '0x1337bedc9d22ecbe766df105c9623922a27963ec', }; -export const SMOOTHY_POOLS = { - syUSD: '0xe5859f4efc09027a9b718781dcb2c6910cac6e91', -}; - export const SADDLE_POOLS = { stablesV2: '0xaCb83E0633d6605c5001e2Ab59EF3C745547C8C7', bitcoinsV2: '0xdf3309771d2BF82cb2B6C56F9f5365C8bD97c4f2', @@ -1589,39 +1579,6 @@ export const IRONSWAP_POLYGON_INFOS: { [name: string]: CurveInfo } = { }, }; -export const SMOOTHY_MAINNET_INFOS: { [name: string]: CurveInfo } = { - [SMOOTHY_POOLS.syUSD]: { - exchangeFunctionSelector: CurveFunctionSelectors.swap_uint256, - sellQuoteFunctionSelector: CurveFunctionSelectors.get_swap_amount, - buyQuoteFunctionSelector: CurveFunctionSelectors.None, - poolAddress: SMOOTHY_POOLS.syUSD, - tokens: [ - MAINNET_TOKENS.USDT, - MAINNET_TOKENS.USDC, - MAINNET_TOKENS.DAI, - MAINNET_TOKENS.TUSD, - MAINNET_TOKENS.sUSD, - MAINNET_TOKENS.BUSD, - MAINNET_TOKENS.PAX, - MAINNET_TOKENS.GUSD, - ], - metaTokens: undefined, - gasSchedule: 190e3, - }, -}; - -export const SMOOTHY_BSC_INFOS: { [name: string]: CurveInfo } = { - [SMOOTHY_POOLS.syUSD]: { - exchangeFunctionSelector: CurveFunctionSelectors.swap_uint256, - sellQuoteFunctionSelector: CurveFunctionSelectors.get_swap_amount, - buyQuoteFunctionSelector: CurveFunctionSelectors.None, - poolAddress: SMOOTHY_POOLS.syUSD, - tokens: [BSC_TOKENS.BUSD, BSC_TOKENS.USDT, BSC_TOKENS.USDC, BSC_TOKENS.DAI, BSC_TOKENS.PAX, BSC_TOKENS.UST], - metaTokens: undefined, - gasSchedule: 90e3, - }, -}; - export const NERVE_BSC_INFOS: { [name: string]: CurveInfo } = { [NERVE_POOLS.threePool]: { exchangeFunctionSelector: CurveFunctionSelectors.swap, @@ -2276,13 +2233,6 @@ export const QUICKSWAP_ROUTER_BY_CHAIN_ID = valueByChainId( NULL_ADDRESS, ); -export const COMETHSWAP_ROUTER_BY_CHAIN_ID = valueByChainId( - { - [ChainId.Polygon]: '0x93bcdc45f7e62f89a8e901dc4a0e2c6c427d9f25', - }, - NULL_ADDRESS, -); - export const DFYN_ROUTER_BY_CHAIN_ID = valueByChainId( { [ChainId.Polygon]: '0xa102072a4c07f06ec3b4900fdc4c7b80b6c57429', @@ -2450,7 +2400,6 @@ export const DEFAULT_GAS_SCHEDULE: Required = { [ERC20BridgeSource.Synapse]: fillData => (fillData as CurveFillData).pool.gasSchedule, [ERC20BridgeSource.Belt]: fillData => (fillData as CurveFillData).pool.gasSchedule, [ERC20BridgeSource.Ellipsis]: fillData => (fillData as CurveFillData).pool.gasSchedule, - [ERC20BridgeSource.Smoothy]: fillData => (fillData as CurveFillData).pool.gasSchedule, [ERC20BridgeSource.Saddle]: fillData => (fillData as CurveFillData).pool.gasSchedule, [ERC20BridgeSource.IronSwap]: fillData => (fillData as CurveFillData).pool.gasSchedule, [ERC20BridgeSource.XSigma]: fillData => (fillData as CurveFillData).pool.gasSchedule, @@ -2589,7 +2538,6 @@ export const DEFAULT_GAS_SCHEDULE: Required = { // Polygon // [ERC20BridgeSource.QuickSwap]: uniswapV2CloneGasSchedule, - [ERC20BridgeSource.ComethSwap]: uniswapV2CloneGasSchedule, [ERC20BridgeSource.Dfyn]: uniswapV2CloneGasSchedule, [ERC20BridgeSource.MeshSwap]: uniswapV2CloneGasSchedule, diff --git a/packages/asset-swapper/src/utils/market_operation_utils/orders.ts b/packages/asset-swapper/src/utils/market_operation_utils/orders.ts index 15832bfc0a..f3849b9384 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/orders.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/orders.ts @@ -135,8 +135,6 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s return encodeBridgeSourceId(BridgeProtocol.Curve, 'Ellipsis'); case ERC20BridgeSource.Component: return encodeBridgeSourceId(BridgeProtocol.Shell, 'Component'); - case ERC20BridgeSource.Smoothy: - return encodeBridgeSourceId(BridgeProtocol.Curve, 'Smoothy'); case ERC20BridgeSource.Saddle: return encodeBridgeSourceId(BridgeProtocol.Nerve, 'Saddle'); case ERC20BridgeSource.XSigma: @@ -151,8 +149,6 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s return encodeBridgeSourceId(BridgeProtocol.KyberDmm, 'KyberDmm'); case ERC20BridgeSource.QuickSwap: return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'QuickSwap'); - case ERC20BridgeSource.ComethSwap: - return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'ComethSwap'); case ERC20BridgeSource.Dfyn: return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'Dfyn'); case ERC20BridgeSource.CurveV2: @@ -236,7 +232,6 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder case ERC20BridgeSource.Synapse: case ERC20BridgeSource.Belt: case ERC20BridgeSource.Ellipsis: - case ERC20BridgeSource.Smoothy: case ERC20BridgeSource.Saddle: case ERC20BridgeSource.XSigma: case ERC20BridgeSource.FirebirdOneSwap: @@ -284,7 +279,6 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder case ERC20BridgeSource.ApeSwap: case ERC20BridgeSource.CheeseSwap: case ERC20BridgeSource.QuickSwap: - case ERC20BridgeSource.ComethSwap: case ERC20BridgeSource.Dfyn: case ERC20BridgeSource.WaultSwap: case ERC20BridgeSource.ShibaSwap: @@ -506,7 +500,6 @@ export const BRIDGE_ENCODERS: { [ERC20BridgeSource.Synapse]: curveEncoder, [ERC20BridgeSource.Belt]: curveEncoder, [ERC20BridgeSource.Ellipsis]: curveEncoder, - [ERC20BridgeSource.Smoothy]: curveEncoder, [ERC20BridgeSource.Saddle]: curveEncoder, [ERC20BridgeSource.XSigma]: curveEncoder, [ERC20BridgeSource.FirebirdOneSwap]: curveEncoder, @@ -544,7 +537,6 @@ export const BRIDGE_ENCODERS: { [ERC20BridgeSource.WaultSwap]: routerAddressPathEncoder, // Polygon [ERC20BridgeSource.QuickSwap]: routerAddressPathEncoder, - [ERC20BridgeSource.ComethSwap]: routerAddressPathEncoder, [ERC20BridgeSource.Dfyn]: routerAddressPathEncoder, // Generic pools [ERC20BridgeSource.Shell]: poolEncoder, diff --git a/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts b/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts index 8fab5a9dd4..d9ce87e3d2 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts @@ -475,62 +475,6 @@ export class SamplerOperations { }); } - public getSmoothySellQuotes( - pool: CurveInfo, - fromTokenIdx: number, - toTokenIdx: number, - takerFillAmounts: BigNumber[], - ): SourceQuoteOperation { - return new SamplerContractOperation({ - source: ERC20BridgeSource.Smoothy, - fillData: { - pool, - fromTokenIdx, - toTokenIdx, - }, - contract: this._samplerContract, - function: this._samplerContract.sampleSellsFromSmoothy, - params: [ - { - poolAddress: pool.poolAddress, - sellQuoteFunctionSelector: pool.sellQuoteFunctionSelector, - buyQuoteFunctionSelector: pool.buyQuoteFunctionSelector, - }, - new BigNumber(fromTokenIdx), - new BigNumber(toTokenIdx), - takerFillAmounts, - ], - }); - } - - public getSmoothyBuyQuotes( - pool: CurveInfo, - fromTokenIdx: number, - toTokenIdx: number, - makerFillAmounts: BigNumber[], - ): SourceQuoteOperation { - return new SamplerContractOperation({ - source: ERC20BridgeSource.Smoothy, - fillData: { - pool, - fromTokenIdx, - toTokenIdx, - }, - contract: this._samplerContract, - function: this._samplerContract.sampleBuysFromSmoothy, - params: [ - { - poolAddress: pool.poolAddress, - sellQuoteFunctionSelector: pool.sellQuoteFunctionSelector, - buyQuoteFunctionSelector: pool.buyQuoteFunctionSelector, - }, - new BigNumber(fromTokenIdx), - new BigNumber(toTokenIdx), - makerFillAmounts, - ], - }); - } - public getBalancerV2MultihopSellQuotes( vault: string, quoteSwaps: BalancerSwapInfo, // Should always be sell swap steps. @@ -1481,7 +1425,6 @@ export class SamplerOperations { case ERC20BridgeSource.ApeSwap: case ERC20BridgeSource.CheeseSwap: case ERC20BridgeSource.QuickSwap: - case ERC20BridgeSource.ComethSwap: case ERC20BridgeSource.Dfyn: case ERC20BridgeSource.WaultSwap: case ERC20BridgeSource.ShibaSwap: @@ -1531,15 +1474,6 @@ export class SamplerOperations { source, ), ); - case ERC20BridgeSource.Smoothy: - return getCurveLikeInfosForPair(this.chainId, takerToken, makerToken, source).map(pool => - this.getSmoothySellQuotes( - pool, - pool.tokens.indexOf(takerToken), - pool.tokens.indexOf(makerToken), - takerFillAmounts, - ), - ); case ERC20BridgeSource.Shell: case ERC20BridgeSource.Component: return getShellLikeInfosForPair(this.chainId, takerToken, makerToken, source).map(pool => @@ -1829,7 +1763,6 @@ export class SamplerOperations { case ERC20BridgeSource.ApeSwap: case ERC20BridgeSource.CheeseSwap: case ERC20BridgeSource.QuickSwap: - case ERC20BridgeSource.ComethSwap: case ERC20BridgeSource.Dfyn: case ERC20BridgeSource.WaultSwap: case ERC20BridgeSource.ShibaSwap: @@ -1879,15 +1812,6 @@ export class SamplerOperations { source, ), ); - case ERC20BridgeSource.Smoothy: - return getCurveLikeInfosForPair(this.chainId, takerToken, makerToken, source).map(pool => - this.getSmoothyBuyQuotes( - pool, - pool.tokens.indexOf(takerToken), - pool.tokens.indexOf(makerToken), - makerFillAmounts, - ), - ); case ERC20BridgeSource.Shell: case ERC20BridgeSource.Component: return getShellLikeInfosForPair(this.chainId, takerToken, makerToken, source).map(pool => diff --git a/packages/asset-swapper/src/utils/market_operation_utils/types.ts b/packages/asset-swapper/src/utils/market_operation_utils/types.ts index d54cd4ea8a..3d281b67ec 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/types.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/types.ts @@ -55,7 +55,6 @@ export enum ERC20BridgeSource { DodoV2 = 'DODO_V2', CryptoCom = 'CryptoCom', KyberDmm = 'KyberDMM', - Smoothy = 'Smoothy', Component = 'Component', Saddle = 'Saddle', XSigma = 'xSigma', @@ -82,7 +81,6 @@ export enum ERC20BridgeSource { ACryptos = 'ACryptoS', // Polygon only QuickSwap = 'QuickSwap', - ComethSwap = 'ComethSwap', Dfyn = 'Dfyn', WaultSwap = 'WaultSwap', FirebirdOneSwap = 'FirebirdOneSwap', @@ -132,7 +130,7 @@ export enum CurveFunctionSelectors { exchange_underlying_v2 = '0x65b2489b', get_dy_v2 = '0x556d6e9f', get_dy_underlying_v2 = '0x85f11d1e', - // Smoothy + // Smoothy(deprecated) swap_uint256 = '0x5673b02d', // swap(uint256,uint256,uint256,uint256) get_swap_amount = '0x45cf2ef6', // getSwapAmount(uint256,uint256,uint256) // Nerve BSC, Saddle Mainnet, Synapse diff --git a/packages/asset-swapper/test/artifacts.ts b/packages/asset-swapper/test/artifacts.ts index a2038d4589..d59142a8fa 100644 --- a/packages/asset-swapper/test/artifacts.ts +++ b/packages/asset-swapper/test/artifacts.ts @@ -31,7 +31,6 @@ 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'; import * as IUniswapV2Router01 from '../test/generated-artifacts/IUniswapV2Router01.json'; import * as KyberDmmSampler from '../test/generated-artifacts/KyberDmmSampler.json'; @@ -44,7 +43,6 @@ import * as NativeOrderSampler from '../test/generated-artifacts/NativeOrderSamp 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'; import * as TestNativeOrderSampler from '../test/generated-artifacts/TestNativeOrderSampler.json'; import * as TwoHopSampler from '../test/generated-artifacts/TwoHopSampler.json'; import * as UniswapSampler from '../test/generated-artifacts/UniswapSampler.json'; @@ -78,7 +76,6 @@ export const artifacts = { PlatypusSampler: PlatypusSampler as ContractArtifact, SamplerUtils: SamplerUtils as ContractArtifact, ShellSampler: ShellSampler as ContractArtifact, - SmoothySampler: SmoothySampler as ContractArtifact, TwoHopSampler: TwoHopSampler as ContractArtifact, UniswapSampler: UniswapSampler as ContractArtifact, UniswapV2Sampler: UniswapV2Sampler as ContractArtifact, @@ -96,7 +93,6 @@ export const artifacts = { IMultiBridge: IMultiBridge as ContractArtifact, IPlatypus: IPlatypus as ContractArtifact, IShell: IShell as ContractArtifact, - ISmoothy: ISmoothy as ContractArtifact, IUniswapExchangeQuotes: IUniswapExchangeQuotes as ContractArtifact, IUniswapV2Router01: IUniswapV2Router01 as ContractArtifact, TestNativeOrderSampler: TestNativeOrderSampler as ContractArtifact, diff --git a/packages/asset-swapper/test/market_operation_utils_test.ts b/packages/asset-swapper/test/market_operation_utils_test.ts index 16276a5f04..fe67b381a7 100644 --- a/packages/asset-swapper/test/market_operation_utils_test.ts +++ b/packages/asset-swapper/test/market_operation_utils_test.ts @@ -348,17 +348,6 @@ describe('MarketOperationUtils tests', () => { fromTokenIdx: 0, toTokenIdx: 1, }, - [ERC20BridgeSource.Smoothy]: { - pool: { - poolAddress: randomAddress(), - tokens: [TAKER_TOKEN, MAKER_TOKEN], - exchangeFunctionSelector: hexUtils.random(4), - sellQuoteFunctionSelector: hexUtils.random(4), - buyQuoteFunctionSelector: hexUtils.random(4), - }, - fromTokenIdx: 0, - toTokenIdx: 1, - }, [ERC20BridgeSource.Saddle]: { pool: { poolAddress: randomAddress(), diff --git a/packages/asset-swapper/test/wrappers.ts b/packages/asset-swapper/test/wrappers.ts index 2b0994a93d..aab25f0bba 100644 --- a/packages/asset-swapper/test/wrappers.ts +++ b/packages/asset-swapper/test/wrappers.ts @@ -28,7 +28,6 @@ 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'; @@ -42,7 +41,6 @@ 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'; export * from '../test/generated-wrappers/test_native_order_sampler'; export * from '../test/generated-wrappers/two_hop_sampler'; export * from '../test/generated-wrappers/uniswap_sampler'; diff --git a/packages/asset-swapper/tsconfig.json b/packages/asset-swapper/tsconfig.json index fa7f68d2ba..c8016e3e82 100644 --- a/packages/asset-swapper/tsconfig.json +++ b/packages/asset-swapper/tsconfig.json @@ -32,7 +32,6 @@ "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", "test/generated-artifacts/IUniswapV2Router01.json", "test/generated-artifacts/KyberDmmSampler.json", @@ -45,7 +44,6 @@ "test/generated-artifacts/PlatypusSampler.json", "test/generated-artifacts/SamplerUtils.json", "test/generated-artifacts/ShellSampler.json", - "test/generated-artifacts/SmoothySampler.json", "test/generated-artifacts/TestNativeOrderSampler.json", "test/generated-artifacts/TwoHopSampler.json", "test/generated-artifacts/UniswapSampler.json",