Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
Merge pull request #14 from 8thlight/pit-file
Browse files Browse the repository at this point in the history
Pit file
  • Loading branch information
rmulhol authored Sep 6, 2018
2 parents f298a1a + d080038 commit d8d8386
Show file tree
Hide file tree
Showing 73 changed files with 2,256 additions and 172 deletions.
7 changes: 4 additions & 3 deletions db/migrations/1533844125_create_frob_table.up.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
CREATE TABLE maker.frob (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
tx_idx INTEGER,
ilk bytea,
lad bytea,
urn bytea,
dink NUMERIC,
dart NUMERIC,
ink NUMERIC,
art NUMERIC,
iart NUMERIC,
iart NUMERIC,
tx_idx INTEGER NOT NUll,
raw_log JSONB,
UNIQUE (header_id, tx_idx)
);
3 changes: 3 additions & 0 deletions db/migrations/1535667935_create_pit_file_table.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP TABLE maker.pit_file_ilk;
DROP TABLE maker.pit_file_stability_fee;
DROP TABLE maker.pit_file_debt_ceiling;
30 changes: 30 additions & 0 deletions db/migrations/1535667935_create_pit_file_table.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
CREATE TABLE maker.pit_file_ilk (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
ilk TEXT,
what TEXT,
data NUMERIC,
tx_idx INTEGER NOT NUll,
raw_log JSONB,
UNIQUE (header_id, tx_idx)
);

CREATE TABLE maker.pit_file_stability_fee (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
what TEXT,
data TEXT,
tx_idx INTEGER NOT NULL,
raw_log JSONB,
UNIQUE (header_id, tx_idx)
);

CREATE TABLE maker.pit_file_debt_ceiling (
id SERIAL PRIMARY KEY,
header_id INTEGER NOT NULL REFERENCES headers (id) ON DELETE CASCADE,
what TEXT,
data NUMERIC,
tx_idx INTEGER NOT NULL,
raw_log JSONB,
UNIQUE (header_id, tx_idx)
);
203 changes: 200 additions & 3 deletions db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,15 @@ ALTER SEQUENCE maker.flip_kick_db_id_seq OWNED BY maker.flip_kick.db_id;
CREATE TABLE maker.frob (
id integer NOT NULL,
header_id integer NOT NULL,
tx_idx integer,
ilk bytea,
lad bytea,
urn bytea,
dink numeric,
dart numeric,
ink numeric,
art numeric,
iart numeric
iart numeric,
tx_idx integer NOT NULL,
raw_log jsonb
);


Expand All @@ -155,6 +156,109 @@ CREATE SEQUENCE maker.frob_id_seq
ALTER SEQUENCE maker.frob_id_seq OWNED BY maker.frob.id;


--
-- Name: pit_file_debt_ceiling; Type: TABLE; Schema: maker; Owner: -
--

CREATE TABLE maker.pit_file_debt_ceiling (
id integer NOT NULL,
header_id integer NOT NULL,
what text,
data numeric,
tx_idx integer NOT NULL,
raw_log jsonb
);


--
-- Name: pit_file_debt_ceiling_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--

CREATE SEQUENCE maker.pit_file_debt_ceiling_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


--
-- Name: pit_file_debt_ceiling_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--

ALTER SEQUENCE maker.pit_file_debt_ceiling_id_seq OWNED BY maker.pit_file_debt_ceiling.id;


--
-- Name: pit_file_ilk; Type: TABLE; Schema: maker; Owner: -
--

CREATE TABLE maker.pit_file_ilk (
id integer NOT NULL,
header_id integer NOT NULL,
ilk text,
what text,
data numeric,
tx_idx integer NOT NULL,
raw_log jsonb
);


--
-- Name: pit_file_ilk_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--

CREATE SEQUENCE maker.pit_file_ilk_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


--
-- Name: pit_file_ilk_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--

ALTER SEQUENCE maker.pit_file_ilk_id_seq OWNED BY maker.pit_file_ilk.id;


--
-- Name: pit_file_stability_fee; Type: TABLE; Schema: maker; Owner: -
--

CREATE TABLE maker.pit_file_stability_fee (
id integer NOT NULL,
header_id integer NOT NULL,
what text,
data text,
tx_idx integer NOT NULL,
raw_log jsonb
);


--
-- Name: pit_file_stability_fee_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
--

CREATE SEQUENCE maker.pit_file_stability_fee_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;


--
-- Name: pit_file_stability_fee_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
--

ALTER SEQUENCE maker.pit_file_stability_fee_id_seq OWNED BY maker.pit_file_stability_fee.id;


