GoodDollar / GoodProtocolUI

UI for the GoodProtocol smart contracts
https://good-swap.vercel.app
GNU General Public License v3.0
7 stars 12 forks source link

Re-enable Swap functionality on GoodDapp #537

Closed decentralauren closed 2 months ago

decentralauren commented 4 months ago

Business Description

The Swap feature allows any wallet holder to swap GoodDollar to/from other currencies across listed networks. We would like to reinstate the Swap functionality on GoodDapp.

Detailed Description of Functionality

  1. If the user is connected to Celo, the Uniswap widget should appear
  2. If the user is connected to Fuse, the Voltage widget should appear
  3. If the user is connected to Ethereum, text should display that:
    • links to information about liquidity (including how to provide liquidity) and
    • has text (links?) that prompt the user to switch their network to Fuse or Celo

Page Description - Celo/Fuse: Please be patient, loading information in the Swap widget may take some time. Thanks for waiting!

Page Description - Ethereum: GoodDapp currently does not support Swap on Ethereum.

Please switch your network to Fuse or Celo to Swap. [text should be a hyperlink that launches the network picker]

Click here to learn more about GoodDollar liquidity, including how to provide liquidity [https://docs.gooddollar.org/liquidity]

FAQ Content

Where is the GoodDapp widget pulling the liquidity from?

The GoodDapp Swap widget seamlessly integrates with Fuse's Voltage Finance DEX and Celo's Uniswap DEX, allowing you to swap your assets.

What are the fees for swapping? The fee structure is based on factors such as transaction volume and network fees. You can view the applicable fees before confirming you transactions.

GoodDapp does not charge extra fees.

Which networks can I swap my G$ on? You can currently swap your G$ on Fuse and Celo

Can I track the status of my swap? You can track the status of your swap transaction with your transaction hash and through the blockchain explorer.

To check transactions on Celo, check the [Celo Blockchain explorer](https://explorer.celo.org/mainnet/).

To check transaction on Fuse, check the [Fuse Blockchain explorer](https://explorer.fuse.io/).

How can I bridge my G$ from one network to another?

To bridge is the action of transferring your assets from one network to another. To bridge your G$ between Celo and Fuse, you can use the microbridge in the GoodWallet.[https://wallet.gooddollar.org/]

How can I buy G$? You can purchase G$ on Celo from any network and supported token via [Squid](https://app.squidrouter.com/).

How can I provide G$ liquidity?

If you are interested in learning more about GoodDollar liquidity, including how to provide liquidity, please click here [https://docs.gooddollar.org/liquidity]

Technical Implementation

Outline the technical approach for building the feature. This section is typically filled out by the development team or can contain suggestions. (dev team: @johnsmith-gooddollar @sirpy @L03TJ3)

Acceptance Criteria

Specify criteria that will be used to determine if the feature meets the requirements and functions correctly.

decentralauren commented 4 months ago

Open Questions

Can we have a link that prompts a network switch (E.g. if the user is on Ethereum, a link that launches the network picker) Yes Do we currently have any custom error handling for liquidity issues or is that all managed in the respective widget? Managed via widget

decentralauren commented 3 months ago

@L03TJ3 what were the defaults before we shut it off?

Based on recent discussions and per the ticket, the default on the Swap function for Celo should be:

And same for Fuse per above in the requirement (we should assume people are swapping INTO G$ :) It seems to default now to what the user has in their wallet, which is also fine if easier.

Also you can disable the banner i

Screenshot 2024-03-18 at 12 24 25 PM

n dev!

decentralauren commented 3 months ago

@L03TJ3 At confirmation, Says "view on etherscan" for celo swap - perhaps we just change to "View on Explorer" to work across all.

Screenshot 2024-03-18 at 12 32 08 PM
decentralauren commented 3 months ago

@L03TJ3 added all page description & FAQ content in the initial ticket content. The page title should be "Swap" across all networks :)

decentralauren commented 3 months ago

@L03TJ3 Testing swap and a cray cray custom spending cap is prepopulated - is this bc of dev environemnt? Can we control this?

Screenshot 2024-03-18 at 12 34 44 PM
L03TJ3 commented 3 months ago

@decentralauren everything is exactly as it was before we disabled the widget(s) The 'view on etherscan'. we don't control this area.

L03TJ3 commented 3 months ago

@decentralauren again, something we don't control and is hardcoded by uniswap, not based on anything related to what coin is used. but also good to point out there are multiple stages here -->

  1. First you give permission to a contract called Permit2 where you set your token-allowance (manages token-approvals for uniswap). <--- This cost gas

  2. Following is a approve spending (I think you give permission to the uniswap contract handling the actual swap) if you had set any token-allowance during a previous swap this will become step 1. <-- this is a sign transaction, does not cost any gas fee. Is also time-based and has an expiration time of a month.

  3. the actual swap transaction <-- cost gas

Summary of this is: When you give only the amount you currently swap on step 1, means that every following swap you have a step where you pay an additional gas-fee because you need to set your token-allowance again. It would not hurt to just take the max-amount of your balance here (if you care for saving some gas-fees).

Why they use a hardcoded max integer value I don't know. If this is an issue that is bothersome, that should be raised on their own repository: https://github.com/Uniswap/widgets

Sidenote: this is all based on purely celo. For fuse we might be able set this cap amount, though we use some older sdk-s and will require some dev work. Could also be handled by linking through FAQ to relevant articles/guides on how/why this works like it does

L03TJ3 commented 3 months ago

@decentralauren updated the input/output tokens.

L03TJ3 commented 3 months ago

@decentralauren the banner will be removed once we have released to production?

decentralauren commented 3 months ago

@L03TJ3 you're awesome. Thanks for all of this explanation and for fixing the tokens!

Let me know once the title and FAQs are implemented and I'll test it out again.

On the banner - yes we can wait until we release to production to remove.

decentralauren commented 3 months ago

@L03TJ3 there was some very weird copy / paste issue resulting in the liquidiy and squidrouter URLs getting mixed up. It is fixed now - sorry for the brain pretzel!

L03TJ3 commented 3 months ago

Copy updated, moving this back to QA

decentralauren commented 3 months ago

@vldkhh FYI :)

vldkhh commented 3 months ago

@L03TJ3 @decentralauren found a couple of issues: FAQs: 1) should include this information - "The fee structure is based on factors such as transaction volume and network fees. You can view the applicable fees before confirming you transactions.

GoodDapp does not charge extra fees."

Snag_16522b54.png

2) the link to docs should be added here - "If you are interested in learning more about GoodDollar liquidity, including how to provide liquidity, please click here [https://docs.gooddollar.org/liquidity]"

Snag_165317e7.png
decentralauren commented 3 months ago

@L03TJ3 a few other copy updates requested from Meri:

What is a Swap?

A swap is when you convert one digital asset for another, allowing people to diversify their cryptocurrency holdings.

The swap on this page happens through decentralized exchanges (DEXs). When you swap, your funds are sent directly to the DEX service (Voltage on Fuse Network or Uniswap on Celo Network).

vldkhh commented 3 months ago

verified FAQ on QA

vldkhh commented 2 months ago

verified on prod