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 single pool handler #94

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

feat: add single pool handler #94

wants to merge 7 commits into from

Conversation

agualis
Copy link
Collaborator

@agualis agualis commented Oct 22, 2024

Adds pool swap handler and extracts an new abstract class to share common logic.

TODO: Pool swaps in nested pools do not work cause underneath pool tokens are not valid in the swap route.

Copy link

vercel bot commented Oct 22, 2024

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

Name Status Preview Comments Updated (UTC)
mono-beets-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 4:29pm
mono-frontend-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 4:29pm
mono-test-v3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 22, 2024 4:29pm

[swapState.tokenIn.address, swapState.tokenOut.address, swapState.selectedChain]
)
const handler = useMemo(() => {
if (isPoolSwap) resetSwapAmounts()
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be here. The useMemo is about setting the swap handler and shouldn't contain other logic. If this side-effect is needed I guess it will have to go in a useEffect.

Copy link
Contributor

Choose a reason for hiding this comment

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

Although, why is it needed only in the case of it being a pool swap?

/**
* PRIVATE METHODS
*/
protected async runSimulation({
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there not a pattern for this where you don't have to rename the function to something different? Can you not call super() or something within the simulate function of the child classes to call the simulate function in the abstract class?

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.

Pool page swap UI
2 participants