umbra-protocol icon indicating copy to clipboard operation
umbra-protocol copied to clipboard

On withdraw modal, warn if withdrawing to a token contract

Open mds1 opened this issue 3 years ago • 2 comments

We'd add this check here: https://github.com/ScopeLift/umbra-protocol/blob/a9ee536c46d7e28c990b536b03986ac860358a88/frontend/src/utils/address.ts#L99

Potential ways to implement:

  • Have the backend maintain a static list of token addresses, and the frontend will use a new endpoint to ask if the destination address is a token
  • The frontend can directly query the contract for "name", "symbol", "decimals", and fields, and if all 3 exist it's likely a token. Alternatively just query for name and symbol which should also cover NFTs

I think I lean toward the second option to reduce reliance on the backend

mds1 avatar Mar 23 '22 18:03 mds1

To start, perhaps we just only check against the address being withdrawn to simplify the logic

mds1 avatar Mar 23 '22 18:03 mds1

I will pick this one up this week

alexkeating avatar Sep 27 '22 19:09 alexkeating

This should be resolved now

alexkeating avatar Oct 24 '22 00:10 alexkeating