diff --git a/models/core/actions_events_function_call.sql b/models/core/actions_events_function_call.sql new file mode 100644 index 0000000..51215a3 --- /dev/null +++ b/models/core/actions_events_function_call.sql @@ -0,0 +1,47 @@ +{{ + config( + materialized='incremental', + cluster_by='block_timestamp', + tags=['near','actions','events','functioncall'] + ) +}} + +with +action_events as ( + + select * from {{ ref('actions_events') }} + where {{ incremental_load_filter('block_timestamp') }} + and action_name = 'FunctionCall' + +), + +decoding as ( +select + + *, + try_base64_decode_string(action_data:args) as args_decoded, + action_data:deposit::float / pow(10,24) as deposit, + action_data:gas::float / pow(10,12) as attached_tgas, + action_data:method_name::string as method_name + +from action_events +where args_decoded is not null + +), + +function_calls as ( + select + + action_id, + tx_hash, + block_timestamp, + action_name, + method_name, + try_parse_json(args_decoded) as args, + deposit, + attached_tgas + + from decoding +) + +select * from function_calls diff --git a/models/core/actions_events_function_call.yml b/models/core/actions_events_function_call.yml new file mode 100644 index 0000000..f6a6c9d --- /dev/null +++ b/models/core/actions_events_function_call.yml @@ -0,0 +1,48 @@ +version: 2 + +models: + - name: actions_events_function_call + description: |- + + + columns: + - name: action_id + description: The `action_id` as compiled from `tx_id` and `action_index`. This is unique for each record. + tests: + - unique + - not_null + + - name: tx_hash + description: The hash of the transaction, this is the primary key for this table. + tests: + - not_null + + - name: block_timestamp + description: The `block_timestamp` taken from block headers. The time when the block was created. + tests: + - not_null + + - name: action_name + description: The name of the action performed. + tests: + - not_null + + - name: method_name + description: The method called within the action `FunctionCall`. + tests: + - not_null + + - name: args + description: Decoded arguments passed alongside the `method_name`. + tests: + - not_null + + - name: deposit + description: Sum of all NEAR tokens (decimal adjusted, 10^24) transferred from the Signing account to the Receiver account. This includes tokens sent in a Transfer action(s), and as deposits on Function Call action(s). + tests: + - not_null + + - name: attached_tgas + description: Units of gas (decimal adjusted, 10^12) attached to the transaction (this is often higher than 'Gas Used'). + tests: + - not_null