mirror of
https://github.com/FlipsideCrypto/livequery-base.git
synced 2026-02-06 03:07:13 +00:00
STREAM-366/STREAM-346/refactor-function-deployment (#32)
This commit is contained in:
parent
040b3fdf9a
commit
1a00e9fe86
12
.github/workflows/dbt_docs_update.yml
vendored
12
.github/workflows/dbt_docs_update.yml
vendored
@ -24,24 +24,26 @@ jobs:
|
||||
scheduled_run:
|
||||
name: docs_update
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
environment:
|
||||
name: workflow_prod
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-python@v1
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.7.x"
|
||||
python-version: "3.10"
|
||||
cache: "pip"
|
||||
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
pip install dbt-snowflake==${{ vars.DBT_VERSION }}
|
||||
pip install -r requirements.txt
|
||||
dbt deps
|
||||
- name: checkout docs branch
|
||||
run: |
|
||||
git checkout -b docs origin/main
|
||||
|
||||
|
||||
- name: generate dbt docs
|
||||
run: dbt docs generate -t prod
|
||||
|
||||
|
||||
30
.github/workflows/dbt_run_adhoc.yml
vendored
30
.github/workflows/dbt_run_adhoc.yml
vendored
@ -1,13 +1,11 @@
|
||||
name: dbt_run_adhoc
|
||||
run-name: dbt_run_adhoc
|
||||
run-name: ${{ inputs.dbt_command }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- "main"
|
||||
inputs:
|
||||
environment:
|
||||
type: choice
|
||||
type: choice
|
||||
description: DBT Run Environment
|
||||
required: true
|
||||
options:
|
||||
@ -15,9 +13,9 @@ on:
|
||||
- prod
|
||||
default: dev
|
||||
warehouse:
|
||||
type: choice
|
||||
type: choice
|
||||
description: Snowflake warehouse
|
||||
required: true
|
||||
required: true
|
||||
options:
|
||||
- DBT
|
||||
- DBT_CLOUD
|
||||
@ -27,7 +25,7 @@ on:
|
||||
type: string
|
||||
description: 'DBT Run Command'
|
||||
required: true
|
||||
|
||||
|
||||
env:
|
||||
DBT_PROFILES_DIR: ./
|
||||
|
||||
@ -46,20 +44,28 @@ concurrency:
|
||||
jobs:
|
||||
run_dbt_jobs:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
environment:
|
||||
name: workflow_${{ inputs.environment }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-python@v1
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.7.x"
|
||||
python-version: "3.10"
|
||||
cache: "pip"
|
||||
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
pip3 install dbt-snowflake==${{ vars.DBT_VERSION }} cli_passthrough requests click
|
||||
pip install -r requirements.txt
|
||||
dbt deps
|
||||
- name: Run DBT Jobs
|
||||
run: |
|
||||
${{ inputs.dbt_command }}
|
||||
dbt --debug ${{ inputs.dbt_command }}
|
||||
|
||||
- name: Store logs
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dbt-logs
|
||||
path: logs
|
||||
12
.github/workflows/dbt_run_dev_refresh.yml
vendored
12
.github/workflows/dbt_run_dev_refresh.yml
vendored
@ -6,7 +6,7 @@ on:
|
||||
schedule:
|
||||
# Runs "at 9:00 UTC" (see https://crontab.guru)
|
||||
- cron: '0 9 * * *'
|
||||
|
||||
|
||||
env:
|
||||
DBT_PROFILES_DIR: ./
|
||||
|
||||
@ -25,19 +25,21 @@ concurrency:
|
||||
jobs:
|
||||
run_dbt_jobs:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
environment:
|
||||
name: workflow_prod
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-python@v1
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.7.x"
|
||||
python-version: "3.10"
|
||||
cache: "pip"
|
||||
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
pip3 install dbt-snowflake==${{ vars.DBT_VERSION }} cli_passthrough requests click
|
||||
pip install -r requirements.txt
|
||||
dbt deps
|
||||
- name: Run DBT Jobs
|
||||
run: |
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -16,4 +16,6 @@ logs/
|
||||
.vscode/
|
||||
dbt-env/
|
||||
.env
|
||||
.*
|
||||
.*
|
||||
# KEEP
|
||||
!.github/
|
||||
@ -1,4 +1,8 @@
|
||||
{%- set udfs = fromyaml(config_core_udfs()) -%}
|
||||
{%- set udfs = fromyaml(config_core_live()) -%}
|
||||
{% do udfs.extend(fromyaml(config_core__live())) %}
|
||||
{% do udfs.extend(fromyaml(config_core__utils())) %}
|
||||
{% do udfs.extend(fromyaml(config_core_utils())) %}
|
||||
|
||||
{%- for udf in udfs -%}
|
||||
{{- create_or_drop_function_from_config(udf, drop_=True) -}}
|
||||
{{- create_or_drop_function_from_config(udf, drop_=False) -}}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{{crud_udfs_in_schema(config_evm_high_level_abstractions, 'ethereum', 'mainnet', false)}}
|
||||
{# {{- crud_udfs_in_schema(config_evm_rpc_primitives, "ethereum", None, False) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "ethereum", None, true) -}} #}
|
||||
{{crud_udfs_by_chain(config_evm_high_level_abstractions, 'ethereum', 'mainnet', false)}}
|
||||
{{- crud_udfs_by_chain(config_evm_rpc_primitives, "ethereum", None, False) -}}
|
||||
{{- crud_udfs_by_chain(config_evm_rpc_primitives, "ethereum", None, true) -}}
|
||||
@ -1,2 +1,3 @@
|
||||
{{ sql_udf_json_rpc_call(True) }}
|
||||
{{ sql_udf_json_rpc_call(False) }}
|
||||
{# {{ sql_udf_json_rpc_call(False) }} #}
|
||||
{{ config_core__live() }}
|
||||
@ -1,5 +1,5 @@
|
||||
Project,Endpoint,Type,Documentation
|
||||
Snapshot,https://hub.snapshot.org/graphql,GraphQL,https://docs.snapshot.org/graphql-api
|
||||
Snapshot,https://hub.snapshot.org/graphql,GraphQL,https://docs.snapshot.org/graphql-api
|
||||
Defillama,https://api.llama.fi/,REST,https://defillama.com/docs/api
|
||||
Defillama,https://yields.llama.fi/,REST,https://defillama.com/docs/api
|
||||
Defillama,https://stablecoins.llama.fi/,REST,https://defillama.com/docs/api
|
||||
|
@ -13,7 +13,7 @@ profile: "livequery"
|
||||
# found in the "models/" directory. You probably won't need to change these!
|
||||
model-paths: ["models"]
|
||||
analysis-paths: ["analysis"]
|
||||
test-paths: ["tests"]
|
||||
# test-paths: ["tests"]
|
||||
seed-paths: ["data"]
|
||||
macro-paths: ["macros"]
|
||||
snapshot-paths: ["snapshots"]
|
||||
@ -24,12 +24,22 @@ clean-targets: # directories to be removed by `dbt clean`
|
||||
- "dbt_modules"
|
||||
- "dbt_packages"
|
||||
|
||||
models:
|
||||
livequery_models:
|
||||
deploy:
|
||||
+materialized: ephemeral
|
||||
core:
|
||||
+tags: core
|
||||
evm:
|
||||
+tags: evm
|
||||
marketplace:
|
||||
+tags: marketplace
|
||||
|
||||
tests:
|
||||
+store_failures: true # all tests
|
||||
|
||||
on-run-start:
|
||||
- "{{ create_sps() }}"
|
||||
- "{{ create_udfs() }}"
|
||||
|
||||
on-run-end:
|
||||
- "{{ apply_meta_as_tags(results) }}"
|
||||
@ -44,6 +54,7 @@ on-run-end:
|
||||
vars:
|
||||
"dbt_date:time_zone": GMT
|
||||
UPDATE_UDFS_AND_SPS: false
|
||||
DROP_UDFS_AND_SPS: false
|
||||
UPDATE_SNOWFLAKE_TAGS: true
|
||||
STREAMLINE_INVOKE_STREAMS: False
|
||||
STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES: False
|
||||
|
||||
18
macros/core/_live.yaml.sql
Normal file
18
macros/core/_live.yaml.sql
Normal file
@ -0,0 +1,18 @@
|
||||
{% macro config_core__live(schema="_live") %}
|
||||
|
||||
- name: {{ schema }}.udf_api
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [url, STRING]
|
||||
- [headers, OBJECT]
|
||||
- [DATA, OBJECT]
|
||||
- [user_id, STRING]
|
||||
- [SECRET, STRING]
|
||||
return_type: VARIANT
|
||||
func_type: EXTERNAL
|
||||
api_integration: '{{ var("API_INTEGRATION") }}'
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
sql: udf_api
|
||||
{% endmacro %}
|
||||
64
macros/core/_utils.yaml.sql
Normal file
64
macros/core/_utils.yaml.sql
Normal file
@ -0,0 +1,64 @@
|
||||
{% macro config_core__utils(schema="_utils") %}
|
||||
|
||||
- name: {{ schema }}.udf_introspect
|
||||
signature:
|
||||
- [echo, STRING]
|
||||
func_type: SECURE EXTERNAL
|
||||
return_type: TEXT
|
||||
api_integration: '{{ var("API_INTEGRATION") }}'
|
||||
sql: introspect
|
||||
|
||||
|
||||
- name: {{ schema }}.udf_user_tier
|
||||
signature: []
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
MEMOIZABLE
|
||||
sql: |
|
||||
SELECT
|
||||
COALESCE(PARSE_JSON(GETVARIABLE('LIVEQUERY_CONTEXT')):userTier::STRING, 'community')
|
||||
|
||||
- name: {{ schema }}.udf_provider
|
||||
signature: []
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
MEMOIZABLE
|
||||
sql: |
|
||||
SELECT
|
||||
COALESCE(PARSE_JSON(GETVARIABLE('LIVEQUERY_CONTEXT')):provider::STRING, 'quicknode')
|
||||
|
||||
- name: {{ schema }}.udf_whoami
|
||||
signature: []
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
MEMOIZABLE
|
||||
sql: |
|
||||
SELECT
|
||||
COALESCE(PARSE_JSON(GETVARIABLE('LIVEQUERY_CONTEXT')):userId::STRING, CURRENT_USER())
|
||||
|
||||
- name: {{ schema }}.udf_register_secret
|
||||
signature:
|
||||
- [request_id, STRING]
|
||||
- [user_id, STRING]
|
||||
- [key, STRING]
|
||||
return_type: TEXT
|
||||
func_type: SECURE EXTERNAL
|
||||
api_integration: '{{ var("API_INTEGRATION") }}'
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
sql: secret/register
|
||||
|
||||
{% endmacro %}
|
||||
120
macros/core/functions.py.sql
Normal file
120
macros/core/functions.py.sql
Normal file
@ -0,0 +1,120 @@
|
||||
{% macro python_hex_to_int() %}
|
||||
def hex_to_int(hex) -> str:
|
||||
"""
|
||||
Converts hex (of any size) to int (as a string). Snowflake and java script can only handle up to 64-bit (38 digits of precision)
|
||||
hex_to_int('200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int('0x200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int(NULL);
|
||||
>> NULL
|
||||
"""
|
||||
try:
|
||||
return str(int(hex, 16)) if hex and hex != "0x" else None
|
||||
except:
|
||||
return None
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro python_udf_hex_to_int_with_encoding() %}
|
||||
def hex_to_int(encoding, hex) -> str:
|
||||
"""
|
||||
Converts hex (of any size) to int (as a string). Snowflake and java script can only handle up to 64-bit (38 digits of precision)
|
||||
hex_to_int('hex', '200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int('hex', '0x200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int('hex', NULL);
|
||||
>> NULL
|
||||
hex_to_int('s2c', 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffe5b83acf');
|
||||
>> -440911153
|
||||
"""
|
||||
try:
|
||||
if not hex:
|
||||
return None
|
||||
if encoding.lower() == 's2c':
|
||||
if hex[0:2].lower() != '0x':
|
||||
hex = f'0x{hex}'
|
||||
|
||||
bits = len(hex[2:]) * 4
|
||||
value = int(hex, 0)
|
||||
if value & (1 << (bits - 1)):
|
||||
value -= 1 << bits
|
||||
return str(value)
|
||||
else:
|
||||
return str(int(hex, 16))
|
||||
except:
|
||||
return None
|
||||
{% endmacro %}
|
||||
|
||||
{% macro create_udf_keccak256() %}
|
||||
from Crypto.Hash import keccak
|
||||
|
||||
def udf_encode(event_name):
|
||||
keccak_hash = keccak.new(digest_bits=256)
|
||||
keccak_hash.update(event_name.encode('utf-8'))
|
||||
return '0x' + keccak_hash.hexdigest()
|
||||
{% endmacro %}
|
||||
|
||||
{% macro create_udf_evm_text_signature() %}
|
||||
|
||||
def get_simplified_signature(abi):
|
||||
def generate_signature(inputs):
|
||||
signature_parts = []
|
||||
for input_data in inputs:
|
||||
if 'components' in input_data:
|
||||
component_signature_parts = []
|
||||
components = input_data['components']
|
||||
component_signature_parts.extend(generate_signature(components))
|
||||
component_signature_parts[-1] = component_signature_parts[-1].rstrip(",")
|
||||
if input_data['type'].endswith('[]'):
|
||||
signature_parts.append("(" + "".join(component_signature_parts) + ")[],")
|
||||
else:
|
||||
signature_parts.append("(" + "".join(component_signature_parts) + "),")
|
||||
else:
|
||||
signature_parts.append(input_data['type'].replace('enum ', '').replace(' payable', '') + ",")
|
||||
return signature_parts
|
||||
|
||||
signature_parts = [abi['name'] + "("]
|
||||
signature_parts.extend(generate_signature(abi['inputs']))
|
||||
signature_parts[-1] = signature_parts[-1].rstrip(",") + ")"
|
||||
return "".join(signature_parts)
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro python_object_to_url_query_string() %}
|
||||
import urllib.parse
|
||||
|
||||
def object_to_url_query_string(variant_object):
|
||||
return f'{urllib.parse.urlencode(variant_object)}'
|
||||
|
||||
{% endmacro %}
|
||||
|
||||
{% macro python_udf_evm_transform_log(schema) %}
|
||||
from copy import deepcopy
|
||||
|
||||
def transform_event(event: dict):
|
||||
new_event = deepcopy(event)
|
||||
if new_event.get("components"):
|
||||
components = new_event.get("components")
|
||||
for iy, y in enumerate(new_event["value"]):
|
||||
for i, c in enumerate(components):
|
||||
y[i] = {"value": y[i], **c}
|
||||
new_event["value"][iy] = {z["name"]: z["value"] for z in y}
|
||||
return new_event
|
||||
else:
|
||||
return event
|
||||
|
||||
|
||||
def transform(events: list):
|
||||
try:
|
||||
results = [
|
||||
transform_event(event) if event["decoded"] else event
|
||||
for event in events["data"]
|
||||
]
|
||||
events["data"] = results
|
||||
return events
|
||||
except:
|
||||
return events
|
||||
|
||||
{% endmacro %}
|
||||
137
macros/core/live.yaml.sql
Normal file
137
macros/core/live.yaml.sql
Normal file
@ -0,0 +1,137 @@
|
||||
{% macro config_core_live(schema="live") %}
|
||||
|
||||
- name: {{ schema }}.udf_api
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [url, STRING]
|
||||
- [headers, OBJECT]
|
||||
- [data, OBJECT]
|
||||
- [secret_name, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
method,
|
||||
url,
|
||||
headers,
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
secret_name
|
||||
)
|
||||
- name: {{ schema }}.udf_api
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [url, STRING]
|
||||
- [headers, OBJECT]
|
||||
- [data, OBJECT]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
method,
|
||||
url,
|
||||
headers,
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
''
|
||||
)
|
||||
- name: {{ schema }}.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
- [data, OBJECT]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'POST',
|
||||
url,
|
||||
{'Content-Type': 'application/json'},
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
''
|
||||
)
|
||||
- name: {{ schema }}.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
- [data, OBJECT]
|
||||
- [secret_name, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'POST',
|
||||
url,
|
||||
{'Content-Type': 'application/json'},
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
secret_name
|
||||
)
|
||||
- name: {{ schema }}.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'GET',
|
||||
url,
|
||||
{},
|
||||
{},
|
||||
_utils.UDF_WHOAMI(),
|
||||
''
|
||||
)
|
||||
- name: {{ schema }}.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
- [secret_name, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'GET',
|
||||
url,
|
||||
{},
|
||||
{},
|
||||
_utils.UDF_WHOAMI(),
|
||||
secret_name
|
||||
)
|
||||
|
||||
- name: {{ schema }}.udf_rpc
|
||||
signature:
|
||||
- [blockchain, STRING]
|
||||
- [network, STRING]
|
||||
- [method, STRING]
|
||||
- [parameters, VARIANT]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
COMMENT = $$Executes an JSON RPC call on a blockchain.$$
|
||||
sql: |
|
||||
{{ sql_live_rpc_call("method", "parameters", "blockchain", "network") | indent(4) -}}
|
||||
{% endmacro %}
|
||||
180
macros/core/utils.yaml.sql
Normal file
180
macros/core/utils.yaml.sql
Normal file
@ -0,0 +1,180 @@
|
||||
{% macro config_core_utils(schema="utils") %}
|
||||
|
||||
|
||||
- name: {{ schema }}.udf_register_secret
|
||||
signature:
|
||||
- [request_id, STRING]
|
||||
- [key, STRING]
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
SELECT
|
||||
_utils.UDF_REGISTER_SECRET(REQUEST_ID, _utils.UDF_WHOAMI(), KEY)
|
||||
|
||||
- name: {{ schema }}.udf_hex_to_int
|
||||
signature:
|
||||
- [hex, STRING]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE PYTHON
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'hex_to_int'
|
||||
sql: |
|
||||
{{ python_hex_to_int() | indent(4) }}
|
||||
- name: {{ schema }}.udf_hex_to_int
|
||||
signature:
|
||||
- [encoding, STRING]
|
||||
- [hex, STRING]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE PYTHON
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'hex_to_int'
|
||||
sql: |
|
||||
{{ python_udf_hex_to_int_with_encoding() | indent(4) }}
|
||||
- name: {{ schema }}.udf_evm_text_signature
|
||||
signature:
|
||||
- [abi, VARIANT]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
LANGUAGE PYTHON
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'get_simplified_signature'
|
||||
sql: |
|
||||
{{ create_udf_evm_text_signature() | indent(4) }}
|
||||
- name: {{ schema }}.udf_keccak256
|
||||
signature:
|
||||
- [event_name, VARCHAR(255)]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
LANGUAGE PYTHON
|
||||
RUNTIME_VERSION = '3.8'
|
||||
PACKAGES = ('pycryptodome==3.15.0')
|
||||
HANDLER = 'udf_encode'
|
||||
sql: |
|
||||
{{ create_udf_keccak256() | indent(4) }}
|
||||
- name: {{ schema }}.udf_hex_to_string
|
||||
signature:
|
||||
- [hex, STRING]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
SELECT
|
||||
LTRIM(regexp_replace(
|
||||
try_hex_decode_string(hex),
|
||||
'[\x00-\x1F\x7F-\x9F\xAD]', '', 1))
|
||||
- name: {{ schema }}.udf_int_to_hex
|
||||
signature:
|
||||
- [int, INTEGER]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
select CONCAT('0x', TRIM(TO_CHAR(int, 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')))
|
||||
|
||||
- name: {{ schema }}.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, ARRAY]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call() }}
|
||||
- name: {{ schema }}.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, OBJECT]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call() }}
|
||||
- name: {{ schema }}.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, OBJECT]
|
||||
- [id, STRING]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call(False) }}
|
||||
- name: {{ schema }}.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, ARRAY]
|
||||
- [id, STRING]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call(False) }}
|
||||
|
||||
- name: {{ schema }}.udf_object_to_url_query_string
|
||||
signature:
|
||||
- [object, OBJECT]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE PYTHON
|
||||
IMMUTABLE
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'object_to_url_query_string'
|
||||
sql: |
|
||||
{{ python_object_to_url_query_string() | indent(4) }}
|
||||
- name: {{ schema }}.udf_evm_transform_log
|
||||
signature:
|
||||
- [decoded, VARIANT]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE PYTHON
|
||||
IMMUTABLE
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'transform'
|
||||
sql: |
|
||||
{{ python_udf_evm_transform_log() | indent(4) }}
|
||||
|
||||
- name: {{ schema }}.udf_evm_decode_log
|
||||
signature:
|
||||
- [abi, ARRAY]
|
||||
- [data, OBJECT]
|
||||
return_type: ARRAY
|
||||
func_type: EXTERNAL
|
||||
api_integration: '{{ var("API_INTEGRATION") }}'
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
sql: evm/decode/log
|
||||
|
||||
{% endmacro %}
|
||||
@ -1,64 +0,0 @@
|
||||
{% macro create_udfs(drop_=False) %}
|
||||
{% if var("UPDATE_UDFS_AND_SPS") %}
|
||||
{% set sql %}
|
||||
CREATE SCHEMA IF NOT EXISTS silver;
|
||||
CREATE SCHEMA IF NOT EXISTS beta;
|
||||
CREATE SCHEMA IF NOT EXISTS utils;
|
||||
CREATE SCHEMA IF NOT EXISTS _utils;
|
||||
CREATE SCHEMA IF NOT EXISTS _live;
|
||||
CREATE SCHEMA IF NOT EXISTS live;
|
||||
{%- set udfs = fromyaml(config_core_udfs()) -%}
|
||||
{%- for udf in udfs -%}
|
||||
{{- create_or_drop_function_from_config(udf, drop_=drop_) -}}
|
||||
{% endfor %}
|
||||
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "arbitrum_nova", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "arbitrum_one", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "arbitrum_one", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "avalanche_c", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "avalanche_c", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "base", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "bsc", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "bsc", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "celo", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "ethereum", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "ethereum", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "ethereum", "sepolia", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "fantom", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "gnosis", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "harmony", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "harmony", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "optimism", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "optimism", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "polygon", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "polygon", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "polygon_zkevm", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_rpc_primitives, "polygon_zkevm", "testnet", drop_) -}}
|
||||
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "arbitrum_nova", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "arbitrum_one", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "arbitrum_one", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "avalanche_c", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "avalanche_c", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "base", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "bsc", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "bsc", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "celo", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "ethereum", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "ethereum", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "ethereum", "sepolia", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "fantom", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "gnosis", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "harmony", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "harmony", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "optimism", "goerli", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "optimism", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "polygon", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "polygon", "testnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "polygon_zkevm", "mainnet", drop_) -}}
|
||||
{{- crud_udfs_in_schema(config_evm_high_level_abstractions, "polygon_zkevm", "testnet", drop_) -}}
|
||||
|
||||
{% endset %}
|
||||
{% do run_query(sql) %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
@ -4,11 +4,11 @@
|
||||
blockchain.
|
||||
#}
|
||||
{% set schema = blockchain ~ "_" ~ network %}
|
||||
- name: {{ schema -}}.latest_native_balance
|
||||
- name: {{ schema -}}.tf_latest_native_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the latest block]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
- |
|
||||
The table has the following columns:
|
||||
* `blockchain` - The blockchain
|
||||
@ -25,11 +25,11 @@
|
||||
sql: |
|
||||
{{ evm_latest_native_balance_string(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_native_balance
|
||||
- name: {{ schema -}}.tf_latest_native_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, An array of addresses string to get the balance of at the latest block]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -38,12 +38,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_native_balance_array(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_token_balance
|
||||
- name: {{ schema -}}.tf_latest_token_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the latest block]
|
||||
- [token, STRING, The address of the token to get the balance of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -52,12 +52,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_token_balance_ss(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_token_balance
|
||||
- name: {{ schema -}}.tf_latest_token_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the latest block]
|
||||
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -66,12 +66,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_token_balance_sa(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_token_balance
|
||||
- name: {{ schema -}}.tf_latest_token_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, An array of addresses string to get the balance of at the latest block]
|
||||
- [token, STRING, The address of the token to get the balance of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -80,12 +80,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_token_balance_as(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_token_balance
|
||||
- name: {{ schema -}}.tf_latest_token_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, An array of addresses string to get the balance of at the latest block]
|
||||
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -94,13 +94,13 @@
|
||||
sql: |
|
||||
{{ evm_latest_token_balance_aa(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_token_balance
|
||||
- name: {{ schema -}}.tf_historical_token_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the input block]
|
||||
- [token, STRING, The address of the token to get the balance of]
|
||||
- [block_number, INTEGER, The block number to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -109,13 +109,13 @@
|
||||
sql: |
|
||||
{{ evm_historical_token_balance_ssi(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_token_balance
|
||||
- name: {{ schema -}}.tf_historical_token_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the input block]
|
||||
- [token, STRING, The address of the token to get the balance of]
|
||||
- [block_numbers, ARRAY, The block numbers to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -124,13 +124,13 @@
|
||||
sql: |
|
||||
{{ evm_historical_token_balance_ssa(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_token_balance
|
||||
- name: {{ schema -}}.tf_historical_token_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, The addresses to get the balance of at the input block]
|
||||
- [token, STRING, The address of the token to get the balance of]
|
||||
- [block_number, INTEGER, The block number to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -139,13 +139,13 @@
|
||||
sql: |
|
||||
{{ evm_historical_token_balance_asi(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_token_balance
|
||||
- name: {{ schema -}}.tf_historical_token_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the input block]
|
||||
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
|
||||
- [block_number, INTEGER, The block number to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -154,13 +154,13 @@
|
||||
sql: |
|
||||
{{ evm_historical_token_balance_sai(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_token_balance
|
||||
- name: {{ schema -}}.tf_historical_token_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the input block]
|
||||
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
|
||||
- [block_numbers, ARRAY, The block numbers to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -169,13 +169,13 @@
|
||||
sql: |
|
||||
{{ evm_historical_token_balance_saa(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_token_balance
|
||||
- name: {{ schema -}}.tf_historical_token_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, An array of address strings to get the balance of at the input block]
|
||||
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
|
||||
- [block_number, INTEGER, The block number to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -184,13 +184,13 @@
|
||||
sql: |
|
||||
{{ evm_historical_token_balance_aai(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_token_balance
|
||||
- name: {{ schema -}}.tf_historical_token_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, An array of address strings to get the balance of at the input block]
|
||||
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
|
||||
- [block_numbers, ARRAY, The block numbers to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -199,12 +199,12 @@
|
||||
sql: |
|
||||
{{ evm_historical_token_balance_aaa(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_native_balance
|
||||
- name: {{ schema -}}.tf_historical_native_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the input block]
|
||||
- [block_number, INTEGER, The block number to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -213,12 +213,12 @@
|
||||
sql: |
|
||||
{{ evm_historical_native_balance_si(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_native_balance
|
||||
- name: {{ schema -}}.tf_historical_native_balance
|
||||
signature:
|
||||
- [wallet, STRING, The address to get the balance of at the input block]
|
||||
- [block_numbers, ARRAY, The block numbers to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -227,12 +227,12 @@
|
||||
sql: |
|
||||
{{ evm_historical_native_balance_sa(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_native_balance
|
||||
- name: {{ schema -}}.tf_historical_native_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, An array of address strings to get the balance of at the input block]
|
||||
- [block_number, INTEGER, The block number to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -241,12 +241,12 @@
|
||||
sql: |
|
||||
{{ evm_historical_native_balance_ai(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.historical_native_balance
|
||||
- name: {{ schema -}}.tf_historical_native_balance
|
||||
signature:
|
||||
- [wallets, ARRAY, An array of address strings to get the balance of at the input block]
|
||||
- [block_numbers, ARRAY, The block numbers to get the balance at]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, symbol STRING, block_number INTEGER, raw_balance STRING, balance FLOAT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -255,11 +255,11 @@
|
||||
sql: |
|
||||
{{ evm_historical_native_balance_aa(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events
|
||||
- name: {{ schema -}}.tf_latest_contract_events
|
||||
signature:
|
||||
- [address, STRING, The address of the contract to get the events of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -268,12 +268,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_s(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events
|
||||
- name: {{ schema -}}.tf_latest_contract_events
|
||||
signature:
|
||||
- [address, STRING, The address of the contract to get the events of]
|
||||
- [lookback, INTEGER, The number of blocks to look back. Please note there are RPC limitations on this method.]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -282,11 +282,11 @@
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_si(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events
|
||||
- name: {{ schema -}}.tf_latest_contract_events
|
||||
signature:
|
||||
- [addresses, ARRAY, The addresses of the contracts to get the events of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -295,12 +295,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_a(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events
|
||||
- name: {{ schema -}}.tf_latest_contract_events
|
||||
signature:
|
||||
- [addresses, ARRAY, The addresses of the contracts to get the events of]
|
||||
- [lookback, INTEGER, The number of blocks to look back. Please note there are RPC limitations on this method.]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -309,11 +309,11 @@
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_ai(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events_decoded
|
||||
- name: {{ schema -}}.tf_latest_contract_events_decoded
|
||||
signature:
|
||||
- [address, STRING, The address of the contract to get the decoded events of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -322,11 +322,11 @@
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_decoded_s(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events_decoded
|
||||
- name: {{ schema -}}.tf_latest_contract_events_decoded
|
||||
signature:
|
||||
- [addresses, ARRAY, The addresses of the contracts to get the decoded events of]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -335,12 +335,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_decoded_a(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events_decoded
|
||||
- name: {{ schema -}}.tf_latest_contract_events_decoded
|
||||
signature:
|
||||
- [address, STRING, The address of the contract to get the decoded events of]
|
||||
- [lookback, INTEGER, The number of blocks to look back. Please note there are RPC limitations on this method.]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -349,12 +349,12 @@
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_decoded_si(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.latest_contract_events_decoded
|
||||
- name: {{ schema -}}.tf_latest_contract_events_decoded
|
||||
signature:
|
||||
- [addresses, ARRAY, The addresses of the contracts to get the decoded events of]
|
||||
- [lookback, INTEGER, The number of blocks to look back. Please note there are RPC limitations on this method.]
|
||||
return_type:
|
||||
- "TABLE(blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
@ -362,4 +362,38 @@
|
||||
COMMENT = $$Returns the latest decoded events emitted by multiple contracts within the last `lookback` blocks. Submit missing ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/). *Please note there are RPC limitations on this method.* $$
|
||||
sql: |
|
||||
{{ evm_latest_contract_events_decoded_ai(schema, blockchain, network) | indent(4) -}}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro config_eth_high_level_abstractions(blockchain, network) -%}
|
||||
{#
|
||||
This macro is used to generate high level abstractions for Ethereum mainnet only.
|
||||
#}
|
||||
{% set schema = blockchain ~ "_" ~ network %}
|
||||
- name: {{ schema -}}.tf_all_contract_events
|
||||
signature:
|
||||
- [address, STRING, The address of the contracts to get the events of]
|
||||
- [min_block, INTEGER, The minimum block number to get the events from]
|
||||
return_type:
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, contract_address STRING, event_topics ARRAY, event_data STRING)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
COMMENT = $$Returns the events emitted by a contract from a specific block to the latest block.$$
|
||||
sql: |
|
||||
{{ evm_contract_events(schema, blockchain, network) | indent(4) -}}
|
||||
|
||||
- name: {{ schema -}}.tf_all_contract_events_decoded
|
||||
signature:
|
||||
- [address, STRING, The address of the contracts to get the events of]
|
||||
- [min_block, INTEGER, The minimum block number to get the events from]
|
||||
return_type:
|
||||
- "TABLE(status STRING, blockchain STRING, network STRING, tx_hash STRING, block_number INTEGER, event_index INTEGER, event_name STRING, contract_address STRING, event_topics ARRAY, event_data STRING, decoded_data OBJECT)"
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
COMMENT = $$Returns the decoded events emitted by a contract from a specific block to the latest block. Submit missing ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/).$$
|
||||
sql: |
|
||||
{{ evm_contract_events_decoded(schema, blockchain, network) | indent(4) -}}
|
||||
{%- endmacro -%}
|
||||
@ -1,22 +1,21 @@
|
||||
{% macro evm_latest_native_balance_string(schema, blockchain, network) %}
|
||||
with base as (select lower(wallet) AS wallet_address)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
lower(wallet) AS wallet_address,
|
||||
CASE
|
||||
WHEN '{{blockchain}}' ILIKE 'avalanche%' THEN 'AVAX'
|
||||
WHEN '{{blockchain}}' ILIKE 'polygon%' THEN 'MATIC'
|
||||
WHEN '{{blockchain}}' ILIKE 'binance%' THEN 'BNB'
|
||||
WHEN '{{blockchain}}' ILIKE 'gnosis%' THEN 'xDAI'
|
||||
WHEN '{{blockchain}}' ILIKE 'ethereum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'arbitrum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'optimism%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'base%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'fantom%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'harmony%' THEN 'ONE'
|
||||
END AS symbol,
|
||||
wallet_address,
|
||||
symbol,
|
||||
utils.udf_hex_to_int({{schema}}.udf_rpc_eth_get_balance(wallet_address,'latest')::string) AS raw_balance,
|
||||
(raw_balance / POW(10,18))::float AS balance
|
||||
FROM base
|
||||
LEFT JOIN {{ ref('_evm__native_symbol_map') }}
|
||||
on '{{blockchain}}' = blockchain
|
||||
and '{{network}}' = network
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_latest_native_balance_array(schema, blockchain, network) %}
|
||||
@ -34,24 +33,21 @@ node_call AS (
|
||||
FROM flat_addresses
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
CASE
|
||||
WHEN '{{blockchain}}' ILIKE 'avalanche%' THEN 'AVAX'
|
||||
WHEN '{{blockchain}}' ILIKE 'polygon%' THEN 'MATIC'
|
||||
WHEN '{{blockchain}}' ILIKE 'binance%' THEN 'BNB'
|
||||
WHEN '{{blockchain}}' ILIKE 'gnosis%' THEN 'xDAI'
|
||||
WHEN '{{blockchain}}' ILIKE 'ethereum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'arbitrum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'optimism%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'base%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'fantom%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'harmony%' THEN 'ONE'
|
||||
END AS symbol,
|
||||
symbol,
|
||||
utils.udf_hex_to_int(hex_balance) AS raw_balance,
|
||||
(raw_balance / POW(10,18))::FLOAT AS balance
|
||||
FROM node_call
|
||||
LEFT JOIN {{ ref('_evm__native_symbol_map') }}
|
||||
on '{{blockchain}}' = blockchain
|
||||
and '{{network}}' = network
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_latest_token_balance_ss(schema, blockchain, network) %}
|
||||
@ -75,11 +71,17 @@ node_call AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
inputs
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
and blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -116,11 +118,17 @@ final AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
flat_rows
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
and blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -157,11 +165,17 @@ final AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
flat_rows
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
and blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -200,11 +214,17 @@ final AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
flat_rows
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
and blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -237,11 +257,18 @@ WITH inputs AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
inputs
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -284,11 +311,18 @@ final AS (
|
||||
FROM
|
||||
inputs
|
||||
CROSS JOIN blocks
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -331,11 +365,18 @@ final AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
inputs
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -387,11 +428,18 @@ final AS (
|
||||
FROM
|
||||
inputs
|
||||
CROSS JOIN blocks
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -435,11 +483,18 @@ final AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
inputs
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -492,11 +547,18 @@ final AS (
|
||||
FROM
|
||||
inputs
|
||||
CROSS JOIN blocks
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -549,11 +611,18 @@ final AS (
|
||||
raw_balance::INT / POW(10, ifnull(decimals,0)) AS balance
|
||||
FROM
|
||||
inputs
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -615,11 +684,18 @@ final AS (
|
||||
FROM
|
||||
inputs
|
||||
CROSS JOIN blocks
|
||||
LEFT JOIN {{ ref('_internal__contracts_map') }}
|
||||
LEFT JOIN {{ ref('_evm__contracts_map') }}
|
||||
ON token_address = address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and REGEXP_LIKE(token_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -632,25 +708,25 @@ FROM final
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_historical_native_balance_si(schema, blockchain, network) %}
|
||||
with base as (select lower(wallet) AS wallet_address, CONCAT('0x', TRIM(TO_CHAR(block_number, 'XXXXXXXXXX'))) as hex_block)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
lower(wallet) AS wallet_address,
|
||||
CASE
|
||||
WHEN '{{blockchain}}' ILIKE 'avalanche%' THEN 'AVAX'
|
||||
WHEN '{{blockchain}}' ILIKE 'polygon%' THEN 'MATIC'
|
||||
WHEN '{{blockchain}}' ILIKE 'binance%' THEN 'BNB'
|
||||
WHEN '{{blockchain}}' ILIKE 'gnosis%' THEN 'xDAI'
|
||||
WHEN '{{blockchain}}' ILIKE 'ethereum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'arbitrum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'optimism%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'base%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'fantom%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'harmony%' THEN 'ONE'
|
||||
END AS symbol,
|
||||
wallet_address,
|
||||
symbol,
|
||||
block_number,
|
||||
utils.udf_hex_to_int({{schema}}.udf_rpc_eth_get_balance(wallet_address,CONCAT('0x', TRIM(TO_CHAR(block_number, 'XXXXXXXXXX'))))::string) AS raw_balance,
|
||||
utils.udf_hex_to_int({{schema}}.udf_rpc_eth_get_balance(wallet_address,hex_block)::string) AS raw_balance,
|
||||
(raw_balance / POW(10,18))::float AS balance
|
||||
FROM base
|
||||
LEFT JOIN {{ ref('_evm__native_symbol_map') }}
|
||||
on '{{blockchain}}' = blockchain
|
||||
and '{{network}}' = network
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_historical_native_balance_sa(schema, blockchain, network) %}
|
||||
@ -665,23 +741,17 @@ blocks AS (
|
||||
inputs AS (
|
||||
SELECT
|
||||
wallet AS wallet_address,
|
||||
CASE
|
||||
WHEN '{{blockchain}}' ILIKE 'avalanche%' THEN 'AVAX'
|
||||
WHEN '{{blockchain}}' ILIKE 'polygon%' THEN 'MATIC'
|
||||
WHEN '{{blockchain}}' ILIKE 'binance%' THEN 'BNB'
|
||||
WHEN '{{blockchain}}' ILIKE 'gnosis%' THEN 'xDAI'
|
||||
WHEN '{{blockchain}}' ILIKE 'ethereum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'arbitrum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'optimism%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'base%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'fantom%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'harmony%' THEN 'ONE'
|
||||
END AS symbol,
|
||||
block_number,
|
||||
utils.udf_hex_to_int({{schema}}.udf_rpc_eth_get_balance(wallet, CONCAT('0x', TRIM(TO_CHAR(block_number, 'XXXXXXXXXX')))))::STRING AS raw_balance
|
||||
FROM blocks
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -690,6 +760,9 @@ SELECT
|
||||
raw_balance,
|
||||
(raw_balance::int / pow(10,18)) ::float as balance
|
||||
FROM inputs
|
||||
LEFT JOIN {{ ref('_evm__native_symbol_map') }}
|
||||
on '{{blockchain}}' = blockchain
|
||||
and '{{network}}' = network
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_historical_native_balance_ai(schema, blockchain, network) %}
|
||||
@ -704,23 +777,17 @@ flat_wallets AS (
|
||||
inputs AS (
|
||||
SELECT
|
||||
wallet AS wallet_address,
|
||||
CASE
|
||||
WHEN '{{blockchain}}' ILIKE 'avalanche%' THEN 'AVAX'
|
||||
WHEN '{{blockchain}}' ILIKE 'polygon%' THEN 'MATIC'
|
||||
WHEN '{{blockchain}}' ILIKE 'binance%' THEN 'BNB'
|
||||
WHEN '{{blockchain}}' ILIKE 'gnosis%' THEN 'xDAI'
|
||||
WHEN '{{blockchain}}' ILIKE 'ethereum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'arbitrum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'optimism%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'base%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'fantom%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'harmony%' THEN 'ONE'
|
||||
END AS symbol,
|
||||
block_number,
|
||||
utils.udf_hex_to_int({{schema}}.udf_rpc_eth_get_balance(wallet, CONCAT('0x', TRIM(TO_CHAR(block_number, 'XXXXXXXXXX')))))::STRING AS raw_balance
|
||||
FROM flat_wallets
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -729,6 +796,9 @@ SELECT
|
||||
raw_balance,
|
||||
(raw_balance::int / pow(10,18)) ::float as balance
|
||||
FROM inputs
|
||||
LEFT JOIN {{ ref('_evm__native_symbol_map') }}
|
||||
on '{{blockchain}}' = blockchain
|
||||
and '{{network}}' = network
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_historical_native_balance_aa(schema, blockchain, network) %}
|
||||
@ -744,23 +814,17 @@ FROM inputs
|
||||
final AS (
|
||||
SELECT
|
||||
wallet AS wallet_address,
|
||||
CASE
|
||||
WHEN '{{blockchain}}' ILIKE 'avalanche%' THEN 'AVAX'
|
||||
WHEN '{{blockchain}}' ILIKE 'polygon%' THEN 'MATIC'
|
||||
WHEN '{{blockchain}}' ILIKE 'binance%' THEN 'BNB'
|
||||
WHEN '{{blockchain}}' ILIKE 'gnosis%' THEN 'xDAI'
|
||||
WHEN '{{blockchain}}' ILIKE 'ethereum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'arbitrum%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'optimism%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'base%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'fantom%' THEN 'ETH'
|
||||
WHEN '{{blockchain}}' ILIKE 'harmony%' THEN 'ONE'
|
||||
END AS symbol,
|
||||
block_number,
|
||||
utils.udf_hex_to_int({{schema}}.udf_rpc_eth_get_balance(wallet, CONCAT('0x', TRIM(TO_CHAR(block_number, 'XXXXXXXXXX')))))::STRING AS raw_balance
|
||||
FROM flat_wallets
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(wallet_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(block_number)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
wallet_address,
|
||||
@ -769,6 +833,9 @@ FROM inputs
|
||||
raw_balance,
|
||||
(raw_balance::int / pow(10,18))::float as balance
|
||||
FROM final
|
||||
LEFT JOIN {{ ref('_evm__native_symbol_map') }}
|
||||
on '{{blockchain}}' = blockchain
|
||||
and '{{network}}' = network
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_latest_contract_events_s(schema, blockchain, network) %}
|
||||
@ -799,6 +866,11 @@ FROM inputs
|
||||
LATERAL FLATTEN(input => eth_getLogs)
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(contract_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
tx_hash,
|
||||
@ -838,6 +910,12 @@ FROM inputs
|
||||
LATERAL FLATTEN(input => eth_getLogs)
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(contract_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(lookback)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
tx_hash,
|
||||
@ -880,6 +958,11 @@ FROM inputs
|
||||
LATERAL FLATTEN(input => eth_getLogs)
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(contract_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
tx_hash,
|
||||
@ -922,6 +1005,12 @@ FROM inputs
|
||||
LATERAL FLATTEN(input => eth_getLogs)
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(contract_address, '^0x([a-fA-F0-9]{40})$')
|
||||
and is_integer(lookback)
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
tx_hash,
|
||||
@ -949,7 +1038,7 @@ abis AS (
|
||||
event_signature,
|
||||
abi
|
||||
FROM inputs
|
||||
JOIN {{ ref('_internal__abi_map') }}
|
||||
JOIN {{ ref('_evm__abi_map') }}
|
||||
ON lower(contract_address) = parent_contract_address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
QUALIFY ROW_NUMBER() OVER (PARTITION BY contract_address, event_name ORDER BY end_block DESC) = 1
|
||||
@ -986,7 +1075,7 @@ decode_logs AS (
|
||||
event_removed,
|
||||
event_data,
|
||||
event_topics,
|
||||
ethereum.streamline.udf_decode(
|
||||
utils.udf_evm_decode_log(
|
||||
abi,
|
||||
OBJECT_CONSTRUCT(
|
||||
'topics',
|
||||
@ -998,7 +1087,7 @@ decode_logs AS (
|
||||
)
|
||||
)[0] AS decoded_data,
|
||||
decoded_data:name::STRING AS event_name,
|
||||
ethereum.silver.udf_transform_logs(decoded_data) AS transformed
|
||||
utils.udf_evm_transform_log(decoded_data) AS transformed
|
||||
FROM node_flat
|
||||
JOIN abis
|
||||
ON contract_address = parent_contract_address
|
||||
@ -1036,6 +1125,11 @@ final AS (
|
||||
transformed
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(n.contract_address, '^0x([a-fA-F0-9]{40})$') then 'Success'
|
||||
when f.event_name is null then 'Error - Contract ABI Not Found, submit ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/)'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
n.tx_hash,
|
||||
@ -1060,7 +1154,8 @@ WITH inputs AS (
|
||||
chainhead AS (
|
||||
SELECT
|
||||
{{ schema }}.udf_rpc('eth_blockNumber', [])::STRING AS chainhead_hex,
|
||||
CONCAT('0x', TRIM(TO_CHAR(utils.udf_hex_to_int(chainhead_hex) - lookback, 'XXXXXXXXXX'))) AS from_block_hex
|
||||
CONCAT('0x', TRIM(TO_CHAR(utils.udf_hex_to_int(chainhead_hex) - lookback, 'XXXXXXXXXX'))) AS from_block_hex,
|
||||
lookback
|
||||
),
|
||||
abis AS (
|
||||
SELECT
|
||||
@ -1069,7 +1164,7 @@ abis AS (
|
||||
event_signature,
|
||||
abi
|
||||
FROM inputs
|
||||
JOIN {{ ref('_internal__abi_map') }}
|
||||
JOIN {{ ref('_evm__abi_map') }}
|
||||
ON lower(contract_address) = parent_contract_address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
QUALIFY ROW_NUMBER() OVER (PARTITION BY contract_address, event_name ORDER BY end_block DESC) = 1
|
||||
@ -1079,13 +1174,15 @@ node_call AS (
|
||||
inputs.contract_address,
|
||||
{{ schema }}.udf_rpc_eth_get_logs(
|
||||
OBJECT_CONSTRUCT('address', inputs.contract_address, 'fromBlock', from_block_hex, 'toBlock', chainhead_hex)
|
||||
) AS eth_getLogs
|
||||
) AS eth_getLogs,
|
||||
lookback
|
||||
FROM inputs
|
||||
JOIN chainhead ON 1=1
|
||||
),
|
||||
node_flat AS (
|
||||
SELECT
|
||||
contract_address,
|
||||
lookback,
|
||||
utils.udf_hex_to_int(value:blockNumber::STRING)::INT AS block_number,
|
||||
value:transactionHash::STRING AS tx_hash,
|
||||
utils.udf_hex_to_int(value:transactionIndex::STRING)::INT AS tx_index,
|
||||
@ -1106,7 +1203,7 @@ decode_logs AS (
|
||||
event_removed,
|
||||
event_data,
|
||||
event_topics,
|
||||
ethereum.streamline.udf_decode(
|
||||
utils.udf_evm_decode_log(
|
||||
abi,
|
||||
OBJECT_CONSTRUCT(
|
||||
'topics',
|
||||
@ -1118,7 +1215,7 @@ decode_logs AS (
|
||||
)
|
||||
)[0] AS decoded_data,
|
||||
decoded_data:name::STRING AS event_name,
|
||||
ethereum.silver.udf_transform_logs(decoded_data) AS transformed
|
||||
utils.udf_evm_transform_log(decoded_data) AS transformed
|
||||
FROM node_flat
|
||||
JOIN abis
|
||||
ON contract_address = parent_contract_address
|
||||
@ -1156,6 +1253,11 @@ final AS (
|
||||
transformed
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(n.contract_address, '^0x([a-fA-F0-9]{40})$') and is_integer(n.lookback) then 'Success'
|
||||
when f.event_name is null then 'Error - Contract ABI Not Found, submit ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/)'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
n.tx_hash,
|
||||
@ -1191,7 +1293,7 @@ abis AS (
|
||||
event_signature,
|
||||
abi
|
||||
FROM inputs
|
||||
JOIN {{ ref('_internal__abi_map') }}
|
||||
JOIN {{ ref('_evm__abi_map') }}
|
||||
ON lower(contract_address) = parent_contract_address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
QUALIFY ROW_NUMBER() OVER (PARTITION BY contract_address, event_name ORDER BY end_block DESC) = 1
|
||||
@ -1228,7 +1330,7 @@ decode_logs AS (
|
||||
event_removed,
|
||||
event_data,
|
||||
event_topics,
|
||||
ethereum.streamline.udf_decode(
|
||||
utils.udf_evm_decode_log(
|
||||
abi,
|
||||
OBJECT_CONSTRUCT(
|
||||
'topics',
|
||||
@ -1240,7 +1342,7 @@ decode_logs AS (
|
||||
)
|
||||
)[0] AS decoded_data,
|
||||
decoded_data:name::STRING AS event_name,
|
||||
ethereum.silver.udf_transform_logs(decoded_data) AS transformed
|
||||
utils.udf_evm_transform_log(decoded_data) AS transformed
|
||||
FROM node_flat
|
||||
JOIN abis
|
||||
ON contract_address = parent_contract_address
|
||||
@ -1278,6 +1380,11 @@ final AS (
|
||||
transformed
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(n.contract_address, '^0x([a-fA-F0-9]{40})$') then 'Success'
|
||||
when f.event_name is null then 'Error - Contract ABI Not Found, submit ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/)'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
n.tx_hash,
|
||||
@ -1304,7 +1411,8 @@ inputs AS (
|
||||
chainhead AS (
|
||||
SELECT
|
||||
{{ schema }}.udf_rpc('eth_blockNumber', [])::STRING AS chainhead_hex,
|
||||
CONCAT('0x', TRIM(TO_CHAR(utils.udf_hex_to_int(chainhead_hex) - lookback, 'XXXXXXXXXX'))) AS from_block_hex
|
||||
CONCAT('0x', TRIM(TO_CHAR(utils.udf_hex_to_int(chainhead_hex) - lookback, 'XXXXXXXXXX'))) AS from_block_hex,
|
||||
lookback
|
||||
),
|
||||
abis AS (
|
||||
SELECT
|
||||
@ -1313,7 +1421,7 @@ abis AS (
|
||||
event_signature,
|
||||
abi
|
||||
FROM inputs
|
||||
JOIN {{ ref('_internal__abi_map') }}
|
||||
JOIN {{ ref('_evm__abi_map') }}
|
||||
ON lower(contract_address) = parent_contract_address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
QUALIFY ROW_NUMBER() OVER (PARTITION BY contract_address, event_name ORDER BY end_block DESC) = 1
|
||||
@ -1323,13 +1431,15 @@ node_call AS (
|
||||
inputs.contract_address,
|
||||
{{ schema }}.udf_rpc_eth_get_logs(
|
||||
OBJECT_CONSTRUCT('address', inputs.contract_address, 'fromBlock', from_block_hex, 'toBlock', chainhead_hex)
|
||||
) AS eth_getLogs
|
||||
) AS eth_getLogs,
|
||||
lookback
|
||||
FROM inputs
|
||||
JOIN chainhead ON 1=1
|
||||
),
|
||||
node_flat AS (
|
||||
SELECT
|
||||
contract_address,
|
||||
lookback,
|
||||
utils.udf_hex_to_int(value:blockNumber::STRING)::INT AS block_number,
|
||||
value:transactionHash::STRING AS tx_hash,
|
||||
utils.udf_hex_to_int(value:transactionIndex::STRING)::INT AS tx_index,
|
||||
@ -1350,7 +1460,7 @@ decode_logs AS (
|
||||
event_removed,
|
||||
event_data,
|
||||
event_topics,
|
||||
ethereum.streamline.udf_decode(
|
||||
utils.udf_evm_decode_log(
|
||||
abi,
|
||||
OBJECT_CONSTRUCT(
|
||||
'topics',
|
||||
@ -1362,7 +1472,7 @@ decode_logs AS (
|
||||
)
|
||||
)[0] AS decoded_data,
|
||||
decoded_data:name::STRING AS event_name,
|
||||
ethereum.silver.udf_transform_logs(decoded_data) AS transformed
|
||||
utils.udf_evm_transform_log(decoded_data) AS transformed
|
||||
FROM node_flat
|
||||
JOIN abis
|
||||
ON contract_address = parent_contract_address
|
||||
@ -1400,6 +1510,11 @@ final AS (
|
||||
transformed
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(n.contract_address, '^0x([a-fA-F0-9]{40})$') and is_integer(n.lookback) then 'Success'
|
||||
when f.event_name is null then 'Error - Contract ABI Not Found, submit ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/)'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
n.tx_hash,
|
||||
@ -1416,3 +1531,206 @@ on n.block_number = f.block_number
|
||||
and n.tx_hash = f.tx_hash
|
||||
and n.event_index = f.event_index
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_contract_events(schema, blockchain, network) %}
|
||||
WITH chainhead AS (
|
||||
SELECT
|
||||
{{ schema }}.udf_rpc('eth_blockNumber', [])::STRING AS chainhead_hex,
|
||||
CONCAT('0x', TRIM(TO_CHAR(utils.udf_hex_to_int(chainhead_hex) - 200, 'XXXXXXXXXX'))) AS from_block_hex,
|
||||
utils.udf_hex_to_int(chainhead_hex) - 200 as min_block_no
|
||||
),
|
||||
node_call AS (
|
||||
SELECT
|
||||
lower(address) AS contract_address,
|
||||
{{ schema }}.udf_rpc_eth_get_logs(
|
||||
OBJECT_CONSTRUCT('address', address, 'fromBlock', from_block_hex, 'toBlock', chainhead_hex)
|
||||
) AS eth_getLogs
|
||||
FROM chainhead
|
||||
),
|
||||
node_flat AS (
|
||||
SELECT
|
||||
contract_address,
|
||||
utils.udf_hex_to_int(value:blockNumber::STRING)::INT AS block_number,
|
||||
value:transactionHash::STRING AS tx_hash,
|
||||
utils.udf_hex_to_int(value:transactionIndex::STRING)::INT AS tx_index,
|
||||
utils.udf_hex_to_int(value:logIndex::STRING)::INT AS event_index,
|
||||
value:removed::BOOLEAN AS event_removed,
|
||||
value:data::STRING AS event_data,
|
||||
value:topics::ARRAY AS event_topics
|
||||
FROM node_call,
|
||||
LATERAL FLATTEN(input => eth_getLogs)
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(contract_address, '^0x([a-fA-F0-9]{40})$')
|
||||
then 'Success'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
tx_hash,
|
||||
block_number,
|
||||
event_index,
|
||||
contract_address,
|
||||
event_topics,
|
||||
event_data
|
||||
FROM node_flat
|
||||
UNION ALL
|
||||
SELECT
|
||||
'Success' as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
tx_hash,
|
||||
block_number,
|
||||
event_index,
|
||||
contract_address,
|
||||
topics as event_topics,
|
||||
data as event_data
|
||||
from {{ ref('_eth__logs') }}
|
||||
where contract_address = (select contract_address from node_call)
|
||||
and block_number >= min_block
|
||||
and block_number <= (select min_block_no from chainhead)
|
||||
{% endmacro %}
|
||||
|
||||
{% macro evm_contract_events_decoded(schema, blockchain, network) %}
|
||||
WITH inputs AS (
|
||||
SELECT lower(address::STRING) AS contract_address
|
||||
),
|
||||
chainhead AS (
|
||||
SELECT
|
||||
{{ schema }}.udf_rpc('eth_blockNumber', [])::STRING AS chainhead_hex,
|
||||
CONCAT('0x', TRIM(TO_CHAR(utils.udf_hex_to_int(chainhead_hex) - 400, 'XXXXXXXXXX'))) AS from_block_hex,
|
||||
utils.udf_hex_to_int(chainhead_hex) - 400 as min_block_no
|
||||
),
|
||||
abis AS (
|
||||
SELECT
|
||||
parent_contract_address,
|
||||
event_name,
|
||||
event_signature,
|
||||
abi
|
||||
FROM inputs
|
||||
JOIN {{ ref('_evm__abi_map') }}
|
||||
ON lower(contract_address) = parent_contract_address
|
||||
AND blockchain = '{{blockchain}}'
|
||||
QUALIFY ROW_NUMBER() OVER (PARTITION BY contract_address, event_name ORDER BY end_block DESC) = 1
|
||||
),
|
||||
node_call AS (
|
||||
SELECT
|
||||
inputs.contract_address,
|
||||
{{ schema }}.udf_rpc_eth_get_logs(
|
||||
OBJECT_CONSTRUCT('address', inputs.contract_address, 'fromBlock', from_block_hex, 'toBlock', chainhead_hex)
|
||||
) AS eth_getLogs
|
||||
FROM inputs
|
||||
JOIN chainhead ON 1=1
|
||||
),
|
||||
node_flat AS (
|
||||
SELECT
|
||||
contract_address,
|
||||
utils.udf_hex_to_int(value:blockNumber::STRING)::INT AS block_number,
|
||||
value:transactionHash::STRING AS tx_hash,
|
||||
utils.udf_hex_to_int(value:transactionIndex::STRING)::INT AS tx_index,
|
||||
utils.udf_hex_to_int(value:logIndex::STRING)::INT AS event_index,
|
||||
value:removed::BOOLEAN AS event_removed,
|
||||
value:data::STRING AS event_data,
|
||||
value:topics::ARRAY AS event_topics
|
||||
FROM node_call,
|
||||
LATERAL FLATTEN(input => eth_getLogs)
|
||||
),
|
||||
decode_logs AS (
|
||||
SELECT
|
||||
contract_address,
|
||||
block_number,
|
||||
tx_hash,
|
||||
tx_index,
|
||||
event_index,
|
||||
event_removed,
|
||||
event_data,
|
||||
event_topics,
|
||||
utils.udf_evm_decode_log(
|
||||
abi,
|
||||
OBJECT_CONSTRUCT(
|
||||
'topics',
|
||||
event_topics,
|
||||
'data',
|
||||
event_data,
|
||||
'address',
|
||||
contract_address
|
||||
)
|
||||
)[0] AS decoded_data,
|
||||
decoded_data:name::STRING AS event_name,
|
||||
utils.udf_evm_transform_log(decoded_data) AS transformed
|
||||
FROM node_flat
|
||||
JOIN abis
|
||||
ON contract_address = parent_contract_address
|
||||
AND event_topics[0]::STRING = event_signature
|
||||
),
|
||||
final AS (
|
||||
SELECT
|
||||
b.tx_hash,
|
||||
b.block_number,
|
||||
b.event_index,
|
||||
b.event_name,
|
||||
b.contract_address,
|
||||
b.event_topics,
|
||||
b.event_data,
|
||||
b.decoded_data,
|
||||
transformed,
|
||||
OBJECT_AGG(
|
||||
DISTINCT CASE
|
||||
WHEN v.value:name = '' THEN CONCAT('anonymous_', v.index)
|
||||
ELSE v.value:name
|
||||
END,
|
||||
v.value:value
|
||||
) AS decoded_flat
|
||||
FROM decode_logs b,
|
||||
LATERAL FLATTEN(input => transformed:data) v
|
||||
GROUP BY
|
||||
b.tx_hash,
|
||||
b.block_number,
|
||||
b.event_index,
|
||||
b.event_name,
|
||||
b.contract_address,
|
||||
b.event_topics,
|
||||
b.event_data,
|
||||
b.decoded_data,
|
||||
transformed
|
||||
)
|
||||
SELECT
|
||||
case
|
||||
when REGEXP_LIKE(n.contract_address, '^0x([a-fA-F0-9]{40})$') and is_integer(min_block) then 'Success'
|
||||
when f.event_name is null then 'Error - Contract ABI Not Found, submit ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/)'
|
||||
else 'Error - Invalid Input'
|
||||
end as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
n.tx_hash,
|
||||
n.block_number,
|
||||
n.event_index,
|
||||
f.event_name,
|
||||
n.contract_address,
|
||||
n.event_topics,
|
||||
n.event_data,
|
||||
f.decoded_flat AS decoded_data
|
||||
FROM node_flat n
|
||||
left join final f
|
||||
on n.block_number = f.block_number
|
||||
and n.tx_hash = f.tx_hash
|
||||
and n.event_index = f.event_index
|
||||
union all
|
||||
select
|
||||
'Success' as status,
|
||||
'{{blockchain}}' AS blockchain,
|
||||
'{{network}}' AS network,
|
||||
tx_hash,
|
||||
block_number,
|
||||
event_index,
|
||||
event_name,
|
||||
contract_address,
|
||||
topics as event_topics,
|
||||
data as event_data,
|
||||
decoded_log as decoded_data
|
||||
from {{ ref('_eth__decoded_logs') }}
|
||||
where contract_address = (select contract_address from inputs)
|
||||
and block_number >= min_block
|
||||
and block_number <= (select min_block_no from chainhead)
|
||||
{% endmacro %}
|
||||
@ -61,4 +61,31 @@
|
||||
sql: |
|
||||
SELECT {{ schema -}}.udf_rpc('eth_getBalance', [address, block_or_tag])
|
||||
|
||||
- name: {{ schema -}}.udf_get_token_balance
|
||||
signature:
|
||||
- [wallet_address, STRING, The address to get the balance of]
|
||||
- [token_address, STRING, The token to get the balance of]
|
||||
return_type: [STRING, The balance of the account of given address]
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
COMMENT = $$Returns the balance of the wallet of given token address at the latest block.$$
|
||||
sql: |
|
||||
SELECT utils.udf_hex_to_int({{ schema -}}.udf_rpc_eth_call(object_construct_keep_null('from', null, 'to', token_address, 'data', concat('0x70a08231',LPAD(REPLACE(wallet_address, '0x', ''), 64, 0))),'latest')::string)
|
||||
|
||||
- name: {{ schema -}}.udf_get_token_balance
|
||||
signature:
|
||||
- [wallet_address, STRING, The address to get the balance of]
|
||||
- [token_address, STRING, The token to get the balance of]
|
||||
- [block_number, INTEGER, The block number to retrieve the balance at]
|
||||
return_type: [STRING, The balance of the account of given address]
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
COMMENT = $$Returns the balance of the wallet of given token address at the given block.$$
|
||||
sql: |
|
||||
SELECT utils.udf_hex_to_int({{schema}}.udf_rpc_eth_call(OBJECT_CONSTRUCT_KEEP_NULL('from', NULL, 'to', token_address, 'data', concat('0x70a08231',LPAD(REPLACE(wallet_address, '0x', ''), 64, 0))), CONCAT('0x', TRIM(TO_CHAR(block_number, 'XXXXXXXXXX'))))::STRING)
|
||||
|
||||
{%- endmacro -%}
|
||||
53
macros/grants.sql
Normal file
53
macros/grants.sql
Normal file
@ -0,0 +1,53 @@
|
||||
{% macro apply_grants_by_schema(schema) %}
|
||||
{#
|
||||
Generates SQL to grant permissions to roles for a given schema.
|
||||
This gets run automatically when a deployment is made to prod.
|
||||
|
||||
This can be manually run to grant permissions to a new schema:
|
||||
`dbt run-operation apply_grants_by_schema --args '{"schema": "my_schema"}'`
|
||||
#}
|
||||
{% if target.name == "prod" %}
|
||||
{%- set outer = namespace(sql="") -%}
|
||||
{% for role in ["VELOCITY_INTERNAL", "VELOCITY_ETHEREUM", "INTERNAL_DEV"] %}
|
||||
{% set sql -%}
|
||||
{% if schema.startswith("_") %}
|
||||
REVOKE USAGE ON SCHEMA {{ target.database }}.{{ schema }} FROM {{ role }};
|
||||
REVOKE USAGE ON ALL FUNCTIONS IN SCHEMA {{ target.database }}.{{ schema }} FROM {{ role }};
|
||||
{%- else -%}
|
||||
GRANT USAGE ON SCHEMA {{ target.database }}.{{ schema }} TO {{ role }};
|
||||
GRANT USAGE ON ALL FUNCTIONS IN SCHEMA {{ target.database }}.{{ schema }} TO {{ role }};
|
||||
|
||||
GRANT SELECT ON ALL TABLES IN SCHEMA {{ target.database }}.{{ schema }} TO {{ role }};
|
||||
GRANT SELECT ON ALL VIEWS IN SCHEMA {{ target.database }}.{{ schema }} TO {{ role }};
|
||||
{%- endif -%}
|
||||
{%- endset -%}
|
||||
{%- set outer.sql = outer.sql ~ sql -%}
|
||||
{%- endfor -%}
|
||||
{{ outer.sql }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro apply_grants_to_all_schema() %}
|
||||
{#
|
||||
Run SQL to grant permissions to roles for all schemas.
|
||||
This is useful for when a new role is created and needs to be granted access to all schemas.
|
||||
This is not used in the normal grant process.
|
||||
|
||||
`dbt run-operation apply_grants_to_all_schema`
|
||||
#}
|
||||
{% if execute and target.name == "prod" %}
|
||||
{% set sql_get_schema %}
|
||||
SELECT SCHEMA_NAME
|
||||
FROM {{ target.database }}.INFORMATION_SCHEMA.SCHEMATA
|
||||
WHERE SCHEMA_NAME NOT IN ('PUBLIC', 'INFORMATION_SCHEMA')
|
||||
{%- endset -%}
|
||||
{%- set results = run_query(sql_get_schema) -%}
|
||||
{% set sql_apply_grants %}
|
||||
{%- for schema in results.columns[0].values() -%}
|
||||
{{ apply_grants_by_schema(schema) }}
|
||||
{%- endfor -%}
|
||||
{%- endset -%}
|
||||
{% do log(sql_apply_grants, true) %}
|
||||
{% do run_query(sql_apply_grants) %}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
@ -1,348 +0,0 @@
|
||||
{% macro config_core_udfs() %}
|
||||
|
||||
{#
|
||||
UTILITY SCHEMA
|
||||
#}
|
||||
- name: _utils.udf_introspect
|
||||
signature:
|
||||
- [echo, STRING]
|
||||
func_type: SECURE EXTERNAL
|
||||
return_type: TEXT
|
||||
api_integration: '{{ var("API_INTEGRATION") }}'
|
||||
sql: introspect
|
||||
|
||||
|
||||
- name: _utils.udf_user_tier
|
||||
signature: []
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
MEMOIZABLE
|
||||
sql: |
|
||||
SELECT
|
||||
COALESCE(PARSE_JSON(GETVARIABLE('LIVEQUERY_CONTEXT')):userTier::STRING, 'community')
|
||||
|
||||
- name: _utils.udf_provider
|
||||
signature: []
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
MEMOIZABLE
|
||||
sql: |
|
||||
SELECT
|
||||
COALESCE(PARSE_JSON(GETVARIABLE('LIVEQUERY_CONTEXT')):provider::STRING, 'quicknode')
|
||||
|
||||
- name: _utils.udf_whoami
|
||||
signature: []
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
MEMOIZABLE
|
||||
sql: |
|
||||
SELECT
|
||||
COALESCE(PARSE_JSON(GETVARIABLE('LIVEQUERY_CONTEXT')):userId::STRING, CURRENT_USER())
|
||||
|
||||
- name: _utils.udf_register_secret
|
||||
signature:
|
||||
- [request_id, STRING]
|
||||
- [user_id, STRING]
|
||||
- [key, STRING]
|
||||
return_type: TEXT
|
||||
func_type: SECURE EXTERNAL
|
||||
api_integration: '{{ var("API_INTEGRATION") }}'
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
sql: secret/register
|
||||
- name: utils.udf_register_secret
|
||||
signature:
|
||||
- [request_id, STRING]
|
||||
- [key, STRING]
|
||||
func_type: SECURE
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
SELECT
|
||||
_utils.UDF_REGISTER_SECRET(REQUEST_ID, _utils.UDF_WHOAMI(), KEY)
|
||||
|
||||
- name: utils.udf_hex_to_int
|
||||
signature:
|
||||
- [hex, STRING]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE PYTHON
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'hex_to_int'
|
||||
sql: |
|
||||
{{ python_hex_to_int() | indent(4) }}
|
||||
- name: utils.udf_hex_to_int
|
||||
signature:
|
||||
- [encoding, STRING]
|
||||
- [hex, STRING]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE PYTHON
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'hex_to_int'
|
||||
sql: |
|
||||
{{ python_udf_hex_to_int_with_encoding() | indent(4) }}
|
||||
- name: utils.udf_evm_text_signature
|
||||
signature:
|
||||
- [abi, VARIANT]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
LANGUAGE PYTHON
|
||||
RUNTIME_VERSION = '3.8'
|
||||
HANDLER = 'get_simplified_signature'
|
||||
sql: |
|
||||
{{ create_udf_evm_text_signature() | indent(4) }}
|
||||
- name: utils.udf_keccak256
|
||||
signature:
|
||||
- [event_name, VARCHAR(255)]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
LANGUAGE PYTHON
|
||||
RUNTIME_VERSION = '3.8'
|
||||
PACKAGES = ('pycryptodome==3.15.0')
|
||||
HANDLER = 'udf_encode'
|
||||
sql: |
|
||||
{{ create_udf_keccak256() | indent(4) }}
|
||||
- name: utils.udf_hex_to_string
|
||||
signature:
|
||||
- [hex, STRING]
|
||||
return_type: TEXT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
SELECT
|
||||
LTRIM(regexp_replace(
|
||||
try_hex_decode_string(hex),
|
||||
'[\x00-\x1F\x7F-\x9F\xAD]', '', 1))
|
||||
|
||||
- name: utils.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, ARRAY]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call() }}
|
||||
- name: utils.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, OBJECT]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call() }}
|
||||
- name: utils.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, OBJECT]
|
||||
- [id, STRING]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call(False) }}
|
||||
- name: utils.udf_json_rpc_call
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [params, ARRAY]
|
||||
- [id, STRING]
|
||||
return_type: OBJECT
|
||||
options: |
|
||||
NULL
|
||||
LANGUAGE SQL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
IMMUTABLE
|
||||
sql: |
|
||||
{{ sql_udf_json_rpc_call(False) }}
|
||||
|
||||
{#
|
||||
LIVE SCHEMA
|
||||
#}
|
||||
- name: _live.udf_api
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [url, STRING]
|
||||
- [headers, OBJECT]
|
||||
- [DATA, OBJECT]
|
||||
- [user_id, STRING]
|
||||
- [SECRET, STRING]
|
||||
return_type: VARIANT
|
||||
func_type: EXTERNAL
|
||||
api_integration: '{{ var("API_INTEGRATION") }}'
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
sql: udf_api
|
||||
- name: live.udf_api
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [url, STRING]
|
||||
- [headers, OBJECT]
|
||||
- [data, OBJECT]
|
||||
- [secret_name, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
method,
|
||||
url,
|
||||
headers,
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
secret_name
|
||||
)
|
||||
- name: live.udf_api
|
||||
signature:
|
||||
- [method, STRING]
|
||||
- [url, STRING]
|
||||
- [headers, OBJECT]
|
||||
- [data, OBJECT]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
method,
|
||||
url,
|
||||
headers,
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
''
|
||||
)
|
||||
- name: live.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
- [data, OBJECT]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'POST',
|
||||
url,
|
||||
{'Content-Type': 'application/json'},
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
''
|
||||
)
|
||||
- name: live.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
- [data, OBJECT]
|
||||
- [secret_name, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'POST',
|
||||
url,
|
||||
{'Content-Type': 'application/json'},
|
||||
data,
|
||||
_utils.UDF_WHOAMI(),
|
||||
secret_name
|
||||
)
|
||||
- name: live.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'GET',
|
||||
url,
|
||||
{},
|
||||
{},
|
||||
_utils.UDF_WHOAMI(),
|
||||
''
|
||||
)
|
||||
- name: live.udf_api
|
||||
signature:
|
||||
- [url, STRING]
|
||||
- [secret_name, STRING]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
sql: |
|
||||
SELECT
|
||||
_live.UDF_API(
|
||||
'GET',
|
||||
url,
|
||||
{},
|
||||
{},
|
||||
_utils.UDF_WHOAMI(),
|
||||
secret_name
|
||||
)
|
||||
|
||||
- name: live.udf_rpc
|
||||
signature:
|
||||
- [blockchain, STRING]
|
||||
- [network, STRING]
|
||||
- [method, STRING]
|
||||
- [parameters, VARIANT]
|
||||
return_type: VARIANT
|
||||
options: |
|
||||
NOT NULL
|
||||
RETURNS NULL ON NULL INPUT
|
||||
VOLATILE
|
||||
COMMENT = $$Executes an JSON RPC call on a blockchain.$$
|
||||
sql: |
|
||||
{{ sql_live_rpc_call("method", "parameters", "blockchain", "network") | indent(4) -}}
|
||||
|
||||
{% endmacro %}
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
{% macro python_hex_to_int() %}
|
||||
def hex_to_int(hex) -> str:
|
||||
"""
|
||||
Converts hex (of any size) to int (as a string). Snowflake and java script can only handle up to 64-bit (38 digits of precision)
|
||||
hex_to_int('200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int('0x200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int(NULL);
|
||||
>> NULL
|
||||
"""
|
||||
return (str(int(hex, 16)) if hex and hex != "0x" else None)
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro python_udf_hex_to_int_with_encoding() %}
|
||||
def hex_to_int(encoding, hex) -> str:
|
||||
"""
|
||||
Converts hex (of any size) to int (as a string). Snowflake and java script can only handle up to 64-bit (38 digits of precision)
|
||||
hex_to_int('hex', '200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int('hex', '0x200000000000000000000000000000211');
|
||||
>> 680564733841876926926749214863536423441
|
||||
hex_to_int('hex', NULL);
|
||||
>> NULL
|
||||
hex_to_int('s2c', 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffe5b83acf');
|
||||
>> -440911153
|
||||
"""
|
||||
if not hex:
|
||||
return None
|
||||
if encoding.lower() == 's2c':
|
||||
if hex[0:2].lower() != '0x':
|
||||
hex = f'0x{hex}'
|
||||
|
||||
bits = len(hex[2:])*4
|
||||
value = int(hex, 0)
|
||||
if value & (1 << (bits-1)):
|
||||
value -= 1 << bits
|
||||
return str(value)
|
||||
else:
|
||||
return str(int(hex, 16))
|
||||
{% endmacro %}
|
||||
|
||||
{% macro create_udf_keccak256() %}
|
||||
from Crypto.Hash import keccak
|
||||
|
||||
def udf_encode(event_name):
|
||||
keccak_hash = keccak.new(digest_bits=256)
|
||||
keccak_hash.update(event_name.encode('utf-8'))
|
||||
return '0x' + keccak_hash.hexdigest()
|
||||
{% endmacro %}
|
||||
|
||||
{% macro create_udf_evm_text_signature() %}
|
||||
|
||||
def get_simplified_signature(abi):
|
||||
def generate_signature(inputs):
|
||||
signature_parts = []
|
||||
for input_data in inputs:
|
||||
if 'components' in input_data:
|
||||
component_signature_parts = []
|
||||
components = input_data['components']
|
||||
component_signature_parts.extend(generate_signature(components))
|
||||
component_signature_parts[-1] = component_signature_parts[-1].rstrip(",")
|
||||
if input_data['type'].endswith('[]'):
|
||||
signature_parts.append("(" + "".join(component_signature_parts) + ")[],")
|
||||
else:
|
||||
signature_parts.append("(" + "".join(component_signature_parts) + "),")
|
||||
else:
|
||||
signature_parts.append(input_data['type'].replace('enum ', '').replace(' payable', '') + ",")
|
||||
return signature_parts
|
||||
|
||||
signature_parts = [abi['name'] + "("]
|
||||
signature_parts.extend(generate_signature(abi['inputs']))
|
||||
signature_parts[-1] = signature_parts[-1].rstrip(",") + ")"
|
||||
return "".join(signature_parts)
|
||||
{% endmacro %}
|
||||
@ -84,8 +84,26 @@
|
||||
{%- endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro crud_udfs_in_schema(config_func, blockchain, network, drop_) %}
|
||||
{% macro crud_udfs(config_func, schema, drop_) %}
|
||||
{#
|
||||
Generate create or drop statements for a list of udf configs for a given schema
|
||||
|
||||
config_func: function that returns a list of udf configs
|
||||
drop_: whether to drop or create the udfs
|
||||
#}
|
||||
{% set udfs = fromyaml(config_func())%}
|
||||
{%- for udf in udfs -%}
|
||||
{% if udf["name"].split(".") | first == schema %}
|
||||
CREATE SCHEMA IF NOT EXISTS {{ schema }};
|
||||
{{- create_or_drop_function_from_config(udf, drop_=drop_) -}}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro crud_udfs_by_chain(config_func, blockchain, network, drop_) %}
|
||||
{#
|
||||
Generate create or drop statements for a list of udf configs for a given blockchain and network
|
||||
|
||||
config_func: function that returns a list of udf configs
|
||||
blockchain: blockchain name
|
||||
network: network name
|
||||
@ -93,8 +111,96 @@
|
||||
#}
|
||||
{% set schema = blockchain if not network else blockchain ~ "_" ~ network %}
|
||||
CREATE SCHEMA IF NOT EXISTS {{ schema }};
|
||||
{%- set ethereum_rpc_udfs = fromyaml(config_func(blockchain, network)) if network else fromyaml(config_func(schema, blockchain)) -%}
|
||||
{%- for udf in ethereum_rpc_udfs -%}
|
||||
{%- set configs = fromyaml(config_func(blockchain, network)) if network else fromyaml(config_func(schema, blockchain)) -%}
|
||||
{%- for udf in configs -%}
|
||||
{{- create_or_drop_function_from_config(udf, drop_=drop_) -}}
|
||||
{%- endfor -%}
|
||||
{%- endmacro -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro crud_udfs_by_marketplace(config_func, schema, utility_schema, drop_) %}
|
||||
{#
|
||||
Generate create or drop statements for a list of udf configs for a given blockchain and network
|
||||
|
||||
config_func: function that returns a list of udf configs
|
||||
schema: schema name
|
||||
utility_schema: utility schema name
|
||||
#}
|
||||
CREATE SCHEMA IF NOT EXISTS {{ schema }};
|
||||
{%- set configs = fromyaml(config_func(schema, utility_schema)) if utility_schema else fromyaml(config_func(schema, schema)) -%}
|
||||
{%- for udf in configs -%}
|
||||
{{- create_or_drop_function_from_config(udf, drop_=drop_) -}}
|
||||
{%- endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro crud_marketplace_udfs(config_func, schemaName, base_api_schema_name, drop_) %}
|
||||
{#
|
||||
Generate create or drop statements for a list of udf configs for a given schema and api
|
||||
|
||||
config_func: function that returns a list of udf configs
|
||||
schemaName: the target schema to build the udfs
|
||||
base_api_schema_name: the schema that contains base api functions
|
||||
drop_: whether to drop or create the udfs
|
||||
#}
|
||||
{%- set udfs = fromyaml(config_func(schemaName, base_api_schema_name)) -%}
|
||||
{%- for udf in udfs -%}
|
||||
{{- create_or_drop_function_from_config(udf, drop_=drop_) -}}
|
||||
{%- endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro ephemeral_deploy_core(config) %}
|
||||
{#
|
||||
This macro is used to deploy functions using ephemeral models.
|
||||
It should only be used within an ephemeral model.
|
||||
#}
|
||||
{% if execute and (var("UPDATE_UDFS_AND_SPS") or var("DROP_UDFS_AND_SPS")) and model.unique_id in selected_resources %}
|
||||
{% set sql %}
|
||||
{{- crud_udfs(config, this.schema, var("DROP_UDFS_AND_SPS")) -}}
|
||||
{%- endset -%}
|
||||
{%- do log("Deploy core udfs: " ~ this.database ~ "." ~ this.schema, true) -%}
|
||||
{%- do run_query(sql ~ apply_grants_by_schema(this.schema)) -%}
|
||||
{% else -%}
|
||||
SELECT '{{ model.schema }}' as schema_
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro ephemeral_deploy(configs) %}
|
||||
{#
|
||||
This macro is used to deploy functions using ephemeral models.
|
||||
It should only be used within an ephemeral model.
|
||||
#}
|
||||
{%- set blockchain = this.schema -%}
|
||||
{%- set network = this.identifier -%}
|
||||
{% set schema = blockchain ~ "_" ~ network %}
|
||||
{% if execute and (var("UPDATE_UDFS_AND_SPS") or var("DROP_UDFS_AND_SPS")) and model.unique_id in selected_resources %}
|
||||
{% set sql %}
|
||||
{% for config in configs %}
|
||||
{{- crud_udfs_by_chain(config, blockchain, network, var("DROP_UDFS_AND_SPS")) -}}
|
||||
{%- endfor -%}
|
||||
{%- endset -%}
|
||||
{%- do log("Deploy partner udfs: " ~ this.database ~ "." ~ schema, true) -%}
|
||||
{%- do run_query(sql ~ apply_grants_by_schema(schema)) -%}
|
||||
{% else -%}
|
||||
SELECT '{{ model.schema }}' as schema_
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro ephemeral_deploy_marketplace(configs) %}
|
||||
{#
|
||||
This macro is used to deploy functions using ephemeral models.
|
||||
It should only be used within an ephemeral model.
|
||||
#}
|
||||
{%- set schema = this.schema -%}
|
||||
{%- set utility_schema = this.identifier -%}
|
||||
{% if execute and (var("UPDATE_UDFS_AND_SPS") or var("DROP_UDFS_AND_SPS")) and model.unique_id in selected_resources %}
|
||||
{% set sql %}
|
||||
{% for config in configs %}
|
||||
{{- crud_udfs_by_marketplace(config, schema, utility_schema, var("DROP_UDFS_AND_SPS")) -}}
|
||||
{%- endfor -%}
|
||||
{%- endset -%}
|
||||
{%- do log("Deploy marketplace udfs: " ~ this.database ~ "." ~ schema, true) -%}
|
||||
{%- do run_query(sql ~ apply_grants_by_schema(schema)) -%}
|
||||
{% else -%}
|
||||
SELECT '{{ model.schema }}' as schema_
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
|
||||
11
macros/marketplace/alchemy/alchemy_config_utils.sql
Normal file
11
macros/marketplace/alchemy/alchemy_config_utils.sql
Normal file
@ -0,0 +1,11 @@
|
||||
{% macro alchemy_nft_get_api_call(schema_name, api_path) %}
|
||||
SELECT {{ schema_name -}}.nfts_get(NETWORK, '/{{api_path}}', QUERY_ARGS) as response
|
||||
{% endmacro %}
|
||||
|
||||
{% macro alchemy_nft_post_api_call(schema_name, api_path) %}
|
||||
SELECT {{ schema_name -}}.nfts_post(NETWORK, '/{{api_path}}', BODY) as response
|
||||
{% endmacro %}
|
||||
|
||||
{% macro alchemy_rpc_call(schema_name, method) %}
|
||||
SELECT {{ schema_name -}}.rpc(NETWORK, '{{method}}', PARAMS) as response
|
||||
{% endmacro %}
|
||||
216
macros/marketplace/alchemy/nft_udfs.yaml.sql
Normal file
216
macros/marketplace/alchemy/nft_udfs.yaml.sql
Normal file
@ -0,0 +1,216 @@
|
||||
{% macro config_alchemy_nfts_udfs(schema_name = "alchemy_nfts", utils_schema_name = "alchemy_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the alchemy nft endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_nfts
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets all NFTs currently owned by a given address. [Alchemy docs here](https://docs.alchemy.com/reference/getnfts).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getNFTs') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_owners_for_token
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get the owner(s) for a token. [Alchemy docs here](https://docs.alchemy.com/reference/getownersfortoken).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getOwnersForToken') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_owners_for_collection
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets all owners for a given NFT contract. [Alchemy docs here](https://docs.alchemy.com/reference/getownersforcollection).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getOwnersForCollection') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.is_holder_of_collection
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Checks whether a wallet holds a NFT in a given collection. [Alchemy docs here](https://docs.alchemy.com/reference/isholderofcollection).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'isHolderOfCollection') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_contracts_for_owner
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets all NFT contracts held by an owner address. [Alchemy docs here](https://docs.alchemy.com/reference/getcontractsforowner).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getContractsForOwner') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_metadata
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets the metadata associated with a given NFT. [Alchemy docs here](https://docs.alchemy.com/reference/getnftmetadata).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getNFTMetadata') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_metadata_batch
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [BODY, OBJECT, JSON Body]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets the metadata associated with up to 100 given NFT contracts. [Alchemy docs here](https://docs.alchemy.com/reference/getnftmetadatabatch).$$
|
||||
sql: {{ alchemy_nft_post_api_call(utils_schema_name, 'getNFTMetadataBatch') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_contract_metadata
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Queries NFT high-level collection/contract level information. [Alchemy docs here](https://docs.alchemy.com/reference/getcontractmetadata).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getContractMetadata') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_contract_metadata_batch
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [BODY, OBJECT, JSON Body]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets the metadata associated with the given list of contract addresses. [Alchemy docs here](https://docs.alchemy.com/reference/getcontractmetadatabatch).$$
|
||||
sql: {{ alchemy_nft_post_api_call(utils_schema_name, 'getContractMetadataBatch') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.invalidate_contract
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Marks all cached tokens for the particular contract as stale. So the next time the endpoint is queried it fetches live data instead of fetching from cache. [Alchemy docs here](https://docs.alchemy.com/reference/invalidatecontract).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'invalidateContract') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.reingest_contract
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Triggers metadata refresh for an entire NFT collection and refreshes stale metadata after a collection reveal/collection changes. [Alchemy docs here](https://docs.alchemy.com/reference/reingestcontract).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'reingestContract') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.search_contract_metadata
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Search for a keyword across metadata of all ERC-721 and ERC-1155 smart contracts. [Alchemy docs here](https://docs.alchemy.com/reference/searchcontractmetadata).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'searchContractMetadata') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_nfts_for_collection
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets all NFTs for a given NFT contract. [Alchemy docs here](https://docs.alchemy.com/reference/getnftsforcollection).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getNFTsForCollection') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_spam_contracts
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns a list of all spam contracts marked by Alchemy. [Alchemy docs here](https://docs.alchemy.com/reference/getspamcontracts).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getSpamContracts') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.is_spam_contract
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns whether a contract is marked as spam or not by Alchemy. [Alchemy docs here](https://docs.alchemy.com/reference/isspamcontract).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'isSpamContract') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.is_airdrop
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns whether a token is marked as an airdrop or not. Airdrops are defined as NFTs that were minted to a user address in a transaction sent by a different address. [Alchemy docs here](https://docs.alchemy.com/reference/isairdrop).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'isAirdrop') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.report_spam
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Report a particular address to our APIs if you think it is spam. [Alchemy docs here](https://docs.alchemy.com/reference/reportspam).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'reportSpam') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_floor_price
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the floor prices of a NFT collection by marketplace. [Alchemy docs here](https://docs.alchemy.com/reference/getfloorprice).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getFloorPrice') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_sales
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Gets NFT sales that have happened through on-chain marketplaces. [Alchemy docs here](https://docs.alchemy.com/reference/getnftsales).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'getNFTSales') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.compute_rarity
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Computes the rarity of each attribute of an NFT. [Alchemy docs here](https://docs.alchemy.com/reference/computerarity).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'computeRarity') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.summarize_nft_attributes
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Generate a summary of attribute prevalence for an NFT collection. [Alchemy docs here](https://docs.alchemy.com/reference/summarizenftattributes).$$
|
||||
sql: {{ alchemy_nft_get_api_call(utils_schema_name, 'summarizeNFTAttributes') | trim }}
|
||||
|
||||
{% endmacro %}
|
||||
35
macros/marketplace/alchemy/token_udfs.yaml.sql
Normal file
35
macros/marketplace/alchemy/token_udfs.yaml.sql
Normal file
@ -0,0 +1,35 @@
|
||||
{% macro config_alchemy_tokens_udfs(schema_name = "alchemy_tokens", utils_schema_name = "alchemy_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the alchemy token endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_allowance
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [PARAMS, ARRAY, Array of JSON param objects for RPC request]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the amount which the spender is allowed to withdraw from the owner. [Alchemy docs here](https://docs.alchemy.com/reference/alchemy-gettokenallowance).$$
|
||||
sql: {{alchemy_rpc_call(utils_schema_name, "alchemy_getTokenAllowance") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_balances
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [PARAMS, ARRAY, Array of JSON param objects for RPC request]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns ERC20 token balances for all tokens the given address has ever transacted in with. Optionally accepts a list of contracts. [Alchemy docs here](https://docs.alchemy.com/reference/alchemy-gettokenbalances).$$
|
||||
sql: {{alchemy_rpc_call(utils_schema_name, "alchemy_getTokenBalances") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_metadata
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [PARAMS, ARRAY, Array of JSON param objects for RPC request]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns metadata (name, symbol, decimals, logo) for a given token contract address. [Alchemy docs here](https://docs.alchemy.com/reference/alchemy-gettokenmetadata).$$
|
||||
sql: {{alchemy_rpc_call(utils_schema_name, "alchemy_getTokenMetadata") | trim}}
|
||||
{% endmacro %}
|
||||
16
macros/marketplace/alchemy/transfers_udfs.yaml.sql
Normal file
16
macros/marketplace/alchemy/transfers_udfs.yaml.sql
Normal file
@ -0,0 +1,16 @@
|
||||
{% macro config_alchemy_transfers_udfs(schema_name = "alchemy_transfers", utils_schema_name = "alchemy_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the alchemy transfers endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_asset_transfers
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [PARAMS, ARRAY, Array of JSON param objects for RPC request]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$The Transfers API allows you to easily fetch historical transactions for any address across Ethereum and supported L2s including Polygon, Arbitrum, and Optimism. [Alchemy docs here](https://docs.alchemy.com/reference/alchemy-getassettransfers).$$
|
||||
sql: {{alchemy_rpc_call(utils_schema_name, "alchemy_getAssetTransfers") | trim}}
|
||||
|
||||
{% endmacro %}
|
||||
60
macros/marketplace/alchemy/util_udfs.yaml.sql
Normal file
60
macros/marketplace/alchemy/util_udfs.yaml.sql
Normal file
@ -0,0 +1,60 @@
|
||||
{% macro config_alchemy_utils_udfs(schema = "alchemy_utils", utils_schema_name="alchemy_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the alchemy base endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema -}}.nfts_get
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'GET' request to the Alchemy NFT API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
concat(
|
||||
'https://', NETWORK,'.g.alchemy.com/nft/v2/{',NETWORK,'}', PATH, '?',
|
||||
utils.udf_object_to_url_query_string(QUERY_ARGS)
|
||||
),
|
||||
'_FSC_SYS/ALCHEMY'
|
||||
) as response
|
||||
|
||||
- name: {{ schema -}}.nfts_post
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [BODY, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'POST' request to the Alchemy NFT API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat('https://', NETWORK,'.g.alchemy.com/nft/v2/{',NETWORK,'}', PATH),
|
||||
{},
|
||||
BODY,
|
||||
'_FSC_SYS/ALCHEMY'
|
||||
) as response
|
||||
|
||||
- name: {{ schema -}}.rpc
|
||||
signature:
|
||||
- [NETWORK, STRING, The blockchain/network]
|
||||
- [METHOD, STRING, The RPC method to call]
|
||||
- [PARAMS, ARRAY, The RPC Params arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue an RPC call to Alchemy.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
concat('https://', NETWORK,'.g.alchemy.com/v2/{',NETWORK,'}'),
|
||||
{},
|
||||
{'id': 1,'jsonrpc': '2.0','method': METHOD,'params': PARAMS},
|
||||
'_FSC_SYS/ALCHEMY') as response
|
||||
{% endmacro %}
|
||||
23
macros/marketplace/bitquery/udfs.yaml.sql
Normal file
23
macros/marketplace/bitquery/udfs.yaml.sql
Normal file
@ -0,0 +1,23 @@
|
||||
{% macro config_bitquery_udfs(schema_name = "bitquery", utils_schema_name = "bitquery_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the BitQuery calls
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.graphql
|
||||
signature:
|
||||
- [QUERY, OBJECT, The GraphQL query]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Run a graphql query on BitQuery [BitQuery docs here](https://docs.bitquery.io/docs/start/first-query/).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
'https://graphql.bitquery.io',
|
||||
{'X-API-KEY': '{API_KEY}'},
|
||||
QUERY,
|
||||
'_FSC_SYS/BITQUERY'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
44
macros/marketplace/blockpour/util_udfs.yaml.sql
Normal file
44
macros/marketplace/blockpour/util_udfs.yaml.sql
Normal file
@ -0,0 +1,44 @@
|
||||
{% macro config_blockpour_utils_udfs(schema_name = "blockpour_utils", utils_schema_name="blockpour_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Blockpour base endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'GET' request to the Blockpour API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'GET',
|
||||
concat(
|
||||
'https://services.blockpour.com/api', PATH, '?',
|
||||
utils.udf_object_to_url_query_string(QUERY_ARGS)
|
||||
),
|
||||
{'api-key': '{API_KEY}'},
|
||||
{},
|
||||
'_FSC_SYS/BLOCKPOUR'
|
||||
) as response
|
||||
|
||||
- name: {{ schema_name -}}.post
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [BODY, OBJECT, The request body]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'POST' request to the BlockPour API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat('https://services.blockpour.com/api', PATH),
|
||||
{'api-key': '{API_KEY}'},
|
||||
BODY,
|
||||
'_FSC_SYS/BLOCKPOUR'
|
||||
) as response
|
||||
{% endmacro %}
|
||||
61
macros/marketplace/chainbase/util_udfs.yaml.sql
Normal file
61
macros/marketplace/chainbase/util_udfs.yaml.sql
Normal file
@ -0,0 +1,61 @@
|
||||
{% macro config_chainbase_utils_udfs(schema_name = "chainbase_utils", utils_schema_name="chainbase_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the alchemy base endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'GET' request to the Chainbase API. [Chainbase Docs](https://docs.chainbase.com/reference/supported-chains)$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'GET',
|
||||
concat(
|
||||
'https://api.chainbase.online', PATH, '?',
|
||||
utils.udf_object_to_url_query_string(QUERY_ARGS)
|
||||
),
|
||||
{'x-api-key': '{API_KEY}'},
|
||||
{},
|
||||
'_FSC_SYS/CHAINBASE'
|
||||
) as response
|
||||
|
||||
- name: {{ schema_name -}}.post
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [BODY, OBJECT, The request body]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'POST' request to the Chainbase API. [Chainbase Docs](https://docs.chainbase.com/reference/supported-chains)$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat('https://api.chainbase.online', PATH),
|
||||
{'x-api-key': '{API_KEY}'},
|
||||
BODY,
|
||||
'_FSC_SYS/CHAINBASE'
|
||||
) as response
|
||||
|
||||
- name: {{ schema_name -}}.rpc
|
||||
signature:
|
||||
- [METHOD, STRING, The RPC method to call]
|
||||
- [PARAMS, ARRAY, The RPC Params arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue an RPC call to Chainbase. [Chainbase Docs](https://docs.chainbase.com/reference/supported-chains)$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
concat('https://api.chainbase.online'),
|
||||
{'x-api-key': '{API_KEY}'},
|
||||
{'id': 1,'jsonrpc': '2.0','method': METHOD,'params': PARAMS},
|
||||
'_FSC_SYS/CHAINBASE') as response
|
||||
|
||||
{% endmacro %}
|
||||
45
macros/marketplace/credmark/util_udfs.sql
Normal file
45
macros/marketplace/credmark/util_udfs.sql
Normal file
@ -0,0 +1,45 @@
|
||||
{% macro config_credmark_utils_udfs(schema_name = "credmark_utils", utils_schema_name="credmark_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Credmark base endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'GET' request to the Credmark API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'GET',
|
||||
concat(
|
||||
'https://gateway.credmark.com', PATH, '?',
|
||||
utils.udf_object_to_url_query_string(QUERY_ARGS)
|
||||
),
|
||||
{'Authorization': 'Bearer {API_KEY}'},
|
||||
{},
|
||||
'_FSC_SYS/CREDMARK'
|
||||
) as response
|
||||
|
||||
- name: {{ schema_name -}}.post
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [BODY, OBJECT, The request body]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'POST' request to the Credmark API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat('https://gateway.credmark.com', PATH),
|
||||
{'Authorization': 'Bearer {API_KEY}'},
|
||||
BODY,
|
||||
'_FSC_SYS/CREDMARK'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
23
macros/marketplace/dapplooker/udfs.yaml.sql
Normal file
23
macros/marketplace/dapplooker/udfs.yaml.sql
Normal file
@ -0,0 +1,23 @@
|
||||
{% macro config_dapplooker_udfs(schema_name = "dapplooker", utils_schema_name = "dapplooker_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the DappLooker endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_chart
|
||||
signature:
|
||||
- [CHART_ID, STRING, The UUID of the chart]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the chart data. [DappLooker docs here](https://github.com/dapplooker/dapplooker-sdk).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'GET',
|
||||
concat('https://api.dapplooker.com/chart/', CHART_ID, '?api_key={API_KEY}&format=json'),
|
||||
{},
|
||||
{},
|
||||
'_FSC_SYS/DAPPLOOKER'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
15
macros/marketplace/footprint/address_udfs.yaml.sql
Normal file
15
macros/marketplace/footprint/address_udfs.yaml.sql
Normal file
@ -0,0 +1,15 @@
|
||||
{% macro config_footprint_address_udfs(schema_name = "footprint_address", utils_schema_name = "footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the footprint address endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_tx_stats_by_address
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the transactions statistics by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_address-transactions-statistics).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/address/transactions/statistics") | trim}}
|
||||
|
||||
{% endmacro %}
|
||||
51
macros/marketplace/footprint/balances_udfs.yaml.sql
Normal file
51
macros/marketplace/footprint/balances_udfs.yaml.sql
Normal file
@ -0,0 +1,51 @@
|
||||
{% macro config_footprint_balances_udfs(schema_name = "footprint_balances", utils_schema_name = "footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the footprint balance endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_native_balance_by_address
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the native balance by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_address-native-balance).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/address/native/balance") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_all_nfts_owned_by_address
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns all NFTs owned by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_nft-wallet-balance).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/wallet/balance") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_all_erc20_balance_by_address
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns all ERC20 balance by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_address-erc20-balance).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/address/erc20/balance") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_owned_by_address
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the specified NFT owned by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_nft-balance).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/balance") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_erc20_balance_by_address
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the specified ERC20 balance by a wallet address. [Footprint docs here](https://docs.footprint.network/reference/get_token-balance).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/token/balance") | trim}}
|
||||
|
||||
{% endmacro %}
|
||||
24
macros/marketplace/footprint/chain_udfs.yaml.sql
Normal file
24
macros/marketplace/footprint/chain_udfs.yaml.sql
Normal file
@ -0,0 +1,24 @@
|
||||
{% macro config_footprint_chains_udfs(schema_name = "footprint_chains", utils_schema_name = "footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Footprint token endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_chain_transactions
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the transactions of the chain. [Footprint docs here](https://docs.footprint.network/reference/get_chain-transactions).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/chain/transactions") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_chains
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the basic information of all chains. [Footprint docs here](https://docs.footprint.network/reference/get_chain-info).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/chain/info") | trim}}
|
||||
|
||||
{% endmacro %}
|
||||
25
macros/marketplace/footprint/chart_udfs.yaml.sql
Normal file
25
macros/marketplace/footprint/chart_udfs.yaml.sql
Normal file
@ -0,0 +1,25 @@
|
||||
{% macro config_footprint_charts_udfs(schema_name = "footprint_charts", utils_schema_name = "footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Footprint Chart endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_chart_results
|
||||
signature:
|
||||
- [CHART_ID, VARCHAR, The chart ID]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns your Footprint chart data by a chart ID. [Footprint docs here](https://docs.footprint.network/reference/post_dataapi-card-chart-id-query).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat(
|
||||
'https://footprint.network/api/v1/dataApi/card/', CHART_ID, '/query'
|
||||
),
|
||||
{'api-key': '{API_KEY}'},
|
||||
{},
|
||||
'_FSC_SYS/FOOTPRINT'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
7
macros/marketplace/footprint/footprint_config_utils.sql
Normal file
7
macros/marketplace/footprint/footprint_config_utils.sql
Normal file
@ -0,0 +1,7 @@
|
||||
{% macro footprint_get_api_call(schema_name, api_path) %}
|
||||
SELECT {{ schema_name -}}.get('/{{api_path}}', QUERY_PARAMS) as response
|
||||
{% endmacro %}
|
||||
|
||||
{% macro footprint_post_api_call(schema_name, api_path) %}
|
||||
SELECT {{ schema_name -}}.post('/{{api_path}}', BODY) as response
|
||||
{% endmacro %}
|
||||
69
macros/marketplace/footprint/gamefi_udfs.yaml.sql
Normal file
69
macros/marketplace/footprint/gamefi_udfs.yaml.sql
Normal file
@ -0,0 +1,69 @@
|
||||
{% macro config_footprint_gamefi_udfs(schema_name = "footprint_gamefi", utils_schema_name = "footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Footprint Gamefi endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_protocols
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the basic information of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-info).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/info") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_protocols_by_contract
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the basic information of the protocol by contract address. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-info-by-contract).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/info/by-contract") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_protocols_by_name
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the basic information of the protocol by name. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-info-by-name).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/info/by-name") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_protocol_active_users
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the active users of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-active-user).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/active-user") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_protocol_active_user_stats
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the active user statistics data of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-active-user-statistics).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/active-user/statistics") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_protocol_new_user_stats
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the new user statistics data of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-new-user-statistics).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/new-user/statistics") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_protocol_stats
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the statistics metrics data of the protocol. [Footprint docs here](https://docs.footprint.network/reference/get_protocol-statistics).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/protocol/statistics") | trim}}
|
||||
|
||||
{% endmacro %}
|
||||
123
macros/marketplace/footprint/nft_udfs.yaml.sql
Normal file
123
macros/marketplace/footprint/nft_udfs.yaml.sql
Normal file
@ -0,0 +1,123 @@
|
||||
{% macro config_footprint_nfts_udfs(schema_name = "footprint_nfts", utils_schema_name = "footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Footprint nft endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_txs_by_collection
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the sales record of the NFT collection in the marketplace. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-transactions).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/transactions") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_transfers_by_collection
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the transfers record of the NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-transfers).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/transfers") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_listings
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the sales listing of the NFT in the marketplace. [Footprint docs here](https://docs.footprint.network/reference/get_nft-order-listings).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/order/listings") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.check_nft_wash_trade
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns whether the transaction hash is wash trading. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-transactions-is-washtrade).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/transactions/is-washtrade") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_collection_stats
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the statistics metrics data of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-metrics).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/metrics") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_collection_floor_price_history
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the floor price history of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-floor-price-history).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/floor-price/history") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_collection_market_cap_history
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the market cap history of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-market-cap-history).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/market-cap/history") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_collection_volume_history
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the volume history of the specified NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-volume-history).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/volume/history") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_marketplace_stats
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the statistics metrics data of single NFT collection in the marketplace. [Footprint docs here](https://docs.footprint.network/reference/get_nft-marketplace-statistics).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/marketplace/statistics") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_collections
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the basic information of the NFT collection. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-info).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/info") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_tokens_by_collection
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the basic information of the NFT. [Footprint docs here](https://docs.footprint.network/reference/get_nft-info).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/info") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_attributes
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the attributes of the NFT. [Footprint docs here](https://docs.footprint.network/reference/get_nft-attributes).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/attributes") | trim}}
|
||||
|
||||
- name: {{ schema_name -}}.get_nft_owners_by_collection
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the owners of the NFT. [Footprint docs here](https://docs.footprint.network/reference/get_nft-collection-owners).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/nft/collection/owners") | trim}}
|
||||
|
||||
{% endmacro %}
|
||||
15
macros/marketplace/footprint/token_udfs.yaml.sql
Normal file
15
macros/marketplace/footprint/token_udfs.yaml.sql
Normal file
@ -0,0 +1,15 @@
|
||||
{% macro config_footprint_tokens_udfs(schema_name = "footprint_tokens", utils_schema_name = "footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Footprint token endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_transfers
|
||||
signature:
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the transfers record of the token. [Footprint docs here](https://docs.footprint.network/reference/get_token-transfers).$$
|
||||
sql: {{footprint_get_api_call(utils_schema_name, "/v2/token/transfers") | trim}}
|
||||
|
||||
{% endmacro %}
|
||||
62
macros/marketplace/footprint/util_udfs.yaml.sql
Normal file
62
macros/marketplace/footprint/util_udfs.yaml.sql
Normal file
@ -0,0 +1,62 @@
|
||||
{% macro config_footprint_utils_udfs(schema = "footprint_utils", utils_schema_name="footprint_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Footprint base endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema -}}.get
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'GET' request to the Footprint API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'GET',
|
||||
concat(
|
||||
'https://api.footprint.network/api', PATH, '?',
|
||||
utils.udf_object_to_url_query_string(QUERY_ARGS)
|
||||
),
|
||||
{'api-key': '{API_KEY}'},
|
||||
{},
|
||||
'_FSC_SYS/FOOTPRINT'
|
||||
) as response
|
||||
|
||||
- name: {{ schema -}}.post
|
||||
signature:
|
||||
- [PATH, STRING, The path starting with '/']
|
||||
- [BODY, OBJECT, The request body]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a 'POST' request to the Footprint API.$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat('https://api.footprint.network/api', PATH),
|
||||
{'api-key': '{API_KEY}'},
|
||||
BODY,
|
||||
'_FSC_SYS/FOOTPRINT'
|
||||
) as response
|
||||
|
||||
|
||||
- name: {{ schema -}}.rpc
|
||||
signature:
|
||||
- [METHOD, STRING, The RPC method to call]
|
||||
- [PARAMS, ARRAY, The RPC Params arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue an RPC call to Footprint.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
concat('https://api.footprint.network/api'),
|
||||
{'api-key': '{API_KEY}'},
|
||||
{'id': 1,'jsonrpc': '2.0','method': METHOD,'params': PARAMS},
|
||||
'_FSC_SYS/FOOTPRINT') as response
|
||||
|
||||
{% endmacro %}
|
||||
22
macros/marketplace/fred/udfs.yaml.sql
Normal file
22
macros/marketplace/fred/udfs.yaml.sql
Normal file
@ -0,0 +1,22 @@
|
||||
{% macro config_fred_udfs(schema_name = "fred", utils_schema_name = "fred_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the FRED Calls
|
||||
#}
|
||||
- name: {{ schema_name -}}.get_series
|
||||
signature:
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get a FRED series [FRED docs here](https://fred.stlouisfed.org/docs/api/fred/series.html).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'GET',
|
||||
concat('https://api.stlouisfed.org/fred/series/observations?api_key={API_KEY}&', utils.udf_object_to_url_query_string(QUERY_ARGS)),
|
||||
{},
|
||||
{},
|
||||
'_FSC_SYS/FRED'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
49
macros/marketplace/helius/apis_udfs.yaml.sql
Normal file
49
macros/marketplace/helius/apis_udfs.yaml.sql
Normal file
@ -0,0 +1,49 @@
|
||||
{% macro config_helius_apis_udfs(schema_name = "helius_apis", utils_schema_name = "helius_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Helius API endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.token_metadata
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [BODY, OBJECT, The body of the API request]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns metadata for a list of given token mint addresses. [Helius docs here](https://docs.helius.xyz/solana-apis/token-metadata-api).$$
|
||||
sql: {{ helius_post_call(utils_schema_name, '/v0/token-metadata') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.balances
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [ADDRESS, STRING, The address to retrieve balances for]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns the native Solana balance (in lamports) and all token balances for a given address. [Helius docs here](https://docs.helius.xyz/solana-apis/balances-api).$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'GET',
|
||||
CASE
|
||||
WHEN NETWORK = 'devnet' THEN
|
||||
concat('https://api-devnet.helius.xyz/v0/addresses/', ADDRESS, '/balances?api-key={API_KEY}')
|
||||
ELSE
|
||||
concat('https://api.helius.xyz/v0/addresses/', ADDRESS, '/balances?api-key={API_KEY}')
|
||||
END,
|
||||
{},
|
||||
{},
|
||||
'_FSC_SYS/HELIUS'
|
||||
) as response
|
||||
|
||||
- name: {{ schema_name -}}.parse_transactions
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [TRANSACTIONS, ARRAY, An array of transaction signatures]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns an array of enriched, human-readable transactions of the given transaction signatures. Up to 100 transactions per call. [Helius docs here](https://docs.helius.xyz/solana-apis/enhanced-transactions-api/parse-transaction-s).$$
|
||||
sql: |
|
||||
SELECT {{ utils_schema_name -}}.post(NETWORK, '/v0/transactions', {'transactions': TRANSACTIONS}) as response
|
||||
|
||||
{% endmacro %}
|
||||
86
macros/marketplace/helius/das_udfs.yaml.sql
Normal file
86
macros/marketplace/helius/das_udfs.yaml.sql
Normal file
@ -0,0 +1,86 @@
|
||||
{% macro config_helius_das_udfs(schema_name = "helius_das", utils_schema_name = "helius_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Helius DAS endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_asset
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get an asset by its ID. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/get-asset).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'getAsset') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_signatures_for_asset
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get a list of transaction signatures related to a compressed asset. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/get-signatures-for-asset).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'getSignaturesForAsset') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.search_assets
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Search for assets by a variety of parameters. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/search-assets).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'searchAssets') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_asset_proof
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get a merkle proof for a compressed asset by its ID. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/get-asset-proof).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'getAssetProof') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_assets_by_owner
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get a list of assets owned by an address. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/get-assets-by-owner).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'getAssetsByOwner') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_assets_by_authority
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get a list of assets with a specific authority. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/get-assets-by-authority).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'getAssetsByAuthority') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_assets_by_creator
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get a list of assets created by an address. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/get-assets-by-creator).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'getAssetsByCreator') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_assets_by_group
|
||||
signature:
|
||||
- [NETWORK, STRING, mainnet or devnet]
|
||||
- [PARAMS, OBJECT, The RPC Params argument]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Get a list of assets by a group key and value. [Helius docs here](https://docs.helius.xyz/solana-compression/digital-asset-standard-das-api/get-assets-by-group).$$
|
||||
sql: {{ helius_rpc_call(utils_schema_name, 'getAssetsByCreator') | trim }}
|
||||
|
||||
{% endmacro %}
|
||||
11
macros/marketplace/helius/helius_config_utils.sql
Normal file
11
macros/marketplace/helius/helius_config_utils.sql
Normal file
@ -0,0 +1,11 @@
|
||||
{% macro helius_rpc_call(schema_name, method) %}
|
||||
SELECT {{ schema_name -}}.rpc(NETWORK, '{{method}}', PARAMS) as response
|
||||
{% endmacro %}
|
||||
|
||||
{% macro helius_get_call(schema_name, path) %}
|
||||
SELECT {{ schema_name -}}.get(NETWORK, '{{path}}', QUERY_PARAMS) as response
|
||||
{% endmacro %}
|
||||
|
||||
{% macro helius_post_call(schema_name, path) %}
|
||||
SELECT {{ schema_name -}}.post(NETWORK, '{{path}}', BODY) as response
|
||||
{% endmacro %}
|
||||
75
macros/marketplace/helius/util_udfs.yaml.sql
Normal file
75
macros/marketplace/helius/util_udfs.yaml.sql
Normal file
@ -0,0 +1,75 @@
|
||||
{% macro config_helius_util_udfs(schema = "helius_utils", utils_schema_name="helius_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Helius base endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema -}}.get
|
||||
signature:
|
||||
- [NETWORK, STRING, The network 'devnet' or 'mainnet']
|
||||
- [PATH, STRING, The API path starting with '/']
|
||||
- [QUERY_PARAMS, OBJECT, The query parameters]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue an HTTP GET request to Helius.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'GET',
|
||||
CASE
|
||||
WHEN NETWORK = 'devnet' THEN
|
||||
concat('https://api-devnet.helius.xyz', PATH, '?api-key={API_KEY}&', utils.udf_object_to_url_query_string(QUERY_PARAMS))
|
||||
ELSE
|
||||
concat('https://api.helius.xyz', PATH, '?api-key={API_KEY}&', utils.udf_object_to_url_query_string(QUERY_PARAMS))
|
||||
END,
|
||||
{},
|
||||
{},
|
||||
'_FSC_SYS/HELIUS'
|
||||
) as response
|
||||
|
||||
- name: {{ schema -}}.post
|
||||
signature:
|
||||
- [NETWORK, STRING, The network 'devnet' or 'mainnet']
|
||||
- [PATH, STRING, The API path starting with '/']
|
||||
- [BODY, OBJECT, The request body]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue an HTTP POST request to Helius.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
CASE
|
||||
WHEN NETWORK = 'devnet' THEN
|
||||
concat('https://api-devnet.helius.xyz', PATH, '?api-key={API_KEY}')
|
||||
ELSE
|
||||
concat('https://api.helius.xyz', PATH, '?api-key={API_KEY}')
|
||||
END,
|
||||
{},
|
||||
BODY,
|
||||
'_FSC_SYS/HELIUS'
|
||||
) as response
|
||||
|
||||
- name: {{ schema -}}.rpc
|
||||
signature:
|
||||
- [NETWORK, STRING, The network 'devnet' or 'mainnet']
|
||||
- [METHOD, STRING, The RPC method to call]
|
||||
- [PARAMS, OBJECT, The RPC Params arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue an RPC call to Helius.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
CASE
|
||||
WHEN NETWORK = 'devnet' THEN
|
||||
'https://devnet.helius-rpc.com?api-key={API_KEY}'
|
||||
ELSE
|
||||
'https://rpc.helius.xyz?api-key={API_KEY}'
|
||||
END,
|
||||
{},
|
||||
{'id': 1,'jsonrpc': '2.0','method': METHOD,'params': PARAMS},
|
||||
'_FSC_SYS/HELIUS'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
24
macros/marketplace/playgrounds/udfs.yaml.sql
Normal file
24
macros/marketplace/playgrounds/udfs.yaml.sql
Normal file
@ -0,0 +1,24 @@
|
||||
{% macro config_playgrounds_udfs(schema_name = "playgrounds", utils_schema_name = "playgrounds_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Playgrounds calls
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.query_subgraph
|
||||
signature:
|
||||
- [SUBGRAPH_ID, STRING, The ID of the Subgraph]
|
||||
- [QUERY, OBJECT, The GraphQL query]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Query a subgraph via the Playgrounds Proxy [Playgrounds docs here](https://docs.playgrounds.network/api/subgraph-proxy/).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat('https://api.playgrounds.network/v1/proxy/subgraphs/id/', SUBGRAPH_ID),
|
||||
{'Playgrounds-Api-Key': '{API_KEY}', 'Content-Type': 'application/json'},
|
||||
QUERY,
|
||||
'_FSC_SYS/PLAYGROUNDS'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
50
macros/marketplace/quicknode/ethereum_nft_udfs.yaml.sql
Normal file
50
macros/marketplace/quicknode/ethereum_nft_udfs.yaml.sql
Normal file
@ -0,0 +1,50 @@
|
||||
{% macro config_quicknode_ethereum_nft_udfs(schema_name = "quicknode_ethereum_nfts", utils_schema_name = "quicknode_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the QuickNode Ethereum NFT endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nft_collection_details
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns collection details for specified contracts. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_fetchNFTCollectionDetails_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTCollectionDetails') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nfts
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns aggregated data on NFTs for a given wallet. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_fetchNFTs).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTs') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nfts_by_collection
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns aggregated data on NFTs within a given collection. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_fetchNFTsByCollection_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTsByCollection') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_transfers_by_nft
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns transfers by given NFT. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_getTransfersByNFT_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_getTransfersByNFT') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.verify_nfts_owner
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Confirms ownership of specified NFTs for a given wallet. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_verifyNFTsOwner_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_verifyNFTsOwner') | trim }}
|
||||
{% endmacro %}
|
||||
50
macros/marketplace/quicknode/ethereum_token_udfs.yaml.sql
Normal file
50
macros/marketplace/quicknode/ethereum_token_udfs.yaml.sql
Normal file
@ -0,0 +1,50 @@
|
||||
{% macro config_quicknode_ethereum_token_udfs(schema_name = "quicknode_ethereum_tokens", utils_schema_name = "quicknode_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the QuickNode Ethereum Token endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_metadata_by_contract_address
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns token details for specified contract. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_getTokenMetadataByContractAddress_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_getTokenMetadataByContractAddress') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_metadata_by_symbol
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns token details for specified token symbol. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_getTokenMetadataBySymbol_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_getTokenMetadataBySymbol') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_transactions_by_address
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns transactions within a specified wallet address. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_getTransactionsByAddress_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_getTransactionsByAddress') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_wallet_token_balance
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns ERC-20 tokens and token balances within a wallet. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_getWalletTokenBalance_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_getWalletTokenBalance') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_wallet_token_transactions
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns transfers of a specified token within a specified wallet address. [QuickNode docs here](https://www.quicknode.com/docs/ethereum/qn_getWalletTokenTransactions_v2).$$
|
||||
sql: {{ quicknode_ethereum_mainnet_rpc_call(utils_schema_name, 'qn_getWalletTokenTransactions') | trim }}
|
||||
{% endmacro %}
|
||||
50
macros/marketplace/quicknode/polygon_nft_udfs.yaml.sql
Normal file
50
macros/marketplace/quicknode/polygon_nft_udfs.yaml.sql
Normal file
@ -0,0 +1,50 @@
|
||||
{% macro config_quicknode_polygon_nft_udfs(schema_name = "quicknode_polygon_nfts", utils_schema_name = "quicknode_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the QuickNode Polygon NFT endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nft_collection_details
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns collection details for specified contracts. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_fetchNFTCollectionDetails_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTCollectionDetails') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nfts
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns aggregated data on NFTs for a given wallet. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_fetchNFTs_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTs') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nfts_by_collection
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns aggregated data on NFTs within a given collection. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_fetchNFTsByCollection_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTsByCollection') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_transfers_by_nft
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns transfers by given NFT. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_getTransfersByNFT_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_getTransfersByNFT') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.verify_nfts_owner
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Confirms ownership of specified NFTs for a given wallet. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_verifyNFTsOwner_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_verifyNFTsOwner') | trim }}
|
||||
{% endmacro %}
|
||||
50
macros/marketplace/quicknode/polygon_token_udfs.yaml.sql
Normal file
50
macros/marketplace/quicknode/polygon_token_udfs.yaml.sql
Normal file
@ -0,0 +1,50 @@
|
||||
{% macro config_quicknode_polygon_token_udfs(schema_name = "quicknode_polygon_tokens", utils_schema_name = "quicknode_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the QuickNode Polygon Token endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_metadata_by_contract_address
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns token details for specified contract. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_getTokenMetadataByContractAddress_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_getTokenMetadataByContractAddress') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_token_metadata_by_symbol
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns token details for specified token symbol. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_getTokenMetadataBySymbol_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_getTokenMetadataBySymbol') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_transactions_by_address
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns transactions within a specified wallet address. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_getTransactionsByAddress_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_getTransactionsByAddress') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_wallet_token_balance
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns ERC-20 tokens and token balances within a wallet. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_getWalletTokenBalance_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_getWalletTokenBalance') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.get_wallet_token_transactions
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns transfers of a specified token within a specified wallet address. [QuickNode docs here](https://www.quicknode.com/docs/polygon/qn_getWalletTokenTransactions_v2).$$
|
||||
sql: {{ quicknode_polygon_mainnet_rpc_call(utils_schema_name, 'qn_getWalletTokenTransactions') | trim }}
|
||||
{% endmacro %}
|
||||
11
macros/marketplace/quicknode/quicknode_config_utils.sql
Normal file
11
macros/marketplace/quicknode/quicknode_config_utils.sql
Normal file
@ -0,0 +1,11 @@
|
||||
{% macro quicknode_ethereum_mainnet_rpc_call(schema_name, method) %}
|
||||
SELECT {{ schema_name -}}.ethereum_mainnet_rpc('{{method}}', PARAMS) as response
|
||||
{% endmacro %}
|
||||
|
||||
{% macro quicknode_polygon_mainnet_rpc_call(schema_name, method) %}
|
||||
SELECT {{ schema_name -}}.polygon_mainnet_rpc('{{method}}', PARAMS) as response
|
||||
{% endmacro %}
|
||||
|
||||
{% macro quicknode_solana_mainnet_rpc_call(schema_name, method) %}
|
||||
SELECT {{ schema_name -}}.solana_mainnet_rpc('{{method}}', PARAMS) as response
|
||||
{% endmacro %}
|
||||
24
macros/marketplace/quicknode/solana_nft_udfs.yaml.sql
Normal file
24
macros/marketplace/quicknode/solana_nft_udfs.yaml.sql
Normal file
@ -0,0 +1,24 @@
|
||||
{% macro config_quicknode_solana_nft_udfs(schema_name = "quicknode_solana_nfts", utils_schema_name = "quicknode_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the QuickNode Solana NFT endpoints
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nfts
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns aggregated data on NFTs for a given wallet. [QuickNode docs here](https://www.quicknode.com/docs/solana/qn_fetchNFTs).$$
|
||||
sql: {{ quicknode_solana_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTs') | trim }}
|
||||
|
||||
- name: {{ schema_name -}}.fetch_nfts_by_creator
|
||||
signature:
|
||||
- [PARAMS, OBJECT, The RPC Params]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Returns aggregated data on NFTs that have been created by an address. [QuickNode docs here](https://www.quicknode.com/docs/solana/qn_fetchNFTsByCreator).$$
|
||||
sql: {{ quicknode_solana_mainnet_rpc_call(utils_schema_name, 'qn_fetchNFTsByCreator') | trim }}
|
||||
|
||||
{% endmacro %}
|
||||
57
macros/marketplace/quicknode/util_udfs.yaml.sql
Normal file
57
macros/marketplace/quicknode/util_udfs.yaml.sql
Normal file
@ -0,0 +1,57 @@
|
||||
{% macro config_quicknode_util_udfs(schema = "quicknode_utils", utils_schema_name="quicknode_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the QuickNode base endpoints/RPC calls
|
||||
#}
|
||||
|
||||
- name: {{ schema -}}.ethereum_mainnet_rpc
|
||||
signature:
|
||||
- [METHOD, STRING, The RPC method to call]
|
||||
- [PARAMS, OBJECT, The RPC Params arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue an Ethereum RPC call to QuickNode.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
'{ethereum-mainnet}',
|
||||
{},
|
||||
{'id': 1,'jsonrpc': '2.0','method': METHOD,'params': [PARAMS]},
|
||||
'_FSC_SYS/QUICKNODE'
|
||||
) as response
|
||||
|
||||
- name: {{ schema -}}.polygon_mainnet_rpc
|
||||
signature:
|
||||
- [METHOD, STRING, The RPC method to call]
|
||||
- [PARAMS, OBJECT, The RPC Params arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a Polygon RPC call to QuickNode.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
'{polygon-matic}',
|
||||
{},
|
||||
{'id': 1,'jsonrpc': '2.0','method': METHOD,'params': [PARAMS]},
|
||||
'_FSC_SYS/QUICKNODE'
|
||||
) as response
|
||||
|
||||
- name: {{ schema -}}.solana_mainnet_rpc
|
||||
signature:
|
||||
- [METHOD, STRING, The RPC method to call]
|
||||
- [PARAMS, OBJECT, The RPC Params arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Used to issue a Solana RPC call to QuickNode.$$
|
||||
sql: |
|
||||
SELECT live.udf_api(
|
||||
'POST',
|
||||
'{solana-mainnet}',
|
||||
{},
|
||||
{'id': 1,'jsonrpc': '2.0','method': METHOD,'params': PARAMS},
|
||||
'_FSC_SYS/QUICKNODE'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
45
macros/marketplace/strangelove/udfs.yaml.sql
Normal file
45
macros/marketplace/strangelove/udfs.yaml.sql
Normal file
@ -0,0 +1,45 @@
|
||||
{% macro config_strangelove_udfs(schema_name = "strangelove", utils_schema_name = "strangelove_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Subquery Calls
|
||||
#}
|
||||
|
||||
- name: {{ schema_name -}}.get
|
||||
signature:
|
||||
- [URL, STRING, The url to issue a get request to]
|
||||
- [QUERY_ARGS, OBJECT, The query arguments]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Issue a GET request to a Strangelove Endpoint [Strangelove docs here](https://voyager.strange.love/docs/cosmoshub/mainnet#/).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'GET',
|
||||
concat(
|
||||
URL, '?',
|
||||
utils.udf_object_to_url_query_string(QUERY_ARGS)
|
||||
),
|
||||
{'x-apikey': '{API_KEY}'},
|
||||
{},
|
||||
'_FSC_SYS/STRANGELOVE'
|
||||
) as response
|
||||
|
||||
- name: {{ schema_name -}}.post
|
||||
signature:
|
||||
- [URL, STRING, The url to issue a post request to]
|
||||
- [QUERY, OBJECT, The body of the request]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Issue a POST request to a Strangelove Endpoint [Strangelove docs here](https://voyager.strange.love/docs/cosmoshub/mainnet#/).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
URL,
|
||||
{'x-apikey': '{API_KEY}'},
|
||||
QUERY,
|
||||
'_FSC_SYS/STRANGELOVE'
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
22
macros/marketplace/subquery/udfs.yaml.sql
Normal file
22
macros/marketplace/subquery/udfs.yaml.sql
Normal file
@ -0,0 +1,22 @@
|
||||
{% macro config_subquery_udfs(schema_name = "subquery", utils_schema_name = "subquery_utils") -%}
|
||||
{#
|
||||
This macro is used to generate the Subquery Calls
|
||||
#}
|
||||
- name: {{ schema_name -}}.graphql
|
||||
signature:
|
||||
- [PROJECT, STRING, The sub-query project name]
|
||||
- [QUERY, OBJECT, The graphql query]
|
||||
return_type:
|
||||
- "VARIANT"
|
||||
options: |
|
||||
COMMENT = $$Query a SubQuery Project [SubQuery docs here](https://explorer.subquery.network/subquery/subquery/kepler-network).$$
|
||||
sql: |
|
||||
SELECT
|
||||
live.udf_api(
|
||||
'POST',
|
||||
concat('https://api.subquery.network/sq/subquery/', PROJECT),
|
||||
{},
|
||||
QUERY
|
||||
) as response
|
||||
|
||||
{% endmacro %}
|
||||
2
models/deploy/core/_live.sql
Normal file
2
models/deploy/core/_live.sql
Normal file
@ -0,0 +1,2 @@
|
||||
{% set config = config_core__live %}
|
||||
{{ ephemeral_deploy_core(config) }}
|
||||
2
models/deploy/core/_utils.sql
Normal file
2
models/deploy/core/_utils.sql
Normal file
@ -0,0 +1,2 @@
|
||||
{% set config = config_core__utils %}
|
||||
{{ ephemeral_deploy_core(config) }}
|
||||
8
models/deploy/core/_utils.yml
Normal file
8
models/deploy/core/_utils.yml
Normal file
@ -0,0 +1,8 @@
|
||||
models:
|
||||
- name: _utils
|
||||
columns:
|
||||
- name: udf_introspect
|
||||
tests:
|
||||
- test_udf:
|
||||
args: "'hello'"
|
||||
expected: "'hello'"
|
||||
5
models/deploy/core/live.sql
Normal file
5
models/deploy/core/live.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('_utils') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
-- depends_on: {{ ref('_live') }}
|
||||
{% set config = config_core_live %}
|
||||
{{ ephemeral_deploy_core(config) }}
|
||||
3
models/deploy/core/utils.sql
Normal file
3
models/deploy/core/utils.sql
Normal file
@ -0,0 +1,3 @@
|
||||
-- depends_on: {{ ref('_utils') }}
|
||||
{% set config = config_core_utils %}
|
||||
{{ ephemeral_deploy_core(config) }}
|
||||
14
models/deploy/core/utils.yml
Normal file
14
models/deploy/core/utils.yml
Normal file
@ -0,0 +1,14 @@
|
||||
models:
|
||||
- name: utils
|
||||
columns:
|
||||
- name: udf_json_rpc_call
|
||||
tests:
|
||||
- test_udf:
|
||||
args: "'foo', [], 1"
|
||||
expected: >
|
||||
{
|
||||
'jsonrpc': '2.0',
|
||||
'method': 'foo',
|
||||
'params': [],
|
||||
'id': '1'
|
||||
}
|
||||
10
models/deploy/evm/arbitrum_nova__mainnet.sql
Normal file
10
models/deploy/evm/arbitrum_nova__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/arbitrum_one__goerli.sql
Normal file
10
models/deploy/evm/arbitrum_one__goerli.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/arbitrum_one__mainnet.sql
Normal file
10
models/deploy/evm/arbitrum_one__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/avalanche_c__mainnet.sql
Normal file
10
models/deploy/evm/avalanche_c__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/avalanche_c__testnet.sql
Normal file
10
models/deploy/evm/avalanche_c__testnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/base__goerli.sql
Normal file
10
models/deploy/evm/base__goerli.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/base__mainnet.sql
Normal file
10
models/deploy/evm/base__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/bsc__mainnet.sql
Normal file
10
models/deploy/evm/bsc__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/bsc__testnet.sql
Normal file
10
models/deploy/evm/bsc__testnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/celo__mainnet.sql
Normal file
10
models/deploy/evm/celo__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/ethereum__goerli.sql
Normal file
10
models/deploy/evm/ethereum__goerli.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
13
models/deploy/evm/ethereum__mainnet.sql
Normal file
13
models/deploy/evm/ethereum__mainnet.sql
Normal file
@ -0,0 +1,13 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('_eth__logs') }}
|
||||
-- depends_on: {{ ref('_eth__decoded_logs') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions,
|
||||
config_eth_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/ethereum__sepolia.sql
Normal file
10
models/deploy/evm/ethereum__sepolia.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/fantom__mainnet.sql
Normal file
10
models/deploy/evm/fantom__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/gnosis__mainnet.sql
Normal file
10
models/deploy/evm/gnosis__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/harmony__mainnet.sql
Normal file
10
models/deploy/evm/harmony__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/harmony__testnet.sql
Normal file
10
models/deploy/evm/harmony__testnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/optimism__goerli.sql
Normal file
10
models/deploy/evm/optimism__goerli.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/optimism__mainnet.sql
Normal file
10
models/deploy/evm/optimism__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/polygon__mainnet.sql
Normal file
10
models/deploy/evm/polygon__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/polygon__testnet.sql
Normal file
10
models/deploy/evm/polygon__testnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/polygon_zkevm__mainnet.sql
Normal file
10
models/deploy/evm/polygon_zkevm__mainnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
10
models/deploy/evm/polygon_zkevm__testnet.sql
Normal file
10
models/deploy/evm/polygon_zkevm__testnet.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- depends_on: {{ ref('_evm__contracts_map') }}
|
||||
-- depends_on: {{ ref('_evm__abi_map') }}
|
||||
-- depends_on: {{ ref('_evm__native_symbol_map') }}
|
||||
-- depends_on: {{ ref('live') }}
|
||||
-- depends_on: {{ ref('utils') }}
|
||||
{%- set configs = [
|
||||
config_evm_rpc_primitives,
|
||||
config_evm_high_level_abstractions
|
||||
] -%}
|
||||
{{- ephemeral_deploy(configs) -}}
|
||||
@ -0,0 +1,6 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_alchemy_nfts_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
-- depends_on: {{ ref('alchemy_utils__alchemy_utils') }}
|
||||
@ -0,0 +1,6 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_alchemy_tokens_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
-- depends_on: {{ ref('alchemy_utils__alchemy_utils') }}
|
||||
@ -0,0 +1,6 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_alchemy_transfers_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
-- depends_on: {{ ref('alchemy_utils__alchemy_utils') }}
|
||||
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_alchemy_utils_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
5
models/deploy/marketplace/bitquery/bitquery__.sql
Normal file
5
models/deploy/marketplace/bitquery/bitquery__.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_bitquery_udfs
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_blockpour_utils_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_chainbase_utils_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
5
models/deploy/marketplace/credmark/credmark_utils__.sql
Normal file
5
models/deploy/marketplace/credmark/credmark_utils__.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_credmark_utils_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
5
models/deploy/marketplace/dapplooker/dapplooker__.sql
Normal file
5
models/deploy/marketplace/dapplooker/dapplooker__.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_dapplooker_udfs
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_footprint_utils_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
5
models/deploy/marketplace/fred/fred__.sql
Normal file
5
models/deploy/marketplace/fred/fred__.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_fred_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
@ -0,0 +1,6 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_helius_apis_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
-- depends_on: {{ ref('helius_utils__helius_utils') }}
|
||||
@ -0,0 +1,6 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_helius_das_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
-- depends_on: {{ ref('helius_utils__helius_utils') }}
|
||||
@ -0,0 +1,5 @@
|
||||
-- depends_on: {{ ref('live') }}
|
||||
{%- set configs = [
|
||||
config_helius_util_udfs,
|
||||
] -%}
|
||||
{{- ephemeral_deploy_marketplace(configs) -}}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user