Persist Urns in raw bytes32 format

- Enables simple usage in contract storage lookups
This commit is contained in:
Rob Mulholand 2019-02-05 15:43:20 -06:00
parent 0a024d429d
commit 09abcb841a
37 changed files with 99 additions and 106 deletions

View File

@ -20,7 +20,6 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/geth" "github.com/vulcanize/vulcanizedb/pkg/geth"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
@ -63,8 +62,8 @@ func (converter BiteConverter) ToModels(entities []interface{}) ([]interface{},
return nil, fmt.Errorf("entity of type %T, not %T", entity, BiteEntity{}) return nil, fmt.Errorf("entity of type %T, not %T", entity, BiteEntity{})
} }
ilk := common.Bytes2Hex(biteEntity.Ilk[:]) ilk := shared.GetHexWithoutPrefix(biteEntity.Ilk[:])
urn := common.BytesToAddress(biteEntity.Urn[:]).String() urn := shared.GetHexWithoutPrefix(biteEntity.Urn[:])
ink := biteEntity.Ink ink := biteEntity.Ink
art := biteEntity.Art art := biteEntity.Art
iArt := biteEntity.IArt iArt := biteEntity.IArt

View File

@ -71,7 +71,7 @@ var _ = Describe("Bite Converter", func() {
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
expectedModel := bite.BiteModel{ expectedModel := bite.BiteModel{
Ilk: "0000000000000000000000000000000000000000000000000000000000000000", Ilk: "0000000000000000000000000000000000000000000000000000000000000000",
Urn: "0x0000000000000000000000000000000000000000", Urn: "0000000000000000000000000000000000000000000000000000000000000000",
Ink: "", Ink: "",
Art: "", Art: "",
IArt: "", IArt: "",

View File

@ -41,6 +41,7 @@ func (c DentConverter) ToModels(ethLogs []types.Log) (result []interface{}, err
bidId := log.Topics[2].Big() bidId := log.Topics[2].Big()
lot := log.Topics[3].Big().String() lot := log.Topics[3].Big().String()
bidValue := getBidValue(log) bidValue := getBidValue(log)
// TODO: verify guy is available on Topics[1] (looks like it may just be an int id)
guy := common.HexToAddress(log.Topics[1].Hex()).String() guy := common.HexToAddress(log.Topics[1].Hex()).String()
logIndex := log.Index logIndex := log.Index

View File

@ -17,7 +17,6 @@
package ilk package ilk
import ( import (
"bytes"
"encoding/json" "encoding/json"
"errors" "errors"
"math/big" "math/big"
@ -39,7 +38,7 @@ func (DripFileIlkConverter) ToModels(ethLogs []types.Log) ([]interface{}, error)
} }
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes()) ilk := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
vow := string(bytes.Trim(ethLog.Topics[3].Bytes(), "\x00")) vow := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes())
taxBytes := ethLog.Data[len(ethLog.Data)-constants.DataItemLength:] taxBytes := ethLog.Data[len(ethLog.Data)-constants.DataItemLength:]
tax := shared.ConvertToRay(big.NewInt(0).SetBytes(taxBytes).String()) tax := shared.ConvertToRay(big.NewInt(0).SetBytes(taxBytes).String())
raw, err := json.Marshal(ethLog) raw, err := json.Marshal(ethLog)

View File

@ -20,8 +20,8 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/geth" "github.com/vulcanize/vulcanizedb/pkg/geth"
) )
@ -64,8 +64,8 @@ func (FrobConverter) ToModels(entities []interface{}) ([]interface{}, error) {
return nil, err return nil, err
} }
model := FrobModel{ model := FrobModel{
Ilk: common.Bytes2Hex(frobEntity.Ilk[:]), Ilk: shared.GetHexWithoutPrefix(frobEntity.Ilk[:]),
Urn: common.BytesToAddress(frobEntity.Urn[:]).String(), Urn: shared.GetHexWithoutPrefix(frobEntity.Urn[:]),
Ink: frobEntity.Ink.String(), Ink: frobEntity.Ink.String(),
Art: frobEntity.Art.String(), Art: frobEntity.Art.String(),
Dink: frobEntity.Dink.String(), Dink: frobEntity.Dink.String(),

View File

@ -87,7 +87,7 @@ var _ = Describe("Bite Transformer", func() {
Expect(dbResult[0].Ink).To(Equal("1000000000000000000")) Expect(dbResult[0].Ink).To(Equal("1000000000000000000"))
Expect(dbResult[0].NFlip).To(Equal("2")) Expect(dbResult[0].NFlip).To(Equal("2"))
Expect(dbResult[0].Tab).To(Equal("149846666666666655744")) Expect(dbResult[0].Tab).To(Equal("149846666666666655744"))
Expect(dbResult[0].Urn).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) Expect(dbResult[0].Urn).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
}) })
It("unpacks an event log", func() { It("unpacks an event log", func() {

View File

@ -96,7 +96,7 @@ var _ = Describe("Frob Transformer", func() {
Expect(dbResult[0].IArt).To(Equal("1495509999999999999992")) Expect(dbResult[0].IArt).To(Equal("1495509999999999999992"))
Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Ink).To(Equal("10050100000000000")) Expect(dbResult[0].Ink).To(Equal("10050100000000000"))
Expect(dbResult[0].Urn).To(Equal("0xc8E093e5f3F9B5Aa6A6b33ea45960b93C161430C")) Expect(dbResult[0].Urn).To(Equal("000000000000000000000000c8e093e5f3f9b5aa6a6b33ea45960b93c161430c"))
}) })
It("rechecks frob event", func() { It("rechecks frob event", func() {
@ -141,7 +141,7 @@ var _ = Describe("Frob Transformer", func() {
Expect(dbResult[0].IArt).To(Equal("1495509999999999999992")) Expect(dbResult[0].IArt).To(Equal("1495509999999999999992"))
Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Ink).To(Equal("10050100000000000")) Expect(dbResult[0].Ink).To(Equal("10050100000000000"))
Expect(dbResult[0].Urn).To(Equal("0xc8E093e5f3F9B5Aa6A6b33ea45960b93C161430C")) Expect(dbResult[0].Urn).To(Equal("000000000000000000000000c8e093e5f3f9b5aa6a6b33ea45960b93c161430c"))
}) })
It("unpacks an event log", func() { It("unpacks an event log", func() {

View File

@ -91,7 +91,7 @@ var _ = Describe("Tend LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Bid).To(Equal("4000")) Expect(dbResult[0].Bid).To(Equal("4000"))
Expect(dbResult[0].BidId).To(Equal("3")) Expect(dbResult[0].BidId).To(Equal("3"))
Expect(dbResult[0].Guy).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) Expect(dbResult[0].Lot).To(Equal("1000000000000000000"))
var dbTic int64 var dbTic int64
@ -137,7 +137,7 @@ var _ = Describe("Tend LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Bid).To(Equal("4000")) Expect(dbResult[0].Bid).To(Equal("4000"))
Expect(dbResult[0].BidId).To(Equal("3")) Expect(dbResult[0].BidId).To(Equal("3"))
Expect(dbResult[0].Guy).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) Expect(dbResult[0].Lot).To(Equal("1000000000000000000"))
var dbTic int64 var dbTic int64
@ -170,7 +170,7 @@ var _ = Describe("Tend LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Bid).To(Equal("4300")) Expect(dbResult[0].Bid).To(Equal("4300"))
Expect(dbResult[0].BidId).To(Equal("3")) Expect(dbResult[0].BidId).To(Equal("3"))
Expect(dbResult[0].Guy).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) Expect(dbResult[0].Lot).To(Equal("1000000000000000000"))
var dbTic int64 var dbTic int64
@ -203,7 +203,7 @@ var _ = Describe("Tend LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Bid).To(Equal("1000000000000000")) Expect(dbResult[0].Bid).To(Equal("1000000000000000"))
Expect(dbResult[0].BidId).To(Equal("1")) Expect(dbResult[0].BidId).To(Equal("1"))
Expect(dbResult[0].Guy).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) Expect(dbResult[0].Guy).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult[0].Lot).To(Equal("1000000000000000000")) Expect(dbResult[0].Lot).To(Equal("1000000000000000000"))
var dbTic int64 var dbTic int64

View File

@ -75,8 +75,8 @@ var _ = Describe("VatFlux LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Src).To(Equal("0xC0851F73CC8DD5c0765E71980eC7E7Fd1EF74434")) Expect(dbResult[0].Src).To(Equal("000000000000000000000000c0851f73cc8dd5c0765e71980ec7e7fd1ef74434"))
Expect(dbResult[0].Dst).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) Expect(dbResult[0].Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult[0].Rad).To(Equal("1800000000000000000000000000000000000000000000")) Expect(dbResult[0].Rad).To(Equal("1800000000000000000000000000000000000000000000"))
Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) Expect(dbResult[0].TransactionIndex).To(Equal(uint(0)))
}) })
@ -139,8 +139,8 @@ var _ = Describe("VatFlux LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Src).To(Equal("0xC0851F73CC8DD5c0765E71980eC7E7Fd1EF74434")) Expect(dbResult[0].Src).To(Equal("000000000000000000000000c0851f73cc8dd5c0765e71980ec7e7fd1ef74434"))
Expect(dbResult[0].Dst).To(Equal("0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB")) Expect(dbResult[0].Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult[0].Rad).To(Equal("1800000000000000000000000000000000000000000000")) Expect(dbResult[0].Rad).To(Equal("1800000000000000000000000000000000000000000000"))
Expect(dbResult[0].TransactionIndex).To(Equal(uint(0))) Expect(dbResult[0].TransactionIndex).To(Equal(uint(0)))
}) })

