Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
@0x/instant: Fix for changed asset-swapper configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
merklejerk committed Mar 9, 2020
1 parent 3e5f7de commit 1c6ca0c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 4 additions & 0 deletions packages/instant/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
{
"note": "Fix ERC721 asset support",
"pr": 2491
},
{
"note": "Remove `bridgeSlippage` SwapQuoter config.",
"pr": 2513
}
]
},
Expand Down
2 changes: 0 additions & 2 deletions packages/instant/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const ONE_SECOND_MS = 1000;
export const ONE_MINUTE_MS = ONE_SECOND_MS * 60;
export const GIT_SHA = process.env.GIT_SHA;
export const NODE_ENV = process.env.NODE_ENV;
export const ERC20_SWAP_QUOTE_SLIPPAGE_PERCENTAGE = 0.2;
export const ERC721_SWAP_QUOTE_SLIPPAGE_PERCENTAGE = 0;
export const NPM_PACKAGE_VERSION = process.env.NPM_PACKAGE_VERSION;
export const DEFAULT_UNKOWN_ASSET_NAME = '???';
export const ACCOUNT_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 5;
Expand Down
6 changes: 0 additions & 6 deletions packages/instant/src/util/swap_quote_updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Dispatch } from 'redux';

import { ERC20_SWAP_QUOTE_SLIPPAGE_PERCENTAGE, ERC721_SWAP_QUOTE_SLIPPAGE_PERCENTAGE } from '../constants';
import { Action, actions } from '../redux/actions';
import { Asset, QuoteFetchOrigin } from '../types';

Expand Down Expand Up @@ -37,18 +36,13 @@ export const swapQuoteUpdater = {
}
const wethAssetData = await swapQuoter.getEtherTokenAssetDataOrThrowAsync();
let newSwapQuote: MarketBuySwapQuote | undefined;
const slippagePercentage =
asset.metaData.assetProxyId === AssetProxyId.ERC20
? ERC20_SWAP_QUOTE_SLIPPAGE_PERCENTAGE
: ERC721_SWAP_QUOTE_SLIPPAGE_PERCENTAGE;
try {
const gasInfo = await gasPriceEstimator.getGasInfoAsync();
newSwapQuote = await swapQuoter.getMarketBuySwapQuoteForAssetDataAsync(
asset.assetData,
wethAssetData,
baseUnitValue,
{
slippagePercentage,
gasPrice: gasInfo.gasPriceInWei,
// Only use native orders
// excludedSources: [ERC20BridgeSource.Eth2Dai, ERC20BridgeSource.Kyber, ERC20BridgeSource.Uniswap],
Expand Down

0 comments on commit 1c6ca0c

Please sign in to comment.