--
-- Name: price_feeds; Type: TABLE; Schema: maker; Owner: -
--
Expand Down Expand Up @@ -619,6 +723,27 @@ ALTER TABLE ONLY maker.flip_kick ALTER COLUMN db_id SET DEFAULT nextval('maker.f
ALTER TABLE ONLY maker.frob ALTER COLUMN id SET DEFAULT nextval('maker.frob_id_seq'::regclass);


--
-- Name: pit_file_debt_ceiling id; Type: DEFAULT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_debt_ceiling ALTER COLUMN id SET DEFAULT nextval('maker.pit_file_debt_ceiling_id_seq'::regclass);


--
-- Name: pit_file_ilk id; Type: DEFAULT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_ilk ALTER COLUMN id SET DEFAULT nextval('maker.pit_file_ilk_id_seq'::regclass);


--
-- Name: pit_file_stability_fee id; Type: DEFAULT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_stability_fee ALTER COLUMN id SET DEFAULT nextval('maker.pit_file_stability_fee_id_seq'::regclass);


--
-- Name: price_feeds id; Type: DEFAULT; Schema: maker; Owner: -
--
Expand Down Expand Up @@ -744,6 +869,54 @@ ALTER TABLE ONLY maker.frob
ADD CONSTRAINT frob_pkey PRIMARY KEY (id);


--
-- Name: pit_file_debt_ceiling pit_file_debt_ceiling_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_debt_ceiling
ADD CONSTRAINT pit_file_debt_ceiling_header_id_tx_idx_key UNIQUE (header_id, tx_idx);


--
-- Name: pit_file_debt_ceiling pit_file_debt_ceiling_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_debt_ceiling
ADD CONSTRAINT pit_file_debt_ceiling_pkey PRIMARY KEY (id);


--
-- Name: pit_file_ilk pit_file_ilk_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_ilk
ADD CONSTRAINT pit_file_ilk_header_id_tx_idx_key UNIQUE (header_id, tx_idx);


--
-- Name: pit_file_ilk pit_file_ilk_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_ilk
ADD CONSTRAINT pit_file_ilk_pkey PRIMARY KEY (id);


--
-- Name: pit_file_stability_fee pit_file_stability_fee_header_id_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_stability_fee
ADD CONSTRAINT pit_file_stability_fee_header_id_tx_idx_key UNIQUE (header_id, tx_idx);


--
-- Name: pit_file_stability_fee pit_file_stability_fee_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_stability_fee
ADD CONSTRAINT pit_file_stability_fee_pkey PRIMARY KEY (id);


--
-- Name: price_feeds price_feeds_header_id_medianizer_address_tx_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
--
Expand Down Expand Up @@ -939,6 +1112,30 @@ ALTER TABLE ONLY maker.price_feeds
ADD CONSTRAINT headers_fk FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;


--
-- Name: pit_file_debt_ceiling pit_file_debt_ceiling_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_debt_ceiling
ADD CONSTRAINT pit_file_debt_ceiling_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;


--
-- Name: pit_file_ilk pit_file_ilk_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_ilk
ADD CONSTRAINT pit_file_ilk_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;


--
-- Name: pit_file_stability_fee pit_file_stability_fee_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--

ALTER TABLE ONLY maker.pit_file_stability_fee
ADD CONSTRAINT pit_file_stability_fee_header_id_fkey FOREIGN KEY (header_id) REFERENCES public.headers(id) ON DELETE CASCADE;


--
-- Name: tend tend_header_id_fkey; Type: FK CONSTRAINT; Schema: maker; Owner: -
--
Expand Down
6 changes: 6 additions & 0 deletions pkg/transformers/bite/bite_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"io/ioutil"
"log"
)

func TestBite(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Bite Suite")
}

var _ = BeforeSuite(func() {
log.SetOutput(ioutil.Discard)
})
6 changes: 3 additions & 3 deletions pkg/transformers/bite/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
)

var BiteConfig = shared.TransformerConfig{
ContractAddresses: "0xe0f0fa6982c59d8aa4ae0134bfe048327bd788cacf758b643ca41f055ffce76c", //this is a temporary address deployed locally
ContractAbi: BiteABI,
Topics: []string{BiteSignature},
ContractAddress: "0xe0f0fa6982c59d8aa4ae0134bfe048327bd788cacf758b643ca41f055ffce76c", //this is a temporary address deployed locally
ContractAbi: shared.CatABI,
Topics: []string{shared.BiteSignature},
StartingBlockNumber: 0,
EndingBlockNumber: 100,
}
22 changes: 0 additions & 22 deletions pkg/transformers/bite/constants.go

This file was deleted.

3 changes: 2 additions & 1 deletion pkg/transformers/bite/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
)

var _ = Describe("Bite Converter", func() {
var converter = bite.BiteConverter{}

Describe("ToEntity", func() {
It("converts an eth log to a bite entity", func() {
entity, err := converter.ToEntity(test_data.TemporaryBiteAddress, bite.BiteABI, test_data.EthBiteLog)
entity, err := converter.ToEntity(test_data.TemporaryBiteAddress, shared.CatABI, test_data.EthBiteLog)

Expect(err).NotTo(HaveOccurred())
Expect(entity.Ilk).To(Equal(test_data.BiteEntity.Ilk))
Expand Down
4 changes: 2 additions & 2 deletions pkg/transformers/bite/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("Integration tests", func() {
transactionConverter := rpc2.NewRpcTransactionConverter(ethClient)
realBlockChain := geth.NewBlockChain(blockChainClient, realNode, transactionConverter)
realFetcher := shared.NewFetcher(realBlockChain)
topic0 := common.HexToHash(bite.BiteSignature)
topic0 := common.HexToHash(shared.BiteSignature)
topics := [][]common.Hash{{topic0}}

result, err := realFetcher.FetchLogs(test_data.TemporaryBiteAddress, topics, int64(26))
Expand All @@ -64,7 +64,7 @@ var _ = Describe("Integration tests", func() {

It("unpacks an event log", func() {
address := common.HexToAddress(test_data.TemporaryBiteAddress)
abi, err := geth.ParseAbi(bite.BiteABI)
abi, err := geth.ParseAbi(shared.CatABI)
Expect(err).NotTo(HaveOccurred())

contract := bind.NewBoundContract(address, abi, nil, nil, nil)
Expand Down
Loading

0 comments on commit d8d8386

Please sign in to comment.