-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add option to stop and remove all liquidity in one tx and improve withdraw UX #704
Merged
yvesfracari
merged 5 commits into
cowamm-next
from
pedro/cow-276-add-option-to-stop-and-remove-all-liquidity-in-one-tx
Jun 13, 2024
Merged
Add option to stop and remove all liquidity in one tx and improve withdraw UX #704
yvesfracari
merged 5 commits into
cowamm-next
from
pedro/cow-276-add-option-to-stop-and-remove-all-liquidity-in-one-tx
Jun 13, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ribeirojose
reviewed
Jun 12, 2024
apps/cow-amm-deployer/src/app/[userId]/amms/[id]/(components)/DisableAmmButton.tsx
Show resolved
Hide resolved
ribeirojose
reviewed
Jun 12, 2024
Comment on lines
43
to
58
let amount0 = BigInt(0); | ||
let amount1 = BigInt(0); | ||
if (data.withdrawPct === 100) { | ||
// avoid floating point arithmetic | ||
amount0 = parseUnits(cowAmm.token0.balance, cowAmm.token0.decimals); | ||
amount1 = parseUnits(cowAmm.token1.balance, cowAmm.token1.decimals); | ||
} else { | ||
amount0 = parseUnits( | ||
String((Number(cowAmm.token0.balance) * data.withdrawPct) / 100), | ||
cowAmm.token0.decimals | ||
); | ||
amount1 = parseUnits( | ||
String((Number(cowAmm.token1.balance) * data.withdrawPct) / 100), | ||
cowAmm.token1.decimals | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we do something like this?
const withdrawPct = BigInt(data.withdrawPct);
const hundred = BigInt(100);
// Parse the balances as BigNumber and then calculate the amounts
const balance0 = parseUnits(cowAmm.token0.balance, cowAmm.token0.decimals);
const balance1 = parseUnits(cowAmm.token1.balance, cowAmm.token1.decimals);
const amount0 = (balance0 * withdrawPct) / hundred;
const amount1 = (balance1 * withdrawPct) / hundred;
ribeirojose
approved these changes
Jun 12, 2024
yvesfracari
force-pushed
the
pedro/cow-276-add-option-to-stop-and-remove-all-liquidity-in-one-tx
branch
from
June 13, 2024 13:52
7198262
to
f2ea092
Compare
yvesfracari
deleted the
pedro/cow-276-add-option-to-stop-and-remove-all-liquidity-in-one-tx
branch
June 13, 2024 14:05
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR: