monorepo icon indicating copy to clipboard operation
monorepo copied to clipboard

As a user I should be able to specify slippage boundaries in a UI so I don't unexpectedly take massive slippage (SDK)

Open alexwhte opened this issue 3 years ago • 3 comments

Background

UI AND SDK SIDE OF https://github.com/connext/nxtp/issues/1227 and https://github.com/connext/nxtp/issues/1321 Important to have a way for users to specify slippage boundaries so they don't unexpectedly take massive slippage. Doing this in xcall is straightforward, but doing so on execute necessarily involves creating a way for the users funds to escape without hitting the AMM (i.e. withdrawing local asset)

Linked Issues & Documentation

See comments in https://github.com/connext/nxtp/issues/1080 Another consideration point -- how should the force execute work into the execute flow with the routers and sequencers? Ideally, user should be able to submit a overriding forceLocal flag, which emits an event, which routers can track in their bids

Definition Of Done

  • SDK overrides added for slippage
  • User should be able to specify slippage boundaries through Bridge UI which correctly execute through SDK+Contracts
  • User can specify slippage %
  • If slippage fails then ForceReceive local asset

Out of scope

We will consider adding these alternatives if slippage limits are hit:

  1. User re-executes
  2. Return to sender option

Other

alexwhte avatar Jun 04 '22 18:06 alexwhte

UI is ready for this. I think we just need the below

  • Test pool funded
  • SDK overrides are added for slippage
  • If slippage fails, confirm default handling (do we auto receive local assets on destination?) --> Please consider advanced handling out of scope
  • Fully tested in UI

image

alexwhte avatar Jul 12 '22 13:07 alexwhte

We think it will keep retrying execute until this succeeds

alexwhte avatar Jul 14 '22 15:07 alexwhte

Please note for this issue that we've just changed from using a percentage slippage tolerance to using the actual amount.

xcall now has an argument, originMinOut, which indicates the minimum amount out from the stableswap on the origin side.

CallParams now includes a param destinationMinOut which indicates the minimum amount out from the stableswap on the destination side.

This utility will need to take the user-defined percentage and convert that to the min amount received for both swaps.

jakekidd avatar Jul 27 '22 23:07 jakekidd

@just-a-node as owner to take this on Consider setting a default level for slippage or allowing auto slippage Blocked by having stableswap setup

alexwhte avatar Aug 16 '22 15:08 alexwhte

Default slippage on UI is 3%, can be overridden on sdk call. Currently, UI offers 1%, 2%, and 3% as well as custom input.

WETH pool exists and there is liquidity in it. In order to test this at the moment, we need a router with supported liquidity in madWETH.

just-a-node avatar Aug 16 '22 23:08 just-a-node

Blocked by testnet and WETH liquidty (Test)

alexwhte avatar Aug 23 '22 15:08 alexwhte

covered in other issues

alexwhte avatar Sep 29 '22 15:09 alexwhte