monorepo
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)
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:
- User re-executes
- Return to sender option
Other
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

We think it will keep retrying execute until this succeeds
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.
@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
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.
Blocked by testnet and WETH liquidty (Test)
covered in other issues