Skip to content

Commit

Permalink
Merge branch 'main' into cowprotocol/add_base_2
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRobin authored Dec 16, 2024
2 parents 1d6ea73 + c7237e7 commit ae32bc6
Show file tree
Hide file tree
Showing 42 changed files with 282 additions and 406 deletions.
23 changes: 23 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"dbt: daily":
- changed-files:
- any-glob-to-any-file: 'dbt_subprojects/daily_spellbook/**'

"dbt: dex":
- changed-files:
- any-glob-to-any-file: 'dbt_subprojects/dex/**'

"dbt: hourly":
- changed-files:
- any-glob-to-any-file: 'dbt_subprojects/hourly_spellbook/**'

"dbt: nft":
- changed-files:
- any-glob-to-any-file: 'dbt_subprojects/nft/**'

"dbt: solana":
- changed-files:
- any-glob-to-any-file: 'dbt_subprojects/solana/**'

"dbt: tokens":
- changed-files:
- any-glob-to-any-file: 'dbt_subprojects/tokens/**'
46 changes: 46 additions & 0 deletions .github/workflows/pr_automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: PR automation

on:
pull_request:
types:
- opened
- ready_for_review
- converted_to_draft
- synchronize
- labeled

permissions:
pull-requests: write
contents: write

jobs:
pr-automation:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.number }}
steps:
- name: Mark new PR as Draft
if: (github.event.action == 'opened' && github.event.pull_request.draft == false)
run: gh pr ready "$NUMBER" --undo

- name: Set labels on Open
if: github.event.action == 'opened'
run: gh pr edit "$NUMBER" --add-label "WIP"

- name: Set labels on Draft
if: github.event.action == 'converted_to_draft'
run: gh pr edit "$NUMBER" --add-label "WIP" --remove-label "ready-for-review"

- name: Set labels on ready-for-review
if: github.event.action == 'ready_for_review'
run: gh pr edit "$NUMBER" --add-label "ready-for-review" --remove-label "WIP"

- name: Add subproject labels
if: contains('synchronize,opened,reopened', github.event.action)
uses: actions/labeler@v5
with:
sync-labels: true


12 changes: 8 additions & 4 deletions dbt_macros/shared/balances_incremental_subset_daily.sql
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,18 @@ from(
{% endif %}

) b
left join {{source('prices','usd')}} p
on (token_standard = 'erc20'
left join {{source('prices','usd_daily')}} p
on 1=1
{% if is_incremental() %}
and {{ incremental_predicate('p.day') }}
{% endif %}
and ((token_standard = 'erc20'
and p.blockchain = '{{blockchain}}'
and b.token_address = p.contract_address
and b.day = p.minute)
and b.day = p.day)
or (token_standard = 'native'
and p.blockchain is null
and p.contract_address is null
and p.symbol = (select native_token_symbol from {{source('evms','info')}} where blockchain = '{{blockchain}}')
and b.day = p.minute)
and b.day = p.day))
{% endmacro %}
2 changes: 1 addition & 1 deletion dbt_subprojects/daily_spellbook/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Daily Spellbook

This is a DBT sub project for the the main models of Spellbook that runs on a daily candence.
This is a DBT sub project for the the main models of Spellbook that runs on a daily candence.
3 changes: 3 additions & 0 deletions dbt_subprojects/daily_spellbook/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ quoting:
# profile: "spellbook-poc-tokens"
profile: "spellbook-local"

flags:
require_certificate_validation: true

