Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Mohamed Sohail | dbcc03d1e8 | |
DeepSource Bot | 5d2daa2c8e | |
Mohamed Sohail | 2070f9afcd | |
Mohamed Sohail | 9a7dc6457e |
|
@ -0,0 +1,8 @@
|
||||||
|
version = 1
|
||||||
|
|
||||||
|
[[analyzers]]
|
||||||
|
name = "go"
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
[analyzers.meta]
|
||||||
|
import_root = "github.com/grassrootseconomics/cic-go"
|
|
@ -1,3 +1,5 @@
|
||||||
|
> DEPRECATED: Use https://github.com/grassrootseconomics/cic-go-sdk
|
||||||
|
|
||||||
[![Go Reference](https://pkg.go.dev/badge/github.com/grassrootseconomics/cic_go.svg)](https://pkg.go.dev/github.com/grassrootseconomics/cic_go)
|
[![Go Reference](https://pkg.go.dev/badge/github.com/grassrootseconomics/cic_go.svg)](https://pkg.go.dev/github.com/grassrootseconomics/cic_go)
|
||||||
[![Go](https://github.com/grassrootseconomics/cic_go/actions/workflows/go.yml/badge.svg)](https://github.com/grassrootseconomics/cic_go/actions/workflows/go.yml)
|
[![Go](https://github.com/grassrootseconomics/cic_go/actions/workflows/go.yml/badge.svg)](https://github.com/grassrootseconomics/cic_go/actions/workflows/go.yml)
|
||||||
[![Coverage Status](https://coveralls.io/repos/github/grassrootseconomics/cic_go/badge.svg?branch=sohail/cic_net_updates)](https://coveralls.io/github/grassrootseconomics/cic_go?branch=sohail/cic_net_updates)
|
[![Coverage Status](https://coveralls.io/repos/github/grassrootseconomics/cic_go/badge.svg?branch=sohail/cic_net_updates)](https://coveralls.io/github/grassrootseconomics/cic_go?branch=sohail/cic_net_updates)
|
||||||
|
@ -22,4 +24,4 @@ import (
|
||||||
cic_meta "github.com/grassrootseconomics/cic-go/meta"
|
cic_meta "github.com/grassrootseconomics/cic-go/meta"
|
||||||
cic_net "github.com/grassrootseconomics/cic-go/net"
|
cic_net "github.com/grassrootseconomics/cic-go/net"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
|
@ -10,9 +10,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type ERC20Token struct {
|
type ERC20Token struct {
|
||||||
Name string
|
Name string
|
||||||
Symbol string
|
Symbol string
|
||||||
Decimals big.Int
|
Decimals big.Int
|
||||||
|
TotalSupply big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CicNet) ERC20TokenInfo(ctx context.Context, tokenAddress common.Address) (ERC20Token, error) {
|
func (c *CicNet) ERC20TokenInfo(ctx context.Context, tokenAddress common.Address) (ERC20Token, error) {
|
||||||
|
@ -20,6 +21,7 @@ func (c *CicNet) ERC20TokenInfo(ctx context.Context, tokenAddress common.Address
|
||||||
tokenName string
|
tokenName string
|
||||||
tokenSymbol string
|
tokenSymbol string
|
||||||
tokenDecimals big.Int
|
tokenDecimals big.Int
|
||||||
|
totalSupply big.Int
|
||||||
)
|
)
|
||||||
|
|
||||||
err := c.provider.EthClient.CallCtx(
|
err := c.provider.EthClient.CallCtx(
|
||||||
|
@ -27,15 +29,17 @@ func (c *CicNet) ERC20TokenInfo(ctx context.Context, tokenAddress common.Address
|
||||||
eth.CallFunc(w3.MustNewFunc("name()", "string"), tokenAddress).Returns(&tokenName),
|
eth.CallFunc(w3.MustNewFunc("name()", "string"), tokenAddress).Returns(&tokenName),
|
||||||
eth.CallFunc(w3.MustNewFunc("symbol()", "string"), tokenAddress).Returns(&tokenSymbol),
|
eth.CallFunc(w3.MustNewFunc("symbol()", "string"), tokenAddress).Returns(&tokenSymbol),
|
||||||
eth.CallFunc(w3.MustNewFunc("decimals()", "uint256"), tokenAddress).Returns(&tokenDecimals),
|
eth.CallFunc(w3.MustNewFunc("decimals()", "uint256"), tokenAddress).Returns(&tokenDecimals),
|
||||||
|
eth.CallFunc(w3.MustNewFunc("totalSupply()", "uint256"), tokenAddress).Returns(&totalSupply),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ERC20Token{}, err
|
return ERC20Token{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERC20Token{
|
return ERC20Token{
|
||||||
Name: tokenName,
|
Name: tokenName,
|
||||||
Symbol: tokenSymbol,
|
Symbol: tokenSymbol,
|
||||||
Decimals: tokenDecimals,
|
Decimals: tokenDecimals,
|
||||||
|
TotalSupply: totalSupply,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
func (c *CicNet) BalanceOf(ctx context.Context, tokenAddress common.Address, accountAddress common.Address) (big.Int, error) {
|
func (c *CicNet) BalanceOf(ctx context.Context, tokenAddress common.Address, accountAddress common.Address) (big.Int, error) {
|
||||||
|
|
Loading…
Reference in New Issue