0

When I am showing data from latest block with transactions I need to check it is smart contact or not. Below the code I can check it is smart contact or not

    address := common.HexToAddress("0x0536806df512d6cdde913cf95c9886f65b1d3462")
    bytecode, err := client.CodeAt(context.Background(), address, nil)
    if err != nil {
        log.Fatal(err)
    }

    isContract := len(bytecode) > 0
    fmt.Printf("True contract: %v\n", isContract) // True contract: true

If it returns smart contact true then need to show some data like this(https://goethereumbook.org/smart-contract-read-erc20). Like this example how can I read ERC721 without importing token on the top.

0 Answers0