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

Added uniswap trade widget #10148

Merged
merged 13 commits into from
Dec 12, 2024
Merged

Conversation

mzparacha
Copy link
Contributor

@mzparacha mzparacha commented Dec 5, 2024

Link to Issue

Closes: #9887

Description of Changes

Added uniswap trade widget to trade tokens post launchpad phase. Trading will not work on tokens launched via common as they are launched on base sepolia, while the modal will use base network, it will only work for the tokens that are already on base. In our implementation, we added USDT, USDC, WETH as token swap options.

"How We Fixed It"

N/A

Test Plan

Note: Custom tokens launched via common will not be tradeable via the uniswap modal.

Pre-req

  1. Apply this change to enforce uniswap widget modal for every token trade (this is only for testing, and this will automatically be set when token reaches market-cap goal/post-launchpad-phase on common) - this basically tells the modal to show swap mode instead of buy/sell via common.
diff --git a/packages/commonwealth/client/scripts/helpers/launchpad.ts b/packages/commonwealth/client/scripts/helpers/launchpad.ts
index 7868642563..5366153b40 100644
--- a/packages/commonwealth/client/scripts/helpers/launchpad.ts
+++ b/packages/commonwealth/client/scripts/helpers/launchpad.ts
@@ -18,7 +18,7 @@ export const calculateTokenPricing = (
   );
   const marketCapCurrent = currentPrice * token.initial_supply;
   const marketCapGoal = token.eth_market_cap_target * ethToUsdRate;
-  const isMarketCapGoalReached = marketCapCurrent >= marketCapGoal;
+  const isMarketCapGoalReached = marketCapCurrent >= marketCapGoal || true;
 
   return {
     currentPrice: parseFloat(`${currentPrice.toFixed(8)}`),

Steps

  1. Create a token community.
  2. Click on the swap button for that token (this "Swap" button will be displayed inside community and on the communities explore page for that token, test both of these flows)
  3. Verify you see the chain switch modal in your wallet (if your wallet is not on base network)
  4. Verify you are able to see the available base eth amount in your active address, in the modal.
  5. Verify you are able to switch tokens. (Plz don't select the community token, as it won't be testable, see above for more info)
  6. Verify you are able to complete a trade successfully. IMPORTANT: the test is on base mainnet, so it will require real tokens.
  7. Verify the modal remains open after the trade (to show basescan link and other transaction details). The whole flow should look like this
Screen.Recording.2024-12-10.at.6.17.38.PM.mov

Deployment Plan

N/A

Other Considerations

N/A

@github-actions github-actions bot marked this pull request as draft December 5, 2024 19:42
@mzparacha mzparacha self-assigned this Dec 10, 2024
@mzparacha mzparacha marked this pull request as ready for review December 10, 2024 13:20
Copy link
Contributor

@masvelio masvelio left a comment

Choose a reason for hiding this comment

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

code lgtm, tested and works according to the test plan

packages/commonwealth/client/vite.config.ts Show resolved Hide resolved
@mzparacha mzparacha merged commit 807071c into master Dec 12, 2024
10 checks passed
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.

Use Uniswap trade widget for post-launchpad phase
3 participants