(VDB-298) Consume Pit contract storage diffs
- Continuously parse storage diffs CSV data to read Pit contract state - Convert ilks in database to raw bytes32 value for use in generating storage keys dynamically - Persist storage diffs with block number and hash for validation
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared"
|
||||
)
|
||||
|
||||
type Transformer interface {
|
||||
Execute(row shared.StorageDiffRow) error
|
||||
ContractAddress() common.Address
|
||||
}
|
||||
|
||||
type TransformerInitializer func(db *postgres.DB) Transformer
|
||||
@@ -17,6 +17,7 @@
|
||||
package shared
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
|
||||
"math/big"
|
||||
)
|
||||
@@ -59,6 +60,10 @@ func GetDataBytesAtIndex(n int, logData []byte) []byte {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
func GetHexWithoutPrefix(raw []byte) string {
|
||||
return common.Bytes2Hex(raw)
|
||||
}
|
||||
|
||||
func ConvertToRay(value string) string {
|
||||
return convert(ray, value, rayPrecision)
|
||||
}
|
||||
|
||||
@@ -62,4 +62,12 @@ var _ = Describe("Shared utilities", func() {
|
||||
Expect(wadTwo).To(Equal("1.234567890123456690"))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("getting hex without prefix", func() {
|
||||
It("returns bytes as hex without 0x prefix", func() {
|
||||
raw := common.HexToHash("0x4554480000000000000000000000000000000000000000000000000000000000").Bytes()
|
||||
result := shared.GetHexWithoutPrefix(raw)
|
||||
Expect(result).To(Equal("4554480000000000000000000000000000000000000000000000000000000000"))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user