![Razvan Gabriel | razgraf.eth Profile](https://pbs.twimg.com/profile_images/1799474158725644288/fof_tEDi_x96.jpg)
Razvan Gabriel | razgraf.eth
@razgraf
Followers
1K
Following
8K
Statuses
2K
Co-founder and CPO @Sablier Prev. @PodsFinance Product designer & engineer π¨βπ»π¦π a16z CSX β24
π·π΄
Joined November 2014
Picture this: you're building the next big thing on @ethereum Your app allows users to __ ERC20 tokens. Cats, dogs, penguins, the US dollar, you name it, anything that's a token, users can __. They click the button. Something breaks. Let's explore the dark side of ERC20sππ§΅
2
4
15
Did you know some tokens store their details as bytes32 instead of strings? Famous example of this was @SkyEcosystemβs OG $MKR token.
Solution? Don't expect to always get strings. Query for token details in both formats, at once or in sequence. If the call expecting a string result fails, revert to the bytes32 version (and manually convert to strings afterwards).
0
0
1
H/t to @MirceaGavriliu, @sy100x for ideas and feedback + @PaulRBerg for recommending I write this thread. -- What other ERC20 unexpected mechanics have you uncovered?
0
0
6
βToken details, string vs bytes32 Most ERC20s return name/symbol as strings. To optimize gas, devs may choose to represent these in bytes32. The switch can cause failing queries, or worst, failing infra when indexers like @graphprotocol or @envio_indexer stop parsing events β
1
0
4
Picture this: you're building the next big thing on @ethereum Your app allows users to __ ERC20 tokens. Cats, dogs, penguins, the US dollar, you name it, anything that's a token, users can __. They click the button. Something breaks. Let's explore the dark side of ERC20sππ§΅
2
4
15