Merge pull request #9 from vulcanize/VDB322-Vow-storage-diff
Vdb322 vow storage diff
This commit is contained in:
commit
2ecc524224
@ -60,6 +60,7 @@ func parseStorageDiffs() {
|
||||
watcher.AddTransformers([]storage.TransformerInitializer{
|
||||
transformers.GetPitStorageTransformer().NewTransformer,
|
||||
transformers.GetVatStorageTransformer().NewTransformer,
|
||||
transformers.GetVowStorageTransformer().NewTransformer,
|
||||
})
|
||||
|
||||
err = watcher.Execute()
|
||||
|
@ -99,4 +99,4 @@ DROP TABLE maker.vat_urn_art;
|
||||
DROP TABLE maker.vat_urn_ink;
|
||||
DROP TABLE maker.vat_gem;
|
||||
DROP TABLE maker.vat_dai;
|
||||
DROP TABLE maker.vat_sin;
|
||||
DROP TABLE maker.vat_sin;
|
||||
|
82
db/migrations/00074_create_vow_contract_storage_tables.sql
Normal file
82
db/migrations/00074_create_vow_contract_storage_tables.sql
Normal file
@ -0,0 +1,82 @@
|
||||
-- +goose Up
|
||||
CREATE TABLE maker.vow_vat (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
vat TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_cow (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
cow TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_row (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
row TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_sin (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
sin numeric
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_woe (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
woe numeric
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_ash (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
ash numeric
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_wait (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
wait numeric
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_sump (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
sump numeric
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_bump (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
bump numeric
|
||||
);
|
||||
|
||||
CREATE TABLE maker.vow_hump (
|
||||
id SERIAL PRIMARY KEY,
|
||||
block_number BIGINT,
|
||||
block_hash TEXT,
|
||||
hump numeric
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE maker.vow_vat;
|
||||
DROP TABLE maker.vow_cow;
|
||||
DROP TABLE maker.vow_row;
|
||||
DROP TABLE maker.vow_sin;
|
||||
DROP TABLE maker.vow_woe;
|
||||
DROP TABLE maker.vow_ash;
|
||||
DROP TABLE maker.vow_wait;
|
||||
DROP TABLE maker.vow_sump;
|
||||
DROP TABLE maker.vow_bump;
|
||||
DROP TABLE maker.vow_hump;
|
474
db/schema.sql
474
db/schema.sql
@ -2,8 +2,8 @@
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 10.5
|
||||
-- Dumped by pg_dump version 10.5
|
||||
-- Dumped from database version 10.4
|
||||
-- Dumped by pg_dump version 10.4
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
@ -1605,6 +1605,102 @@ CREATE SEQUENCE maker.vat_vice_id_seq
|
||||
ALTER SEQUENCE maker.vat_vice_id_seq OWNED BY maker.vat_vice.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_ash; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_ash (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
ash numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_ash_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_ash_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_ash_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_ash_id_seq OWNED BY maker.vow_ash.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_bump; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_bump (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
bump numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_bump_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_bump_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_bump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_bump_id_seq OWNED BY maker.vow_bump.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_cow; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_cow (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
cow text
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_cow_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_cow_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_cow_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_cow_id_seq OWNED BY maker.vow_cow.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_flog; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
@ -1639,6 +1735,230 @@ CREATE SEQUENCE maker.vow_flog_id_seq
|
||||
ALTER SEQUENCE maker.vow_flog_id_seq OWNED BY maker.vow_flog.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_hump; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_hump (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
hump numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_hump_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_hump_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_hump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_hump_id_seq OWNED BY maker.vow_hump.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_row; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_row (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
"row" text
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_row_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_row_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_row_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_row_id_seq OWNED BY maker.vow_row.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sin; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_sin (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
sin numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sin_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_sin_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sin_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_sin_id_seq OWNED BY maker.vow_sin.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sump; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_sump (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
sump numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sump_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_sump_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sump_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_sump_id_seq OWNED BY maker.vow_sump.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_vat; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_vat (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
vat text
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_vat_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_vat_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_vat_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_vat_id_seq OWNED BY maker.vow_vat.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_wait; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_wait (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
wait numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_wait_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_wait_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_wait_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_wait_id_seq OWNED BY maker.vow_wait.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_woe; Type: TABLE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE maker.vow_woe (
|
||||
id integer NOT NULL,
|
||||
block_number bigint,
|
||||
block_hash text,
|
||||
woe numeric
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_woe_id_seq; Type: SEQUENCE; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE maker.vow_woe_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_woe_id_seq; Type: SEQUENCE OWNED BY; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER SEQUENCE maker.vow_woe_id_seq OWNED BY maker.vow_woe.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: logs; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@ -2400,6 +2720,27 @@ ALTER TABLE ONLY maker.vat_urn_ink ALTER COLUMN id SET DEFAULT nextval('maker.va
|
||||
ALTER TABLE ONLY maker.vat_vice ALTER COLUMN id SET DEFAULT nextval('maker.vat_vice_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_ash id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_ash ALTER COLUMN id SET DEFAULT nextval('maker.vow_ash_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_bump id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_bump ALTER COLUMN id SET DEFAULT nextval('maker.vow_bump_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_cow id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_cow ALTER COLUMN id SET DEFAULT nextval('maker.vow_cow_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_flog id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
@ -2407,6 +2748,55 @@ ALTER TABLE ONLY maker.vat_vice ALTER COLUMN id SET DEFAULT nextval('maker.vat_v
|
||||
ALTER TABLE ONLY maker.vow_flog ALTER COLUMN id SET DEFAULT nextval('maker.vow_flog_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_hump id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_hump ALTER COLUMN id SET DEFAULT nextval('maker.vow_hump_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_row id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_row ALTER COLUMN id SET DEFAULT nextval('maker.vow_row_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sin id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_sin ALTER COLUMN id SET DEFAULT nextval('maker.vow_sin_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sump id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_sump ALTER COLUMN id SET DEFAULT nextval('maker.vow_sump_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_vat id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_vat ALTER COLUMN id SET DEFAULT nextval('maker.vow_vat_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_wait id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_wait ALTER COLUMN id SET DEFAULT nextval('maker.vow_wait_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_woe id; Type: DEFAULT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_woe ALTER COLUMN id SET DEFAULT nextval('maker.vow_woe_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: blocks id; Type: DEFAULT; Schema: public; Owner: -
|
||||
--
|
||||
@ -3052,6 +3442,30 @@ ALTER TABLE ONLY maker.vat_vice
|
||||
ADD CONSTRAINT vat_vice_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_ash vow_ash_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_ash
|
||||
ADD CONSTRAINT vow_ash_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_bump vow_bump_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_bump
|
||||
ADD CONSTRAINT vow_bump_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_cow vow_cow_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_cow
|
||||
ADD CONSTRAINT vow_cow_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_flog vow_flog_header_id_tx_idx_log_idx_key; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
@ -3068,6 +3482,62 @@ ALTER TABLE ONLY maker.vow_flog
|
||||
ADD CONSTRAINT vow_flog_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_hump vow_hump_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_hump
|
||||
ADD CONSTRAINT vow_hump_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_row vow_row_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_row
|
||||
ADD CONSTRAINT vow_row_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sin vow_sin_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_sin
|
||||
ADD CONSTRAINT vow_sin_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_sump vow_sump_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_sump
|
||||
ADD CONSTRAINT vow_sump_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_vat vow_vat_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_vat
|
||||
ADD CONSTRAINT vow_vat_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_wait vow_wait_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_wait
|
||||
ADD CONSTRAINT vow_wait_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vow_woe vow_woe_pkey; Type: CONSTRAINT; Schema: maker; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY maker.vow_woe
|
||||
ADD CONSTRAINT vow_woe_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -18,7 +18,6 @@ package postgres
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/lib/pq" //postgres driver
|
||||
@ -41,7 +40,6 @@ var (
|
||||
|
||||
func NewDB(databaseConfig config.Database, node core.Node) (*DB, error) {
|
||||
connectString := config.DbConnectionString(databaseConfig)
|
||||
logrus.Info("Using connection string: ", connectString)
|
||||
db, err := sqlx.Connect("postgres", connectString)
|
||||
if err != nil {
|
||||
return &DB{}, ErrDBConnectionFailed
|
||||
|
152
pkg/transformers/storage_diffs/maker/vow/mappings.go
Normal file
152
pkg/transformers/storage_diffs/maker/vow/mappings.go
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright 2018 Vulcanize
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package vow
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared"
|
||||
)
|
||||
|
||||
const (
|
||||
VowVat = "vat"
|
||||
VowCow = "cow"
|
||||
VowRow = "row"
|
||||
VowSin = "Sin"
|
||||
VowWoe = "Woe"
|
||||
VowAsh = "Ash"
|
||||
VowWait = "wait"
|
||||
VowSump = "sump"
|
||||
VowBump = "bump"
|
||||
VowHump = "hump"
|
||||
)
|
||||
|
||||
var (
|
||||
VatKey = common.HexToHash(storage_diffs.IndexOne)
|
||||
VatMetadata = shared.StorageValueMetadata{
|
||||
Name: VowVat,
|
||||
Keys: nil,
|
||||
Type: shared.Address,
|
||||
}
|
||||
|
||||
CowKey = common.HexToHash(storage_diffs.IndexTwo)
|
||||
CowMetadata = shared.StorageValueMetadata{
|
||||
Name: VowCow,
|
||||
Keys: nil,
|
||||
Type: shared.Address,
|
||||
}
|
||||
|
||||
RowKey = common.HexToHash(storage_diffs.IndexThree)
|
||||
RowMetadata = shared.StorageValueMetadata{
|
||||
Name: VowRow,
|
||||
Keys: nil,
|
||||
Type: shared.Address,
|
||||
}
|
||||
|
||||
SinKey = common.HexToHash(storage_diffs.IndexFive)
|
||||
SinMetadata = shared.StorageValueMetadata{
|
||||
Name: VowSin,
|
||||
Keys: nil,
|
||||
Type: shared.Uint256,
|
||||
}
|
||||
|
||||
WoeKey = common.HexToHash(storage_diffs.IndexSix)
|
||||
WoeMetadata = shared.StorageValueMetadata{
|
||||
Name: VowWoe,
|
||||
Keys: nil,
|
||||
Type: shared.Uint256,
|
||||
}
|
||||
|
||||
AshKey = common.HexToHash(storage_diffs.IndexSeven)
|
||||
AshMetadata = shared.StorageValueMetadata{
|
||||
Name: VowAsh,
|
||||
Keys: nil,
|
||||
Type: shared.Uint256,
|
||||
}
|
||||
|
||||
WaitKey = common.HexToHash(storage_diffs.IndexEight)
|
||||
WaitMetadata = shared.StorageValueMetadata{
|
||||
Name: VowWait,
|
||||
Keys: nil,
|
||||
Type: shared.Uint256,
|
||||
}
|
||||
|
||||
SumpKey = common.HexToHash(storage_diffs.IndexNine)
|
||||
SumpMetadata = shared.StorageValueMetadata{
|
||||
Name: VowSump,
|
||||
Keys: nil,
|
||||
Type: shared.Uint256,
|
||||
}
|
||||
|
||||
BumpKey = common.HexToHash(storage_diffs.IndexTen)
|
||||
BumpMetadata = shared.StorageValueMetadata{
|
||||
Name: VowBump,
|
||||
Keys: nil,
|
||||
Type: shared.Uint256,
|
||||
}
|
||||
|
||||
HumpKey = common.HexToHash(storage_diffs.IndexEleven)
|
||||
HumpMetadata = shared.StorageValueMetadata{
|
||||
Name: VowHump,
|
||||
Keys: nil,
|
||||
Type: shared.Uint256,
|
||||
}
|
||||
)
|
||||
|
||||
type VowMappings struct {
|
||||
StorageRepository maker.IMakerStorageRepository
|
||||
mappings map[common.Hash]shared.StorageValueMetadata
|
||||
}
|
||||
|
||||
func (mappings *VowMappings) Lookup(key common.Hash) (shared.StorageValueMetadata, error) {
|
||||
metadata, ok := mappings.mappings[key]
|
||||
if !ok {
|
||||
err := mappings.loadMappings()
|
||||
if err != nil {
|
||||
return metadata, err
|
||||
}
|
||||
metadata, ok = mappings.mappings[key]
|
||||
if !ok {
|
||||
return metadata, shared.ErrStorageKeyNotFound{Key: key.Hex()}
|
||||
}
|
||||
}
|
||||
return metadata, nil
|
||||
}
|
||||
|
||||
func (mappings *VowMappings) loadMappings() error {
|
||||
staticMappings := make(map[common.Hash]shared.StorageValueMetadata)
|
||||
staticMappings[VatKey] = VatMetadata
|
||||
staticMappings[CowKey] = CowMetadata
|
||||
staticMappings[RowKey] = RowMetadata
|
||||
staticMappings[SinKey] = SinMetadata
|
||||
staticMappings[WoeKey] = WoeMetadata
|
||||
staticMappings[AshKey] = AshMetadata
|
||||
staticMappings[WaitKey] = WaitMetadata
|
||||
staticMappings[SumpKey] = SumpMetadata
|
||||
staticMappings[BumpKey] = BumpMetadata
|
||||
staticMappings[HumpKey] = HumpMetadata
|
||||
|
||||
mappings.mappings = staticMappings
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mappings *VowMappings) SetDB(db *postgres.DB) {
|
||||
mappings.StorageRepository.SetDB(db)
|
||||
}
|
42
pkg/transformers/storage_diffs/maker/vow/mappings_test.go
Normal file
42
pkg/transformers/storage_diffs/maker/vow/mappings_test.go
Normal file
@ -0,0 +1,42 @@
|
||||
package vow_test
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/fakes"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/test_helpers"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vow"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared"
|
||||
)
|
||||
|
||||
var _ = Describe("Vow storage mappings", func() {
|
||||
Describe("looking up static keys", func() {
|
||||
It("returns value metadata if key exists", func() {
|
||||
storageRepository := &test_helpers.MockMakerStorageRepository{}
|
||||
|
||||
mappings := vow.VowMappings{StorageRepository: storageRepository}
|
||||
|
||||
Expect(mappings.Lookup(vow.VatKey)).To(Equal(vow.VatMetadata))
|
||||
Expect(mappings.Lookup(vow.CowKey)).To(Equal(vow.CowMetadata))
|
||||
Expect(mappings.Lookup(vow.RowKey)).To(Equal(vow.RowMetadata))
|
||||
Expect(mappings.Lookup(vow.SinKey)).To(Equal(vow.SinMetadata))
|
||||
Expect(mappings.Lookup(vow.WoeKey)).To(Equal(vow.WoeMetadata))
|
||||
Expect(mappings.Lookup(vow.AshKey)).To(Equal(vow.AshMetadata))
|
||||
Expect(mappings.Lookup(vow.WaitKey)).To(Equal(vow.WaitMetadata))
|
||||
Expect(mappings.Lookup(vow.SumpKey)).To(Equal(vow.SumpMetadata))
|
||||
Expect(mappings.Lookup(vow.BumpKey)).To(Equal(vow.BumpMetadata))
|
||||
Expect(mappings.Lookup(vow.HumpKey)).To(Equal(vow.HumpMetadata))
|
||||
})
|
||||
|
||||
It("returns error if key does not exist", func() {
|
||||
storageRepository := &test_helpers.MockMakerStorageRepository{}
|
||||
|
||||
mappings := vow.VowMappings{StorageRepository: storageRepository}
|
||||
_, err := mappings.Lookup(common.HexToHash(fakes.FakeHash.Hex()))
|
||||
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err).To(MatchError(shared.ErrStorageKeyNotFound{Key: fakes.FakeHash.Hex()}))
|
||||
})
|
||||
})
|
||||
})
|
117
pkg/transformers/storage_diffs/maker/vow/repository.go
Normal file
117
pkg/transformers/storage_diffs/maker/vow/repository.go
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2018 Vulcanize
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package vow
|
||||
|
||||
import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/shared"
|
||||
)
|
||||
|
||||
type VowStorageRepository struct {
|
||||
db *postgres.DB
|
||||
}
|
||||
|
||||
func (repository *VowStorageRepository) SetDB(db *postgres.DB) {
|
||||
repository.db = db
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) Create(blockNumber int, blockHash string, metadata shared.StorageValueMetadata, value interface{}) error {
|
||||
switch metadata.Name {
|
||||
case VowVat:
|
||||
return repository.insertVowVat(blockNumber, blockHash, value.(string))
|
||||
case VowCow:
|
||||
return repository.insertVowCow(blockNumber, blockHash, value.(string))
|
||||
case VowRow:
|
||||
return repository.insertVowRow(blockNumber, blockHash, value.(string))
|
||||
case VowSin:
|
||||
return repository.insertVowSin(blockNumber, blockHash, value.(string))
|
||||
case VowWoe:
|
||||
return repository.insertVowWoe(blockNumber, blockHash, value.(string))
|
||||
case VowAsh:
|
||||
return repository.insertVowAsh(blockNumber, blockHash, value.(string))
|
||||
case VowWait:
|
||||
return repository.insertVowWait(blockNumber, blockHash, value.(string))
|
||||
case VowSump:
|
||||
return repository.insertVowSump(blockNumber, blockHash, value.(string))
|
||||
case VowBump:
|
||||
return repository.insertVowBump(blockNumber, blockHash, value.(string))
|
||||
case VowHump:
|
||||
return repository.insertVowHump(blockNumber, blockHash, value.(string))
|
||||
default:
|
||||
panic("unrecognized storage metadata name")
|
||||
}
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowVat(blockNumber int, blockHash string, vat string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_vat (block_number, block_hash, vat) VALUES ($1, $2, $3)`, blockNumber, blockHash, vat)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowCow(blockNumber int, blockHash string, cow string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_cow (block_number, block_hash, cow) VALUES ($1, $2, $3)`, blockNumber, blockHash, cow)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowRow(blockNumber int, blockHash string, row string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_row (block_number, block_hash, row) VALUES ($1, $2, $3)`, blockNumber, blockHash, row)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowSin(blockNumber int, blockHash string, sin string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_sin (block_number, block_hash, sin) VALUES ($1, $2, $3)`, blockNumber, blockHash, sin)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowWoe(blockNumber int, blockHash string, woe string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_woe (block_number, block_hash, woe) VALUES ($1, $2, $3)`, blockNumber, blockHash, woe)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowAsh(blockNumber int, blockHash string, ash string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_ash (block_number, block_hash, ash) VALUES ($1, $2, $3)`, blockNumber, blockHash, ash)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowWait(blockNumber int, blockHash string, wait string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_wait (block_number, block_hash, wait) VALUES ($1, $2, $3)`, blockNumber, blockHash, wait)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowSump(blockNumber int, blockHash string, sump string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_sump (block_number, block_hash, sump) VALUES ($1, $2, $3)`, blockNumber, blockHash, sump)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowBump(blockNumber int, blockHash string, bump string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_bump (block_number, block_hash, bump) VALUES ($1, $2, $3)`, blockNumber, blockHash, bump)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (repository VowStorageRepository) insertVowHump(blockNumber int, blockHash string, hump string) error {
|
||||
_, err := repository.db.Exec(`INSERT INTO maker.vow_hump (block_number, block_hash, hump) VALUES ($1, $2, $3)`, blockNumber, blockHash, hump)
|
||||
|
||||
return err
|
||||
}
|
230
pkg/transformers/storage_diffs/maker/vow/repository_test.go
Normal file
230
pkg/transformers/storage_diffs/maker/vow/repository_test.go
Normal file
@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright 2018 Vulcanize
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package vow_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vow"
|
||||
"github.com/vulcanize/vulcanizedb/test_config"
|
||||
)
|
||||
|
||||
var _ = Describe("Vow storage repository test", func() {
|
||||
var (
|
||||
blockNumber int
|
||||
blockHash string
|
||||
db *postgres.DB
|
||||
err error
|
||||
repo vow.VowStorageRepository
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
blockNumber = 123
|
||||
blockHash = "expected_block_hash"
|
||||
db = test_config.NewTestDB(test_config.NewTestNode())
|
||||
test_config.CleanTestDB(db)
|
||||
repo = vow.VowStorageRepository{}
|
||||
repo.SetDB(db)
|
||||
})
|
||||
|
||||
It("persists a vow vat", func() {
|
||||
expectedVat := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.VatMetadata, expectedVat)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowVat struct {
|
||||
BlockMetadata
|
||||
Vat string
|
||||
}
|
||||
var result VowVat
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, vat from maker.vow_vat`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Vat).To(Equal(expectedVat))
|
||||
})
|
||||
|
||||
It("persists a vow cow", func() {
|
||||
expectedCow := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.CowMetadata, expectedCow)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowCow struct {
|
||||
BlockMetadata
|
||||
Cow string
|
||||
}
|
||||
var result VowCow
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, cow from maker.vow_cow`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Cow).To(Equal(expectedCow))
|
||||
})
|
||||
|
||||
It("persists a vow row", func() {
|
||||
expectedRow := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.RowMetadata, expectedRow)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowRow struct {
|
||||
BlockMetadata
|
||||
Row string
|
||||
}
|
||||
var result VowRow
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, row from maker.vow_row`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Row).To(Equal(expectedRow))
|
||||
})
|
||||
|
||||
It("persists a vow Sin", func() {
|
||||
expectedSow := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.SinMetadata, expectedSow)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowSin struct {
|
||||
BlockMetadata
|
||||
Sin string
|
||||
}
|
||||
var result VowSin
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, sin from maker.vow_sin`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Sin).To(Equal(expectedSow))
|
||||
})
|
||||
|
||||
It("persists a vow woe", func() {
|
||||
expectedWoe := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.WoeMetadata, expectedWoe)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowWoe struct {
|
||||
BlockMetadata
|
||||
Woe string
|
||||
}
|
||||
var result VowWoe
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, woe from maker.vow_woe`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Woe).To(Equal(expectedWoe))
|
||||
})
|
||||
|
||||
It("persists a vow Ash", func() {
|
||||
expectedAsh := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.AshMetadata, expectedAsh)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowAsh struct {
|
||||
BlockMetadata
|
||||
Ash string
|
||||
}
|
||||
var result VowAsh
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, ash from maker.vow_ash`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Ash).To(Equal(expectedAsh))
|
||||
})
|
||||
|
||||
It("persists a vow Wait", func() {
|
||||
expectedWait := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.WaitMetadata, expectedWait)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowWait struct {
|
||||
BlockMetadata
|
||||
Wait string
|
||||
}
|
||||
var result VowWait
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, wait from maker.vow_wait`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Wait).To(Equal(expectedWait))
|
||||
})
|
||||
|
||||
It("persists a vow Bump", func() {
|
||||
expectedBump := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.BumpMetadata, expectedBump)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowBump struct {
|
||||
BlockMetadata
|
||||
Bump string
|
||||
}
|
||||
var result VowBump
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, bump from maker.vow_bump`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Bump).To(Equal(expectedBump))
|
||||
})
|
||||
|
||||
It("persists a vow Sump", func() {
|
||||
expectedSump := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.SumpMetadata, expectedSump)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowSump struct {
|
||||
BlockMetadata
|
||||
Sump string
|
||||
}
|
||||
var result VowSump
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, sump from maker.vow_sump`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Sump).To(Equal(expectedSump))
|
||||
})
|
||||
|
||||
It("persists a vow Hump", func() {
|
||||
expectedHump := "123"
|
||||
|
||||
err = repo.Create(blockNumber, blockHash, vow.HumpMetadata, expectedHump)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
type VowHump struct {
|
||||
BlockMetadata
|
||||
Hump string
|
||||
}
|
||||
var result VowHump
|
||||
err = db.Get(&result, `SELECT block_number, block_hash, hump from maker.vow_hump`)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(result.BlockNumber).To(Equal(blockNumber))
|
||||
Expect(result.BlockHash).To(Equal(blockHash))
|
||||
Expect(result.Hump).To(Equal(expectedHump))
|
||||
})
|
||||
})
|
||||
|
||||
type BlockMetadata struct {
|
||||
BlockNumber int `db:"block_number"`
|
||||
BlockHash string `db:"block_hash"`
|
||||
}
|
13
pkg/transformers/storage_diffs/maker/vow/vow_suite_test.go
Normal file
13
pkg/transformers/storage_diffs/maker/vow/vow_suite_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package vow_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestVow(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Storage Diff Vow Suite")
|
||||
}
|
@ -30,14 +30,18 @@ type Mappings interface {
|
||||
}
|
||||
|
||||
const (
|
||||
IndexZero = "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
IndexOne = "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
IndexTwo = "0000000000000000000000000000000000000000000000000000000000000002"
|
||||
IndexThree = "0000000000000000000000000000000000000000000000000000000000000003"
|
||||
IndexFour = "0000000000000000000000000000000000000000000000000000000000000004"
|
||||
IndexFive = "0000000000000000000000000000000000000000000000000000000000000005"
|
||||
IndexSix = "0000000000000000000000000000000000000000000000000000000000000006"
|
||||
IndexSeven = "0000000000000000000000000000000000000000000000000000000000000007"
|
||||
IndexZero = "0000000000000000000000000000000000000000000000000000000000000000"
|
||||
IndexOne = "0000000000000000000000000000000000000000000000000000000000000001"
|
||||
IndexTwo = "0000000000000000000000000000000000000000000000000000000000000002"
|
||||
IndexThree = "0000000000000000000000000000000000000000000000000000000000000003"
|
||||
IndexFour = "0000000000000000000000000000000000000000000000000000000000000004"
|
||||
IndexFive = "0000000000000000000000000000000000000000000000000000000000000005"
|
||||
IndexSix = "0000000000000000000000000000000000000000000000000000000000000006"
|
||||
IndexSeven = "0000000000000000000000000000000000000000000000000000000000000007"
|
||||
IndexEight = "0000000000000000000000000000000000000000000000000000000000000008"
|
||||
IndexNine = "0000000000000000000000000000000000000000000000000000000000000009"
|
||||
IndexTen = "0000000000000000000000000000000000000000000000000000000000000010"
|
||||
IndexEleven = "0000000000000000000000000000000000000000000000000000000000000011 "
|
||||
)
|
||||
|
||||
func GetMapping(indexOnContract, key string) common.Hash {
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/pit"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vat"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/transformers/storage_diffs/maker/vow"
|
||||
)
|
||||
|
||||
func GetPitStorageTransformer() storage.Transformer {
|
||||
@ -24,3 +25,11 @@ func GetVatStorageTransformer() storage.Transformer {
|
||||
Repository: &vat.VatStorageRepository{},
|
||||
}
|
||||
}
|
||||
|
||||
func GetVowStorageTransformer() storage.Transformer {
|
||||
return storage.Transformer{
|
||||
Address: common.HexToAddress(constants.VowContractAddress()),
|
||||
Mappings: &vow.VowMappings{StorageRepository: &maker.MakerStorageRepository{}},
|
||||
Repository: &vow.VowStorageRepository{},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user