diff --git a/pkg/transformers/integration_tests/pit_file_debt_ceiling.go b/pkg/transformers/integration_tests/pit_file_debt_ceiling.go index f3eaff08..c276a3d2 100644 --- a/pkg/transformers/integration_tests/pit_file_debt_ceiling.go +++ b/pkg/transformers/integration_tests/pit_file_debt_ceiling.go @@ -58,6 +58,6 @@ var _ = Describe("PitFileDebtCeiling LogNoteTransformer", func() { Expect(len(dbResult)).To(Equal(1)) Expect(dbResult[0].What).To(Equal("Line")) - Expect(dbResult[0].Data).To(Equal("10000000000000000000000000")) + Expect(dbResult[0].Data).To(Equal("10000000.000000000000000000")) }) }) diff --git a/pkg/transformers/pit_file/debt_ceiling/converter.go b/pkg/transformers/pit_file/debt_ceiling/converter.go index 76bd2ca1..e62f2b46 100644 --- a/pkg/transformers/pit_file/debt_ceiling/converter.go +++ b/pkg/transformers/pit_file/debt_ceiling/converter.go @@ -15,13 +15,12 @@ package debt_ceiling import ( - "encoding/json" - "github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants" - "math/big" - "bytes" + "encoding/json" "errors" "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{} @@ -34,7 +33,7 @@ func (PitFileDebtCeilingConverter) ToModels(ethLogs []types.Log) ([]interface{}, return nil, err } 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) if err != nil { diff --git a/pkg/transformers/test_data/pit_file.go b/pkg/transformers/test_data/pit_file.go index 3dfa8ba5..2d40d99e 100644 --- a/pkg/transformers/test_data/pit_file.go +++ b/pkg/transformers/test_data/pit_file.go @@ -25,6 +25,7 @@ import ( "github.com/vulcanize/vulcanizedb/pkg/fakes" "github.com/vulcanize/vulcanizedb/pkg/transformers/pit_file/debt_ceiling" 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" ) @@ -48,7 +49,7 @@ var EthPitFileDebtCeilingLog = types.Log{ var rawPitFileDebtCeilingLog, _ = json.Marshal(EthPitFileDebtCeilingLog) var PitFileDebtCeilingModel = debt_ceiling.PitFileDebtCeilingModel{ What: "Line", - Data: big.NewInt(123456).String(), + Data: shared.ConvertToWad(big.NewInt(123456).String()), LogIndex: EthPitFileDebtCeilingLog.Index, TransactionIndex: EthPitFileDebtCeilingLog.TxIndex, Raw: rawPitFileDebtCeilingLog,