(VDB-253) Update numerical values for Pit.file debt ceiling

- convert Line to wad
This commit is contained in:
Rob Mulholand 2018-11-13 16:56:39 -06:00
parent 4a5765b20d
commit 087af252c9
3 changed files with 7 additions and 7 deletions

View File

@ -58,6 +58,6 @@ var _ = Describe("PitFileDebtCeiling LogNoteTransformer", func() {
Expect(len(dbResult)).To(Equal(1)) Expect(len(dbResult)).To(Equal(1))
Expect(dbResult[0].What).To(Equal("Line")) Expect(dbResult[0].What).To(Equal("Line"))
Expect(dbResult[0].Data).To(Equal("10000000000000000000000000")) Expect(dbResult[0].Data).To(Equal("10000000.000000000000000000"))
}) })
}) })

View File

@ -15,13 +15,12 @@
package debt_ceiling package debt_ceiling
import ( import (
"encoding/json"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
"math/big"
"bytes" "bytes"
"encoding/json"
"errors" "errors"
"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"
) )
type PitFileDebtCeilingConverter struct{} type PitFileDebtCeilingConverter struct{}
@ -34,7 +33,7 @@ func (PitFileDebtCeilingConverter) ToModels(ethLogs []types.Log) ([]interface{},
return nil, err return nil, err
} }
what := string(bytes.Trim(ethLog.Topics[2].Bytes(), "\x00")) what := string(bytes.Trim(ethLog.Topics[2].Bytes(), "\x00"))
data := big.NewInt(0).SetBytes(ethLog.Topics[3].Bytes()).String() data := shared.ConvertToWad(ethLog.Topics[3].Big().String())
raw, err := json.Marshal(ethLog) raw, err := json.Marshal(ethLog)
if err != nil { if err != nil {

View File

@ -25,6 +25,7 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/fakes" "github.com/vulcanize/vulcanizedb/pkg/fakes"
"github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling" "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling"
ilk2 "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk" ilk2 "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/ilk"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
) )
@ -48,7 +49,7 @@ var EthPitFileDebtCeilingLog = types.Log{
var rawPitFileDebtCeilingLog, _ = json.Marshal(EthPitFileDebtCeilingLog) var rawPitFileDebtCeilingLog, _ = json.Marshal(EthPitFileDebtCeilingLog)
var PitFileDebtCeilingModel = debt_ceiling.PitFileDebtCeilingModel{ var PitFileDebtCeilingModel = debt_ceiling.PitFileDebtCeilingModel{
What: "Line", What: "Line",
Data: big.NewInt(123456).String(), Data: shared.ConvertToWad(big.NewInt(123456).String()),
LogIndex: EthPitFileDebtCeilingLog.Index, LogIndex: EthPitFileDebtCeilingLog.Index,
TransactionIndex: EthPitFileDebtCeilingLog.TxIndex, TransactionIndex: EthPitFileDebtCeilingLog.TxIndex,
Raw: rawPitFileDebtCeilingLog, Raw: rawPitFileDebtCeilingLog,