Skip to content

Commit

Permalink
Keeping slippage fixed at 50 bips (#1744)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchung committed Feb 19, 2021
1 parent 62cace7 commit 1b0d1ba
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/handlers/uniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ enum SwapType {

const UniswapPageSize = 1000;

const DefaultMaxSlippageInBips = 200;
const SlippageBufferInBips = 100;

// default allowed slippage, in bips
const INITIAL_ALLOWED_SLIPPAGE = 50;
// 20 minutes, denominated in seconds
Expand Down Expand Up @@ -347,20 +344,13 @@ const getContractExecutionDetails = ({
providerOrSigner: Provider | Signer;
tradeDetails: Trade;
}) => {
const priceImpact = tradeDetails?.priceImpact?.toFixed(2).toString();
const slippage = Number(priceImpact) * 100;
const maxSlippage = Math.max(
slippage + SlippageBufferInBips,
DefaultMaxSlippageInBips
);
const { methodArguments, methodNames, value } = getExecutionDetails(
accountAddress,
chainId,
inputCurrency,
outputCurrency,
tradeDetails,
providerOrSigner,
maxSlippage
providerOrSigner
);

const exchange = new Contract(
Expand Down

0 comments on commit 1b0d1ba

Please sign in to comment.