View File

@ -83,7 +83,7 @@ var _ = Describe("VatFold Transformer", func() {
Expect(len(dbResults)).To(Equal(1)) Expect(len(dbResults)).To(Equal(1))
dbResult := dbResults[0] dbResult := dbResults[0]
Expect(dbResult.Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000")) Expect(dbResult.Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult.Urn).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String())) Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
Expect(dbResult.Rate).To(Equal("0.000000000000000000000000000")) Expect(dbResult.Rate).To(Equal("0.000000000000000000000000000"))
}) })
@ -137,7 +137,7 @@ var _ = Describe("VatFold Transformer", func() {
Expect(len(dbResults)).To(Equal(1)) Expect(len(dbResults)).To(Equal(1))
dbResult := dbResults[0] dbResult := dbResults[0]
Expect(dbResult.Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000")) Expect(dbResult.Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult.Urn).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String())) Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
Expect(dbResult.Rate).To(Equal("0.000000000000000000000000000")) Expect(dbResult.Rate).To(Equal("0.000000000000000000000000000"))
}) })
}) })

View File

@ -76,9 +76,9 @@ var _ = Describe("Vat Grab Transformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Urn).To(Equal("0x6a3AE20C315E845B2E398e68EfFe39139eC6060C")) Expect(dbResult[0].Urn).To(Equal("0000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c"))
Expect(dbResult[0].V).To(Equal("0x2F34f22a00eE4b7a8F8BBC4eAee1658774c624e0")) //cat contract address Expect(dbResult[0].V).To(Equal("0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e0")) //cat contract address as bytes32
Expect(dbResult[0].W).To(Equal("0x3728e9777B2a0a611ee0F89e00E01044ce4736d1")) Expect(dbResult[0].W).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
expectedDink := new(big.Int) expectedDink := new(big.Int)
expectedDink.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) expectedDink.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10)
Expect(dbResult[0].Dink).To(Equal(expectedDink.String())) Expect(dbResult[0].Dink).To(Equal(expectedDink.String()))
@ -144,9 +144,9 @@ var _ = Describe("Vat Grab Transformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("5245500000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Urn).To(Equal("0x6a3AE20C315E845B2E398e68EfFe39139eC6060C")) Expect(dbResult[0].Urn).To(Equal("0000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c"))
Expect(dbResult[0].V).To(Equal("0x2F34f22a00eE4b7a8F8BBC4eAee1658774c624e0")) //cat contract address Expect(dbResult[0].V).To(Equal("0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e0")) //cat contract address
Expect(dbResult[0].W).To(Equal("0x3728e9777B2a0a611ee0F89e00E01044ce4736d1")) Expect(dbResult[0].W).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
expectedDink := new(big.Int) expectedDink := new(big.Int)
expectedDink.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) expectedDink.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10)
Expect(dbResult[0].Dink).To(Equal(expectedDink.String())) Expect(dbResult[0].Dink).To(Equal(expectedDink.String()))

