polygon-models/models/deploy/core/utils.yml
Ryan-Loofy fc211f5fbd
Polygon Overhaul (#233)
* Polygon Overhaul

- Update DBT models to match streamline optimizations
- Standardization
- Added more recent DBT optimizations

* Add livequery infra

* Add PROD integration
2023-10-18 13:13:59 -04:00

240 lines
8.3 KiB
YAML

version: 2
models:
- name: utils
columns:
- name: udf_json_rpc_call
tests:
- test_udf:
args: "'foo', [], 1"
assertions:
- >
result = {
'jsonrpc': '2.0',
'method': 'foo',
'params': [],
'id': '1'
}
- name: udf_urlencode
tests:
- test_udf:
name: test_utils__udf_urlencode_dict_true_1
args: >
{'a':'b'}, TRUE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_dict_true_2
args: >
{'a':'a', 'b':'b'}, TRUE
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_dict_true_space
args: >
{'space': 'abc 123'}, TRUE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_dict_true_special
args: >
{'special!': ' !@#$,+"'}, TRUE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_dict_true_array
args: >
{'array': [0, 1, 2]}, TRUE
assertions:
- result = 'array=0&array=1&array=2'
- test_udf:
name: test_utils__udf_urlencode_dict_false_1
args: >
{'a':'b'}, FALSE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_dict_false_2
args: >
{'a':'b', 'b':'b'}, FALSE
assertions:
- result = 'a=b&b=b'
- test_udf:
name: test_utils__udf_urlencode_dict_false_space
args: >
{'space': 'abc 123'}, FALSE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_dict_false_special
args: >
{'special!': ' !@#$,+"'}, FALSE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_dict_false_array
args: >
{'array': [0, 1, 2]}, FALSE
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'
- test_udf:
name: test_utils__udf_urlencode_dict_1
args: >
{'a':'b'}
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_dict_2
args: >
{'a':'b', 'b':'b'}
assertions:
- result = 'a=b&b=b'
- test_udf:
name: test_utils__udf_urlencode_dict_space
args: >
{'space': 'abc 123'}
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_dict_special
args: >
{'special!': ' !@#$,+"'}
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_dict_array
args: >
{'array': [0, 1, 2]}
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'
# write tests but use arrays of arrays instead of dictionaries
- test_udf:
name: test_utils__udf_urlencode_array_true_1
args: >
[['a', 'b']], TRUE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_array_true_2
args: >
[['a', 'a'], ['b', 'b']], TRUE
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_array_true_space
args: >
[['space', 'abc 123']], TRUE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_array_true_special
args: >
[['special!', ' !@#$,+"']], TRUE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_array_true_array
args: >
[['array', [0, 1, 2]]], TRUE
assertions:
- result = 'array=0&array=1&array=2'
- test_udf:
name: test_utils__udf_urlencode_array_false_1
args: >
[['a', 'b']], FALSE
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_array_false_2
args: >
[['a', 'a'], ['b', 'b']], FALSE
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_array_false_space
args: >
[['space', 'abc 123']], FALSE
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_array_false_special
args: >
[['special!', ' !@#$,+"']], FALSE
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_array_false_array
args: >
[['array', [0, 1, 2]]], FALSE
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'
- test_udf:
name: test_utils__udf_urlencode_array_1
args: >
[['a', 'b']]
assertions:
- result = 'a=b'
- test_udf:
name: test_utils__udf_urlencode_array_2
args: >
[['a', 'a'], ['b', 'b']]
assertions:
- result = 'a=a&b=b'
- test_udf:
name: test_utils__udf_urlencode_array_space
args: >
[['space', 'abc 123']]
assertions:
- result = 'space=abc+123'
- test_udf:
name: test_utils__udf_urlencode_array_special
args: >
[['special!', ' !@#$,+"']]
assertions:
- result = 'special%21=+%21%40%23%24%2C%2B%22'
- test_udf:
name: test_utils__udf_urlencode_array_array
args: >
[['array', [0, 1, 2]]]
assertions:
- result = 'array=%5B0%2C+1%2C+2%5D'
- name: udf_evm_decode_log
tests:
- test_udf:
name: test_utils__udf_evm_decode_log
args: >
{
'anonymous': false,
'inputs': [
{
'indexed': false,
'name': 'nonce',
'type': 'uint256'
}
],
'name': 'NonceChanged',
'type': 'event'
}::variant,
{
'address': '0x55032650b14df07b85bf18a3a3ec8e0af2e028d5',
'data': '0x000000000000000000000000000000000000000000000000000000000000279c',
'topics': [
'0x7220970e1f1f12864ecccd8942690a837c7a8dd45d158cb891eb45a8a69134aa'
]
}::variant
assertions:
- >
result = [
{
'address': '0x55032650b14df07b85bF18A3a3eC8E0Af2e028d5',
'data': [
{
'decoded': true,
'name': 'nonce',
'type': 'uint256',
'value': 10140
}
],
'decoded': true,
'name': 'NonceChanged'
}
]