Skip to content

Commit e51c93d

Browse files
update min slippage amount (#67)
1 parent b32b440 commit e51c93d

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const FUNCTION_ID_ERC20_APPROVE = '0x095ea7b3';
4141
export const DEFAULT_SETTER_MIN_AMOUNT_OUT = BigNumber.from('1');
4242
export const MAX_BPS = BigNumber.from('10000'); // NB: 100%
4343
export const MIN_BPS = BigNumber.from('0');
44-
export const MIN_AMOUNT_OUT_MIN_SLIPPAGE = BigNumber.from('0');
44+
export const MIN_AMOUNT_OUT_MIN_SLIPPAGE = BigNumber.from('10000');
4545
export const DEFAULT_SLIPPAGE = BigNumber.from('100');
4646
export const DEFAULT_MIN_AMOUNT_BPS = BigNumber.from('9900');
4747

src/helpers/args.ts

+3-11
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { BigNumber } from '@ethersproject/bignumber';
33
import dotenv from 'dotenv';
44
import { execSync } from 'node:child_process';
55

6-
import {
7-
MAX_BPS,
8-
MIN_AMOUNT_OUT_MIN_SLIPPAGE,
9-
ShortcutExecutionMode,
10-
ShortcutOutputFormat,
11-
SimulationMode,
12-
} from '../constants';
6+
import { MAX_BPS, ShortcutExecutionMode, ShortcutOutputFormat, SimulationMode } from '../constants';
137
import { Shortcut } from '../types';
148
import { shortcuts } from './shortcuts';
159
import { getChainId } from './utils';
@@ -135,10 +129,8 @@ export function getBasisPointsFromArgs(args: string[], label: string, defaultVal
135129
throw new Error(`Invalid ${label}: ${raw}. Required a BigNumber type as BIPS. Reason: ${error}`);
136130
}
137131

138-
if (value.lt(MIN_AMOUNT_OUT_MIN_SLIPPAGE) || value.gt(MAX_BPS)) {
139-
throw new Error(
140-
`invalid ${label}: ${raw}. BIPS is out of range [${MIN_AMOUNT_OUT_MIN_SLIPPAGE.toString()},${MAX_BPS.toString()}]`,
141-
);
132+
if (value.lt(0) || value.gt(MAX_BPS)) {
133+
throw new Error(`invalid ${label}: ${raw}. BIPS is out of range [0,${MAX_BPS.toString()}]`);
142134
}
143135

144136
return value;

0 commit comments

Comments
 (0)