Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEndpoint = errs.Class("tokens endpoint")
ErrEndpoint - tokens endpoint error class.
var ErrService = errs.Class("tokens service")
ErrService - tokens service error class.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Endpoint string `help:"Ethereum RPC endpoint" devDefault:"http://localhost:8545" releaseDefault:"/home/storj/.ethereum/geth.ipc"` Contract string `help:"Address of the STORJ token to scan for transactions" default:"0xb64ef51c888972c908cfacf59b47c1afbc0ab8ac"` }
Config holds tokens service configuration.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint for querying ERC20 token information from ethereum chain.
architecture: Endpoint
func NewEndpoint ¶
NewEndpoint creates new payments endpoint instance.
func (*Endpoint) AllPayments ¶
func (endpoint *Endpoint) AllPayments(w http.ResponseWriter, r *http.Request)
AllPayments endpoint retrieves all ERC20 token payments claimed by one satellite starting from particular block for ethereum address.
type LatestPayments ¶
type LatestPayments struct { LatestBlock blockchain.Header Payments []Payment }
LatestPayments contains latest payments and latest chain block header.
type Payment ¶
type Payment struct { From blockchain.Address To blockchain.Address TokenValue currency.Amount USDValue currency.Amount BlockHash blockchain.Hash BlockNumber int64 Transaction blockchain.Hash LogIndex int Timestamp time.Time }
Payment is on chain payment made for particular contract and deposit wallet.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service for querying ERC20 token information from ethereum chain.
architecture: Service
func NewService ¶
func NewService( log *zap.Logger, endpoint string, token blockchain.Address, cache *blockchain.HeadersCache, walletDB wallets.DB, tokenPrice *tokenprice.Service, batchSize int) *Service
NewService creates new token service instance.
func (*Service) AllPayments ¶
func (service *Service) AllPayments(ctx context.Context, satelliteID string, from int64) (_ LatestPayments, err error)
AllPayments returns all the payments associated with the current satellite.