Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Safe Mode #160

Closed
wants to merge 8 commits into from
Closed

Safe Mode #160

wants to merge 8 commits into from

Conversation

hensha256
Copy link
Collaborator

@hensha256 hensha256 commented Jan 29, 2024

No description provided.

@hensha256 hensha256 changed the title Wrap all ETH Safe Mode Feb 6, 2024
@ewilz
Copy link
Member

ewilz commented Feb 7, 2024

change feels hefty, the odds of losing an ERC20 are so slim. The most minimally invasive change to the sdk IMO is to add a bool parameter to SwapRouterConfig called safetyMode and add a sweepETH command at the end before encoding the "plan". Basically a 2 line change.

If we must be this thorough this looks fiiiiiine i guess 😏 but wouldnt want the sdk to get too out of hand with trying to every last unlikely case.

@@ -53,6 +68,11 @@ export class UniswapTrade implements Command {
encode(planner: RoutePlanner, _config: TradeConfig): void {
let payerIsUser = true

let safetyMode = this.options.safetyMode ?? SafetyModes.Normal
let inputETHSweep = safetyMode == SafetyModes.InputOutputSweeps || safetyMode == SafetyModes.AllSweeps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we rename to shouldSweepETH and shouldSweepIntermediateTokens for readability, know it's a bool flag

@ewilz
Copy link
Member

ewilz commented Feb 7, 2024

per slack convo: could we enforce a certain slippage instead of sweeping erc20 tokens on intermediate swaps?? if so, the changes could possibly go in swapRouter.ts??

Copy link
Member

@ewilz ewilz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slippage in lieau of sweeping interediate?? arguably safer bc we could get back some random ERC20, but still have bad slippage on the trade.......right?

@hensha256 hensha256 closed this Feb 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants