Skip to content

Commit

Permalink
Merge branch 'main' into stablecoin_transfer_macro
Browse files Browse the repository at this point in the history
  • Loading branch information
thetroyharris committed Jun 20, 2024
2 parents e107d3d + 589dac7 commit c5b5230
Show file tree
Hide file tree
Showing 63 changed files with 81 additions and 106 deletions.
1 change: 0 additions & 1 deletion dex/models/_projects/oneinch/_meta/oneinch_blockchains.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
schema = 'oneinch',
alias = 'blockchains',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
schema = 'oneinch',
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
tags = ['prod_exclude'],
unique_key = ['blockchain', 'address'],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
schema = 'oneinch',
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
tags = ['prod_exclude'],
unique_key = ['blockchain', 'address', 'signature'],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
12 changes: 10 additions & 2 deletions dex/models/_projects/oneinch/oneinch_project_orders.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
incremental_strategy = 'merge',
partition_by = ['block_month'],
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')],
unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash']
unique_key = ['blockchain', 'block_number', 'tx_hash', 'call_trace_address', 'order_hash', 'call_trade']
)
}}

Expand Down Expand Up @@ -65,6 +65,8 @@ meta as (
, order_start
, order_end
, order_deadline
, call_trade
, call_trades
from {{ ref('oneinch_' + blockchain + '_project_orders') }}
where call_success
{% if not loop.last %} union all {% endif %}
Expand All @@ -79,6 +81,8 @@ meta as (
, null as order_start
, null as order_end
, null as order_deadline
, 1 as call_trade
, 1 as call_trades
from {{ ref('oneinch_lop') }}
where call_success
)
Expand Down Expand Up @@ -109,6 +113,7 @@ meta as (
, tx_hash
, call_trace_address
, coalesce(order_hash, concat(tx_hash, to_big_endian_32(cast(counter as int)))) as order_hash
, call_trade
, any_value(block_time) as block_time
, any_value(project) as project
, any_value(call_selector) as call_selector
Expand All @@ -127,11 +132,12 @@ meta as (
, any_value(order_start) as order_start
, any_value(order_end) as order_end
, any_value(order_deadline) as order_deadline
, any_value(call_trades) as call_trades
, any_value(flags) as flags
, any_value(tag) as tag
from (select * from orders, unnest(assets) as a(contract_address))
left join prices using(blockchain, contract_address, minute)
group by 1, 2, 3, 4, 5
group by 1, 2, 3, 4, 5, 6
)

-- output --
Expand Down Expand Up @@ -161,6 +167,8 @@ select
, order_start
, order_end
, order_deadline
, call_trade
, call_trades
, flags
, tag
, date(date_trunc('month', block_time)) as block_month
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_contracts',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
schema = 'oneinch_' + blockchain,
alias = 'mapped_methods',
materialized = 'table',
on_table_exists = 'drop',
unique_key = ['blockchain', 'address'],
)
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro
oneinch_project_calls_macro(
blockchain
, date_from = '2024-06-18'
, date_from = '2023-01-01'
)
%}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro
oneinch_project_swaps_macro(
blockchain
, date_from = '2024-06-18'
, date_from = '2023-01-01'
)
%}

Expand Down
41 changes: 0 additions & 41 deletions nft/models/_sector/trades/chains/solana/nft_solana_base_trades.sql

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,3 @@ models:
- &inner_instruction_index
name: inner_instruction_index
description: "inner index of instruction call"

- name: nft_solana_base_trades
meta:
blockchain: solana
sector: nft
contributors: [ 0xRob ]
config:
tags: [ 'solana','nft' ]
description: >
nft solana trades with the schema of nft_trades, mainly used to include volume and tx counts into nft.trades
tests:
- check_columns_nft_base_trades
- dbt_utils.unique_combination_of_columns:
combination_of_columns: [ 'block_number','tx_hash','sub_tx_trade_id' ]
File renamed without changes.
2 changes: 2 additions & 0 deletions solana/models/solana_utils/solana_utils_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ models:
name: token_mint_address
- &address
name: address
- &account_type
name: account_type
- &updated_at
name: updated_at

Expand Down
13 changes: 9 additions & 4 deletions solana/models/solana_utils/solana_utils_token_accounts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
\'["ilemi"]\') }}')
}}

WITH
WITH
distinct_accounts as (
SELECT
aa.address
aa.address
, max_by(aa.token_balance_owner, aa.block_time) as token_balance_owner
, max_by(aa.token_mint_address, aa.block_time) as token_mint_address
FROM {{ source('solana','account_activity') }} aa
Expand All @@ -25,5 +25,10 @@ WITH
{% endif %}
group by 1
)

SELECT * FROM distinct_accounts
SELECT
*
, case when nft.account_mint is not null then 'nft'
else 'fungible'
end as account_type
FROM distinct_accounts da
LEFT JOIN {{ ref('tokens_solana_nft')}} nft ON da.token_mint_address = nft.account_mint
2 changes: 1 addition & 1 deletion solana/package-lock.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
packages:
- package: dbt-labs/dbt_utils
version: 1.2.0
sha1_hash: d4f259856543b0ef301e0b3b0bbc94ccb6b12a54
sha1_hash: eb1031c07e7c89332527e572f2e44613ce5b62bf
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion sources/oneinch/arbitrum/oneinch_arbitrum_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,14 @@ sources:
loaded_at_field: call_block_time
- name: AggregationRouterV6_call_fillContractOrderArgs
loaded_at_field: call_block_time
- name: mapped_contracts
- name: project_orders
loaded_at_field: block_time
- name: project_calls
loaded_at_field: block_time
- name: lop
loaded_at_field: block_time

- name: oneinch_arbitrum
tables:
- name: mapped_contracts

8 changes: 6 additions & 2 deletions sources/oneinch/avalanche_c/oneinch_avalanche_c_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,14 @@ sources:
loaded_at_field: call_block_time
- name: AggregationRouterV6_call_fillContractOrderArgs
loaded_at_field: call_block_time
- name: mapped_contracts
- name: project_orders
loaded_at_field: block_time
- name: project_calls
loaded_at_field: block_time
- name: lop
loaded_at_field: block_time
loaded_at_field: block_time


- name: oneinch_avalanche_c
tables:
- name: mapped_contracts
Loading

0 comments on commit c5b5230

Please sign in to comment.