0xProject / 0x-monorepo

0x protocol monorepo - includes our smart contracts and many developer tools
Other
1.41k stars 464 forks source link

AS: respect max slippage in EP consumer #2712

Closed dorothy-zbornak closed 3 years ago

dorothy-zbornak commented 3 years ago

Description

In the EP consumer we were setting minBuyAmount = quote.worstCaseQuoteInfo.makerAssetAmount, which would allow for very high slippage because the quote simulator (who populates this value) finds the actual worst case, irregardless of slippage limits.

:heavy_check_mark: SWRV/WETH pairs that slip >1% now revert as incomplete fills in simbot.

Testing instructions

Types of changes

Checklist:

coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 78.711% when pulling c782d9d41ff2839e2c929459be90d3549b9c1de8 on fix/asset-swapper/respect-max-slippage-in-ep-consumer into 6f78832a13ecb4a23abf4eaf62b60f01cfce1970 on fix/balancer-sampling.