Persist Urns in raw bytes32 format

- Enables simple usage in contract storage lookups
This commit is contained in:
Rob Mulholand
2019-02-08 11:41:17 -06:00
parent 0a024d429d
commit 09abcb841a
37 changed files with 99 additions and 106 deletions
+6 -7
View File
@@ -3,7 +3,6 @@ package vat_grab
import (
"encoding/json"
"errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
@@ -20,10 +19,10 @@ func (VatGrabConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
return nil, err
}
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
urn := common.BytesToAddress(ethLog.Topics[2].Bytes())
v := common.BytesToAddress(ethLog.Topics[3].Bytes())
urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
v := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes())
wBytes := shared.GetDataBytesAtIndex(-3, ethLog.Data)
w := common.BytesToAddress(wBytes)
w := shared.GetHexWithoutPrefix(wBytes)
dinkBytes := shared.GetDataBytesAtIndex(-2, ethLog.Data)
dink := big.NewInt(0).SetBytes(dinkBytes).String()
dartBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data)
@@ -35,9 +34,9 @@ func (VatGrabConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
}
model := VatGrabModel{
Ilk: ilk,
Urn: urn.String(),
V: v.String(),
W: w.String(),
Urn: urn,
V: v,
W: w,
Dink: dink,
Dart: dart,
LogIndex: ethLog.Index,