Skip to content

Conversation

@jackburrus
Copy link
Contributor

@jackburrus jackburrus commented Oct 11, 2024

This PR updates the design of the remove LP form.

Screen.Recording.2024-10-11.at.12.15.44.PM.mov

@changeset-bot
Copy link

changeset-bot bot commented Oct 11, 2024

⚠️ No Changeset found

Latest commit: 1cf45e1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Oct 11, 2024

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

Name Status Preview Comments Updated (UTC)
hyperdrive-mainnet-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2024 7:40pm
hyperdrive-sepolia-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2024 7:40pm
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
hyperdrive-js ⬜️ Ignored (Inspect) Visit Preview Oct 11, 2024 7:40pm
hyperdrive-mainnet-production ⬜️ Ignored (Inspect) Visit Preview Oct 11, 2024 7:40pm
hyperdrive-sepolia-production ⬜️ Ignored (Inspect) Visit Preview Oct 11, 2024 7:40pm
testnet-v1 ⬜️ Ignored (Inspect) Oct 11, 2024 7:40pm
testnet-v1.0.6 ⬜️ Ignored (Inspect) Visit Preview Oct 11, 2024 7:40pm
trading-competition ⬜️ Ignored (Inspect) Visit Preview Oct 11, 2024 7:40pm

? (() => {
// Calculate the ratio of remaining shares to the total supply
const ratio = calculateRatio({
a: lpShares - (lpSharesIn || 0n) - (withdrawalShares || 0n), // Remaining LP Shares in pool after removing input value lpShares and withdrawalShares received
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quick question: If a user has withdrawalShares, does that count as a part of the pool percentage? I'm including those in the ratio calculation here because i'm assuming they are removed from the pool along with the LP shares and treated differently.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, your assumption is correct 👍

They are accounted for separately and don't contribute to the total pools liquidity.

<label className="items-end text-neutral-content">
{bottomRightStatistic ? bottomRightStatistic : null}
</label>
<div className="flex w-full items-baseline justify-end text-sm">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was bugging me:
Before items-baseline
Screenshot 2024-10-11 at 12 20 15 PM
After items-baseline:
Screenshot 2024-10-11 at 12 20 04 PM

decimals: hyperdrive.decimals,
});

const baseTokenDepositEnabled =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was unused

? (() => {
// Calculate the ratio of remaining shares to the total supply
const ratio = calculateRatio({
a: lpShares - (lpSharesIn || 0n) - (withdrawalShares || 0n), // Remaining LP Shares in pool after removing input value lpShares and withdrawalShares received
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, your assumption is correct 👍

They are accounted for separately and don't contribute to the total pools liquidity.

Comment on lines 249 to 255
<div className="flex flex-col text-xs text-neutral-content">
{`Withdrawable: ${formatBalance({
balance: lpShares,
decimals: baseToken.decimals,
places: baseToken.places,
})}`}
</div>
Copy link
Member

Choose a reason for hiding this comment

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

nits:

  • unnecessary class names
  • <div> is kinda like a catch all for block elements and <span> for inline. Even though we mostly use CSS to override these display properties, I still like using the tag that best fits the intention, i.e., the one I would use if writing HTML without CSS. Especially ✨semantic elements✨ when it makes sense.
Suggested change
<div className="flex flex-col text-xs text-neutral-content">
{`Withdrawable: ${formatBalance({
balance: lpShares,
decimals: baseToken.decimals,
places: baseToken.places,
})}`}
</div>
<span className="text-xs text-neutral-content">
{`Withdrawable: ${formatBalance({
balance: lpShares,
decimals: baseToken.decimals,
places: baseToken.places,
})}`}
</span>

Copy link
Contributor Author

@jackburrus jackburrus Oct 11, 2024

Choose a reason for hiding this comment

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

Agreed, I try to use the approriate tag when needed. However, I've been reaching for divs so as to not cause any dom nesting issues in any of our components in the case I pass a <p><div>Text</div></p>. It should be fine here though.

Comment on lines 273 to 278
? fixed(actualValueOut, hyperdrive.decimals).toString()
: "0"
}
maxValue={
actualValueOut
? formatUnits(actualValueOut, hyperdrive.decimals)
Copy link
Member

Choose a reason for hiding this comment

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

nit: 2 ways to do the same thing: formatUnits and fixed + toString. I recommend choosing 1. I'm indifferent to which.

@jackburrus jackburrus merged commit 94d2205 into main Oct 11, 2024
6 checks passed
@jackburrus jackburrus deleted the update-remove-lp-form branch October 11, 2024 19:44
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.

3 participants