mirror of
https://github.com/FlipsideCrypto/fsc-evm.git
synced 2026-02-06 10:46:48 +00:00
nado
This commit is contained in:
parent
c113992f83
commit
8dfc21b105
9
data/curated/contract_reads/silver_reads__nado_seed.csv
Normal file
9
data/curated/contract_reads/silver_reads__nado_seed.csv
Normal file
@ -0,0 +1,9 @@
|
||||
chain,token_address,contract_address
|
||||
ink,0x0200C29006150606B650577BBE7B6248F58470c1,0xD218103918C19D0A10cf35300E4CfAfbD444c5fE
|
||||
ink,0x0200C29006150606B650577BBE7B6248F58470c1,0x05ec92D78ED421f3D3Ada77FFdE167106565974E
|
||||
ink,0x4200000000000000000000000000000000000006,0xD218103918C19D0A10cf35300E4CfAfbD444c5fE
|
||||
ink,0x4200000000000000000000000000000000000006,0x05ec92D78ED421f3D3Ada77FFdE167106565974E
|
||||
ink,0x73E0C0d45E048D25Fc26Fa3159b0aA04BfA4Db98,0xD218103918C19D0A10cf35300E4CfAfbD444c5fE
|
||||
ink,0x73E0C0d45E048D25Fc26Fa3159b0aA04BfA4Db98,0x05ec92D78ED421f3D3Ada77FFdE167106565974E
|
||||
ink,0x2D270e6886d130D724215A266106e6832161EAEd,0xD218103918C19D0A10cf35300E4CfAfbD444c5fE
|
||||
ink,0x2D270e6886d130D724215A266106e6832161EAEd,0x05ec92D78ED421f3D3Ada77FFdE167106565974E
|
||||
|
@ -82,12 +82,14 @@
|
||||
'CURATED_DEFI_LENDING_CONTRACT_MAPPING': {
|
||||
'shroomy': {
|
||||
'v1': {
|
||||
'aave_version_address': '0x70c88e98578bc521a799de0b1c65a2b12d6f99e4'
|
||||
'aave_version_address': '0x70c88e98578bc521a799de0b1c65a2b12d6f99e4',
|
||||
'fork_version': 'v3'
|
||||
}
|
||||
},
|
||||
'tydro': {
|
||||
'v1': {
|
||||
'aave_version_address': '0x2816cf15f6d2a220e789aa011d5ee4eb6c47feba'
|
||||
'aave_version_address': '0x2816cf15f6d2a220e789aa011d5ee4eb6c47feba',
|
||||
'fork_version': 'v3'
|
||||
}
|
||||
},
|
||||
'morpho': {
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
{# Get variables #}
|
||||
{% set vars = return_vars() %}
|
||||
|
||||
{# Log configuration details #}
|
||||
{{ log_model_details() }}
|
||||
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
unique_key = 'nado_reads_id',
|
||||
tags = ['streamline','contract_reads','records']
|
||||
) }}
|
||||
|
||||
WITH contracts AS (
|
||||
|
||||
SELECT
|
||||
LOWER(s.token_address) AS contract_address,
|
||||
LOWER(s.contract_address) AS address
|
||||
FROM
|
||||
{{ ref('silver_reads__nado_seed') }} s
|
||||
WHERE
|
||||
chain = '{{ vars.GLOBAL_PROJECT_NAME }}'
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND CONCAT(COALESCE(token_address, 'null'), '-', contract_address) NOT IN (
|
||||
SELECT
|
||||
CONCAT(COALESCE(contract_address, 'null'), '-', address)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
contract_address,
|
||||
address,
|
||||
'balanceOf' AS function_name,
|
||||
'0x70a08231' AS function_sig,
|
||||
CONCAT(
|
||||
function_sig,
|
||||
LPAD(SUBSTR(address, 3), 64, '0')
|
||||
) AS input,
|
||||
NULL :: variant AS metadata,
|
||||
'nado' AS protocol,
|
||||
'v1' AS version,
|
||||
CONCAT(
|
||||
protocol,
|
||||
'-',
|
||||
version
|
||||
) AS platform,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['contract_address','address','input','platform']
|
||||
) }} AS nado_reads_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
contracts
|
||||
@ -7,10 +7,10 @@
|
||||
-- depends_on: {{ ref('price__ez_asset_metadata') }}
|
||||
-- depends_on: {{ ref('silver_reads__lido_v1_reads') }}
|
||||
-- depends_on: {{ ref('silver_reads__binance_v1_reads') }}
|
||||
-- depends_on: {{ ref('silver_reads__polymarket_v1_reads') }}
|
||||
-- depends_on: {{ ref('silver_reads__eigenlayer_v1_reads') }}
|
||||
-- depends_on: {{ ref('silver_reads__rocketpool_v1_reads') }}
|
||||
-- depends_on: {{ ref('silver_reads__sky_v1_reads') }}
|
||||
-- depends_on: {{ ref('silver_reads__polymarket_v1_reads') }}
|
||||
{{ config (
|
||||
materialized = "incremental",
|
||||
unique_key = "contract_reads_records_id",
|
||||
@ -45,6 +45,7 @@
|
||||
{% set _ = models.append((ref('silver_reads__tornado_cash_v1_reads'), 'daily')) %}
|
||||
{% set _ = models.append((ref('silver_reads__etherfi_v1_reads'), 'daily')) %}
|
||||
{% set _ = models.append((ref('silver_reads__morpho_blue_v1_reads'), 'daily')) %}
|
||||
{% set _ = models.append((ref('silver_reads__nado_v1_reads'), 'daily')) %}
|
||||
{% set _ = models.append((ref('silver_reads__compound_v1_reads'), 'daily')) %}
|
||||
{% set _ = models.append((ref('silver_reads__compound_v2_reads'), 'daily')) %}
|
||||
{% set _ = models.append((ref('silver_reads__compound_v3_reads'), 'daily')) %}
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
{# Get variables #}
|
||||
{% set vars = return_vars() %}
|
||||
|
||||
{# Log configuration details #}
|
||||
{{ log_model_details() }}
|
||||
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
incremental_strategy = 'delete+insert',
|
||||
unique_key = 'nado_v1_tvl_id',
|
||||
tags = ['silver','defi','tvl','curated_daily']
|
||||
) }}
|
||||
|
||||
WITH reads AS (
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
block_date,
|
||||
contract_address,
|
||||
address,
|
||||
result_hex AS amount_hex,
|
||||
IFNULL(
|
||||
CASE
|
||||
WHEN LENGTH(amount_hex) <= 4300
|
||||
AND amount_hex IS NOT NULL THEN TRY_CAST(utils.udf_hex_to_int(amount_hex) AS bigint)END,
|
||||
CASE
|
||||
WHEN amount_hex IS NOT NULL THEN TRY_CAST(utils.udf_hex_to_int(RTRIM(amount_hex, '0')) AS bigint)
|
||||
END
|
||||
) AS amount_raw,
|
||||
protocol,
|
||||
version,
|
||||
platform,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__contract_reads') }}
|
||||
WHERE
|
||||
platform = 'nado-v1'
|
||||
AND amount_raw IS NOT NULL
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND modified_timestamp > (
|
||||
SELECT
|
||||
MAX(modified_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
block_number,
|
||||
block_date,
|
||||
contract_address,
|
||||
address,
|
||||
contract_address AS token_address,
|
||||
amount_hex,
|
||||
amount_raw,
|
||||
protocol,
|
||||
version,
|
||||
platform,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['block_date','contract_address','address','platform']
|
||||
) }} AS nado_v1_tvl_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
reads qualify(ROW_NUMBER() over(PARTITION BY nado_v1_tvl_id
|
||||
ORDER BY
|
||||
_inserted_timestamp DESC)) = 1
|
||||
@ -0,0 +1,4 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver_tvl__nado_v1_tvl
|
||||
description: '{{ doc("nado_v1_tvl_table_doc") }}'
|
||||
@ -35,7 +35,8 @@
|
||||
(ref('silver_tvl__morpho_blue_v1_tvl'), 12, 'morpho-v1'),
|
||||
(ref('silver_tvl__compound_v1_tvl'), 12, 'compound-v1'),
|
||||
(ref('silver_tvl__compound_v2_tvl'), 12, 'compound-v2'),
|
||||
(ref('silver_tvl__compound_v3_tvl'), 12, 'compound-v3')
|
||||
(ref('silver_tvl__compound_v3_tvl'), 12, 'compound-v3'),
|
||||
(ref('silver_tvl__nado_v1_tvl'), 12, 'nado-v1')
|
||||
] %}
|
||||
|
||||
WITH all_tvl AS (
|
||||
|
||||
@ -159,4 +159,11 @@ Sums balanceOf() for base tokens + all collateral assets held by each Comet mark
|
||||
Methodology:
|
||||
Sums balanceOf() for collateral tokens held by each collateral join contract (discovered via MCD_VAT rely events and gem() calls) plus USDC held by the PSM wallet.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
{% docs nado_v1_tvl_table_doc %}
|
||||
|
||||
Methodology:
|
||||
Sums ERC20 token balances across clearinghouse and endpoint contracts
|
||||
|
||||
{% enddocs %}
|
||||
Loading…
Reference in New Issue
Block a user