forked from cerc-io/ipld-eth-server
Extract constants package
- Reduce clutter in the shared package
This commit is contained in:
@@ -14,13 +14,16 @@
|
||||
|
||||
package ilk
|
||||
|
||||
import "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
var DripFileIlkConfig = shared.TransformerConfig{
|
||||
TransformerName: shared.DripFileIlkLabel,
|
||||
ContractAddresses: []string{shared.DripContractAddress},
|
||||
ContractAbi: shared.DripABI,
|
||||
Topic: shared.DripFileIlkSignature,
|
||||
TransformerName: constants.DripFileIlkLabel,
|
||||
ContractAddresses: []string{constants.DripContractAddress},
|
||||
ContractAbi: constants.DripABI,
|
||||
Topic: constants.DripFileIlkSignature,
|
||||
StartingBlockNumber: 0,
|
||||
EndingBlockNumber: 10000000,
|
||||
}
|
||||
|
||||
@@ -17,11 +17,12 @@ package ilk
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"math/big"
|
||||
|
||||
"errors"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
|
||||
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
)
|
||||
|
||||
type DripFileIlkConverter struct{}
|
||||
@@ -36,7 +37,7 @@ func (DripFileIlkConverter) ToModels(ethLogs []types.Log) ([]interface{}, error)
|
||||
|
||||
ilk := string(bytes.Trim(ethLog.Topics[2].Bytes(), "\x00"))
|
||||
vow := string(bytes.Trim(ethLog.Topics[3].Bytes(), "\x00"))
|
||||
taxBytes := ethLog.Data[len(ethLog.Data)-shared.DataItemLength:]
|
||||
taxBytes := ethLog.Data[len(ethLog.Data)-constants.DataItemLength:]
|
||||
tax := big.NewInt(0).SetBytes(taxBytes).String()
|
||||
raw, err := json.Marshal(ethLog)
|
||||
if err != nil {
|
||||
@@ -60,7 +61,7 @@ func verifyLog(log types.Log) error {
|
||||
if len(log.Topics) < 4 {
|
||||
return errors.New("log missing topics")
|
||||
}
|
||||
if len(log.Data) < shared.DataItemLength {
|
||||
if len(log.Data) < constants.DataItemLength {
|
||||
return errors.New("log missing data")
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user