diff --git a/models/core/core__ez_swaps.yml b/models/core/core__ez_swaps.yml index aa1e2b0..2513388 100644 --- a/models/core/core__ez_swaps.yml +++ b/models/core/core__ez_swaps.yml @@ -1,4 +1,6 @@ version: 2 +models: + version: 2 models: - name: core__ez_swaps tests: @@ -66,8 +68,8 @@ models: column_type_list: - boolean - - name: PROPOSER - description: "{{ doc('proposer') }}" + - name: from_currency + description: "{{ doc('from_currency') }}" tests: - not_null - dbt_expectations.expect_column_values_to_be_in_type_list: @@ -75,22 +77,23 @@ models: - STRING - VARCHAR - - name: PROPOSAL_ID - description: "{{ doc('proposal_id') }}" + - name: trader + description: "{{ doc('trader') }}" tests: - not_null - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - - NUMBER - - - name: PROPOSAL_TYPE - description: "{{ doc('proposal_type') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - VARCHAR - STRING + - VARCHAR + + - name: from_amount + description: "{{ doc('from_amount') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - decimal + - float - name: _INSERTED_TIMESTAMP description: "{{ doc('_inserted_timestamp') }}" diff --git a/models/descriptions/from_amount.md b/models/descriptions/from_amount.md new file mode 100644 index 0000000..f984ec6 --- /dev/null +++ b/models/descriptions/from_amount.md @@ -0,0 +1,5 @@ +{% docs from_amount %} + +The amount that the user sent to be swapped for another currency. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/from_currency.md b/models/descriptions/from_currency.md new file mode 100644 index 0000000..9e62766 --- /dev/null +++ b/models/descriptions/from_currency.md @@ -0,0 +1,5 @@ +{% docs from_currency %} + +The currency that the user sent to be swapped for another currency. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/from_decimal.md b/models/descriptions/from_decimal.md new file mode 100644 index 0000000..e4e2ea2 --- /dev/null +++ b/models/descriptions/from_decimal.md @@ -0,0 +1,5 @@ +{% docs from_decimal %} + +Divide the swap_from_amount by POW(10, swap_from_decimal) to get the amount the user swapped. + +{% enddocs %} \ No newline at end of file diff --git a/models/descriptions/trader.md b/models/descriptions/trader.md new file mode 100644 index 0000000..015efb7 --- /dev/null +++ b/models/descriptions/trader.md @@ -0,0 +1,5 @@ +{% docs trader %} + +The address of the user that initiated the swap + +{% enddocs %} \ No newline at end of file diff --git a/models/silver/silver__dex_swaps.sql b/models/silver/silver__dex_swaps.sql index 42c2026..8b2c079 100644 --- a/models/silver/silver__dex_swaps.sql +++ b/models/silver/silver__dex_swaps.sql @@ -29,9 +29,10 @@ SELECT message_value:contract :: STRING as contract_address FROM - TERRA_DEV.silver.messages + {{ ref('silver__messages')}} where message_type ilike '%msgexecutecontract%' -and message_json:msg in ('swap') +and message_value:msg:swap is not null +and {{ incremental_load_filter("_inserted_timestamp") }} ) ,execute_swap_operations AS ( @@ -127,4 +128,23 @@ SELECT u.*, t.tx_sender as trader LEFT outer JOIN terra.core.dim_address_labels l ON s.contract_address = l.address -) \ No newline at end of file +) + +SELECT + BLOCK_ID, + BLOCK_TIMESTAMP, + _inserted_timestamp, + BLOCKCHAIN, + CHAIN_ID, + tx_id, + tx_succeeded, + trader, + From_amount, + from_currency, + from_decimal, + to_amount, + to_currency, + to_decimal, + pool_id +FROM + Final \ No newline at end of file diff --git a/models/silver/silver__dex_swaps.yml b/models/silver/silver__dex_swaps.yml index 696ac1f..727a030 100644 --- a/models/silver/silver__dex_swaps.yml +++ b/models/silver/silver__dex_swaps.yml @@ -66,8 +66,8 @@ models: column_type_list: - boolean - - name: PROPOSER - description: "{{ doc('proposer') }}" + - name: from_currency + description: "{{ doc('from_currency') }}" tests: - not_null - dbt_expectations.expect_column_values_to_be_in_type_list: @@ -75,22 +75,23 @@ models: - STRING - VARCHAR - - name: PROPOSAL_ID - description: "{{ doc('proposal_id') }}" + - name: trader + description: "{{ doc('trader') }}" tests: - not_null - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - - NUMBER - - - name: PROPOSAL_TYPE - description: "{{ doc('proposal_type') }}" - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - VARCHAR - STRING + - VARCHAR + + - name: from_amount + description: "{{ doc('from_amount') }}" + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_in_type_list: + column_type_list: + - decimal + - float - name: _INSERTED_TIMESTAMP description: "{{ doc('_inserted_timestamp') }}"