kardiachain / kardia-explorer-backend

Backend repo for explorer
2 stars 7 forks source link

Auto detect KRC tokens #102

Open trinhdn97 opened 3 years ago

trinhdn97 commented 3 years ago

Currently, grabber automatically detect KRC20 by trying to call some functions (name(), symbol(), totalSupply(), decimal()) of the destination contract to determine if this contract is a KRC20 token (code at https://github.com/kardiachain/kardia-explorer-backend/blob/master/kardia/krc20.go#L151). We need a proper way to determine if a contract is a KRC20 or KRC721 ones based on its interface, and should we automatically detect, store and show KRC tokens to our explorer at https://explorer.kardiachain.io/tokens?

ngdlong91 commented 3 years ago

Now we detect new KRC tokens when the first transfer event fire. Support interface for KRC20:

Support interface for KRC721: