coin

package
v2.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateCoinData

type CreateCoinData struct {
	Name           string `json:"name"`
	Symbol         string `json:"symbol"`
	InitialAmount  string `json:"initial_amount"`
	InitialReserve string `json:"initial_reserve"`
	Crr            string `json:"crr"`
}

type Repository

type Repository struct {
	DB *pg.DB
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(db *pg.DB) *Repository

func (*Repository) Add

func (r *Repository) Add(c *models.Coin) error

func (Repository) DeleteBySymbol

func (r Repository) DeleteBySymbol(symbol string) error

func (*Repository) FindCoinIdBySymbol

func (r *Repository) FindCoinIdBySymbol(symbol string) (uint, error)

Find coin id by symbol

func (*Repository) FindSymbolById

func (r *Repository) FindSymbolById(id uint) (string, error)

func (*Repository) GetAllCoins

func (r *Repository) GetAllCoins() ([]*models.Coin, error)

func (*Repository) GetById

func (r *Repository) GetById(id uint) (*models.Coin, error)

func (*Repository) GetCoinBySymbol

func (r *Repository) GetCoinBySymbol(symbol string) ([]models.Coin, error)

func (*Repository) GetLastCoinId

func (r *Repository) GetLastCoinId() (uint, error)

func (*Repository) RemoveFromCacheBySymbol

func (r *Repository) RemoveFromCacheBySymbol(symbol string)

func (*Repository) Save

func (r *Repository) Save(c *models.Coin) error

func (Repository) SaveAllIfNotExist

func (r Repository) SaveAllIfNotExist(coins []*models.Coin) error

func (Repository) SaveAllNewIfNotExist

func (r Repository) SaveAllNewIfNotExist(coins []*models.Coin) error

func (*Repository) Update

func (r *Repository) Update(c *models.Coin) error

func (*Repository) UpdateAll

func (r *Repository) UpdateAll(coins []*models.Coin) error

func (*Repository) UpdateOwnerBySymbol

func (r *Repository) UpdateOwnerBySymbol(symbol string, id uint) error

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(env *env.ExtenderEnvironment, nodeApi *grpc_client.Client, repository *Repository, addressRepository *address.Repository, logger *logrus.Entry) *Service

func (*Service) ChangeOwner

func (s *Service) ChangeOwner(symbol, owner string) error

func (*Service) CreateNewCoins

func (s *Service) CreateNewCoins(coins []*models.Coin) error

func (Service) ExtractCoinsFromTransactions

func (s Service) ExtractCoinsFromTransactions(block *api_pb.BlockResponse) ([]*models.Coin, error)

func (*Service) ExtractFromTx

func (s *Service) ExtractFromTx(tx *api_pb.BlockResponse_Transaction, blockId uint64) (*models.Coin, error)

func (*Service) GetCoinFromNode

func (s *Service) GetCoinFromNode(coinId uint64, optionalHeight ...uint64) (*models.Coin, error)

func (*Service) GetUpdateCoinsFromCoinsMapJobChannel

func (s *Service) GetUpdateCoinsFromCoinsMapJobChannel() chan map[uint64]struct{}

func (*Service) GetUpdateCoinsFromTxsJobChannel

func (s *Service) GetUpdateCoinsFromTxsJobChannel() chan []*models.Transaction

func (*Service) RecreateCoin

func (s *Service) RecreateCoin(data *api_pb.RecreateCoinData, height uint64) error

func (*Service) UpdateCoinIdCache

func (s *Service) UpdateCoinIdCache()

func (*Service) UpdateCoinsInfo

func (s *Service) UpdateCoinsInfo(coinIds []uint64) error

func (Service) UpdateCoinsInfoFromCoinsMap

func (s Service) UpdateCoinsInfoFromCoinsMap(job <-chan map[uint64]struct{})

func (*Service) UpdateCoinsInfoFromTxsWorker

func (s *Service) UpdateCoinsInfoFromTxsWorker(jobs <-chan []*models.Transaction)

Jump to

Keyboard shortcuts

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