Skip to content

Commit

Permalink
add missing contructors (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
Despire authored and robdefeo committed Jan 5, 2020
1 parent 538d01f commit 6766057
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/indexer/internal/ethereum/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ type Block struct {
txProcessor actions.Transaction
}

func NewBlockProcessor(tx actions.Transaction) *Block {
return &Block{
txProcessor: tx,
}
}

func (b *Block) Run(ctx context.Context, protocol, network string, blk interface{}) error {
ethBlk, ok := blk.(*types.Block)
if !ok {
Expand Down
9 changes: 9 additions & 0 deletions cmd/indexer/internal/ethereum/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ type txOptions struct {
block *types.Block
}

func NewTransactionProcessor(store datastore.TransactionStore, rawStore datastore.RawTransactionStore, pkStore datastore.PublicKeyStore, networkID *big.Int) *Transaction {
return &Transaction{
txStore: store,
rawTxStore: rawStore,
pkStore: pkStore,
networkID: networkID,
}
}

func (t *Transaction) Run(ctx context.Context, protocol, network string, tx interface{}, txOpts actions.TransactionOptions) error {
// blk *types.Block, ethTx *types.Transaction
ethTx, ok := tx.(*types.Transaction)
Expand Down
10 changes: 10 additions & 0 deletions cmd/indexer/internal/processor/sequential.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ type Sequential struct {
blockClient clients.BlockByNumber
}

func NewSequential(protocol, network string, store datastore.SyncStore, proc actions.Block, client clients.BlockByNumber) *Sequential {
return &Sequential{
protocol: protocol,
network: network,
syncStore: store,
blockProcessor: proc,
blockClient: client,
}
}

func (s *Sequential) NextBlock(ctx context.Context) error {
blkNo, err := s.syncStore.GetBlockNumber(ctx, s.protocol, s.network)
if err != nil {
Expand Down

0 comments on commit 6766057

Please sign in to comment.