solana-models/macros/create_udfs.sql
desmond-hui ec6a458253
An 4131/an 4152/jupv5 and jupv6 models (#387)
* v5 swaps, first contract

* rename

* tests wip

* update swap_index

* fix duplicates and null mints for marinade deposits

* disable models

* An 4131/add jupv6 (#385)

* wip

* fix index join

* clean up

* adjust cols and union to swaps

* fix null _log_id col

* update swap_index

* remove solana_dev prefix

---------

Co-authored-by: Desmond Hui <desmond@flipsidecrypto.com>

* initial jup v5.2 model (#386)

* initial jup v5.2 model

* testing and swap_index update

* fix duplicates

* fix transfer ordering issue, fix mint actions bad join

---------

Co-authored-by: tarikceric <tarik@flipsidecrypto.com>

* make same fixes as in v5_2 model

* disable v5 models as there are no longer new events for them

* add incremental predicate

* add new udf to be created

* add succeeded column for v5 models

* remove v6 from silver swaps, add to defi.swaps view directly

---------

Co-authored-by: tarikceric <tarik@flipsidecrypto.com>
Co-authored-by: tarikceric <46071768+tarikceric@users.noreply.github.com>
2023-11-07 06:51:44 -08:00

61 lines
1.9 KiB
SQL

{% macro create_udfs() %}
{% if var("UPDATE_UDFS_AND_SPS") %}
{% set sql %}
{% if target.database != "SOLANA_COMMUNITY_DEV" %}
{{ udf_bulk_get_decoded_instructions_data() }};
{{ udf_bulk_get_validator_metadata() }};
{{ udf_bulk_get_blocks() }};
{{ udf_bulk_get_block_txs() }};
{{ udf_bulk_get_block_rewards() }};
{{ udf_snapshot_get_vote_accounts() }};
{{ udf_snapshot_get_validators_app_data() }};
{{ udf_snapshot_get_stake_accounts() }};
{{ udf_snapshot_get_vote_program_accounts() }};
{{ udf_bulk_program_parser() }};
{{ udf_decode_instructions() }};
{{ udf_bulk_parse_compressed_nft_mints() }};
{{ udf_bulk_get_solscan_blocks() }};
{% endif %}
{{ create_udf_ordered_signers(
schema = "silver"
) }}
{{ create_udf_get_all_inner_instruction_events(
schema = "silver"
) }}
{{ create_udf_get_account_balances_index(
schema = "silver"
) }}
{{
create_udf_get_all_inner_instruction_program_ids(
schema = "silver"
) }}
{{
create_udf_get_multi_signers_swapper(
schema = "silver"
) }}
{{
create_udf_get_jupv4_inner_programs(
schema = "silver"
) }}
{{
create_udf_get_compute_units_consumed(
schema = "silver"
) }}
{{
create_udf_get_compute_units_total(
schema = "silver"
) }}
{{
create_udf_get_tx_size(
schema = "silver"
) }}
{{
create_udf_get_account_pubkey_by_name(
schema = "silver"
) }}
{% endset %}
{% do run_query(sql) %}
{% endif %}
{% endmacro %}