-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 1202-init-flare
- Loading branch information
Showing
35 changed files
with
853 additions
and
9 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
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/**' |
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,46 @@ | ||
name: PR automation | ||
|
||
on: | ||
pull_request_target: | ||
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 | ||
|
||
|
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
58 changes: 58 additions & 0 deletions
58
...ts/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_core_assets.sql
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,58 @@ | ||
{{ | ||
config( | ||
schema = 'swell_balances_ethereum', | ||
alias = 'core_assets', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['day', 'wallet_address', 'token_address'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')], | ||
post_hook='{{ expose_spells(\'["ethereum"]\', | ||
"project", | ||
"swell", | ||
\'["maybeYonas"]\') }}' | ||
) | ||
}} | ||
|
||
with | ||
tokens as ( | ||
select * from (values | ||
(0xf951E335afb289353dc249e82926178EaC7DEd78, 'swETH', 'Swell LRT'), | ||
(0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0, 'rswETH', 'Swell LRT'), | ||
(0x0a6E7Ba5042B38349e437ec6Db6214AEC7B35676, 'SWELL', 'Swell LRT'), | ||
(0x358d94b5b2F147D741088803d932Acb566acB7B6, 'rSWELL', 'Swell LRT'), | ||
(0x9Ed15383940CC380fAEF0a75edacE507cC775f22, 'earnETH', 'Swell LRT'), | ||
(0x66E47E6957B85Cf62564610B76dD206BB04d831a, 'earnBTC', 'Swell LRT'), | ||
(0x8DB2350D78aBc13f5673A411D4700BCF87864dDE, 'swBTC', 'Swell LRT') | ||
) as t( | ||
token_address, | ||
symbol, | ||
name | ||
) | ||
), | ||
balances as ( | ||
{{ | ||
balances_incremental_subset_daily( | ||
blockchain = 'ethereum', | ||
token_list = 'tokens', | ||
start_date = '2023-04-12' | ||
) | ||
}} | ||
) | ||
|
||
select | ||
-- t.name, | ||
b.blockchain, | ||
b.day, | ||
b.address as wallet_address, | ||
b.token_symbol, | ||
b.token_address, | ||
b.token_standard, | ||
b.token_id, | ||
b.balance, | ||
b.balance_usd, | ||
b.last_updated, | ||
b.next_update | ||
from balances b | ||
-- left join tokens t | ||
-- on b.token_address = t.token_address |
63 changes: 63 additions & 0 deletions
63
...rojects/daily_spellbook/models/swell/balances/ethereum/swell_balances_ethereum_schema.yml
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,63 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: swell_balances_ethereum_core_assets | ||
|
||
meta: | ||
blockchain: ethereum | ||
project: swell | ||
contributors: maybeYonas | ||
|
||
config: | ||
tags: ['swell', 'restaking', 'lrt', 'lst', 'vaults', 'balances'] | ||
description: "balances of swell asset holders" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- day | ||
- wallet_address | ||
- token_address | ||
- check_seed: | ||
seed_file: ref('swell_balances_ethereum_core_assets_seed') | ||
match_columns: | ||
- blockchain | ||
- day | ||
- wallet_address | ||
- token_address | ||
check_columns: | ||
- balance | ||
- last_updated | ||
columns: | ||
- &blockchain | ||
name: blockchain | ||
description: "blockchain" | ||
- &day | ||
name: day | ||
description: "date on which the token balance is logged" | ||
- &wallet_address | ||
name: wallet_address | ||
description: "wallet address of the holder" | ||
- &token_symbol | ||
name: token_symbol | ||
description: "token symbol" | ||
- &token_address | ||
name: token_address | ||
description: "token address" | ||
- &token_standard | ||
name: token_standard | ||
description: "standard of the token (erc20)" | ||
- &token_id | ||
name: token_id | ||
description: "ID of the token" | ||
- &balance | ||
name: balance | ||
description: "asset balance of the wallet" | ||
- &balance_usd | ||
name: balance_usd | ||
description: "usd value of token balance of the wallet" | ||
- &last_updated | ||
name: last_updated | ||
description: "UTC timestamp when balance was last updated" | ||
- &next_update | ||
name: next_update | ||
description: "UTC timestamp when balance is next updated" |
12 changes: 12 additions & 0 deletions
12
dbt_subprojects/daily_spellbook/seeds/swell/balances/ethereum/schema.yml
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,12 @@ | ||
version: 2 | ||
|
||
seeds: | ||
- name: swell_balances_ethereum_core_assets_seed | ||
config: | ||
column_types: | ||
blockchain: varchar | ||
day: timestamp | ||
wallet_address: varbinary | ||
token_address: varbinary | ||
balance: double | ||
last_updated: timestamp |
8 changes: 8 additions & 0 deletions
8
...aily_spellbook/seeds/swell/balances/ethereum/swell_balances_ethereum_core_assets_seed.csv
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,8 @@ | ||
blockchain,day,wallet_address,token_address,balance,last_updated | ||
ethereum,2024-08-13 00:00:00.000 UTC,0x4589Ef5d52a152C25Daa513cF43b1389Bd1f3C00,0xf951E335afb289353dc249e82926178EaC7DEd78,0.004752378895635013,2024-02-29 00:00:00.000 UTC | ||
ethereum,2024-12-04 00:00:00.000 UTC,0xaf1ec97ea59e9052ee563e4265c39291c020e3dd,0x0a6e7ba5042b38349e437ec6db6214aec7b35676,1074.616281,2024-11-08 00:00:00.000 UTC | ||
ethereum,2024-12-05 00:00:00.000 UTC,0x841ea52b74c94420a61d41ba790e710e1af8ee0a,0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0,0.050121577326075153,2024-11-24 00:00:00.000 UTC | ||
ethereum,2024-08-13 00:00:00.000 UTC,0xfee2d4498085581dde097b9924e4e3544682d767,0x8db2350d78abc13f5673a411d4700bcf87864dde,0.04096165,2024-08-13 00:00:00.000 UTC | ||
ethereum,2024-12-04 00:00:00.000 UTC,0xbdD5d655ad781FB9929BFe515EB4A50090444C21,0x9Ed15383940CC380fAEF0a75edacE507cC775f22,89.828941195874851394,2024-11-08 00:00:00.000 UTC | ||
ethereum,2024-12-01 00:00:00.000 UTC,0x84a6a7c0674A3AA03e09c026600cb46181821f07,0x66E47E6957B85Cf62564610B76dD206BB04d831a,1,2024-11-25 00:00:00.000 UTC | ||
ethereum,2024-12-04 00:00:00.000 UTC,0x22aA3f5D1daFfe1a9DF298e79a0CF2f98C1b92FF,0x358d94b5b2F147D741088803d932Acb566acB7B6,278707.960865665406065408,2024-12-02 00:00:00.000 UTC |
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
53 changes: 53 additions & 0 deletions
53
dbt_subprojects/dex/models/_projects/fluid/ethereum/fluid_v1_ethereum_pools.sql
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,53 @@ | ||
{{ | ||
config( | ||
schema = 'fluid_ethereum', | ||
alias = 'pools', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['dex'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], | ||
post_hook='{{ expose_spells(blockchains = \'["ethereum"]\', | ||
spell_type = "project", | ||
spell_name = "fluid", | ||
contributors = \'["maybeYonas", "pyor_xyz"]\') }}' | ||
) | ||
}} | ||
|
||
{% set weth_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' %} | ||
|
||
with | ||
decoded_events as ( | ||
select | ||
block_time, | ||
block_number, | ||
index as evt_index, | ||
tx_hash, | ||
contract_address as factory, | ||
substr(topic1, 13) as dex, | ||
substr(topic2, 13) as supplyToken, | ||
substr(topic3, 13) as borrowToken, | ||
bytearray_to_uint256(data) as dexId | ||
from {{ source('ethereum', 'logs')}} | ||
where topic0 = 0x3fecd5f7aca6136a20a999e7d11ff5dcea4bd675cb125f93ccd7d53f98ec57e4 | ||
-- DexT1Deployed -> sample tx: https://etherscan.io/tx/0xabf5c0e676e69de941c283400d7ac5f47b17a09d870f225b5240522f95da501c#eventlog | ||
and block_number > 20776998 | ||
{% if is_incremental() %} | ||
and {{ incremental_predicate('block_time') }} | ||
{% endif %} | ||
) | ||
|
||
select | ||
'ethereum' as blockchain, | ||
'fluid' as project, | ||
'1' as version, | ||
block_time, | ||
block_number, | ||
evt_index, | ||
tx_hash, | ||
factory, | ||
dex, | ||
case supplyToken when 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee then {{weth_address}} else supplyToken end as supply_token, | ||
case borrowToken when 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee then {{weth_address}} else borrowToken end as borrow_token, | ||
dexId as dex_id | ||
from decoded_events |
54 changes: 54 additions & 0 deletions
54
dbt_subprojects/dex/models/_projects/fluid/ethereum/schema.yml
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,54 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: fluid_v1_ethereum_pools | ||
meta: | ||
blockchain: ethereum | ||
sector: dex | ||
project: fluid | ||
contributor: maybeYonas | ||
config: | ||
tags: ['ethereum', 'trades', 'fluid', 'dex'] | ||
description: "fluid pools" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- dex | ||
columns: | ||
- &blockchain | ||
name: blockchain | ||
description: "blockchain where the pool is deployed" | ||
- &project | ||
name: project | ||
description: "project name" | ||
- &version | ||
name: version | ||
description: "project version" | ||
- &block_time | ||
name: block_time | ||
description: "utc block timestamp when the pool is deployed" | ||
- &block_number | ||
name: block_number | ||
description: "block number at which the pool is deployed" | ||
- &evt_index | ||
name: evt_index | ||
description: "index of log emitted" | ||
- &tx_hash | ||
name: tx_hash | ||
description: "hash of tx in which pool is deployed" | ||
- &factory | ||
name: factory | ||
description: "factory contract deploying the pool" | ||
- &dex | ||
name: dex | ||
description: "pool contract address" | ||
- &supply_token | ||
name: supply_token | ||
description: "supply token" | ||
- &borrow_token | ||
name: borrow_token | ||
description: "borrow token" | ||
- &dex_id | ||
name: dex_id | ||
description: "nonce unique to factory and pool" | ||
|
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.