tokenmeta

package
v0.1.0-beta5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

README

Token metadata service

This service is there to inform anyone about the known token contracts on a given network.

It serves a list of top currency contracts for each platform.

Bootstrap /tmp/cache.json (based on abicodec's cache)

go install -v ./cmd/abicodec/ && abicodec --cache-base-url=gs://dfuseio-global-abicache-us --cache-file-name=eos-kylin-v2.bin --export-cache --export-cache-base-url=gs://dfuseio-global-abicache-us --export-cache-file-name=eos-kylin-v2.json

Running

tokenmeta serve --listen-grpc-addr=:9000

TO DO

  1. implement pipeline that calls the mutations batches a)forkable irreversible @s

  2. implement bootstrap from cached abi json file a) loop through and setTokens

  3. Implment flush cache to JSON store (GS) @j a) dstore b) every 200 blocks

  4. Implement GRPC server @j

  5. SHIP IT

  6. DON"T TEST

Performence kylin @ block 89,692,219 bootrstrap took: 5m30s jungle @ block 74,611,793 boostrap took: 6m30s

GRPC Calls

Get Tokens

grpcurl -plaintext localhost:9010 dfuse.tokenmeta.v1.EOS.GetTokens | jq

Get Token Holders

*Get Token Holders*
echo '{
    "tokenContract":"eosio.token",
    "filterTokenSymbols":["EOS"],
    "limit": "1",
    "sortOrder":  "DESC",
    "sortField": "AMOUNT"
}' | grpcurl -plaintext -d @ localhost:9010 dfuse.tokenmeta.v1.EOS.GetTokenBalances | jq

Get An Account

*Get Token Holders*
echo '{
    "account": "zbeoscharge1",
    "limit": "25",
    "sortOrder":  "DESC",
    "sortField": "AMOUNT"
}' | grpcurl -plaintext -d @ localhost:9010 dfuse.tokenmeta.v1.EOS.GetAccountBalances | jq

Documentation

Index

Constants

View Source
const AccountsTable eos.TableName = eos.TableName("accounts")
View Source
const EOSStakeTable eos.TableName = eos.TableName("delband")
View Source
const StatTable eos.TableName = eos.TableName("stat")

Variables

View Source
var MetricsSet = dmetrics.NewSet()

Functions

func Bootstrap

func Bootstrap(abisFileContent []byte, stateClient pbstatedb.StateClient, bootstrapblockOffset uint64) (tokens []*pbtokenmeta.Token, balances []*pbtokenmeta.AccountBalance, stakeds []*cache.EOSStakeEntry, startBlock bstream.BlockRef, err error)

func TokenToEOSSymbol

func TokenToEOSSymbol(e *pbtokenmeta.Token) *eos.Symbol

Types

type EOSStakeDbRow

type EOSStakeDbRow struct {
	CPUWeight eos.Asset       `json:"cpu_weight"`
	NetWeight eos.Asset       `json:"net_weight"`
	To        eos.AccountName `json:"to"`
	From      eos.AccountName `json:"from"`
}

type Server

type Server struct {
	*shutter.Shutter
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cache cache.Cache) *Server

func (*Server) Close

func (s *Server) Close()

func (*Server) GetTokens

func (*Server) Serve

func (s *Server) Serve(listenAddr string)

type TokenMeta

type TokenMeta struct {
	*shutter.Shutter
	// contains filtered or unexported fields
}

func NewTokenMeta

func NewTokenMeta(cache cache.Cache, abiCodecCli pbabicodec.DecoderClient, saveEveryNBlock uint32) *TokenMeta

func (*TokenMeta) Launch

func (i *TokenMeta) Launch() error

func (*TokenMeta) ProcessBlock

func (t *TokenMeta) ProcessBlock(block *bstream.Block, obj interface{}) error

func (*TokenMeta) SetupPipeline

func (t *TokenMeta) SetupPipeline(startBlock bstream.BlockRef, blockFilter func(blk *bstream.Block) error, blockstreamAddr string, blocksStore dstore.Store)

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL