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

Reduce number of times we compute price from ticks in AddLiquidityActionCard #140

Open
haydenshively opened this issue Oct 26, 2022 · 0 comments

Comments

@haydenshively
Copy link
Member

I see your reasoning, but what if we did the following:

define the following above the input:

const lowerStepperInputValue = isToken0Selected ? prices?.[0] : prices?.[1];
const upperStepperInputValue = isToken0Selected ? prices?.[1] : prices?.[0];

this gives us either null if the prices are not defined, or the corresponding price for each input if the prices are defined.

Then, we switch the ternary operator to use lowerStepperInputValue == null and upperStepperInputValue == null respectively and make the else case equal to lowerStepperInputValue.toString(10) and upperStepperInputValue.toString(10) respectively.

While this may look like more code, it requires fewer calculations and thus I feel is better and more performant.

Originally posted by @IanWoodard in #134 (comment)

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

No branches or pull requests

1 participant