Skip to content

[DRAFT] Add CoW Protocol Sepolia tables #8081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 81 additions & 4 deletions dbt_subprojects/dex/models/_projects/cow_protocol/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ models:
- name: trader
description: "Owner of the order being traded (aka trader)"
- name: sell_token_address
description: "Ethereum address of sellToken"
description: "Gnosis Chain address of sellToken"
- name: sell_token
description: "Symbol of sellToken"
- name: buy_token_address
description: "Ethereum address of buyToken"
description: "Gnosis Chain address of buyToken"
- name: buy_token
description: "Symbol of buyToken"
- name: token_pair
Expand Down Expand Up @@ -361,11 +361,88 @@ models:
- name: trader
description: "Owner of the order being traded (aka trader)"
- name: sell_token_address
description: "Ethereum address of sellToken"
description: "Base address of sellToken"
- name: sell_token
description: "Symbol of sellToken"
- name: buy_token_address
description: "Ethereum address of buyToken"
description: "Base address of buyToken"
- name: buy_token
description: "Symbol of buyToken"
- name: token_pair
description: "Ordered concatenation of buy/sell token symbols involved in trade"
- name: units_sold
description: "Units of sellToken sold (incorporates token decimals)."
- name: atoms_sold
description: "Amount (in atoms) of the sellToken sold"
- name: units_bought
description: "Units of buyToken bought (incorporates token decimals)."
- name: atoms_bought
description: "Amount (in atoms) of the buyToken bought"
- name: usd_value
description: "USD value of trade (taken as the max of buy value, sell value when both available, otherwise whichever is known)"
- name: buy_price
description: "USD price of buyToken at the time of trade"
- name: buy_value_usd
description: "USD value of buyToken amount"
- name: sell_price
description: "USD price of sellToken at the time of trade"
- name: sell_value_usd
description: "USD value of sellToken amount"
- name: fee
description: "Unit of fee taken (in sellToken) - incorporating token decimals"
- name: fee_atoms
description: "Amount (in atoms) of fee - taken in sellToken"
- name: fee_usd
description: "USD value of trade fee"
- name: app_data
description: "Hashed metadata related to trade event (full content available on IPFS)"
- name: receiver
description: "Recipient of trades buyToken"
- name: limit_sell_amount
description: "Sell amount side of the limit price"
- name: limit_buy_amount
description: "Buy amount side of the limit price"
- name: valid_to
description: "epoch timestamp (in seconds) until when the order was valid"
- name: flags
description: "bitmap with additional trade information (cf. https://github.com/cowprotocol/contracts/blob/main/src/contracts/libraries/GPv2Trade.sol#L58-L94)"
- name: surplus_usd
description: "USD value of surplus (difference between limit and executed price)"

- name: cow_protocol_testnet_sepolia_trades
meta:
blockchain: testnet_sepolia
project: cow_protocol
contributors: harisang
config:
tags: ["testnet_sepolia", "cow_protocol", "trades", "dex", "aggregator"]
description: >
CoW Protocol enriched trades list on Sepolia
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- order_uid
- evt_index
columns:
- name: block_date
description: "UTC event block date of each trade"
- name: block_time
description: "Timestamp for block event time in UTC"
- name: tx_hash
description: "Transaction hash of trade"
- name: evt_index
description: "Index of the corresponding trade event"
- name: order_uid
description: "Unique identifier of order involved in trade. Note that partially fillable orders can be touched multiple times so this is not a unique ID for trade events."
- name: trader
description: "Owner of the order being traded (aka trader)"
- name: sell_token_address
description: "Sepolia address of sellToken"
- name: sell_token
description: "Symbol of sellToken"
- name: buy_token_address
description: "Sepolia address of buyToken"
- name: buy_token
description: "Symbol of buyToken"
- name: token_pair
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{ config(
schema = 'cow_protocol',
alias='trades',
post_hook='{{ expose_spells(\'["ethereum", "gnosis", "arbitrum"]\',
post_hook='{{ expose_spells(\'["ethereum", "gnosis", "arbitrum", "base", "sepolia"]\',
"project",
"cow_protocol",
\'["bh2smith", "gentrexha", "olgafetisova"]\') }}'
\'["bh2smith", "gentrexha", "olgafetisova", "harisang"]\') }}'
)
}}
SELECT *
Expand Down Expand Up @@ -126,4 +126,34 @@ FROM
trace_address,
evt_index
FROM {{ ref('cow_protocol_base_trades') }}

UNION ALL


SELECT
'sepolia' AS blockchain,
'cow_protocol' AS project,
'1' AS version,
block_date,
block_month,
block_time,
buy_token AS token_bought_symbol,
sell_token AS token_sold_symbol,
token_pair,
units_bought AS token_bought_amount,
units_sold AS token_sold_amount,
atoms_bought AS token_bought_amount_raw,
atoms_sold AS token_sold_amount_raw,
usd_value AS amount_usd,
buy_token_address AS token_bought_address,
sell_token_address AS token_sold_address,
trader AS taker,
CAST(NULL AS VARBINARY) AS maker,
project_contract_address,
tx_hash,
trader AS tx_from,
receiver AS tx_to,
trace_address,
evt_index
FROM {{ ref('cow_protocol_testnet_sepolia_trades') }}
)
Loading
Loading