View File

@ -74,8 +74,8 @@ var _ = Describe("VatHeal Transformer", func() {
Expect(len(dbResults)).To(Equal(1)) Expect(len(dbResults)).To(Equal(1))
dbResult := dbResults[0] dbResult := dbResults[0]
Expect(dbResult.Urn).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String())) Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
Expect(dbResult.V).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String())) Expect(dbResult.V).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
Expect(dbResult.Rad).To(Equal("1000000000000000000000000000")) Expect(dbResult.Rad).To(Equal("1000000000000000000000000000"))
}) })
@ -135,8 +135,8 @@ var _ = Describe("VatHeal Transformer", func() {
Expect(len(dbResults)).To(Equal(1)) Expect(len(dbResults)).To(Equal(1))
dbResult := dbResults[0] dbResult := dbResults[0]
Expect(dbResult.Urn).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String())) Expect(dbResult.Urn).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
Expect(dbResult.V).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String())) Expect(dbResult.V).To(Equal("0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1"))
Expect(dbResult.Rad).To(Equal("1000000000000000000000000000")) Expect(dbResult.Rad).To(Equal("1000000000000000000000000000"))
}) })
}) })

View File

@ -74,8 +74,8 @@ var _ = Describe("VatMove LogNoteTransformer", func() {
Expect(len(dbResults)).To(Equal(1)) Expect(len(dbResults)).To(Equal(1))
dbResult := dbResults[0] dbResult := dbResults[0]
Expect(dbResult.Src).To(Equal(common.HexToAddress("0x8868bad8e74fca4505676d1b5b21ecc23328d132").String())) Expect(dbResult.Src).To(Equal("0000000000000000000000008868bad8e74fca4505676d1b5b21ecc23328d132"))
Expect(dbResult.Dst).To(Equal(common.HexToAddress("0x0000d8b4147eda80fec7122ae16da2479cbd7ffb").String())) Expect(dbResult.Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult.Rad).To(Equal("1000000000000000000000000000000000000000000000")) Expect(dbResult.Rad).To(Equal("1000000000000000000000000000000000000000000000"))
}) })
@ -136,8 +136,8 @@ var _ = Describe("VatMove LogNoteTransformer", func() {
Expect(len(dbResults)).To(Equal(1)) Expect(len(dbResults)).To(Equal(1))
dbResult := dbResults[0] dbResult := dbResults[0]
Expect(dbResult.Src).To(Equal(common.HexToAddress("0x8868bad8e74fca4505676d1b5b21ecc23328d132").String())) Expect(dbResult.Src).To(Equal("0000000000000000000000008868bad8e74fca4505676d1b5b21ecc23328d132"))
Expect(dbResult.Dst).To(Equal(common.HexToAddress("0x0000d8b4147eda80fec7122ae16da2479cbd7ffb").String())) Expect(dbResult.Dst).To(Equal("0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"))
Expect(dbResult.Rad).To(Equal("1000000000000000000000000000000000000000000000")) Expect(dbResult.Rad).To(Equal("1000000000000000000000000000000000000000000000"))
}) })
}) })

View File

