-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from cowprotocol/use_new_tables
Use new database layout
- Loading branch information
Showing
25 changed files
with
626 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
FROM postgres | ||
ENV POSTGRES_PASSWORD=postgres | ||
ENV POSTGRES_DB=mainnet | ||
COPY ./database/01_table_creation.sql /docker-entrypoint-initdb.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- Database Schema for Token Imbalances and Slippage | ||
|
||
-- Table: raw_token_imbalances (for storing raw token imbalances) | ||
CREATE TABLE raw_token_imbalances ( | ||
auction_id BIGINT NOT NULL, | ||
chain_name VARCHAR(50) NOT NULL, | ||
block_number BIGINT NOT NULL, | ||
tx_hash BYTEA NOT NULL, | ||
token_address BYTEA NOT NULL, | ||
imbalance NUMERIC(78,0), | ||
PRIMARY KEY (tx_hash, token_address) | ||
); | ||
|
||
-- Table: slippage_prices (for storing per unit token prices in ETH) | ||
CREATE TABLE slippage_prices ( | ||
chain_name VARCHAR(50) NOT NULL, | ||
source VARCHAR(50) NOT NULL, | ||
block_number BIGINT NOT NULL, | ||
tx_hash BYTEA NOT NULL, | ||
token_address BYTEA NOT NULL, | ||
price NUMERIC(42,18), | ||
PRIMARY KEY (tx_hash, token_address) | ||
); | ||
|
||
-- Table: Stores fees (i.e. protocol fee, network fee on per token basis) | ||
CREATE TABLE fees_new ( | ||
chain_name VARCHAR(50) NOT NULL, | ||
auction_id BIGINT NOT NULL, | ||
block_number BIGINT NOT NULL, | ||
tx_hash BYTEA NOT NULL, | ||
order_uid BYTEA NOT NULL, | ||
token_address BYTEA NOT NULL, | ||
fee_amount NUMERIC(78,0) NOT NULL, | ||
fee_type VARCHAR(50) NOT NULL, -- e.g. "protocol" or "network" | ||
PRIMARY KEY (tx_hash, order_uid, token_address, fee_type) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.