mirror of
https://github.com/FlipsideCrypto/axelar-models.git
synced 2026-02-06 13:56:46 +00:00
tokens & validators tables + label update
This commit is contained in:
parent
e96775b39c
commit
05d422c53f
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,20 @@
|
||||
{{ config(
|
||||
materialized = 'table'
|
||||
) }}
|
||||
|
||||
WITH call AS (
|
||||
SELECT
|
||||
ethereum.streamline.udf_api(
|
||||
'POST',
|
||||
'https://api.axelarscan.io',{},{'path':'/cosmos/staking/v1beta1/validators','module':'lcd'}
|
||||
) AS resp,
|
||||
SYSDATE() AS _inserted_timestamp
|
||||
)
|
||||
SELECT
|
||||
i.value :operator_address :: STRING AS address,
|
||||
i.value AS data,
|
||||
_inserted_timestamp
|
||||
FROM call,
|
||||
LATERAL FLATTEN(
|
||||
input => resp :data :validators
|
||||
) i
|
||||
5
models/descriptions/_unique_key.md
Normal file
5
models/descriptions/_unique_key.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs _unique_key %}
|
||||
|
||||
The unique key for the table.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/address.md
Normal file
5
models/descriptions/address.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs address %}
|
||||
|
||||
Address unique to an individual wallet, validator, or token.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/creator.md
Normal file
5
models/descriptions/creator.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs creator %}
|
||||
|
||||
Name of the label creator - for now, this will always be "Flipside."
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/decimal.md
Normal file
5
models/descriptions/decimal.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs decimal %}
|
||||
|
||||
Divide amount by decimal to get the actual amount of currency being transferred.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/label.md
Normal file
5
models/descriptions/label.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs label %}
|
||||
|
||||
The label or name of the address.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/label_subtype.md
Normal file
5
models/descriptions/label_subtype.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs label_subtype %}
|
||||
|
||||
Adds more detail to the label type.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/label_type.md
Normal file
5
models/descriptions/label_type.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs label_type %}
|
||||
|
||||
A broad category that describes what a label is representing.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/project_name.md
Normal file
5
models/descriptions/project_name.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs project_name %}
|
||||
|
||||
The name of the project the label belongs to.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/descriptions/raw_metadata.md
Normal file
5
models/descriptions/raw_metadata.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs raw_metadata %}
|
||||
|
||||
Additional details about the validator or token in json format.
|
||||
|
||||
{% enddocs %}
|
||||
@ -20,7 +20,7 @@ WHERE
|
||||
blockchain = 'axelar'
|
||||
UNION ALL
|
||||
SELECT
|
||||
'axelar',
|
||||
'axelar' AS blockchain,
|
||||
creator,
|
||||
address,
|
||||
label_type,
|
||||
@ -29,10 +29,16 @@ SELECT
|
||||
project_name,
|
||||
raw_metadata
|
||||
FROM
|
||||
{{ source(
|
||||
'tokens',
|
||||
'dim_labels'
|
||||
) }}
|
||||
WHERE
|
||||
label_type = 'token'
|
||||
AND label_subtype = 'token_contract'
|
||||
{{ ref('core__dim_tokens') }}
|
||||
UNION ALL
|
||||
SELECT
|
||||
'axelar' AS blockchain,
|
||||
creator,
|
||||
address,
|
||||
label_type,
|
||||
label_subtype,
|
||||
label,
|
||||
project_name,
|
||||
raw_metadata
|
||||
FROM
|
||||
{{ ref('core__fact_validators') }}
|
||||
|
||||
26
models/gold/core__dim_tokens.sql
Normal file
26
models/gold/core__dim_tokens.sql
Normal file
@ -0,0 +1,26 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
'axelar' AS blockchain,
|
||||
address,
|
||||
creator,
|
||||
label_type,
|
||||
label_subtype,
|
||||
label,
|
||||
project_name,
|
||||
alias,
|
||||
DECIMAL,
|
||||
raw_metadata,
|
||||
concat_ws(
|
||||
'-',
|
||||
address,
|
||||
creator,
|
||||
blockchain
|
||||
) AS unique_key
|
||||
FROM
|
||||
{{ source(
|
||||
'osmo',
|
||||
'asset_metadata'
|
||||
) }}
|
||||
49
models/gold/core__dim_tokens.yml
Normal file
49
models/gold/core__dim_tokens.yml
Normal file
@ -0,0 +1,49 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__dim_tokens
|
||||
description: Contains token metadata for assets on the Axelar blockchain. This table was sourced from an API and may not contain every token.
|
||||
columns:
|
||||
- name: ADDRESS
|
||||
description: "{{ doc('address') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CREATOR
|
||||
description: "{{ doc('creator') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL_TYPE
|
||||
description: "{{ doc('label_type') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL_SUBTYPE
|
||||
description: "{{ doc('label_subtype') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL
|
||||
description: "{{ doc('label') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROJECT_NAME
|
||||
description: "{{ doc('project_name') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: ALIAS
|
||||
description: A secondary address for the token, where available
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: DECIMAL
|
||||
description: "{{ doc('decimal') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: RAW_METADATA
|
||||
description: "{{ doc('raw_metadata') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: UNIQUE_KEY
|
||||
description: The unique key of the table
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
23
models/gold/core__fact_validators.sql
Normal file
23
models/gold/core__fact_validators.sql
Normal file
@ -0,0 +1,23 @@
|
||||
{{ config(
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
address,
|
||||
blockchain,
|
||||
creator,
|
||||
label_type,
|
||||
label_subtype,
|
||||
label,
|
||||
project_name,
|
||||
delegator_shares,
|
||||
jailed,
|
||||
rate,
|
||||
max_change_rate,
|
||||
max_rate,
|
||||
min_self_delegation,
|
||||
RANK,
|
||||
raw_metadata,
|
||||
unique_key
|
||||
FROM
|
||||
{{ ref('silver__validators') }}
|
||||
73
models/gold/core__fact_validators.yml
Normal file
73
models/gold/core__fact_validators.yml
Normal file
@ -0,0 +1,73 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_validators
|
||||
description: Information about all active and inactive set validators on Axelar.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- UNIQUE_KEY
|
||||
columns:
|
||||
- name: ADDRESS
|
||||
description: "{{ doc('address') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: CREATOR
|
||||
description: "{{ doc('creator') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL_TYPE
|
||||
description: "{{ doc('label_type') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL_SUBTYPE
|
||||
description: "{{ doc('label_subtype') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: LABEL
|
||||
description: "{{ doc('label') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: PROJECT_NAME
|
||||
description: "{{ doc('project_name') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: DELEGATOR_SHARES
|
||||
description: The number of tokens staked to the validator.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: JAILED
|
||||
description: FALSE when a validator is not jailed, TRUE when a validator is jailed
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: RATE
|
||||
description: The current commission rate the validator is charging stakers.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MAX_CHANGE_RATE
|
||||
description: The maximum rate at which a validator can change their commission per day.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MAX_RATE
|
||||
description: The maximum commission rate that the validator can charge
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: MIN_SELF_DELEGATION
|
||||
description: The minimum number of OSMO tokens that the operator must be staking with their own validator
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: RANK
|
||||
description: The rank of the validator in the validator set. Rank is determined by the number of OSMO tokens staked to the validator
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: RAW_METADATA
|
||||
description: "{{ doc('raw_metadata') }}"
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
- name: UNIQUE_KEY
|
||||
description: The unique key of the table
|
||||
tests:
|
||||
- dbt_expectations.expect_column_to_exist
|
||||
32
models/silver/silver__validators.sql
Normal file
32
models/silver/silver__validators.sql
Normal file
@ -0,0 +1,32 @@
|
||||
{{ config(
|
||||
materialized = 'table'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
address,
|
||||
'axelar' AS blockchain,
|
||||
'flipside' AS creator,
|
||||
'operator' AS label_type,
|
||||
'validator' AS label_subtype,
|
||||
DATA :description :moniker :: STRING AS label,
|
||||
DATA :description :identity :: STRING AS project_name,
|
||||
DATA :delegator_shares :: INT AS delegator_shares,
|
||||
DATA :jailed :: BOOLEAN AS jailed,
|
||||
DATA :commission :commission_rates :rate :: FLOAT AS rate,
|
||||
DATA :commission :commission_rates :max_change_rate :: FLOAT AS max_change_rate,
|
||||
DATA :commission :commission_rates :max_rate :: FLOAT AS max_rate,
|
||||
DATA :min_self_delegation :: INT AS min_self_delegation,
|
||||
RANK() over (
|
||||
PARTITION BY address
|
||||
ORDER BY
|
||||
DATA :delegator_shares :: INT DESC
|
||||
) AS RANK,
|
||||
DATA AS raw_metadata,
|
||||
concat_ws(
|
||||
'-',
|
||||
address,
|
||||
creator,
|
||||
blockchain
|
||||
) AS unique_key
|
||||
FROM
|
||||
{{ ref('bronze_api__get_validator_metadata') }}
|
||||
137
models/silver/silver__validators.yml
Normal file
137
models/silver/silver__validators.yml
Normal file
@ -0,0 +1,137 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__validators
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- UNIQUE_KEY
|
||||
columns:
|
||||
- name: ADDRESS
|
||||
description: "{{ doc('address') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: BLOCKCHAIN
|
||||
description: "{{ doc('blockchain') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_be_in_set:
|
||||
value_set: ['axelar']
|
||||
- name: CREATOR
|
||||
description: "{{ doc('creator') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: LABEL_TYPE
|
||||
description: "{{ doc('label_type') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_be_in_set:
|
||||
value_set: ['operator']
|
||||
- name: LABEL_SUBTYPE
|
||||
description: "{{ doc('label_subtype') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- dbt_expectations.expect_column_values_to_be_in_set:
|
||||
value_set: ['validator']
|
||||
- name: LABEL
|
||||
description: "{{ doc('label') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: PROJECT_NAME
|
||||
description: "{{ doc('project_name') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
- name: DELEGATOR_SHARES
|
||||
description: The number of tokens staked to the validator.
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: JAILED
|
||||
description: FALSE when a validator is not jailed, TRUE when a validator is jailed
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- BOOLEAN
|
||||
- name: RATE
|
||||
description: The current commission rate the validator is charging stakers.
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MAX_CHANGE_RATE
|
||||
description: The maximum rate at which a validator can change their commission per day.
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MAX_RATE
|
||||
description: The maximum commission rate that the validator can charge
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: MIN_SELF_DELEGATION
|
||||
description: The minimum number of OSMO tokens that the operator must be staking with their own validator
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: RANK
|
||||
description: The rank of the validator in the validator set. Rank is determined by the number of OSMO tokens staked to the validator
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- NUMBER
|
||||
- FLOAT
|
||||
- name: RAW_METADATA
|
||||
description: "{{ doc('raw_metadata') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- name: UNIQUE_KEY
|
||||
description: The unique key of the table
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- STRING
|
||||
- VARCHAR
|
||||
@ -25,4 +25,9 @@ sources:
|
||||
tables:
|
||||
- name: blocks
|
||||
- name: txs
|
||||
- name: txs_details
|
||||
- name: txs_details
|
||||
- name: osmo
|
||||
database: osmosis
|
||||
schema: silver
|
||||
tables:
|
||||
- name: asset_metadata
|
||||
Loading…
Reference in New Issue
Block a user