-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
511d632
commit 76463b1
Showing
21 changed files
with
1,417 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
transformers/synthetix/models/core/eth/mainnet/synthetix/blocks_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
with indexer_blocks as ( | ||
select | ||
timestamp as ts, | ||
CAST( | ||
number as INTEGER | ||
) as block_number | ||
from | ||
{{ source( | ||
'raw_eth_mainnet', | ||
'synthetix_block' | ||
) }} | ||
), | ||
|
||
parquet_blocks as ( | ||
select | ||
FROM_UNIXTIME(timestamp) as ts, | ||
CAST( | ||
block_number as INTEGER | ||
) as block_number | ||
from | ||
{{ source( | ||
'raw_eth_mainnet', | ||
'blocks_parquet' | ||
) }} | ||
), | ||
|
||
combined_blocks as ( | ||
select * | ||
from | ||
indexer_blocks | ||
|
||
union all | ||
select * | ||
from | ||
parquet_blocks | ||
) | ||
|
||
select | ||
block_number, | ||
MIN(ts) as ts | ||
from | ||
combined_blocks | ||
group by | ||
block_number |
14 changes: 14 additions & 0 deletions
14
...ers/synthetix/models/core/eth/mainnet/synthetix/core/core_account_created_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
with core_account_created as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'account_created') }} -- noqa | ||
) | ||
|
||
select | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
id, | ||
cast(account_id as UInt128) as account_id, | ||
owner | ||
from core_account_created |
16 changes: 16 additions & 0 deletions
16
...rs/synthetix/models/core/eth/mainnet/synthetix/core/core_account_migrated_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
with core_account_created as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'legacy_market_proxy', 'account_migrated') }} -- noqa | ||
) | ||
|
||
select | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
id, | ||
staker, | ||
cast(account_id as UInt128) as account_id, | ||
cast(collateral_amount as UInt256) as collateral_amount, | ||
cast(debt_amount as UInt256) as debt_amount | ||
from core_account_created |
19 changes: 19 additions & 0 deletions
19
.../synthetix/models/core/eth/mainnet/synthetix/core/core_delegation_updated_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
with delegation_updated as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'delegation_updated') }} -- noqa | ||
) | ||
|
||
select | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
id, | ||
sender, | ||
cast(account_id as UInt128) as account_id, | ||
cast(pool_id as UInt128) as pool_id, | ||
collateral_type, | ||
cast(amount as UInt256) as amount, | ||
cast(leverage as UInt256) as leverage | ||
from | ||
delegation_updated |
16 changes: 16 additions & 0 deletions
16
transformers/synthetix/models/core/eth/mainnet/synthetix/core/core_deposited_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
with core_deposited as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'deposited') }} -- noqa | ||
) | ||
|
||
select | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
id, | ||
sender, | ||
cast(account_id as UInt128) as account_id, | ||
collateral_type, | ||
cast(token_amount as UInt256) as token_amount | ||
from core_deposited |
18 changes: 18 additions & 0 deletions
18
...formers/synthetix/models/core/eth/mainnet/synthetix/core/core_liquidation_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
with core_liquidation as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'liquidation') }} -- noqa | ||
) | ||
|
||
select | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
id, | ||
sender, | ||
liquidation_data, | ||
cast(account_id as UInt128) as account_id, | ||
cast(pool_id as UInt128) as pool_id, | ||
collateral_type, | ||
cast(liquidate_as_account_id as UInt128) as liquidate_as_account_id | ||
from core_liquidation |
15 changes: 15 additions & 0 deletions
15
...s/synthetix/models/core/eth/mainnet/synthetix/core/core_market_registered_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
with core_market_registered as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'market_registered') }} -- noqa | ||
) | ||
|
||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
sender, | ||
market, | ||
cast(market_id as UInt128) as market_id | ||
from core_market_registered |
91 changes: 91 additions & 0 deletions
91
...mers/synthetix/models/core/eth/mainnet/synthetix/core/core_market_updated_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
with events as ( | ||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
sender, | ||
collateral_type, | ||
cast(market_id as UInt128) as market_id, | ||
cast(net_issuance as Int128) as net_issuance, | ||
cast( | ||
deposited_collateral_value as UInt256 | ||
) as deposited_collateral_value, | ||
cast(credit_capacity as Int128) as credit_capacity, | ||
cast(token_amount as UInt256) as token_amount | ||
from | ||
( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'market_collateral_deposited') }} -- noqa | ||
) as collateral_deposited -- noqa: AL05 | ||
union all | ||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
sender, | ||
collateral_type, | ||
cast(market_id as UInt128) as market_id, | ||
cast(net_issuance as Int128) as net_issuance, | ||
cast( | ||
deposited_collateral_value as UInt256 | ||
) as deposited_collateral_value, | ||
cast(credit_capacity as Int128) as credit_capacity, | ||
cast(token_amount as UInt256) as token_amount | ||
from | ||
( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'market_collateral_withdrawn') }} -- noqa | ||
) as collateral_withdrawn -- noqa: AL05 | ||
union all | ||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
target as sender, | ||
'USD' as collateral_type, | ||
cast(market_id as UInt128) as market_id, | ||
cast(net_issuance as Int128) as net_issuance, | ||
cast( | ||
deposited_collateral_value as UInt256 | ||
) as deposited_collateral_value, | ||
cast(credit_capacity as Int128) as credit_capacity, | ||
cast(amount as UInt256) as token_amount | ||
from | ||
( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'market_usd_deposited') }} -- noqa | ||
) as usd_deposited -- noqa: AL05 | ||
union all | ||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
target as sender, | ||
'USD' as collateral_type, | ||
cast(market_id as UInt128) as market_id, | ||
cast(net_issuance as Int128) as net_issuance, | ||
cast( | ||
deposited_collateral_value as UInt256 | ||
) as deposited_collateral_value, | ||
cast(credit_capacity as Int128) as credit_capacity, | ||
cast(amount as UInt256) as token_amount | ||
from | ||
( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'market_usd_withdrawn') }} -- noqa | ||
) as usd_withdrawn -- noqa: AL05 | ||
) | ||
|
||
select * | ||
from | ||
events | ||
order by | ||
block_timestamp |
15 changes: 15 additions & 0 deletions
15
...ormers/synthetix/models/core/eth/mainnet/synthetix/core/core_pool_created_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
with core_pool_created as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'pool_created') }} -- noqa | ||
) | ||
|
||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
sender, | ||
owner, | ||
cast(pool_id as UInt128) as pool_id | ||
from core_pool_created |
17 changes: 17 additions & 0 deletions
17
...ers/synthetix/models/core/eth/mainnet/synthetix/core/core_rewards_claimed_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
with core_rewards_claimed as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'rewards_claimed') }} -- noqa | ||
) | ||
|
||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
cast(account_id as UInt128) as account_id, | ||
cast(pool_id as UInt128) as pool_id, | ||
collateral_type, | ||
distributor, | ||
cast(amount as UInt256) as amount | ||
from core_rewards_claimed |
18 changes: 18 additions & 0 deletions
18
...synthetix/models/core/eth/mainnet/synthetix/core/core_rewards_distributed_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
with core_rewards_distributed as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'rewards_distributed') }} -- noqa | ||
) | ||
|
||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
cast(pool_id as UInt128) as pool_id, | ||
collateral_type, | ||
distributor, | ||
cast(amount as UInt256) as amount, | ||
cast(start as UInt256) as start, -- noqa | ||
cast(duration as UInt256) as duration | ||
from core_rewards_distributed |
17 changes: 17 additions & 0 deletions
17
...sformers/synthetix/models/core/eth/mainnet/synthetix/core/core_usd_burned_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
with core_usd_burned as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'usd_burned') }} -- noqa | ||
) | ||
|
||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
sender, | ||
cast(account_id as UInt128) as account_id, | ||
cast(pool_id as UInt128) as pool_id, | ||
collateral_type, | ||
cast(amount as UInt256) as amount | ||
from core_usd_burned |
17 changes: 17 additions & 0 deletions
17
...sformers/synthetix/models/core/eth/mainnet/synthetix/core/core_usd_minted_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
with core_usd_minted as ( | ||
{{ get_event_data('eth', 'mainnet', 'synthetix', 'core_proxy', 'usd_minted') }} -- noqa | ||
) | ||
|
||
select | ||
id, | ||
block_timestamp, | ||
block_number, | ||
transaction_hash, | ||
contract, | ||
event_name, | ||
sender, | ||
cast(account_id as UInt128) as account_id, | ||
cast(pool_id as UInt128) as pool_id, | ||
collateral_type, | ||
cast(amount as UInt256) as amount | ||
from core_usd_minted |
36 changes: 36 additions & 0 deletions
36
...rs/synthetix/models/core/eth/mainnet/synthetix/core/core_vault_collateral_eth_mainnet.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
with base as ( | ||
select | ||
block_number, | ||
contract_address, | ||
chain_id, | ||
cast(pool_id as Int128) as pool_id, | ||
collateral_type, | ||
cast( | ||
amount as UInt256 | ||
) as amount, | ||
cast( | ||
value as UInt256 | ||
) as collateral_value | ||
from | ||
{{ source( | ||
'raw_eth_mainnet', | ||
'get_vault_collateral' | ||
) }} | ||
where | ||
amount is not null | ||
) | ||
|
||
select | ||
from_unixtime(blocks.timestamp) as ts, | ||
cast( | ||
blocks.block_number as integer | ||
) as block_number, | ||
base.contract_address, | ||
base.pool_id, | ||
base.collateral_type, | ||
{{ convert_wei('base.amount') }} as amount, | ||
{{ convert_wei('base.collateral_value') }} as collateral_value | ||
from | ||
base | ||
inner join {{ source('raw_eth_mainnet', 'blocks_parquet') }} as blocks | ||
on base.block_number = blocks.block_number |
Oops, something went wrong.