Extract addresses to shared constants file

This commit is contained in:
Rob Mulholand 2018-09-11 12:01:12 -05:00
parent ceeaa0f8d3
commit dc9bda7d68
17 changed files with 39 additions and 38 deletions

View File

@ -21,7 +21,7 @@ import (
)
var BiteConfig = shared.TransformerConfig{
ContractAddress: "0xe0f0fa6982c59d8aa4ae0134bfe048327bd788cacf758b643ca41f055ffce76c", //this is a temporary address deployed locally
ContractAddress: shared.CatContractAddress,
ContractAbi: shared.CatABI,
Topics: []string{shared.BiteSignature},
StartingBlockNumber: 0,

View File

@ -34,7 +34,7 @@ var _ = Describe("Bite Converter", func() {
Describe("ToEntity", func() {
It("converts an eth log to a bite entity", func() {
entity, err := converter.ToEntity(test_data.TemporaryBiteAddress, shared.CatABI, test_data.EthBiteLog)
entity, err := converter.ToEntity(shared.CatContractAddress, shared.CatABI, test_data.EthBiteLog)
Expect(err).NotTo(HaveOccurred())
Expect(entity.Ilk).To(Equal(test_data.BiteEntity.Ilk))
@ -49,7 +49,7 @@ var _ = Describe("Bite Converter", func() {
})
It("returns an error if converting log to entity fails", func() {
_, err := converter.ToEntity(test_data.TemporaryBiteAddress, "error abi", test_data.EthBiteLog)
_, err := converter.ToEntity(shared.CatContractAddress, "error abi", test_data.EthBiteLog)
Expect(err).To(HaveOccurred())
})

View File

@ -51,11 +51,11 @@ var _ = Describe("Integration tests", func() {
topic0 := common.HexToHash(shared.BiteSignature)
topics := [][]common.Hash{{topic0}}
result, err := realFetcher.FetchLogs(test_data.TemporaryBiteAddress, topics, int64(26))
result, err := realFetcher.FetchLogs(shared.CatContractAddress, topics, int64(26))
Expect(err).NotTo(HaveOccurred())
Expect(len(result) > 0).To(BeTrue())
Expect(result[0].Address).To(Equal(common.HexToAddress(test_data.TemporaryBiteAddress)))
Expect(result[0].Address).To(Equal(common.HexToAddress(shared.CatContractAddress)))
Expect(result[0].TxHash).To(Equal(test_data.EthBiteLog.TxHash))
Expect(result[0].BlockNumber).To(Equal(test_data.EthBiteLog.BlockNumber))
Expect(result[0].Topics).To(Equal(test_data.EthBiteLog.Topics))
@ -63,7 +63,7 @@ var _ = Describe("Integration tests", func() {
})
It("unpacks an event log", func() {
address := common.HexToAddress(test_data.TemporaryBiteAddress)
address := common.HexToAddress(shared.CatContractAddress)
abi, err := geth.ParseAbi(shared.CatABI)
Expect(err).NotTo(HaveOccurred())

View File

@ -17,7 +17,7 @@ package frob
import "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
var FrobConfig = shared.TransformerConfig{
ContractAddress: "0xff3f2400f1600f3f493a9a92704a29b96795af1a", //this is a temporary address deployed locally
ContractAddress: shared.PitContractAddress,
ContractAbi: shared.PitABI,
Topics: []string{shared.FrobSignature},
StartingBlockNumber: 0,

View File

@ -27,7 +27,7 @@ var _ = Describe("Frob converter", func() {
It("converts a log to an entity", func() {
converter := frob.FrobConverter{}
entity, err := converter.ToEntity(test_data.TemporaryFrobAddress, shared.PitABI, test_data.EthFrobLog)
entity, err := converter.ToEntity(shared.PitContractAddress, shared.PitABI, test_data.EthFrobLog)
Expect(err).NotTo(HaveOccurred())
Expect(entity).To(Equal(test_data.FrobEntity))

View File

@ -49,11 +49,11 @@ var _ = Describe("Integration tests", func() {
topic0 := common.HexToHash(shared.FrobSignature)
topics := [][]common.Hash{{topic0}}
result, err := realFetcher.FetchLogs(test_data.TemporaryFrobAddress, topics, int64(12))
result, err := realFetcher.FetchLogs(shared.PitContractAddress, topics, int64(12))
Expect(err).NotTo(HaveOccurred())
Expect(len(result) > 0).To(BeTrue())
Expect(result[0].Address).To(Equal(common.HexToAddress(test_data.TemporaryFrobAddress)))
Expect(result[0].Address).To(Equal(common.HexToAddress(shared.PitContractAddress)))
Expect(result[0].TxHash).To(Equal(test_data.EthFrobLog.TxHash))
Expect(result[0].BlockNumber).To(Equal(test_data.EthFrobLog.BlockNumber))
Expect(result[0].Topics).To(Equal(test_data.EthFrobLog.Topics))
@ -61,7 +61,7 @@ var _ = Describe("Integration tests", func() {
})
It("unpacks an event log", func() {
address := common.HexToAddress(test_data.TemporaryFrobAddress)
address := common.HexToAddress(shared.PitContractAddress)
abi, err := geth.ParseAbi(shared.PitABI)
Expect(err).NotTo(HaveOccurred())

View File

@ -19,7 +19,7 @@ import (
)
var PitFileConfig = shared.TransformerConfig{
ContractAddress: "0xff3f2400f1600f3f493a9a92704a29b96795af1a", // temporary address from Ganache deploy
ContractAddress: shared.PitContractAddress,
ContractAbi: shared.PitABI,
Topics: []string{shared.PitFileIlkSignature, shared.PitFileDebtCeilingSignature, shared.PitFileStabilityFeeSignature},
StartingBlockNumber: 0,

View File

@ -27,7 +27,7 @@ var _ = Describe("", func() {
It("converts a log to an model", func() {
converter := debt_ceiling.PitFileDebtCeilingConverter{}
model, err := converter.ToModel(test_data.PitAddress, shared.PitABI, test_data.EthPitFileDebtCeilingLog)
model, err := converter.ToModel(shared.PitContractAddress, shared.PitABI, test_data.EthPitFileDebtCeilingLog)
Expect(err).NotTo(HaveOccurred())
Expect(model).To(Equal(test_data.PitFileDebtCeilingModel))

View File

@ -27,7 +27,7 @@ var _ = Describe("Pit file ilk converter", func() {
It("converts a log to an model", func() {
converter := ilk.PitFileIlkConverter{}
model, err := converter.ToModel(test_data.PitAddress, shared.PitABI, test_data.EthPitFileIlkLog)
model, err := converter.ToModel(shared.PitContractAddress, shared.PitABI, test_data.EthPitFileIlkLog)
Expect(err).NotTo(HaveOccurred())
Expect(model).To(Equal(test_data.PitFileIlkModel))

View File

@ -27,7 +27,7 @@ var _ = Describe("Pit file stability fee converter", func() {
It("converts a log to an model", func() {
converter := stability_fee.PitFileStabilityFeeConverter{}
model, err := converter.ToModel(test_data.PitAddress, shared.PitABI, test_data.EthPitFileStabilityFeeLog)
model, err := converter.ToModel(shared.PitContractAddress, shared.PitABI, test_data.EthPitFileStabilityFeeLog)
Expect(err).NotTo(HaveOccurred())
Expect(model).To(Equal(test_data.PitFileStabilityFeeModel))

View File

@ -14,11 +14,9 @@
package price_feeds
var (
PepAddress = "0x99041F808D598B782D5a3e498681C2452A31da08"
PipAddress = "0x729D19f657BD0614b4985Cf1D82531c67569197B"
RepAddress = "0xF5f94b7F9De14D43112e713835BCef2d55b76c1C"
)
import "github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
var ()
type IPriceFeedConfig struct {
ContractAddresses []string
@ -28,9 +26,9 @@ type IPriceFeedConfig struct {
var PriceFeedConfig = IPriceFeedConfig{
ContractAddresses: []string{
PepAddress,
PipAddress,
RepAddress,
shared.PepContractAddress,
shared.PipContractAddress,
shared.RepContractAddress,
},
StartingBlockNumber: 0,
EndingBlockNumber: 100,

View File

@ -32,7 +32,14 @@ var (
PitABI = `[{"constant":true,"inputs":[],"name":"vat","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x36569e77"},{"constant":true,"inputs":[],"name":"live","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x957aa58c"},{"constant":true,"inputs":[],"name":"drip","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x9f678cca"},{"constant":true,"inputs":[],"name":"Line","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbabe8a3f"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"spot","type":"uint256"},{"name":"line","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"inputs":[{"name":"vat_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"ilk","type":"bytes32"},{"indexed":true,"name":"urn","type":"bytes32"},{"indexed":false,"name":"ink","type":"uint256"},{"indexed":false,"name":"art","type":"uint256"},{"indexed":false,"name":"dink","type":"int256"},{"indexed":false,"name":"dart","type":"int256"},{"indexed":false,"name":"iArt","type":"uint256"}],"name":"Frob","type":"event","signature":"0xb2afa28318bcc689926b52835d844de174ef8de97e982a85c0199d584920791b"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event","signature":"0x644843f351d3fba4abcd60109eaff9f54bac8fb8ccf0bab941009c21df21cf31"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x1a0b287e"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"uint256"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x29ae8114"},{"constant":false,"inputs":[{"name":"what","type":"bytes32"},{"name":"data","type":"address"}],"name":"file","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xd4e8be83"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"frob","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5a984ded"}]`
VatABI = `[{"constant":true,"inputs":[],"name":"debt","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x0dca59c1"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"bytes32"}],"name":"urns","outputs":[{"name":"ink","type":"uint256"},{"name":"art","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x26e27482"},{"constant":true,"inputs":[],"name":"vice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x2d61a355"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"sin","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xa60f1d3e"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"wards","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xbf353dbb"},{"constant":true,"inputs":[{"name":"","type":"bytes32"},{"name":"","type":"bytes32"}],"name":"gem","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xc0912683"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"ilks","outputs":[{"name":"take","type":"uint256"},{"name":"rate","type":"uint256"},{"name":"Ink","type":"uint256"},{"name":"Art","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd9638d36"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"dai","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xf53e4e69"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":true,"name":"too","type":"bytes32"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"Note","type":"event","signature":"0x8c2dbbc2b33ffaa77c104b777e574a8a4ff79829dfee8b66f4dc63e3f8067152"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"rely","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x65fae35e"},{"constant":false,"inputs":[{"name":"guy","type":"address"}],"name":"deny","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x9c52a7f1"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"}],"name":"init","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x3b663195"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"guy","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"slip","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x42066cbb"},{"constant":false,"inputs":[{"name":"ilk","type":"bytes32"},{"name":"src","type":"bytes32"},{"name":"dst","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"flux","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xa6e41821"},{"constant":false,"inputs":[{"name":"src","type":"bytes32"},{"name":"dst","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"move","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x78f19470"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"w","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"tune","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5dd6471a"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"w","type":"bytes32"},{"name":"dink","type":"int256"},{"name":"dart","type":"int256"}],"name":"grab","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x3690ae4c"},{"constant":false,"inputs":[{"name":"u","type":"bytes32"},{"name":"v","type":"bytes32"},{"name":"rad","type":"int256"}],"name":"heal","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x990a5f63"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"rate","type":"int256"}],"name":"fold","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xe6a6a64d"},{"constant":false,"inputs":[{"name":"i","type":"bytes32"},{"name":"u","type":"bytes32"},{"name":"take","type":"int256"}],"name":"toll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x09b7a0b5"}]`
FlipperContractAddress = "0x6b59c42097e2fff7cad96cb08ceefd601081ad9c" //this is a temporary address deployed locally
// temporary addresses from local Ganache deployment
CatContractAddress = "0xe0f0fa6982c59d8aa4ae0134bfe048327bd788cacf758b643ca41f055ffce76c"
FlipperContractAddress = "0x6b59c42097e2fff7cad96cb08ceefd601081ad9c"
PepContractAddress = "0x99041F808D598B782D5a3e498681C2452A31da08"
PipContractAddress = "0x729D19f657BD0614b4985Cf1D82531c67569197B"
PitContractAddress = "0xff3f2400f1600f3f493a9a92704a29b96795af1a"
RepContractAddress = "0xF5f94b7F9De14D43112e713835BCef2d55b76c1C"
VatContractAddress = "0x239E6f0AB02713f1F8AA90ebeDeD9FC66Dc96CD6"
BiteSignature = GetEventSignature(biteMethod)
DentFunctionSignature = GetLogNoteSignature(dentMethod)

View File

@ -20,12 +20,12 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/bite"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"math/big"
"strconv"
)
var (
TemporaryBiteAddress = "0x4ac9588a53dc6008058c86eed71a5c91da793a07"
TemporaryBiteBlockHash = common.HexToHash("0xd130caaccc9203ca63eb149faeb013aed21f0317ce23489c0486da2f9adcd0eb")
TemporaryBiteBlockNumber = int64(26)
TemporaryBiteData = "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000005"
@ -46,7 +46,7 @@ var (
)
var EthBiteLog = types.Log{
Address: common.HexToAddress(TemporaryBiteAddress),
Address: common.HexToAddress(shared.CatContractAddress),
Topics: []common.Hash{
common.HexToHash("0x99b5620489b6ef926d4518936cfec15d305452712b88bd59da2d9c10fb0953e8"),
common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"),

View File

@ -20,11 +20,11 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/frob"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"math/big"
)
var (
TemporaryFrobAddress = "0xff3f2400f1600f3f493a9a92704a29b96795af1a"
TemporaryFrobBlockHash = common.HexToHash("0x67ae45eace52de052a0fc58598974b101733f823fc191329ace7aded9a72b84b")
TemporaryFrobBlockNumber = int64(13)
TemporaryFrobData = "0x000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019"
@ -44,7 +44,7 @@ var (
)
var EthFrobLog = types.Log{
Address: common.HexToAddress(TemporaryFrobAddress),
Address: common.HexToAddress(shared.PitContractAddress),
Topics: []common.Hash{
common.HexToHash("0xb2afa28318bcc689926b52835d844de174ef8de97e982a85c0199d584920791b"),
common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"),

View File

@ -25,14 +25,11 @@ import (
"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/pit_file/stability_fee"
)
var (
PitAddress = "0xff3f2400f1600f3f493a9a92704a29b96795af1a"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
)
var EthPitFileDebtCeilingLog = types.Log{
Address: common.HexToAddress(PitAddress),
Address: common.HexToAddress(shared.PitContractAddress),
Topics: []common.Hash{
common.HexToHash("0x29ae811400000000000000000000000000000000000000000000000000000000"),
common.HexToHash("0x00000000000000000000000064d922894153be9eef7b7218dc565d1d0ce2a092"),
@ -57,7 +54,7 @@ var PitFileDebtCeilingModel = debt_ceiling.PitFileDebtCeilingModel{
}
var EthPitFileIlkLog = types.Log{
Address: common.HexToAddress(PitAddress),
Address: common.HexToAddress(shared.PitContractAddress),
Topics: []common.Hash{
common.HexToHash("0x1a0b287e00000000000000000000000000000000000000000000000000000000"),
common.HexToHash("0x0000000000000000000000000f243e26db94b5426032e6dfa6007802dea2a614"),

View File

@ -21,13 +21,12 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/vat_init"
)
var VatAddress = "0x239E6f0AB02713f1F8AA90ebeDeD9FC66Dc96CD6"
var EthVatInitLog = types.Log{
Address: common.HexToAddress(VatAddress),
Address: common.HexToAddress(shared.VatContractAddress),
Topics: []common.Hash{
common.HexToHash("0x3b66319500000000000000000000000000000000000000000000000000000000"),
common.HexToHash("0x66616b6520696c6b000000000000000000000000000000000000000000000000"),

View File

@ -19,7 +19,7 @@ import (
)
var VatInitConfig = shared.TransformerConfig{
ContractAddress: "0x239E6f0AB02713f1F8AA90ebeDeD9FC66Dc96CD6", // temporary address from Ganache deploy
ContractAddress: shared.VatContractAddress,
ContractAbi: shared.VatABI,
Topics: []string{shared.VatInitSignature},
StartingBlockNumber: 0,