mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 13:26:44 +00:00
AN-5209/Upd staking model (#358)
* Upd staking model * drop _s suffix * rm event_data col * upd desc
This commit is contained in:
parent
ccf595e199
commit
9a7151bfc1
@ -1,5 +1,5 @@
|
||||
{% docs delegator %}
|
||||
|
||||
The Flow account address for the wallet delegating to a node.
|
||||
The Flow account address for the wallet delegating to a node. This is derived from the first authorizer on the transaction and may be inaccurate if the transaction was signed by an EOA. Refer to delegator_id as the unique identifier for the delegator, taken directly from the emitted event data.
|
||||
|
||||
{% enddocs %}
|
||||
{% enddocs %}
|
||||
|
||||
@ -11,6 +11,7 @@ SELECT
|
||||
block_height,
|
||||
tx_succeeded,
|
||||
delegator,
|
||||
delegator_id,
|
||||
action,
|
||||
amount,
|
||||
node_id,
|
||||
@ -21,4 +22,4 @@ SELECT
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__staking_actions_s') }}
|
||||
{{ ref('silver__staking_actions') }}
|
||||
|
||||
@ -48,12 +48,16 @@ models:
|
||||
- name: delegator
|
||||
description: "{{ doc('delegator') }}"
|
||||
tests:
|
||||
- not_null
|
||||
- not_null:
|
||||
where: delegator_id is not null
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- VARCHAR
|
||||
- STRING
|
||||
|
||||
- name: delegator_id
|
||||
description: "{{ doc('delegator') }}"
|
||||
|
||||
- name: action
|
||||
description: "{{ doc('action') }}"
|
||||
tests:
|
||||
|
||||
@ -52,7 +52,11 @@ flow_staking AS (
|
||||
tx_succeeded,
|
||||
event_contract,
|
||||
event_type AS action,
|
||||
event_data :amount :: FLOAT AS amount,
|
||||
COALESCE(
|
||||
event_data :amount :: FLOAT,
|
||||
-- amount for event NewNodeCreated rep initial stake
|
||||
event_data :amountCommitted :: FLOAT
|
||||
) AS amount,
|
||||
event_data :delegatorID :: STRING AS delegator_id,
|
||||
event_data :nodeID :: STRING AS node_id,
|
||||
_inserted_timestamp,
|
||||
@ -63,11 +67,33 @@ flow_staking AS (
|
||||
event_contract = 'A.8624b52f9ddcd04a.FlowIDTableStaking'
|
||||
AND event_type IN (
|
||||
'DelegatorTokensCommitted',
|
||||
'DelegatorRewardTokensWithdrawn',
|
||||
'DelegatorUnstakedTokensWithdrawn',
|
||||
'TokensCommitted',
|
||||
|
||||
'DelegatorTokensStaked',
|
||||
'TokensStaked',
|
||||
|
||||
'DelegatorTokensRequestedToUnstake',
|
||||
|
||||
'DelegatorTokensUnstaking',
|
||||
'TokensUnstaking',
|
||||
|
||||
'DelegatorTokensUnstaked',
|
||||
'TokensUnstaked',
|
||||
|
||||
'DelegatorUnstakedTokensWithdrawn',
|
||||
'UnstakedTokensWithdrawn',
|
||||
|
||||
'DelegatorRewardTokensWithdrawn',
|
||||
'RewardTokensWithdrawn',
|
||||
'UnstakedTokensWithdrawn'
|
||||
|
||||
-- important additions to include
|
||||
-- initial stake, any self-unstake, refund
|
||||
'NewNodeCreated',
|
||||
'NodeTokensRequestedToUnstake',
|
||||
'NodeRemovedAndRefunded',
|
||||
|
||||
'RewardsPaid',
|
||||
'DelegatorRewardsPaid'
|
||||
)
|
||||
),
|
||||
add_auth AS (
|
||||
@ -114,7 +140,8 @@ FINAL AS (
|
||||
block_timestamp,
|
||||
block_height,
|
||||
tx_succeeded,
|
||||
primary_authorizer AS delegator,
|
||||
IFF(delegator_id IS NOT NULL, primary_authorizer, null) AS delegator,
|
||||
delegator_id,
|
||||
action,
|
||||
amount,
|
||||
node_id,
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
|
||||
models:
|
||||
- name: silver__staking_actions_s
|
||||
- name: silver__staking_actions
|
||||
description: |-
|
||||
This table provides transaction-level info on FLOW staking activities.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user