(VDB-249) Update numerical values for Vat.fold

- convert rate to ray
This commit is contained in:
Rob Mulholand 2018-11-13 16:33:20 -06:00
parent b922e73bf9
commit 4a5765b20d
3 changed files with 5 additions and 4 deletions

View File

@ -27,7 +27,7 @@ import (
var _ = Describe("VatFold Transformer", func() { var _ = Describe("VatFold Transformer", func() {
It("transforms VatFold log events", func() { It("transforms VatFold log events", func() {
blockNumber := int64(9051149) blockNumber := int64(9367233)
config := vat_fold.VatFoldConfig config := vat_fold.VatFoldConfig
config.StartingBlockNumber = blockNumber config.StartingBlockNumber = blockNumber
config.EndingBlockNumber = blockNumber config.EndingBlockNumber = blockNumber
@ -61,6 +61,6 @@ var _ = Describe("VatFold Transformer", func() {
dbResult := dbResults[0] dbResult := dbResults[0]
Expect(dbResult.Ilk).To(Equal("REP")) Expect(dbResult.Ilk).To(Equal("REP"))
Expect(dbResult.Urn).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String())) Expect(dbResult.Urn).To(Equal(common.HexToAddress("0x0000000000000000000000003728e9777b2a0a611ee0f89e00e01044ce4736d1").String()))
Expect(dbResult.Rate).To(Equal("0")) Expect(dbResult.Rate).To(Equal("0.000000000000000000000000000"))
}) })
}) })

View File

@ -47,7 +47,7 @@ var rawVatFoldLog, _ = json.Marshal(EthVatFoldLog)
var VatFoldModel = vat_fold.VatFoldModel{ var VatFoldModel = vat_fold.VatFoldModel{
Ilk: "REP", Ilk: "REP",
Urn: "0x3728e9777B2a0a611ee0F89e00E01044ce4736d1", Urn: "0x3728e9777B2a0a611ee0F89e00E01044ce4736d1",
Rate: "2", Rate: "0.000000000000000000000000002",
LogIndex: EthVatFoldLog.Index, LogIndex: EthVatFoldLog.Index,
TransactionIndex: EthVatFoldLog.TxIndex, TransactionIndex: EthVatFoldLog.TxIndex,
Raw: rawVatFoldLog, Raw: rawVatFoldLog,

View File

@ -20,6 +20,7 @@ import (
"errors" "errors"
"github.com/ethereum/go-ethereum/common" "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/constants" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
) )
@ -35,7 +36,7 @@ func (VatFoldConverter) ToModels(ethLogs []types.Log) ([]interface{}, error) {
ilk := string(bytes.Trim(ethLog.Topics[1].Bytes(), "\x00")) ilk := string(bytes.Trim(ethLog.Topics[1].Bytes(), "\x00"))
urn := common.BytesToAddress(ethLog.Topics[2].Bytes()).String() urn := common.BytesToAddress(ethLog.Topics[2].Bytes()).String()
rate := ethLog.Topics[3].Big().String() rate := shared.ConvertToRay(ethLog.Topics[3].Big().String())
raw, err := json.Marshal(ethLog) raw, err := json.Marshal(ethLog)
if err != nil { if err != nil {