Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add liquidity unbalanced permit2 #1117

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

Conversation

agualis
Copy link
Contributor

@agualis agualis commented Sep 23, 2024

Adds v3 permit2 flow only for unbalanced add handler.
Contains many TODOs but let's merge it before moving to the monorepo.
Note: It only works pointing to test api in .env.local as sepolia v3 pools are not yet in production api

permit2Adds.mp4

@agualis agualis self-assigned this Sep 23, 2024
Copy link

vercel bot commented Sep 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frontend-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2024 3:15pm
test-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2024 3:15pm

@@ -106,4 +134,22 @@ export class UnbalancedAddLiquidityHandler implements AddLiquidityHandler {
kind: AddLiquidityKind.Unbalanced,
}
}

public constructBaseBuildCallInput({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will probably try to extract this method to be shared by all the handlers but for now I will keep it here until I implement the rest of the v3 handlers

slippage: Slippage.fromPercentage(`${Number(slippagePercent)}`),
wethIsEth: this.helpers.includesNativeAsset(sdkQueryOutput.amountsIn),
}
// baseBuildCallParams.amountsIn = baseBuildCallParams.amountsIn.filter(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will delete this later. It is a reminder to try something...

})
console.log('Call data built:', response)
if (permit2) console.log('permit2 for call data:', permit2)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can leave this comment in production for debugging purposes or we can remove it if we see that permit2 is not problematic.

Copy link
Contributor Author

@agualis agualis Oct 4, 2024

Choose a reason for hiding this comment

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

Should we rename this file/class to UnbalancedAddLiquidityV2.handler.ts to make it more explicit? Note that it also used for V1 CowAMM pools to that would not be precise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unbalanced v3 Adds/Permit2 support
2 participants