vars:
DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}"
DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '3') }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
, ('0xbf1fc29668e5f5eaa819948599c9ac1b1e03e75f', 'true', 'Cone' , 'ConeRouter01' , ['bnb'])
, ('0x11984dc4465481512eb5b777e44061c158cf2259', 'true', 'Connext' , 'ConnextDiamond' , ['polygon'])
, ('0xee9dec2712cce65174b561151701bf54b99c24c8', 'true', 'Connext' , 'ConnextDiamond' , ['arbitrum'])
, ('0x9008d19f58aabd9ed0d60971565aa8510560ab41', 'true', 'CoWSwap' , 'GPv2Settlement' , ['ethereum','gnosis','arbitrum'])
, ('0x9008d19f58aabd9ed0d60971565aa8510560ab41', 'true', 'CoWSwap' , 'GPv2Settlement' , ['ethereum','gnosis','arbitrum','base'])
, ('0xfa43de785dd3cd0ef3dae0dd2b8be3f1b5112d1a', 'true', 'CrossCurve' , 'UnifiedRouterV2v1' , ['ethereum','bnb','polygon','gnosis','arbitrum','avalanche_c','optimism','base','fantom'])
, ('0xa2a786ff9148f7c88ee93372db8cbe9e94585c74', 'true', 'CrossCurve' , 'UnifiedRouterV2v5' , ['ethereum','bnb','polygon','gnosis','arbitrum','avalanche_c','optimism','base','fantom','blast','linea','mantle'])
, ('0xe7db62c7960183895190274f26925388db4a3be4', 'true', 'CrossCurve' , 'UnifiedRouterV2' , ['ethereum','bnb','polygon','gnosis','arbitrum','avalanche_c','optimism','base','fantom'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ with bungee_bridges as (
receiver,
metadata,
source_chain,
transfer_id
transfer_id,
amount_usd
from {{ ref( 'bungee_' ~ chain ~ '_bridges' ) }}
{% if not loop.last %}
union all
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
version: 2

models:
- name: safe_arbitrum_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: arbitrum
project: safe
contributors: safeintern
config:
tags: ['safe', 'arbitrum']
description: “Safe addresses balances”

- name: safe_avalanche_c_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: avalanche_c
project: safe
contributors: safeintern
config:
tags: [ 'safe', 'avalanche_c' ]
description: “Safe addresses balances”

- name: safe_base_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: base
project: safe
contributors: safeintern
config:
tags: [ 'safe', 'base' ]
description: “Safe addresses balances”

- name: safe_ethereum_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: ethereum
project: safe
contributors: safeintern
config:
tags: [ 'safe', 'ethereum' ]
description: “Safe addresses balances”

- name: safe_linea_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: linea
project: safe
contributors: safeintern
config:
tags: [ 'safe', 'linea' ]
description: “Safe addresses balances”

- name: safe_optimism_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: optimism
project: safe
contributors: safeintern
config:
tags: [ 'safe', 'optimism' ]
description: “Safe addresses balances”

- name: safe_polygon_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: polygon
project: safe
contributors: safeintern
config:
tags: [ 'safe', 'polygon' ]
description: “Safe addresses balances”

- name: safe_scroll_balances
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
meta:
blockchain: scroll
project: safe
contributors: safeintern
config:
tags: [ 'safe', 'scroll' ]
description: “Safe addresses balances”

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_arbitrum_safes') }}
from {{ source('safe_arbitrum','safes') }}
where blockchain = 'arbitrum'
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_avalanche_c_safes') }}
from {{ source('safe_avalanche_c','safes') }}
where blockchain = 'avalanche_c'
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_base_safes') }}
from {{ source('safe_base','safes') }}
where blockchain = 'base'
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_ethereum_safes') }}
from {{ source('safe_ethereum','safes') }}
where blockchain = 'ethereum'
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_linea_safes') }}
from {{ source('safe_linea','safes') }}
where blockchain = 'linea'
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_optimism_safes') }}
from {{ source('safe_optimism','safes') }}
where blockchain = 'optimism'
),
balances as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_polygon_safes') }}
from {{ source('safe_polygon','safes') }}
where blockchain = 'polygon'
),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with safes as (
select
address,
blockchain
from {{ ref('safe_scroll_safes') }}
from {{ source('safe_scroll','safes') }}
where blockchain = 'scroll'
),

Expand Down
3 changes: 2 additions & 1 deletion dbt_subprojects/dex/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## DEX subproject


This is a DBT subproject for the main lineages of the DEX sector. Included in this subproject, but not limited to over time:
- `dex.trades`
- `dex_aggreagtor.trades`
Expand All @@ -8,4 +9,4 @@ This is a DBT subproject for the main lineages of the DEX sector. Included in th
- `dex.sandwiched`
- ...and more!

This subproject will be dedicated to building the above spells (and others in the future related to DEX) on an hourly cadence in production. All other spells not included within this subproject will treat these spells as sources. For example, labels spells which read from `dex.trades` will now treat the spell as a source, rather than reference within dbt.
This subproject will be dedicated to building the above spells (and others in the future related to DEX) on an hourly cadence in production. All other spells not included within this subproject will treat these spells as sources. For example, labels spells which read from `dex.trades` will now treat the spell as a source, rather than reference within dbt.
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ quoting:
# This setting configures which "profile" dbt uses for this project.
profile: "spellbook-local"

flags:
require_certificate_validation: true

vars:
DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}"
DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}"
Expand Down
2 changes: 1 addition & 1 deletion dbt_subprojects/hourly_spellbook/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Hourly Spellbook

This is a DBT sub project for the all hourly models in spellbook
This is a DBT sub project for the all hourly models in spellbook.
3 changes: 3 additions & 0 deletions dbt_subprojects/hourly_spellbook/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ quoting:
# profile: "spellbook-poc-tokens"
profile: "spellbook-local"

flags:
require_certificate_validation: true

vars:
DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}"
DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ models:
project: balancer
contributors: viniabussafi
config:
tags: ['ethereum', 'gnosis', 'static', 'token', 'mapping']
tags: ['ethereum', 'gnosis', 'token', 'mapping']
description: >
Mapping of ERC4626 tokens, including aTokens and MetaMorpho tokens, and their corresponding underlying tokens.
data_tests:
Expand Down Expand Up @@ -36,7 +36,7 @@ models:
project: balancer
contributors: viniabussafi
config:
tags: ['ethereum', 'gnosis', 'static', 'token', 'pricing']
tags: ['ethereum', 'gnosis', 'token', 'pricing']
description: >
Pricing information for ERC4626 tokens. Prices are derived from the ratio of underlying tokens deposited or withdrawn to shares issued or burned, multiplied by the underlying token price.
data_tests:
Expand All @@ -62,4 +62,4 @@ models:
- name: median_price
description: "Median price of the static token, computed over the dataset."
- name: next_change
description: "Timestamp of the next expected pricing change or event affecting the price."
description: "Timestamp of the next expected pricing change or event affecting the price."
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
)
}}


{% set balancer_models = [
ref('balancer_v3_ethereum_erc4626_token_prices'),
ref('balancer_v3_gnosis_erc4626_token_prices')
Expand Down
Loading

0 comments on commit ae32bc6

Please sign in to comment.