add woe to storage diff vow contract
This commit is contained in:
parent
4fe2ff4104
commit
a8322c7d26
@ -24,42 +24,49 @@ CREATE TABLE maker.vow_sin (
|
|||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
block_number BIGINT,
|
block_number BIGINT,
|
||||||
block_hash TEXT,
|
block_hash TEXT,
|
||||||
sin 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 (
|
CREATE TABLE maker.vow_ash (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
block_number BIGINT,
|
block_number BIGINT,
|
||||||
block_hash TEXT,
|
block_hash TEXT,
|
||||||
ash TEXT
|
ash numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE maker.vow_wait (
|
CREATE TABLE maker.vow_wait (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
block_number BIGINT,
|
block_number BIGINT,
|
||||||
block_hash TEXT,
|
block_hash TEXT,
|
||||||
wait TEXT
|
wait numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE maker.vow_sump (
|
CREATE TABLE maker.vow_sump (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
block_number BIGINT,
|
block_number BIGINT,
|
||||||
block_hash TEXT,
|
block_hash TEXT,
|
||||||
sump TEXT
|
sump numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE maker.vow_bump (
|
CREATE TABLE maker.vow_bump (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
block_number BIGINT,
|
block_number BIGINT,
|
||||||
block_hash TEXT,
|
block_hash TEXT,
|
||||||
bump TEXT
|
bump numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE maker.vow_hump (
|
CREATE TABLE maker.vow_hump (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
block_number BIGINT,
|
block_number BIGINT,
|
||||||
block_hash TEXT,
|
block_hash TEXT,
|
||||||
hump TEXT
|
hump numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
@ -67,6 +74,7 @@ DROP TABLE maker.vow_vat;
|
|||||||
DROP TABLE maker.vow_cow;
|
DROP TABLE maker.vow_cow;
|
||||||
DROP TABLE maker.vow_row;
|
DROP TABLE maker.vow_row;
|
||||||
DROP TABLE maker.vow_sin;
|
DROP TABLE maker.vow_sin;
|
||||||
|
DROP TABLE maker.vow_woe;
|
||||||
DROP TABLE maker.vow_ash;
|
DROP TABLE maker.vow_ash;
|
||||||
DROP TABLE maker.vow_wait;
|
DROP TABLE maker.vow_wait;
|
||||||
DROP TABLE maker.vow_sump;
|
DROP TABLE maker.vow_sump;
|
||||||
|
@ -1613,7 +1613,7 @@ CREATE TABLE maker.vow_ash (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
block_number bigint,
|
block_number bigint,
|
||||||
block_hash text,
|
block_hash text,
|
||||||
ash text
|
ash numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1645,7 +1645,7 @@ CREATE TABLE maker.vow_bump (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
block_number bigint,
|
block_number bigint,
|
||||||
block_hash text,
|
block_hash text,
|
||||||
bump text
|
bump numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1743,7 +1743,7 @@ CREATE TABLE maker.vow_hump (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
block_number bigint,
|
block_number bigint,
|
||||||
block_hash text,
|
block_hash text,
|
||||||
hump text
|
hump numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1807,7 +1807,7 @@ CREATE TABLE maker.vow_sin (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
block_number bigint,
|
block_number bigint,
|
||||||
block_hash text,
|
block_hash text,
|
||||||
sin text
|
sin numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1839,7 +1839,7 @@ CREATE TABLE maker.vow_sump (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
block_number bigint,
|
block_number bigint,
|
||||||
block_hash text,
|
block_hash text,
|
||||||
sump text
|
sump numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1903,7 +1903,7 @@ CREATE TABLE maker.vow_wait (
|
|||||||
id integer NOT NULL,
|
id integer NOT NULL,
|
||||||
block_number bigint,
|
block_number bigint,
|
||||||
block_hash text,
|
block_hash text,
|
||||||
wait text
|
wait numeric
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -1927,6 +1927,38 @@ CREATE SEQUENCE maker.vow_wait_id_seq
|
|||||||
ALTER SEQUENCE maker.vow_wait_id_seq OWNED BY maker.vow_wait.id;
|
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: -
|
-- Name: logs; Type: TABLE; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@ -2758,6 +2790,13 @@ ALTER TABLE ONLY maker.vow_vat ALTER COLUMN id SET DEFAULT nextval('maker.vow_va
|
|||||||
ALTER TABLE ONLY maker.vow_wait ALTER COLUMN id SET DEFAULT nextval('maker.vow_wait_id_seq'::regclass);
|
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: -
|
-- Name: blocks id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
@ -3491,6 +3530,14 @@ ALTER TABLE ONLY maker.vow_wait
|
|||||||
ADD CONSTRAINT vow_wait_pkey PRIMARY KEY (id);
|
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: -
|
-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -29,6 +29,7 @@ const (
|
|||||||
VowCow = "cow"
|
VowCow = "cow"
|
||||||
VowRow = "row"
|
VowRow = "row"
|
||||||
VowSin = "Sin"
|
VowSin = "Sin"
|
||||||
|
VowWoe = "woe"
|
||||||
VowAsh = "ash"
|
VowAsh = "ash"
|
||||||
VowWait = "wait"
|
VowWait = "wait"
|
||||||
VowSump = "sump"
|
VowSump = "sump"
|
||||||
@ -48,14 +49,14 @@ var (
|
|||||||
CowMetadata = shared.StorageValueMetadata{
|
CowMetadata = shared.StorageValueMetadata{
|
||||||
Name: VowCow,
|
Name: VowCow,
|
||||||
Keys: nil,
|
Keys: nil,
|
||||||
Type: shared.Uint256,
|
Type: shared.Address,
|
||||||
}
|
}
|
||||||
|
|
||||||
RowKey = common.HexToHash(storage_diffs.IndexThree)
|
RowKey = common.HexToHash(storage_diffs.IndexThree)
|
||||||
RowMetadata = shared.StorageValueMetadata{
|
RowMetadata = shared.StorageValueMetadata{
|
||||||
Name: VowRow,
|
Name: VowRow,
|
||||||
Keys: nil,
|
Keys: nil,
|
||||||
Type: shared.Uint256,
|
Type: shared.Address,
|
||||||
}
|
}
|
||||||
|
|
||||||
SinKey = common.HexToHash(storage_diffs.IndexFive)
|
SinKey = common.HexToHash(storage_diffs.IndexFive)
|
||||||
@ -65,6 +66,13 @@ var (
|
|||||||
Type: shared.Uint256,
|
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)
|
AshKey = common.HexToHash(storage_diffs.IndexSeven)
|
||||||
AshMetadata = shared.StorageValueMetadata{
|
AshMetadata = shared.StorageValueMetadata{
|
||||||
Name: VowAsh,
|
Name: VowAsh,
|
||||||
@ -127,6 +135,7 @@ func (mappings *VowMappings) loadMappings() error {
|
|||||||
staticMappings[CowKey] = CowMetadata
|
staticMappings[CowKey] = CowMetadata
|
||||||
staticMappings[RowKey] = RowMetadata
|
staticMappings[RowKey] = RowMetadata
|
||||||
staticMappings[SinKey] = SinMetadata
|
staticMappings[SinKey] = SinMetadata
|
||||||
|
staticMappings[WoeKey] = WoeMetadata
|
||||||
staticMappings[AshKey] = AshMetadata
|
staticMappings[AshKey] = AshMetadata
|
||||||
staticMappings[WaitKey] = WaitMetadata
|
staticMappings[WaitKey] = WaitMetadata
|
||||||
staticMappings[SumpKey] = SumpMetadata
|
staticMappings[SumpKey] = SumpMetadata
|
||||||
|
@ -21,6 +21,7 @@ var _ = Describe("Vow storage mappings", func() {
|
|||||||
Expect(mappings.Lookup(vow.CowKey)).To(Equal(vow.CowMetadata))
|
Expect(mappings.Lookup(vow.CowKey)).To(Equal(vow.CowMetadata))
|
||||||
Expect(mappings.Lookup(vow.RowKey)).To(Equal(vow.RowMetadata))
|
Expect(mappings.Lookup(vow.RowKey)).To(Equal(vow.RowMetadata))
|
||||||
Expect(mappings.Lookup(vow.SinKey)).To(Equal(vow.SinMetadata))
|
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.AshKey)).To(Equal(vow.AshMetadata))
|
||||||
Expect(mappings.Lookup(vow.WaitKey)).To(Equal(vow.WaitMetadata))
|
Expect(mappings.Lookup(vow.WaitKey)).To(Equal(vow.WaitMetadata))
|
||||||
Expect(mappings.Lookup(vow.SumpKey)).To(Equal(vow.SumpMetadata))
|
Expect(mappings.Lookup(vow.SumpKey)).To(Equal(vow.SumpMetadata))
|
||||||
|
@ -39,6 +39,8 @@ func (repository VowStorageRepository) Create(blockNumber int, blockHash string,
|
|||||||
return repository.insertVowRow(blockNumber, blockHash, value.(string))
|
return repository.insertVowRow(blockNumber, blockHash, value.(string))
|
||||||
case VowSin:
|
case VowSin:
|
||||||
return repository.insertVowSin(blockNumber, blockHash, value.(string))
|
return repository.insertVowSin(blockNumber, blockHash, value.(string))
|
||||||
|
case VowWoe:
|
||||||
|
return repository.insertVowWoe(blockNumber, blockHash, value.(string))
|
||||||
case VowAsh:
|
case VowAsh:
|
||||||
return repository.insertVowAsh(blockNumber, blockHash, value.(string))
|
return repository.insertVowAsh(blockNumber, blockHash, value.(string))
|
||||||
case VowWait:
|
case VowWait:
|
||||||
@ -78,6 +80,12 @@ func (repository VowStorageRepository) insertVowSin(blockNumber int, blockHash s
|
|||||||
return err
|
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 {
|
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)
|
_, err := repository.db.Exec(`INSERT INTO maker.vow_ash (block_number, block_hash, ash) VALUES ($1, $2, $3)`, blockNumber, blockHash, ash)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow vat", func() {
|
It("persists a vow vat", func() {
|
||||||
expectedVat := "vat"
|
expectedVat := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.VatMetadata, expectedVat)
|
err = repo.Create(blockNumber, blockHash, vow.VatMetadata, expectedVat)
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow cow", func() {
|
It("persists a vow cow", func() {
|
||||||
expectedCow := "cow"
|
expectedCow := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.CowMetadata, expectedCow)
|
err = repo.Create(blockNumber, blockHash, vow.CowMetadata, expectedCow)
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow row", func() {
|
It("persists a vow row", func() {
|
||||||
expectedRow := "row"
|
expectedRow := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.RowMetadata, expectedRow)
|
err = repo.Create(blockNumber, blockHash, vow.RowMetadata, expectedRow)
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow Sin", func() {
|
It("persists a vow Sin", func() {
|
||||||
expectedSow := "sow"
|
expectedSow := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.SinMetadata, expectedSow)
|
err = repo.Create(blockNumber, blockHash, vow.SinMetadata, expectedSow)
|
||||||
|
|
||||||
@ -115,8 +115,26 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
Expect(result.Sin).To(Equal(expectedSow))
|
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() {
|
It("persists a vow Ash", func() {
|
||||||
expectedAsh := "ash"
|
expectedAsh := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.AshMetadata, expectedAsh)
|
err = repo.Create(blockNumber, blockHash, vow.AshMetadata, expectedAsh)
|
||||||
|
|
||||||
@ -134,7 +152,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow Wait", func() {
|
It("persists a vow Wait", func() {
|
||||||
expectedWait := "wait"
|
expectedWait := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.WaitMetadata, expectedWait)
|
err = repo.Create(blockNumber, blockHash, vow.WaitMetadata, expectedWait)
|
||||||
|
|
||||||
@ -152,7 +170,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow Bump", func() {
|
It("persists a vow Bump", func() {
|
||||||
expectedBump := "bump"
|
expectedBump := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.BumpMetadata, expectedBump)
|
err = repo.Create(blockNumber, blockHash, vow.BumpMetadata, expectedBump)
|
||||||
|
|
||||||
@ -170,7 +188,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow Sump", func() {
|
It("persists a vow Sump", func() {
|
||||||
expectedSump := "sump"
|
expectedSump := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.SumpMetadata, expectedSump)
|
err = repo.Create(blockNumber, blockHash, vow.SumpMetadata, expectedSump)
|
||||||
|
|
||||||
@ -188,7 +206,7 @@ var _ = Describe("Vow storage repository test", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("persists a vow Hump", func() {
|
It("persists a vow Hump", func() {
|
||||||
expectedHump := "hump"
|
expectedHump := "123"
|
||||||
|
|
||||||
err = repo.Create(blockNumber, blockHash, vow.HumpMetadata, expectedHump)
|
err = repo.Create(blockNumber, blockHash, vow.HumpMetadata, expectedHump)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user