zeekayandHanzo Dev c9c0bed97f Go 1.27.1, and the code it can say more simply
Modules declare go 1.27.1 and the build images follow. go fix found
nothing to change; omitzero is not applied, since it changes what the JSON
says.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 18:49:00 -07:00
2026-06-28 20:57:17 -07:00
2026-06-02 11:17:08 -07:00
2026-06-28 20:57:18 -07:00

erc20-go

erc20-go

Golang interacts with erc20

example

package main

import (
	"github.com/luxfi/erc20-go/erc20"
	"fmt"
	"github.com/luxfi/geth/common"
	"github.com/luxfi/geth/ethclient"
)

type Config struct {
	Network         string `yaml:"network"`
	ContractAddress string `yaml:"contract_address"`
}

func main() {
	conf := Config{
		Network:         "https://goerli.infura.io/v3/f81902bab6204bb88b03a1507225fe0a",
		ContractAddress: "0x2ac3c1d3e24b45c6c310534bc2dd84b5ed576335",
	}
	client, err := ethclient.Dial(conf.Network)
	if err != nil {
		fmt.Printf("Failed to connect to eth: %v", err)
		return
	}
	token, err := erc20.NewGGToken(common.HexToAddress(conf.ContractAddress), client)
	if err != nil {
		fmt.Printf("Failed to instantiate a Token contract: %v", err)
		return
	}
	name, err := token.Name(nil)
	if err != nil {
		fmt.Printf("Failed to get name: %v", err)
		return
	}
	fmt.Printf("name: %v\n", name)

	totalSupply, err := token.TotalSupply(nil)
	if err != nil {
		fmt.Printf("Failed to get name: %v", err)
		return
	}
	fmt.Printf("totalSupply: %v\n", totalSupply.String())
}

S
Description
Golang interacts with erc20
Readme BSD-3-Clause
119 KiB
Languages
Go 93.2%
Solidity 6.8%