-
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 'op-swaap' of https://github.com/LamprosLabsDAO/spellbook …
…into op-swaap
- Loading branch information
Showing
25 changed files
with
1,049 additions
and
23 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
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
17 changes: 17 additions & 0 deletions
17
dbt_subprojects/daily_spellbook/models/_sector/dex/pools/optimism/uniswap/_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,17 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: uniswap_pools_optimism_balances | ||
description: "Tracks OP token balances in Uniswap pools on Optimism." | ||
meta: | ||
blockchain: optimism | ||
sector: DEX | ||
project: uniswap | ||
contributors: jason | ||
config: | ||
tags: ['optimism', 'op_token', 'balances', 'uniswap','pools'] | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- pool_address | ||
- snapshot_day |
47 changes: 47 additions & 0 deletions
47
...y_spellbook/models/_sector/dex/pools/optimism/uniswap/uniswap_pools_optimism_balances.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,47 @@ | ||
{{ | ||
config( | ||
schema = 'uniswap_pools_optimism', | ||
alias = 'balances', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['pool_address', 'snapshot_day'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.snapshot_day')] | ||
) | ||
}} | ||
|
||
with op_addresses as ( | ||
select | ||
pool as address, | ||
token0, | ||
token1, | ||
0x4200000000000000000000000000000000000042 as token_address, | ||
fee as fee_tier, | ||
creation_block_time as creation_time | ||
from | ||
{{ source('uniswap_v3_optimism', 'pools') }} | ||
where | ||
token0 = 0x4200000000000000000000000000000000000042 | ||
or token1 = 0x4200000000000000000000000000000000000042 | ||
), | ||
|
||
filtered_balances as ( | ||
{{ balances_incremental_subset_daily( | ||
blockchain='optimism', | ||
start_date='2021-11-11', | ||
address_token_list = 'op_addresses' | ||
) }} | ||
) | ||
|
||
select | ||
p.address as pool_address, | ||
p.token0 as token0, | ||
p.token1 as token1, | ||
p.fee_tier, | ||
p.creation_time, | ||
coalesce(b.balance, 0) as op_balance, | ||
coalesce(b.day, current_date) as snapshot_day | ||
from | ||
filtered_balances b | ||
left join | ||
op_addresses p on b.address = p.address |
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 |
---|---|---|
|
@@ -31,6 +31,7 @@ v3 AS( | |
) | ||
}}) | ||
|
||
|
||
SELECT * FROM v2 | ||
|
||
UNION | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: prices_ink_tokens | ||
meta: | ||
blockchain: ink | ||
sector: prices | ||
contributors: jeff-dude | ||
config: | ||
tags: ['prices', 'tokens', 'usd', 'ink'] | ||
description: "Price tokens on ink EVM chain" | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- contract_address | ||
columns: | ||
- name: token_id | ||
description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika." | ||
- name: blockchain | ||
description: "Native blockchain of the token, if any" | ||
data_tests: | ||
- accepted_values: | ||
values: [ "ink" ] | ||
- name: contract_address | ||
description: "Contract address of the token, if any" | ||
- name: symbol | ||
description: "Token symbol" | ||
- name: decimals | ||
description: "Number of decimals for the token contract" |
23 changes: 23 additions & 0 deletions
23
dbt_subprojects/tokens/models/prices/ink/prices_ink_tokens.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,23 @@ | ||
{% set blockchain = 'ink' %} | ||
|
||
{{ config( | ||
schema = 'prices_' + blockchain, | ||
alias = 'tokens', | ||
materialized = 'table', | ||
file_format = 'delta', | ||
tags = ['static'] | ||
) | ||
}} | ||
|
||
SELECT | ||
token_id | ||
, '{{ blockchain }}' as blockchain | ||
, symbol | ||
, contract_address | ||
, decimals | ||
FROM | ||
( | ||
VALUES | ||
('weth-weth', 'WETH', 0x4200000000000000000000000000000000000006, 18) | ||
, ('usdc-usd-coin', 'USDC.e', 0xF1815bd50389c46847f0Bda824eC8da914045D14, 6) | ||
) as temp (token_id, symbol, contract_address, decimals) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: tokens_ink_erc20 | ||
meta: | ||
blockchain: ink | ||
sector: tokens | ||
project: erc20 | ||
contributors: jeff-dude | ||
config: | ||
tags: ['table', 'erc20', 'ink'] | ||
description: "ERC20 Token Addresses, Symbols and Decimals" | ||
columns: | ||
- name: contract_address | ||
description: "ERC20 token contract address" | ||
data_tests: | ||
- unique | ||
- name: symbol | ||
description: "ERC20 token symbol" | ||
- name: decimals | ||
description: "Number of decimals, refers to how divisible an ERC20 token can be" |
Oops, something went wrong.