|
|
@ -5,11 +5,6 @@ CREATE TABLE block ( |
|
|
|
hash BYTEA NOT NULL |
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE slot_min_prices ( |
|
|
|
eth_block_num BIGINT PRIMARY KEY REFERENCES block (eth_block_num) ON DELETE CASCADE, |
|
|
|
min_prices VARCHAR(200) NOT NULL |
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE coordianator ( |
|
|
|
forger_addr BYTEA NOT NULL, |
|
|
|
eth_block_num BIGINT NOT NULL REFERENCES block (eth_block_num) ON DELETE CASCADE, |
|
|
@ -32,14 +27,22 @@ CREATE TABLE batch ( |
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE exit_tree ( |
|
|
|
batch_num BIGINT NOT NULL REFERENCES batch (batch_num) ON DELETE CASCADE, |
|
|
|
account_idx BIGINT NOT NULL, |
|
|
|
batch_num BIGINT REFERENCES batch (batch_num) ON DELETE CASCADE, |
|
|
|
account_idx BIGINT, |
|
|
|
merkle_proof BYTEA NOT NULL, |
|
|
|
amount NUMERIC NOT NULL, |
|
|
|
nullifier BYTEA NOT NULL, |
|
|
|
PRIMARY KEY (batch_num, account_idx) |
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE withdrawal ( |
|
|
|
batch_num BIGINT, |
|
|
|
account_idx BIGINT, |
|
|
|
eth_block_num BIGINT REFERENCES block (eth_block_num) ON DELETE CASCADE, |
|
|
|
FOREIGN KEY (batch_num, account_idx) REFERENCES exit_tree (batch_num, account_idx) ON DELETE CASCADE, |
|
|
|
PRIMARY KEY (batch_num, account_idx) |
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE bid ( |
|
|
|
slot_num BIGINT NOT NULL, |
|
|
|
bid_value BYTEA NOT NULL, -- (check if we can do a max(), if not add float for order purposes) |
|
|
@ -91,7 +94,30 @@ CREATE TABLE account ( |
|
|
|
eth_addr BYTEA NOT NULL |
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE rollup_vars ( |
|
|
|
eth_block_num BIGINT PRIMARY KEY REFERENCES block (eth_block_num) ON DELETE CASCADE, |
|
|
|
forge_l1_timeout BYTEA NOT NULL, |
|
|
|
fee_l1_user_tx BYTEA NOT NULL, |
|
|
|
fee_add_token BYTEA NOT NULL, |
|
|
|
tokens_hez BYTEA NOT NULL, |
|
|
|
governance BYTEA NOT NULL |
|
|
|
); |
|
|
|
|
|
|
|
CREATE TABLE consensus_vars ( |
|
|
|
eth_block_num BIGINT PRIMARY KEY REFERENCES block (eth_block_num) ON DELETE CASCADE, |
|
|
|
slot_deadline INT NOT NULL, |
|
|
|
close_auction_slots INT NOT NULL, |
|
|
|
open_auction_slots INT NOT NULL, |
|
|
|
min_bid_slots VARCHAR(200) NOT NULL, |
|
|
|
outbidding INT NOT NULL, |
|
|
|
donation_address BYTEA NOT NULL, |
|
|
|
governance_address BYTEA NOT NULL, |
|
|
|
allocation_ratio vARCHAR(200) |
|
|
|
); |
|
|
|
|
|
|
|
-- +migrate Down |
|
|
|
DROP TABLE consensus_vars; |
|
|
|
DROP TABLE rollup_vars; |
|
|
|
DROP TABLE account; |
|
|
|
DROP TABLE l2tx; |
|
|
|
DROP TABLE l1tx; |
|
|
@ -100,5 +126,4 @@ DROP TABLE bid; |
|
|
|
DROP TABLE exit_tree; |
|
|
|
DROP TABLE batch; |
|
|
|
DROP TABLE coordianator; |
|
|
|
DROP TABLE slot_min_prices; |
|
|
|
DROP TABLE block; |