@ -67,7 +67,7 @@ var _ = Describe("Vat slip transformer", func() {
err = db.Get(&model, `SELECT ilk, guy, rad, tx_idx FROM maker.vat_slip WHERE header_id = $1`, headerID) err = db.Get(&model, `SELECT ilk, guy, rad, tx_idx FROM maker.vat_slip WHERE header_id = $1`, headerID)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(model.Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) Expect(model.Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000"))
Expect(model.Guy).To(Equal("0xDA15dCE70ab462E66779f23ee14F21d993789eE3")) Expect(model.Guy).To(Equal("000000000000000000000000da15dce70ab462e66779f23ee14f21d993789ee3"))
Expect(model.Rad).To(Equal("100000000000000000000000000000000000000000000000")) Expect(model.Rad).To(Equal("100000000000000000000000000000000000000000000000"))
Expect(model.TransactionIndex).To(Equal(uint(0))) Expect(model.TransactionIndex).To(Equal(uint(0)))
var headerChecked bool var headerChecked bool
@ -125,7 +125,7 @@ var _ = Describe("Vat slip transformer", func() {
err = db.Get(&model, `SELECT ilk, guy, rad, tx_idx FROM maker.vat_slip WHERE header_id = $1`, headerID) err = db.Get(&model, `SELECT ilk, guy, rad, tx_idx FROM maker.vat_slip WHERE header_id = $1`, headerID)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(model.Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) Expect(model.Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000"))
Expect(model.Guy).To(Equal("0xDA15dCE70ab462E66779f23ee14F21d993789eE3")) Expect(model.Guy).To(Equal("000000000000000000000000da15dce70ab462e66779f23ee14f21d993789ee3"))
Expect(model.Rad).To(Equal("100000000000000000000000000000000000000000000000")) Expect(model.Rad).To(Equal("100000000000000000000000000000000000000000000000"))
Expect(model.TransactionIndex).To(Equal(uint(0))) Expect(model.TransactionIndex).To(Equal(uint(0)))
var headerChecked int var headerChecked int

View File

@ -76,9 +76,9 @@ var _ = Describe("VatTune LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Urn).To(Equal("0x4F26FfBe5F04ED43630fdC30A87638d53D0b0876")) Expect(dbResult[0].Urn).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"))
Expect(dbResult[0].V).To(Equal("0x4F26FfBe5F04ED43630fdC30A87638d53D0b0876")) Expect(dbResult[0].V).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"))
Expect(dbResult[0].W).To(Equal("0x4F26FfBe5F04ED43630fdC30A87638d53D0b0876")) Expect(dbResult[0].W).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"))
Expect(dbResult[0].Dink).To(Equal("0")) Expect(dbResult[0].Dink).To(Equal("0"))
expectedDart := new(big.Int) expectedDart := new(big.Int)
expectedDart.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) expectedDart.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10)
@ -143,9 +143,9 @@ var _ = Describe("VatTune LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000")) Expect(dbResult[0].Ilk).To(Equal("4554480000000000000000000000000000000000000000000000000000000000"))
Expect(dbResult[0].Urn).To(Equal("0x4F26FfBe5F04ED43630fdC30A87638d53D0b0876")) Expect(dbResult[0].Urn).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"))
Expect(dbResult[0].V).To(Equal("0x4F26FfBe5F04ED43630fdC30A87638d53D0b0876")) Expect(dbResult[0].V).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"))
Expect(dbResult[0].W).To(Equal("0x4F26FfBe5F04ED43630fdC30A87638d53D0b0876")) Expect(dbResult[0].W).To(Equal("0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"))
Expect(dbResult[0].Dink).To(Equal("0")) Expect(dbResult[0].Dink).To(Equal("0"))
expectedDart := new(big.Int) expectedDart := new(big.Int)
expectedDart.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10) expectedDart.SetString("115792089237316195423570985008687907853269984665640564039455584007913129639936", 10)

View File

@ -19,9 +19,9 @@ package tend
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
) )
@ -35,7 +35,7 @@ func (TendConverter) ToModels(ethLogs []types.Log) (results []interface{}, err e
} }
bidId := ethLog.Topics[2].Big() bidId := ethLog.Topics[2].Big()
guy := common.HexToAddress(ethLog.Topics[1].Hex()).String() guy := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
lot := ethLog.Topics[3].Big().String() lot := ethLog.Topics[3].Big().String()
lastDataItemStartIndex := len(ethLog.Data) - 32 lastDataItemStartIndex := len(ethLog.Data) - 32

View File

