mirror of
https://github.com/grassrootseconomics/cic-chain-events.git
synced 2024-11-22 07:46:46 +01:00
parent
bf029ebabf
commit
a291512d95
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/celo-org/celo-blockchain/common"
|
||||
"github.com/celo-org/celo-blockchain/common/hexutil"
|
||||
"github.com/grassrootseconomics/celoutils"
|
||||
"github.com/grassrootseconomics/cic-chain-events/internal/pub"
|
||||
"github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
|
||||
@ -53,9 +54,11 @@ func (f *GasFilter) Execute(_ context.Context, transaction *fetch.Transaction) (
|
||||
giveToEvent := &pub.MinimalTxInfo{
|
||||
Block: transaction.Block.Number,
|
||||
ContractAddress: celoutils.ChecksumAddress(transaction.To.Address),
|
||||
Timestamp: hexutil.MustDecodeUint64(transaction.Block.Timestamp),
|
||||
To: address.Hex(),
|
||||
TxHash: transaction.Hash,
|
||||
TxIndex: transaction.Index,
|
||||
TXType: "gas",
|
||||
}
|
||||
|
||||
if transaction.Status == 1 {
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/celo-org/celo-blockchain/common"
|
||||
"github.com/celo-org/celo-blockchain/common/hexutil"
|
||||
"github.com/grassrootseconomics/celoutils"
|
||||
"github.com/grassrootseconomics/cic-chain-events/internal/pub"
|
||||
"github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
|
||||
@ -53,9 +54,11 @@ func (f *RegisterFilter) Execute(_ context.Context, transaction *fetch.Transacti
|
||||
addEvent := &pub.MinimalTxInfo{
|
||||
Block: transaction.Block.Number,
|
||||
ContractAddress: celoutils.ChecksumAddress(transaction.To.Address),
|
||||
Timestamp: hexutil.MustDecodeUint64(transaction.Block.Timestamp),
|
||||
To: address.Hex(),
|
||||
TxHash: transaction.Hash,
|
||||
TxIndex: transaction.Index,
|
||||
TXType: "register",
|
||||
}
|
||||
|
||||
if transaction.Status == 1 {
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/celo-org/celo-blockchain/common"
|
||||
"github.com/celo-org/celo-blockchain/common/hexutil"
|
||||
"github.com/grassrootseconomics/celoutils"
|
||||
"github.com/grassrootseconomics/cic-chain-events/internal/pub"
|
||||
"github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
|
||||
@ -60,9 +61,11 @@ func (f *TokenIndexFilter) Execute(_ context.Context, transaction *fetch.Transac
|
||||
addEvent := &pub.MinimalTxInfo{
|
||||
Block: transaction.Block.Number,
|
||||
ContractAddress: celoutils.ChecksumAddress(transaction.To.Address),
|
||||
Timestamp: hexutil.MustDecodeUint64(transaction.Block.Timestamp),
|
||||
To: address.Hex(),
|
||||
TxHash: transaction.Hash,
|
||||
TxIndex: transaction.Index,
|
||||
TXType: "tokenAdd",
|
||||
}
|
||||
|
||||
if transaction.Status == 1 {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"math/big"
|
||||
|
||||
"github.com/celo-org/celo-blockchain/common"
|
||||
"github.com/celo-org/celo-blockchain/common/hexutil"
|
||||
"github.com/grassrootseconomics/celoutils"
|
||||
"github.com/grassrootseconomics/cic-chain-events/internal/pub"
|
||||
"github.com/grassrootseconomics/cic-chain-events/pkg/fetch"
|
||||
@ -60,10 +61,12 @@ func (f *TransferFilter) Execute(_ context.Context, transaction *fetch.Transacti
|
||||
transferEvent := &pub.MinimalTxInfo{
|
||||
Block: transaction.Block.Number,
|
||||
From: celoutils.ChecksumAddress(transaction.From.Address),
|
||||
Timestamp: hexutil.MustDecodeUint64(transaction.Block.Timestamp),
|
||||
To: to.Hex(),
|
||||
ContractAddress: celoutils.ChecksumAddress(transaction.To.Address),
|
||||
TxHash: transaction.Hash,
|
||||
TxIndex: transaction.Index,
|
||||
TXType: "transfer",
|
||||
Value: value.Uint64(),
|
||||
}
|
||||
|
||||
@ -94,10 +97,12 @@ func (f *TransferFilter) Execute(_ context.Context, transaction *fetch.Transacti
|
||||
transferEvent := &pub.MinimalTxInfo{
|
||||
Block: transaction.Block.Number,
|
||||
From: from.Hex(),
|
||||
Timestamp: hexutil.MustDecodeUint64(transaction.Block.Timestamp),
|
||||
To: to.Hex(),
|
||||
ContractAddress: celoutils.ChecksumAddress(transaction.To.Address),
|
||||
TxHash: transaction.Hash,
|
||||
TxIndex: transaction.Index,
|
||||
TXType: "transferFrom",
|
||||
Value: value.Uint64(),
|
||||
}
|
||||
|
||||
@ -127,10 +132,12 @@ func (f *TransferFilter) Execute(_ context.Context, transaction *fetch.Transacti
|
||||
transferEvent := &pub.MinimalTxInfo{
|
||||
Block: transaction.Block.Number,
|
||||
From: celoutils.ChecksumAddress(transaction.From.Address),
|
||||
Timestamp: hexutil.MustDecodeUint64(transaction.Block.Timestamp),
|
||||
To: to.Hex(),
|
||||
ContractAddress: celoutils.ChecksumAddress(transaction.To.Address),
|
||||
TxHash: transaction.Hash,
|
||||
TxIndex: transaction.Index,
|
||||
TXType: "mintTo",
|
||||
Value: value.Uint64(),
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,10 @@ type (
|
||||
To string `json:"to"`
|
||||
ContractAddress string `json:"contractAddress"`
|
||||
Success bool `json:"success"`
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
TxHash string `json:"transactionHash"`
|
||||
TxIndex uint `json:"transactionIndex"`
|
||||
TXType string `json:"txType"`
|
||||
Value uint64 `json:"value"`
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user