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

Add ERC-20 Support #69

Open
TravisWyche opened this issue Apr 23, 2024 · 7 comments
Open

Add ERC-20 Support #69

TravisWyche opened this issue Apr 23, 2024 · 7 comments
Assignees
Labels
Design: UI enhancement New feature or request

Comments

@TravisWyche
Copy link

TravisWyche commented Apr 23, 2024

  • Add option to allow for tokens other than native token
  • Most obvious is stablecoins

"bigger because a new contract plus it touches everything in the app"

Requires a token approval before yeeting.

  • new shaman contract development and template deployment
  • integrate with current factory (i don't think we need a new one but will need to look more)
  • subgraph development to ingest new shaman info and index setup data + new yeet data
  • daap development to handle new subgraph indexing/entities/data/fields
  • update the summon form design/code and transaction
  • update the yeet ui design and code to pull data about erc20 and display relevant info
  • update the yeet form to require token approval and new tx for the send function (2 new txs)

we are working with un-audited contracts - and this adds another. we might need to note that in the UI/faq/docs or something

DESIGN UPDATES

Launch form

  • select yeet with eth or token (would be easiest for dev if this was actually 2 forms, so maybe like a wizard with 1st step asking if they want to use eth or a token?)
  • token yeet form
    • same fields we have now
    • new field for the token (probably need to paste in the address - might need some validation that it's a legit token)
    • If choose ETH, stay in normal launch form. If choose another token, redirect to a new form with a new field for choose the specific ERC20 token.

Yeet details

  • display the accepted token somewhere

Yeet form

  • adjust the yeet input field so that it checks the user approval and shows an 'approve' button for an initial approval tx
  • once the approval is in place the user can submit the yeet
  • the field will be different: user will put in the amount, approval/allowance txn pop up to spend the ERC20.
  • Can be inline in the form.
@TravisWyche
Copy link
Author

TravisWyche commented Apr 24, 2024

Here's my first pass.

Launch Form

  • Instead of adding a form field for the user to paste the token address (feels like that would proliferate gross user error and vulnerabilities), I opted to add token icons. I figure we can ensure the proper token address in the link, and also clearly present the current selection. As we scale, perhaps this should become a drop down list with icon + token name, but in these early days I prefer these fewer clicks and onscreen info. Thots?

Image

Yeet Details

  • I simply changed the ETH text to another example token. Not sure if I'm missing something here regarding the need to display the token in other ways. If so, please add notes.

Image

Yeet Form

  • Changed the copy to read Yeet Amount to be more token agnostic.
  • Added a default message to approve the token. So this will serve as the second/alt screen for any token that's not ETH (or is it network token?). The message is stylized with drop shadow for emphasis... hope that doesn't cause front end dev annoyance.
  • Again, please add a note if I'm missing something here.

Image

@earth2travis
Copy link
Contributor

Instead of adding a form field for the user to paste the token address (feels like that would proliferate gross user error and vulnerabilities), I opted to add token icons. I figure we can ensure the proper token address in the link, and also clearly present the current selection. As we scale, perhaps this should become a drop down list with icon + token name, but in these early days I prefer these fewer clicks and onscreen info. Thots?

Having us provide the token address is complicated and kinda makes us the gatekeepers of what tokens can be used.

If it is easier for this version I understand but it is not ideal. We will have to manage different token addresses on different networks. And then we will be responsible for making updates to the code when support for new tokens is added.

It would be better to inform the user what they are signing up for. And then verify the address they added is the token they expected.

Changed the copy to read Yeet Amount to be more token agnostic.

There is nothing in this view informing the user what they are spending. It was on the previous view but would be a good idea to have it here so they know the type of tokens they are contributing/approving.

@TravisWyche
Copy link
Author

  • The user can paste in any token address without limitation? We are deploying contracts and are otherwise prepared to allow for this UX? It was my understanding that we would be prepared for DAI and RAID but not others.
  • Is there any need to account for different UX/UI for different chains?

@skuhlmann
Copy link
Contributor

skuhlmann commented Apr 24, 2024

@TravisWyche We are prepared for any valid ERC20.

And it should be the same on all chains.

@TravisWyche
Copy link
Author

Second pass:

Launch Form

  • Reverted to a field for user to paste token address with a verification/failure message underneath.
  • Added dynamic token name to Fundraising Goal and Minimum Yeet titles.

ERC20 Enhancement_ Launch Yeeter - Second Pass

Yeet Form

  • Added back the token>loot message (in the app but missing from designs).
  • Added dynamic token name to the Yeet Token title.
  • Added pink highlights to dynamic content. This can be optional if it causes friction.

ERC20 Enhancement_ Yeet Form - Second Pass

@skuhlmann
Copy link
Contributor

@TravisWyche this works for me! Thanks.,

@skuhlmann
Copy link
Contributor

spec notes

Contracts

Implement ERC20 Yeeter contract

  • Draft contract
  • Finalize and deploy the template to Sepolia, Gnosis, Base, Optimisim, Arbitrum

Subgraph

Update for ERC20 Shaman

  • Add fields to yeeter entity
    • YeeterType string (eth, erc20)
    • Token address
  • Update baal-mapping to index shaman with new name ("ERC20Yeeter:0.0.1") and add yeetertype
  • Add mapping for OnReceivedERC20 event
    • Create erc20 yeet
  • Deploy to all networks

Dapp

General

  • Change how we find the shaman address for a DAO
    • Currently just selecting the 1st shaman, need to checktype and is has permissions

Hooks

  • Add data in UseYeeter/UseYeeters/UseYeets for token + type

Utils

  • New summonTx functions and form/field/tx legos to enable erc20 summon
    • new assembleShamanParams with proper shaman template + token params
            address payable _token,
            uint256 _startTime,
            uint256 _endTime,
            bool _isShares,
            uint256 _minTribute,
            uint256 _multiplier,
            uint256 _goal,
            address[] memory _feeRecipients,
            uint256[] memory _feeAmounts

UI

  • Designs in this issue
  • Add token/eth into hub card
  • Update launch form
    • 1st step to choose eth or erc20
    • new erc20 summon form
    • new token field
      • takes token address, validates valid erc20
    • new field/form/tx lego
  • Update yeet detail page
    • Show yeet token
  • New yeet form
    • amount field needs to check token allowance, enforce allowance tx before yeeting tx
      • see tribute field in SDK
    • new field/form/tx legos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design: UI enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants