Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

feat(PoolPage): When set input value, calculate the other input value. Validate if pool ratio is right #185

Merged
merged 5 commits into from
May 21, 2022

Conversation

LuizAsFight
Copy link
Contributor

@LuizAsFight LuizAsFight commented May 21, 2022

  • When set one token value, calculate the other one according to reserve ratio we have
  • Validate add_liquidity ratio is right

Closes #179
Closes #148

@vercel
Copy link

vercel bot commented May 21, 2022

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

Name Status Preview Updated
swayswap ✅ Ready (Inspect) Visit Preview May 21, 2022 at 2:35AM (UTC)

@LuizAsFight LuizAsFight self-assigned this May 21, 2022
@LuizAsFight LuizAsFight added the enhancement New feature or request label May 21, 2022
@@ -11,9 +11,10 @@ export const TOKEN_ID = import.meta.env.VITE_TOKEN_ID!;
export const DECIMAL_UNITS = 3;
export const FAUCET_AMOUNT = parseUnits('0.5', DECIMAL_UNITS).toBigInt();
export const MINT_AMOUNT = parseUnits('2000', DECIMAL_UNITS).toBigInt();
export const ONE_ASSET = parseUnits('1', DECIMAL_UNITS).toBigInt();
export const ONE_ASSET_UNIT = parseUnits('1', DECIMAL_UNITS).toBigInt();
Copy link
Member

Choose a reason for hiding this comment

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

This is not one unit, is ONE asset, a unit is a 1 one asset is 1000

packages/app/src/lib/asset.ts Show resolved Hide resolved
if (!fromAmount) {
throw new Error('"fromAmount" is required');
if (!fromInput.amount) {
errors.push(`Inform ${coinFrom.name} amount`);
Copy link
Member

Choose a reason for hiding this comment

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

Enter ${x} amount

@LuizAsFight
Copy link
Contributor Author

@luizstacio I changed both to zero again to make function accept any values (undefined / null / zero)... add validation to make sure it's not NaN of Infinity

@LuizAsFight LuizAsFight merged commit 13b1d37 into master May 21, 2022
@LuizAsFight LuizAsFight deleted the lf-148/validate-pool-and-calculate-input branch May 21, 2022 02:38
pedronauck added a commit that referenced this pull request May 23, 2022
…-select

* 'master' of github.com:FuelLabs/swayswap:
  ci: add action for validate pull request (#178)
  feat: add user guided states on swap (#188)
  docs: add links for live previews (#183)
  feat(PoolPage): improve button feedback. reload/clear after create liquidity (#187)
  feat(PoolPage): When set input value, calculate the other input value. Validate if pool ratio is right (#185)
  feat: Save state of pool page (#164)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto calculate inputs on add liquidity Validate pool creation values
2 participants