web icon indicating copy to clipboard operation
web copied to clipboard

Import tokens to trade via contract address

Open willyogo opened this issue 4 years ago • 8 comments

Currently users can only trade assets that are in the app's asset list. As a user, I want to be able to trade any asset by pasting in the contract address. 0x's API supports this by passing through the token's contract address (see matcha.xyz example with 0x900dB999074d9277c5DA2A43F252D74366230DA0).

  1. "Search" copy in the field in the trade modal is updated to "Search by name or contract address" image
  2. When a user pastes a contract address in the search field, they can see the corresponding asset's Symbol, Name, auto-generated icon, and their current balance populated image*

*use existing styles so this matches current UI in trade modal

  1. If a user clicks the imported asset, they see the Imported Token Alert

Copy: "⚠️ Unknown Token Alert

⚠️ Unknown Token Alert

This token was detected in your wallet, but is not on the CoinGecko list. Therefore, we cannot verify its legitimacy.

Anyone can create a token and transfer it to your wallet. Before interacting with any token you are not expecting, be sure to research it. ShapeShift makes no representation about the quality, nature, or legal categorization of any tokens. By importing this token, you are doing so at your own risk.

BTN: (IMPORT TOKEN)

Text link: Read our terms of service

image

  1. If a user clicks 'I Understand,' the asset is selected and the user can proceed with trading the asset; they can see the asset's name, symbol, and auto-generated icon displayed throughout the trade flow as if it was an asset in the app's token list

  2. Users can click a back arrow to cancel the token import

willyogo avatar Feb 07 '22 17:02 willyogo

I can take this up after #959 as I have a feeling people might import tokens that are not very popular and don't have icons

amitojsingh366 avatar Feb 07 '22 19:02 amitojsingh366

@willyogo do you know where we can source this missing asset data that isn't coingecko, coincap, or yearn?

0xdef1cafe avatar Feb 09 '22 23:02 0xdef1cafe

@0xdef1cafe now that the app will be able to gracefully handle assets with no pricing data, I believe all of the data we must have (token symbol, name, # of decimal) can be sourced from the contract. The icon will be auto-generated using the token symbol. Is there any data you think we must have?

willyogo avatar Feb 10 '22 17:02 willyogo

ah i see, if it's this rudimentary, just symbol/name/decimals, according to @theoboldfrazier we can get this via web3 utils

engineering note - we need to refetch the portfolio after importing a custom asset to pick up balances etc

@DiggyDiggy2 @reallybeard @SS-FOX-McCloud - @mrnerdhair has some valid points that we should provide some sort of indication

  • when importing custom tokens, and
  • in a few places in the UI, to denote that a user is dealing with a custom token

0xdef1cafe avatar Feb 11 '22 22:02 0xdef1cafe

ah i see, if it's this rudimentary, just symbol/name/decimals, according to @theoboldfrazier we can get this via web3 utils

engineering note - we need to refetch the portfolio after importing a custom asset to pick up balances etc

@DiggyDiggy2 @reallybeard @SS-FOX-McCloud - @mrnerdhair has some valid points that we should provide some sort of indication

  • when importing custom tokens, and
  • in a few places in the UI, to denote that a user is dealing with a custom token

sweet! re: providing indications,

  • we've got this mockup for warning a user in the trade modal when they import a token image
  • we could consider adding an info/warning icon to any token's icon throughout the UI if a token is not on the CoinGecko list (ideally with a tooltip on hover with the same copy displayed when importing a token, but instead of "trade" we should say "interact with"), but I think that is a separate issue. metamask and other wallets don't show any kind of warning after a token has been imported, but as we move to automatically displaying all tokens in a users' wallet, I do like the idea of showing a non-invasive warning for tokens outside of the "approved" asset list.

willyogo avatar Feb 23 '22 17:02 willyogo

ah i see, if it's this rudimentary, just symbol/name/decimals, according to @theoboldfrazier we can get this via web3 utils engineering note - we need to refetch the portfolio after importing a custom asset to pick up balances etc @DiggyDiggy2 @reallybeard @SS-FOX-McCloud - @mrnerdhair has some valid points that we should provide some sort of indication

  • when importing custom tokens, and
  • in a few places in the UI, to denote that a user is dealing with a custom token

sweet! re: providing indications,

  • we've got this mockup for warning a user in the trade modal when they import a token image
  • we could consider adding an info/warning icon to any token's icon throughout the UI if a token is not on the CoinGecko list (ideally with a tooltip on hover with the same copy displayed when importing a token, but instead of "trade" we should say "interact with"), but I think that is a separate issue. metamask and other wallets don't show any kind of warning after a token has been imported, but as we move to automatically displaying all tokens in a users' wallet, I do like the idea of showing a non-invasive warning for tokens outside of the "approved" asset list.

i like this justification and you're right, they only warn on import, we're super clear on import here in the mocks, and it's up to them after that. will remove needs product and we can architect this and get it going on engineerings side.

0xdef1cafe avatar Feb 24 '22 00:02 0xdef1cafe

new AC alert:

  1. add a back button so users can cancel

Updated copy from product:

⚠️ Unknown Token Alert

This token was detected in your wallet, but is not on the CoinGecko list. Therefore, we cannot verify its legitimacy.

Anyone can create a token and transfer it to your wallet. Before interacting with any token you are not expecting, be sure to research it. ShapeShift makes no representation about the quality, nature, or legal categorization of any tokens. By importing this token, you are doing so at your own risk.

BTN: (IMPORT TOKEN)

willyogo avatar Apr 18 '22 15:04 willyogo

@0xdef1cafe to take a look at a spike for this.

0xean avatar May 18 '22 19:05 0xean

closing as low priority

0xdef1cafe avatar Jan 02 '23 17:01 0xdef1cafe