Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add soroban eho table #28

Merged
merged 9 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[comment]: < Config Settings current -

{% docs config_settings_current %}
This table maps a given config_setting_id with its current network setting value.
{% enddocs %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[comment]: < Contract Code current -

{% docs contract_code_current %}
This table maps a given contract code hash to its current status. This table does not contain the physical uploaded WASM. Block explorers and other data indexers should be used to view the current code.
{% enddocs %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[comment]: < Contract Data current -

{% docs contract_data_current %}
This table maps a given contract data entry (contract_id and ledgerKey hash) to its current status. In the case of SAC contracts, it will also return the current balance when a contract is the balance holder. Wallet balances are reported in the trustlines table. The Contract data table does not contain custom data saved in a Soroban contract.
{% enddocs %}
12 changes: 12 additions & 0 deletions models/docs/sources/config_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,15 @@ Max transactions in a ledger
{% docs bucket_list_size_window %}
Bucket list size window
{% enddocs %}

{% docs min_temporary_ttl %}
The minimum number of entries for which a temporary entry can live on the ledger.
{% enddocs %}

{% docs min_persistent_ttl %}
The minimum number of entries for which a persisted entry can live on the ledger.
{% enddocs %}

{% docs max_entries_to_archive %}
Maximum number of entries that emit archival meta in a single ledger
{% enddocs %}
8 changes: 8 additions & 0 deletions models/docs/sources/history_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ The type of operation this operation executes
- Required Field
{% enddocs %}

{% docs operation_result_code %}
The result code returned when the Stellar Network applies an operation. This code is helpful for understanding failed transactions.
{% enddocs %}

{% docs operation_trace_code %}
The trace code returned when an operation is applied to the Stellar Network. This code is helpful for understanding failure types.
{% enddocs %}

{% docs details %}
Record that contains details based on the type of operation executed. Each operation will return its own relevant details, with the rest of the details as null
{% enddocs %}
Expand Down
16 changes: 16 additions & 0 deletions models/docs/sources/history_transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,20 @@ Number of bytes read by the transaction

{% docs soroban_resources_write_bytes %}
Number of bytes written by the transaction
{% enddocs %}

{% docs transaction_result_code %}
The detailed result code that outlines why a transaction failed. This code is only useful for failed transactions. The full list of domain values can be found [here](https://pkg.go.dev/github.com/stellar/go/xdr#TransactionResultCode).
{% enddocs %}

{% docs inclusion_fee_bid %}
The maximum bid the submitter is willing to pay for inclusion of the transaction. This fee is used to prioritize transactions that are included in the ledger.
{% enddocs %}

{% docs inclusion_fee_charged %}
The fee charged for the transaction to be included in the ledger.
{% enddocs %}

{% docs resource_fee_refund %}
The amount of the resource fee refunded to the transaction submitter. The refundable fees are calculated from rent, events and return value. Refundable fees are charged from teh source account before the transaction is executed and then refunded based on the actual usage.
{% enddocs %}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ with
, soroban_resources_instructions
, soroban_resources_read_bytes
, soroban_resources_write_bytes
, transaction_result_code
, inclusion_fee_bid
, inclusion_fee_charged
, resource_fee_refund
from {{ ref('stg_history_transactions') }}
where
cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day)
Expand Down Expand Up @@ -201,6 +205,8 @@ with
, extend_to
, contract_id
, contract_code_hash
, operation_result_code
, operation_trace_code
from {{ ref('stg_history_operations') }}
where
cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day)
Expand Down Expand Up @@ -330,6 +336,8 @@ with
, hist_ops.extend_to
, hist_ops.contract_id
, hist_ops.contract_code_hash
, hist_ops.operation_result_code
, hist_ops.operation_trace_code
-- transaction fields
, hist_trans.transaction_hash
, hist_trans.ledger_sequence
Expand Down Expand Up @@ -357,6 +365,10 @@ with
, hist_trans.soroban_resources_instructions
, hist_trans.soroban_resources_read_bytes
, hist_trans.soroban_resources_write_bytes
, hist_trans.transaction_result_code
, hist_trans.inclusion_fee_bid
, hist_trans.inclusion_fee_charged
, hist_trans.resource_fee_refund
-- ledger fields
, hist_ledg.ledger_hash
, hist_ledg.previous_ledger_hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,3 +630,21 @@ models:

- name: soroban_resources_write_bytes
description: '{{ doc("soroban_resources_write_bytes") }}'

- name: transaction_result_code
description: '{{ doc("transaction_result_code") }}'

- name: inclusion_fee_bid
description: '{{ doc("inclusion_fee_bid") }}'

- name: inclusion_fee_charged
description: '{{ doc("inclusion_fee_charged") }}'

- name: resource_fee_refund
description: '{{ doc("resource_fee_refund") }}'

- name: operation_result_code
description: '{{ doc("operation_result_code") }}'

- name: operation_trace_code
description: '{{ doc("operation_trace_code") }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{{ config(
tags = ["enriched_history_operations"],
materialized='incremental',
unique_key=["op_id"],
partition_by={
"field": "closed_at"
, "data_type": "timestamp"
, "granularity": "month"},
cluster_by=["ledger_sequence", "transaction_id", "op_type"]
)
}}

with
eho_soroban as (
select
enriched.op_id
, enriched.op_source_account
, enriched.op_source_account_muxed
, enriched.transaction_id
, enriched.type as op_type
, enriched.type_string
-- expanded operations details fields
, enriched.from
, enriched.asset_balance_changes
, enriched.parameters
, enriched.parameters_decoded
, enriched.function
, enriched.address
, enriched.soroban_operation_type
, enriched.extend_to
, enriched.contract_id
, enriched.contract_code_hash
, enriched.operation_result_code
, enriched.operation_trace_code
-- transaction fields
, enriched.transaction_hash
, enriched.ledger_sequence
, enriched.txn_account
, enriched.account_sequence
, enriched.max_fee
, enriched.txn_operation_count
, enriched.txn_created_at
, enriched.memo_type
, enriched.memo
, enriched.time_bounds
, enriched.successful
, enriched.fee_charged
, enriched.fee_account
, enriched.new_max_fee
, enriched.account_muxed
, enriched.fee_account_muxed
--new protocol 19 fields for transaction preconditions
, enriched.ledger_bounds
, enriched.min_account_sequence
, enriched.min_account_sequence_age
, enriched.min_account_sequence_ledger_gap
, enriched.extra_signers
, enriched.resource_fee
, enriched.soroban_resources_instructions
, enriched.soroban_resources_read_bytes
, enriched.soroban_resources_write_bytes
, enriched.transaction_result_code
, enriched.inclusion_fee_bid
, enriched.inclusion_fee_charged
, enriched.resource_fee_refund
-- ledger fields
, enriched.ledger_hash
, enriched.previous_ledger_hash
, enriched.transaction_count
, enriched.ledger_operation_count
, enriched.closed_at
, enriched.ledger_id
, enriched.total_coins
, enriched.fee_pool
, enriched.base_fee
, enriched.base_reserve
, enriched.max_tx_set_size
, enriched.protocol_version
, enriched.successful_transaction_count
, enriched.failed_transaction_count
-- general fields
, enriched.batch_id
, enriched.batch_run_date
, enriched.batch_insert_ts
from {{ ref('enriched_history_operations') }} as enriched
where
enriched.type in (24, 25, 26)
and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% if is_incremental() %}
and date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% endif %}
)

select *
from eho_soroban
Loading
Loading