Documentation ¶
Overview ¶
Detect smart contract properties
Index ¶
- func GetAddressDetailFromBlockchain(address string, client *ethclient.Client) (detail addressdetail.AddressDetail, found bool)
- func IsContract(address string, client *ethclient.Client) (isContract bool, err error)
- func IsErc20(address string, client *ethclient.Client) (isErc20 bool, detail addressdetail.AddressDetail, err error)
- func IsErc721(address string, client *ethclient.Client) (isErc721 bool, detail addressdetail.AddressDetail, err error)
- func SmartContractSupportsInterface(address string, interfaceId [4]byte, client *ethclient.Client) (supportsInterface bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAddressDetailFromBlockchain ¶
func GetAddressDetailFromBlockchain(address string, client *ethclient.Client) (detail addressdetail.AddressDetail, found bool)
GetAddressDetailFromBlockchain tries to detect an ERC20 / ERC721 token or generic smart contract, and returns an addressdetail.AddressDetail with the received details.
func IsContract ¶
func IsErc20 ¶
func IsErc20(address string, client *ethclient.Client) (isErc20 bool, detail addressdetail.AddressDetail, err error)
func IsErc721 ¶
func IsErc721(address string, client *ethclient.Client) (isErc721 bool, detail addressdetail.AddressDetail, err error)
TODO: Currently returns true for every SC that supports INTERFACEID_ERC165. It should really be INTERFACEID_ERC721, but that doesn't detect some SCs, eg. cryptokitties https://etherscan.io/address/0x06012c8cf97BEaD5deAe237070F9587f8E7A266d#readContract As a quick fix, just checks ERC165 and count it as ERC721 address. Improve with further/better SC method checks.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.