@ -42,7 +42,7 @@ var (
biteIlk = [32]byte{69, 84, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} biteIlk = [32]byte{69, 84, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
biteLad = [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 180, 20, 126, 218, 128, 254, 199, 18, 42, 225, 109, 162, 71, 156, 189, 127, 251} biteLad = [32]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, 180, 20, 126, 218, 128, 254, 199, 18, 42, 225, 109, 162, 71, 156, 189, 127, 251}
biteIlkString = "4554480000000000000000000000000000000000000000000000000000000000" biteIlkString = "4554480000000000000000000000000000000000000000000000000000000000"
biteLadString = "0x0000d8b4147eDa80Fec7122AE16DA2479Cbd7ffB" biteLadString = "0000000000000000000000000000d8b4147eda80fec7122ae16da2479cbd7ffb"
) )
var EthBiteLog = types.Log{ var EthBiteLog = types.Log{

View File

@ -48,7 +48,7 @@ var EthDripFileIlkLog = types.Log{
var rawDripFileIlkLog, _ = json.Marshal(EthDripFileIlkLog) var rawDripFileIlkLog, _ = json.Marshal(EthDripFileIlkLog)
var DripFileIlkModel = ilk2.DripFileIlkModel{ var DripFileIlkModel = ilk2.DripFileIlkModel{
Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000",
Vow: "fake vow", Vow: "66616b6520766f77000000000000000000000000000000000000000000000000",
Tax: "12300.000000000000000000000000000", Tax: "12300.000000000000000000000000000",
LogIndex: EthDripFileIlkLog.Index, LogIndex: EthDripFileIlkLog.Index,
TransactionIndex: EthDripFileIlkLog.TxIndex, TransactionIndex: EthDripFileIlkLog.TxIndex,

View File

@ -38,7 +38,7 @@ var (
bid = new(big.Int).SetBytes([]byte{0}) bid = new(big.Int).SetBytes([]byte{0})
gal = "0x07Fa9eF6609cA7921112231F8f195138ebbA2977" gal = "0x07Fa9eF6609cA7921112231F8f195138ebbA2977"
end = int64(1535991025) end = int64(1535991025)
urn = [32]byte{115, 64, 224, 6, 244, 19, 91, 166, 151, 13, 67, 191, 67, 216, 141, 202, 212, 231, 168, 202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} urnBytes = [32]byte{115, 64, 224, 6, 244, 19, 91, 166, 151, 13, 67, 191, 67, 216, 141, 202, 212, 231, 168, 202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
urnString = "0x7340e006f4135BA6970D43bf43d88DCAD4e7a8CA" urnString = "0x7340e006f4135BA6970D43bf43d88DCAD4e7a8CA"
tabString = "50" tabString = "50"
tab, _ = new(big.Int).SetString(tabString, 10) tab, _ = new(big.Int).SetString(tabString, 10)
@ -73,7 +73,7 @@ var FlipKickEntity = flip_kick.FlipKickEntity{
Bid: bid, Bid: bid,
Gal: common.HexToAddress(gal), Gal: common.HexToAddress(gal),
End: big.NewInt(end), End: big.NewInt(end),
Urn: urn, Urn: urnBytes,
Tab: tab, Tab: tab,
TransactionIndex: EthFlipKickLog.TxIndex, TransactionIndex: EthFlipKickLog.TxIndex,
LogIndex: EthFlipKickLog.Index, LogIndex: EthFlipKickLog.Index,

View File

@ -42,7 +42,7 @@ var (
ink = big.NewInt(15) ink = big.NewInt(15)
ilk = [32]byte{102, 97, 107, 101, 32, 105, 108, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ilk = [32]byte{102, 97, 107, 101, 32, 105, 108, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
frobIlkString = "66616b6520696c6b000000000000000000000000000000000000000000000000" frobIlkString = "66616b6520696c6b000000000000000000000000000000000000000000000000"
frobUrnString = "0x64d922894153BE9EEf7b7218dc565d1D0Ce2a092" frobUrnString = "00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"
) )
var EthFrobLog = types.Log{ var EthFrobLog = types.Log{

View File

@ -32,7 +32,7 @@ var (
tendBidId = int64(10) tendBidId = int64(10)
tendLot = "85000000000000000000" tendLot = "85000000000000000000"
tendBid = "1000000000000000000" tendBid = "1000000000000000000"
tendGuy = "0x7d7bEe5fCfD8028cf7b00876C5b1421c800561A6" tendGuy = "0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6"
tendData = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000644b43ed12000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000049b9ca9a6943400000000000000000000000000000000000000000000000000000de0b6b3a7640000" tendData = "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000644b43ed12000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000049b9ca9a6943400000000000000000000000000000000000000000000000000000de0b6b3a7640000"
tendTransactionHash = "0x7909c8793ded2b8348f5db623044fbc26bb7ab78ad5792897abdf68ddc1df63d" tendTransactionHash = "0x7909c8793ded2b8348f5db623044fbc26bb7ab78ad5792897abdf68ddc1df63d"
tendBlockHash = "0xa8ea87147c0a68daeb6b1d9f8c0937ba975a650809cab80d19c969e8d0df452c" tendBlockHash = "0xa8ea87147c0a68daeb6b1d9f8c0937ba975a650809cab80d19c969e8d0df452c"

View File

@ -45,8 +45,8 @@ var VatFluxLog = types.Log{
var rawFluxLog, _ = json.Marshal(VatFluxLog) var rawFluxLog, _ = json.Marshal(VatFluxLog)
var VatFluxModel = vat_flux.VatFluxModel{ var VatFluxModel = vat_flux.VatFluxModel{
Ilk: "5245500000000000000000000000000000000000000000000000000000000000", Ilk: "5245500000000000000000000000000000000000000000000000000000000000",
Src: "0x7FA9EF6609Ca7921112231f8f195138ebba29770", Src: "0000000000000000000000007fa9ef6609ca7921112231f8f195138ebba29770",
Dst: "0x93086347c52a8878af71bB818509d484c6a2e1bF", Dst: "00000000000000000000000093086347c52a8878af71bb818509d484c6a2e1bf",
Rad: "123", Rad: "123",
TransactionIndex: VatFluxLog.TxIndex, TransactionIndex: VatFluxLog.TxIndex,
LogIndex: VatFluxLog.Index, LogIndex: VatFluxLog.Index,

View File

@ -47,7 +47,7 @@ var EthVatFoldLog = types.Log{
var rawVatFoldLog, _ = json.Marshal(EthVatFoldLog) var rawVatFoldLog, _ = json.Marshal(EthVatFoldLog)
var VatFoldModel = vat_fold.VatFoldModel{ var VatFoldModel = vat_fold.VatFoldModel{
Ilk: "5245500000000000000000000000000000000000000000000000000000000000", Ilk: "5245500000000000000000000000000000000000000000000000000000000000",
Urn: "0x3728e9777B2a0a611ee0F89e00E01044ce4736d1", Urn: "0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1",
Rate: "0.000000000000000000000000002", Rate: "0.000000000000000000000000002",
LogIndex: EthVatFoldLog.Index, LogIndex: EthVatFoldLog.Index,
TransactionIndex: EthVatFoldLog.TxIndex, TransactionIndex: EthVatFoldLog.TxIndex,

View File

@ -29,9 +29,9 @@ var EthVatGrabLog = types.Log{
var rawVatGrabLog, _ = json.Marshal(EthVatGrabLog) var rawVatGrabLog, _ = json.Marshal(EthVatGrabLog)
var VatGrabModel = vat_grab.VatGrabModel{ var VatGrabModel = vat_grab.VatGrabModel{
Ilk: "5245500000000000000000000000000000000000000000000000000000000000", Ilk: "5245500000000000000000000000000000000000000000000000000000000000",
Urn: "0x6a3AE20C315E845B2E398e68EfFe39139eC6060C", Urn: "0000000000000000000000006a3ae20c315e845b2e398e68effe39139ec6060c",
V: "0x2F34f22a00eE4b7a8F8BBC4eAee1658774c624e0", V: "0000000000000000000000002f34f22a00ee4b7a8f8bbc4eaee1658774c624e0",
W: "0x3728e9777B2a0a611ee0F89e00E01044ce4736d1", W: "0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1",
Dink: "115792089237316195423570985008687907853269984665640564039455584007913129639936", Dink: "115792089237316195423570985008687907853269984665640564039455584007913129639936",
Dart: "115792089237316195423570985008687907853269984665640564039441803007913129639936", Dart: "115792089237316195423570985008687907853269984665640564039441803007913129639936",
LogIndex: EthVatGrabLog.Index, LogIndex: EthVatGrabLog.Index,

View File

@ -44,8 +44,8 @@ var VatHealLog = types.Log{
var rawHealLog, _ = json.Marshal(VatHealLog) var rawHealLog, _ = json.Marshal(VatHealLog)
var VatHealModel = vat_heal.VatHealModel{ var VatHealModel = vat_heal.VatHealModel{
Urn: "0x7d7bEe5fCfD8028cf7b00876C5b1421c800561A6", Urn: "0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6",
V: "0x7340e006f4135BA6970D43bf43d88DCAD4e7a8CA", V: "0000000000000000000000007340e006f4135ba6970d43bf43d88dcad4e7a8ca",
Rad: "120", Rad: "120",
LogIndex: VatHealLog.Index, LogIndex: VatHealLog.Index,
TransactionIndex: VatHealLog.TxIndex, TransactionIndex: VatHealLog.TxIndex,

View File

@ -46,8 +46,8 @@ var EthVatMoveLog = types.Log{
var rawVatMoveLog, _ = json.Marshal(EthVatMoveLog) var rawVatMoveLog, _ = json.Marshal(EthVatMoveLog)
var VatMoveModel = vat_move.VatMoveModel{ var VatMoveModel = vat_move.VatMoveModel{
Src: "0xA730d1FF8B6Bc74a26d54c20a9dda539909BaB0e", Src: "000000000000000000000000a730d1ff8b6bc74a26d54c20a9dda539909bab0e",
Dst: "0xB730D1fF8b6BC74a26D54c20a9ddA539909BAb0e", Dst: "000000000000000000000000b730d1ff8b6bc74a26d54c20a9dda539909bab0e",
Rad: "42", Rad: "42",
LogIndex: EthVatMoveLog.Index, LogIndex: EthVatMoveLog.Index,
TransactionIndex: EthVatMoveLog.TxIndex, TransactionIndex: EthVatMoveLog.TxIndex,

View File

@ -47,7 +47,7 @@ var EthVatSlipLog = types.Log{
var rawVatSlipLog, _ = json.Marshal(EthVatSlipLog) var rawVatSlipLog, _ = json.Marshal(EthVatSlipLog)
var VatSlipModel = vat_slip.VatSlipModel{ var VatSlipModel = vat_slip.VatSlipModel{
Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000",
Guy: common.HexToAddress("0x7d7bEe5fCfD8028cf7b00876C5b1421c800561A6").String(), Guy: "0000000000000000000000007d7bee5fcfd8028cf7b00876c5b1421c800561a6",
Rad: "987654321", Rad: "987654321",
TransactionIndex: EthVatSlipLog.TxIndex, TransactionIndex: EthVatSlipLog.TxIndex,
LogIndex: EthVatSlipLog.Index, LogIndex: EthVatSlipLog.Index,

View File

@ -15,7 +15,7 @@ var EthVatTollLog = types.Log{
Topics: []common.Hash{ Topics: []common.Hash{
common.HexToHash("0x09b7a0b500000000000000000000000000000000000000000000000000000000"), common.HexToHash("0x09b7a0b500000000000000000000000000000000000000000000000000000000"),
common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"), common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"),
common.HexToHash("0xa3e37186e017747dba34042e83e3f76ad3cce9b0000000000000000000000000"), common.HexToHash("0x0000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b"),
common.HexToHash("0x00000000000000000000000000000000000000000000000000000000075bcd15"), common.HexToHash("0x00000000000000000000000000000000000000000000000000000000075bcd15"),
}, },
Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006409b7a0b566616b6520696c6b000000000000000000000000000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b000000000000000000000000000000000000000000000000000000000000000000000000000000000075bcd15"), Data: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006409b7a0b566616b6520696c6b000000000000000000000000000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b000000000000000000000000000000000000000000000000000000000000000000000000000000000075bcd15"),
@ -30,7 +30,7 @@ var EthVatTollLog = types.Log{
var rawVatTollLog, _ = json.Marshal(EthVatTollLog) var rawVatTollLog, _ = json.Marshal(EthVatTollLog)
var VatTollModel = vat_toll.VatTollModel{ var VatTollModel = vat_toll.VatTollModel{
Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000", Ilk: "66616b6520696c6b000000000000000000000000000000000000000000000000",
Urn: "0xA3E37186E017747DbA34042e83e3F76Ad3CcE9b0", Urn: "0000000000000000000000000a3e37186e017747dba34042e83e3f76ad3cce9b",
Take: big.NewInt(123456789).String(), Take: big.NewInt(123456789).String(),
TransactionIndex: EthVatTollLog.TxIndex, TransactionIndex: EthVatTollLog.TxIndex,
LogIndex: EthVatTollLog.Index, LogIndex: EthVatTollLog.Index,

View File

@ -32,12 +32,12 @@ var EthVatTuneLog = types.Log{
var rawVatTuneLog, _ = json.Marshal(EthVatTuneLog) var rawVatTuneLog, _ = json.Marshal(EthVatTuneLog)
var dartString = "115792089237316195423570985008687907853269984665640564039455584007913129639936" var dartString = "115792089237316195423570985008687907853269984665640564039455584007913129639936"
var vatTuneDart, _ = new(big.Int).SetString(dartString, 10) var vatTuneDart, _ = new(big.Int).SetString(dartString, 10)
var urnAddress = "0x4F26FfBe5F04ED43630fdC30A87638d53D0b0876" var urn = "0000000000000000000000004f26ffbe5f04ed43630fdc30a87638d53d0b0876"
var VatTuneModel = vat_tune.VatTuneModel{ var VatTuneModel = vat_tune.VatTuneModel{
Ilk: "4554480000000000000000000000000000000000000000000000000000000000", Ilk: "4554480000000000000000000000000000000000000000000000000000000000",
Urn: urnAddress, Urn: urn,
V: urnAddress, V: urn,
W: urnAddress, W: urn,
Dink: big.NewInt(0).String(), Dink: big.NewInt(0).String(),
Dart: vatTuneDart.String(), Dart: vatTuneDart.String(),
TransactionIndex: EthVatTuneLog.TxIndex, TransactionIndex: EthVatTuneLog.TxIndex,

View File

@ -19,7 +19,6 @@ package vat_flux
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"math/big" "math/big"
@ -36,8 +35,8 @@ func (VatFluxConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
src := common.BytesToAddress(ethLog.Topics[2].Bytes()) src := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
dst := common.BytesToAddress(ethLog.Topics[3].Bytes()) dst := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes())
radBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data) radBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data)
rad := big.NewInt(0).SetBytes(radBytes).String() rad := big.NewInt(0).SetBytes(radBytes).String()
@ -52,8 +51,8 @@ func (VatFluxConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
model := VatFluxModel{ model := VatFluxModel{
Ilk: ilk, Ilk: ilk,
Src: src.String(), Src: src,
Dst: dst.String(), Dst: dst,
Rad: rad, Rad: rad,
TransactionIndex: ethLog.TxIndex, TransactionIndex: ethLog.TxIndex,
LogIndex: ethLog.Index, LogIndex: ethLog.Index,

View File

@ -19,7 +19,6 @@ package vat_fold
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
) )
@ -35,7 +34,7 @@ func (VatFoldConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
urn := common.BytesToAddress(ethLog.Topics[2].Bytes()).String() urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
rate := shared.ConvertToRay(ethLog.Topics[3].Big().String()) rate := shared.ConvertToRay(ethLog.Topics[3].Big().String())
raw, err := json.Marshal(ethLog) raw, err := json.Marshal(ethLog)

View File

@ -3,7 +3,6 @@ package vat_grab
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
@ -20,10 +19,10 @@ func (VatGrabConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
return nil, err return nil, err
} }
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
urn := common.BytesToAddress(ethLog.Topics[2].Bytes()) urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
v := common.BytesToAddress(ethLog.Topics[3].Bytes()) v := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes())
wBytes := shared.GetDataBytesAtIndex(-3, ethLog.Data) wBytes := shared.GetDataBytesAtIndex(-3, ethLog.Data)
w := common.BytesToAddress(wBytes) w := shared.GetHexWithoutPrefix(wBytes)
dinkBytes := shared.GetDataBytesAtIndex(-2, ethLog.Data) dinkBytes := shared.GetDataBytesAtIndex(-2, ethLog.Data)
dink := big.NewInt(0).SetBytes(dinkBytes).String() dink := big.NewInt(0).SetBytes(dinkBytes).String()
dartBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data) dartBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data)
@ -35,9 +34,9 @@ func (VatGrabConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
model := VatGrabModel{ model := VatGrabModel{
Ilk: ilk, Ilk: ilk,
Urn: urn.String(), Urn: urn,
V: v.String(), V: v,
W: w.String(), W: w,
Dink: dink, Dink: dink,
Dart: dart, Dart: dart,
LogIndex: ethLog.Index, LogIndex: ethLog.Index,

View File

@ -19,8 +19,8 @@ package vat_heal
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
) )
@ -34,8 +34,8 @@ func (VatHealConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
return nil, err return nil, err
} }
urn := common.BytesToAddress(ethLog.Topics[1].Bytes()) urn := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
v := common.BytesToAddress(ethLog.Topics[2].Bytes()) v := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
radInt := ethLog.Topics[3].Big() radInt := ethLog.Topics[3].Big()
if err != nil { if err != nil {
return nil, err return nil, err
@ -47,8 +47,8 @@ func (VatHealConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
model := VatHealModel{ model := VatHealModel{
Urn: urn.String(), Urn: urn,
V: v.String(), V: v,
Rad: radInt.String(), Rad: radInt.String(),
LogIndex: ethLog.Index, LogIndex: ethLog.Index,
TransactionIndex: ethLog.TxIndex, TransactionIndex: ethLog.TxIndex,

View File

@ -19,8 +19,8 @@ package vat_move
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
shared2 "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
) )
type VatMoveConverter struct{} type VatMoveConverter struct{}
@ -33,8 +33,8 @@ func (VatMoveConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
return []interface{}{}, err return []interface{}{}, err
} }
src := common.BytesToAddress(ethLog.Topics[1].Bytes()) src := shared2.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
dst := common.BytesToAddress(ethLog.Topics[2].Bytes()) dst := shared2.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
rad := ethLog.Topics[3].Big() rad := ethLog.Topics[3].Big()
raw, err := json.Marshal(ethLog) raw, err := json.Marshal(ethLog)
if err != nil { if err != nil {
@ -42,8 +42,8 @@ func (VatMoveConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
models = append(models, VatMoveModel{ models = append(models, VatMoveModel{
Src: src.String(), Src: src,
Dst: dst.String(), Dst: dst,
Rad: rad.String(), Rad: rad.String(),
LogIndex: ethLog.Index, LogIndex: ethLog.Index,
TransactionIndex: ethLog.TxIndex, TransactionIndex: ethLog.TxIndex,

View File

@ -19,7 +19,6 @@ package vat_slip
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
) )
@ -34,7 +33,7 @@ func (VatSlipConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
return nil, err return nil, err
} }
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
guy := common.BytesToAddress(ethLog.Topics[2].Bytes()) guy := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
rad := ethLog.Topics[3].Big() rad := ethLog.Topics[3].Big()
raw, err := json.Marshal(ethLog) raw, err := json.Marshal(ethLog)
@ -43,7 +42,7 @@ func (VatSlipConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
model := VatSlipModel{ model := VatSlipModel{
Ilk: ilk, Ilk: ilk,
Guy: guy.String(), Guy: guy,
Rad: rad.String(), Rad: rad.String(),
TransactionIndex: ethLog.TxIndex, TransactionIndex: ethLog.TxIndex,
LogIndex: ethLog.Index, LogIndex: ethLog.Index,

View File

@ -5,7 +5,6 @@ import (
"errors" "errors"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
) )
@ -19,7 +18,7 @@ func (VatTollConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
return nil, err return nil, err
} }
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
urn := common.BytesToAddress(ethLog.Topics[2].Bytes()[:common.AddressLength]) urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
take := ethLog.Topics[3].Big() take := ethLog.Topics[3].Big()
raw, err := json.Marshal(ethLog) raw, err := json.Marshal(ethLog)
@ -28,7 +27,7 @@ func (VatTollConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
model := VatTollModel{ model := VatTollModel{
Ilk: ilk, Ilk: ilk,
Urn: urn.String(), Urn: urn,
Take: take.String(), Take: take.String(),
TransactionIndex: ethLog.TxIndex, TransactionIndex: ethLog.TxIndex,
LogIndex: ethLog.Index, LogIndex: ethLog.Index,

View File

@ -5,7 +5,6 @@ import (
"errors" "errors"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
@ -22,10 +21,10 @@ func (VatTuneConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
return nil, err return nil, err
} }
ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes()) ilk := shared.GetHexWithoutPrefix(ethLog.Topics[1].Bytes())
urn := common.BytesToAddress(ethLog.Topics[2].Bytes()) urn := shared.GetHexWithoutPrefix(ethLog.Topics[2].Bytes())
v := common.BytesToAddress(ethLog.Topics[3].Bytes()) v := shared.GetHexWithoutPrefix(ethLog.Topics[3].Bytes())
wBytes := shared.GetDataBytesAtIndex(-3, ethLog.Data) wBytes := shared.GetDataBytesAtIndex(-3, ethLog.Data)
w := common.BytesToAddress(wBytes) w := shared.GetHexWithoutPrefix(wBytes)
dinkBytes := shared.GetDataBytesAtIndex(-2, ethLog.Data) dinkBytes := shared.GetDataBytesAtIndex(-2, ethLog.Data)
dink := big.NewInt(0).SetBytes(dinkBytes) dink := big.NewInt(0).SetBytes(dinkBytes)
dartBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data) dartBytes := shared.GetDataBytesAtIndex(-1, ethLog.Data)
@ -37,9 +36,9 @@ func (VatTuneConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
} }
model := VatTuneModel{ model := VatTuneModel{
Ilk: ilk, Ilk: ilk,
Urn: urn.String(), Urn: urn,
V: v.String(), V: v,
W: w.String(), W: w,
Dink: dink.String(), Dink: dink.String(),
Dart: dart.String(), Dart: dart.String(),
TransactionIndex: ethLog.TxIndex, TransactionIndex: ethLog.TxIndex,