mirror of
https://github.com/FlipsideCrypto/flow-models.git
synced 2026-02-06 13:06:59 +00:00
* flow evm init * flow evm testnet - blocks * deploy dev udfs, update typo * send block height as hex * dev limit * use stg external table * some links * add query to side doc * upd external tbl to stg & testnet * silver and evm txs * testnet silver models pt1 * testnet events final, decode hash udf * udf get evm chainhead * upd resource list * new udf. receipts pipeline. upd testnet model cols. expand readme * receipts silver * traces * vault * reorg to evm dir * rm testnet, blocks lookback * lookbacks, move qualify * macro and align naming * del testnet, reset namespace to gen * silver_evm - receipts and txs * core_evm fact_blocks & fact_transactions * fix vault path in get blocks. Logs v1 (need sample) * core_evm fact_logs * CR updates * del readme and add workflow * upd vault path, batch size * incr logic on modified to core_evm * use local utils.udf, add blockNumber col to complete blocks check * rm col * correct _invocation_id * upd nv csv * incr batch limit due to late start * add evm tag to model run
32 lines
733 B
PL/PgSQL
32 lines
733 B
PL/PgSQL
{% macro run_create_udf_decode_hash_array() %}
|
|
{% set sql %}
|
|
|
|
CREATE
|
|
OR REPLACE FUNCTION {{ target.database }}.streamline.udf_decode_hash_array(raw_array ARRAY)
|
|
RETURNS STRING
|
|
LANGUAGE PYTHON
|
|
RUNTIME_VERSION = '3.8'
|
|
HANDLER = 'decode_hash_array'
|
|
AS
|
|
$$
|
|
def decode_hash_array(raw_array):
|
|
try:
|
|
# Parse the JSON array
|
|
data = raw_array
|
|
|
|
# Extract and convert values
|
|
hex_values = [format(int(item['value']), '02x') for item in data]
|
|
|
|
# Concatenate and add prefix
|
|
result = '0x' + ''.join(hex_values)
|
|
|
|
return result.lower()
|
|
except Exception as e:
|
|
return f"Error: {str(e)}"
|
|
$$
|
|
;
|
|
|
|
{% endset %}
|
|
{% do run_query(sql) %}
|
|
{% endmacro %}
|